summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Kibum <kb0929.kim@samsung.com>2012-04-29 08:01:41 (GMT)
committerKim Kibum <kb0929.kim@samsung.com>2012-04-29 08:01:41 (GMT)
commit781b07c37a0f3ced0734a62459afad04cb7e94eb (patch)
tree29577289f24771e55adb0866ad238665ae377f31
parent59e8658cea33504ab3b56d5108cc15b71518f9e0 (diff)
downloadnotification-781b07c37a0f3ced0734a62459afad04cb7e94eb.zip
notification-781b07c37a0f3ced0734a62459afad04cb7e94eb.tar.gz
notification-781b07c37a0f3ced0734a62459afad04cb7e94eb.tar.bz2
upload tizen1.0 source
-rw-r--r--[-rwxr-xr-x]AUTHORS5
-rw-r--r--[-rwxr-xr-x]CMakeLists.txt13
-rw-r--r--[-rwxr-xr-x]LICENSE0
-rw-r--r--debian/changelog8
-rw-r--r--[-rwxr-xr-x]debian/compat0
-rw-r--r--[-rwxr-xr-x]debian/control8
-rw-r--r--[-rwxr-xr-x]debian/libnotification-0.install.in0
-rw-r--r--[-rwxr-xr-x]debian/libnotification-0.postinst.in0
-rw-r--r--[-rwxr-xr-x]debian/libnotification-dev.install.in0
-rw-r--r--include/notification.h2
-rw-r--r--[-rwxr-xr-x]include/notification_db.h2
-rw-r--r--[-rwxr-xr-x]include/notification_debug.h57
-rw-r--r--include/notification_error.h2
-rw-r--r--[-rwxr-xr-x]include/notification_group.h2
-rw-r--r--[-rwxr-xr-x]include/notification_internal.h2
-rw-r--r--[-rwxr-xr-x]include/notification_list.h2
-rw-r--r--include/notification_noti.h2
-rw-r--r--include/notification_ongoing.h2
-rw-r--r--include/notification_type.h2
-rw-r--r--[-rwxr-xr-x]notification.pc.in2
-rw-r--r--packaging/notification.spec37
-rw-r--r--src/notification.c154
-rw-r--r--[-rwxr-xr-x]src/notification_db.c2
-rw-r--r--src/notification_group.c2
-rw-r--r--[-rwxr-xr-x]src/notification_list.c2
-rw-r--r--src/notification_noti.c2
-rw-r--r--src/notification_ongoing.c2
27 files changed, 237 insertions, 75 deletions
diff --git a/AUTHORS b/AUTHORS
index fa6ae31..7619a9d 100755..100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,3 @@
-Seungtaek Chung <seungtaek.chung@samsung.com>
-Mi-Ju Lee <miju52.lee@samsung.com>
-Xi zhichan <zhichan.xi@samsung.com>
+Jeonghoon Park <jh1979.park@samsung.com>
+Youngjoo Park <yjoo93.park@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4380100..1f80c2f 100755..100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,18 @@ SET(HEADERS ./include/notification.h
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED sqlite3 db-util heynoti vconf bundle dbus-1 dlog ail aul appsvc)
+pkg_check_modules(pkgs REQUIRED
+ sqlite3
+ db-util
+ vconf
+ bundle
+ dlog
+ ail
+ aul
+ appsvc
+ dbus-1
+ dbus-glib-1
+)
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
diff --git a/LICENSE b/LICENSE
index a06208b..a06208b 100755..100644
--- a/LICENSE
+++ b/LICENSE
diff --git a/debian/changelog b/debian/changelog
index 9448d75..a9b6900 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+libnotification (0.1.1-10) unstable; urgency=low
+
+ * update latest changes
+ * Git: slp/pkgs/n/notification
+ * Tag: libnotification_0.1.1-10
+
+ -- Jeonghoon Park <jh1979.park@samsung.com> Tue, 20 Mar 2012 19:00:25 +0900
+
libnotification (0.1.1-9) unstable; urgency=low
* Add content update API
diff --git a/debian/compat b/debian/compat
index 7ed6ff8..7ed6ff8 100755..100644
--- a/debian/compat
+++ b/debian/compat
diff --git a/debian/control b/debian/control
index d1060e9..8add5ef 100755..100644
--- a/debian/control
+++ b/debian/control
@@ -1,21 +1,21 @@
Source: libnotification
Section: libs
Priority: optional
-Maintainer: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
-Build-Depends: debhelper (>= 5), libsqlite3-dev, libslp-db-util-dev, libheynoti-dev, libvconf-dev, libbundle-dev, libdbus-1-dev, dlog-dev, libail-0-dev, libaul-1-dev, libappsvc-dev
+Maintainer: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
+Build-Depends: debhelper (>= 5), libsqlite3-dev, libslp-db-util-dev, libvconf-dev, libbundle-dev, libdbus-1-dev, dlog-dev, libail-0-dev, libaul-1-dev, libappsvc-dev, libdbus-glib-1-dev
Standards-Version: 3.7.2
Package: libnotification-dev
Section: libdevel
Architecture: any
-Depends: libnotification-0 (= ${Source-Version}), libsqlite3-dev, libslp-db-util-dev, libheynoti-dev, libvconf-dev, libbundle-dev, dlog-dev, libail-0-dev, libaul-1-dev
+Depends: libnotification-0 (= ${Source-Version})
Description: Notification library
This package contains devel content.
Package: libnotification-0
Section: libs
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, sqlite3, libdlog-0
+Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Notification library
This package contains notification library.
diff --git a/debian/libnotification-0.install.in b/debian/libnotification-0.install.in
index bf766f0..bf766f0 100755..100644
--- a/debian/libnotification-0.install.in
+++ b/debian/libnotification-0.install.in
diff --git a/debian/libnotification-0.postinst.in b/debian/libnotification-0.postinst.in
index fcf05fb..fcf05fb 100755..100644
--- a/debian/libnotification-0.postinst.in
+++ b/debian/libnotification-0.postinst.in
diff --git a/debian/libnotification-dev.install.in b/debian/libnotification-dev.install.in
index 0f2a4da..0f2a4da 100755..100644
--- a/debian/libnotification-dev.install.in
+++ b/debian/libnotification-dev.install.in
diff --git a/include/notification.h b/include/notification.h
index 0644584..1a19360 100644
--- a/include/notification.h
+++ b/include/notification.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/include/notification_db.h b/include/notification_db.h
index a7fb204..426aa2f 100755..100644
--- a/include/notification_db.h
+++ b/include/notification_db.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/include/notification_debug.h b/include/notification_debug.h
index feebbb7..a50bc76 100755..100644
--- a/include/notification_debug.h
+++ b/include/notification_debug.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,16 +31,49 @@
#ifndef _DLOG_H_
#include <stdio.h>
-#define NOTIFICATION_ERR(fmt, arg...)\
- do { fprintf(stderr, "["LOG_TAG"] %s(%d):"fmt"\n", __FUNCTION__, __LINE__, ##arg); } while (0)
-#define NOTIFICATION_INFO(fmt, arg...)\
- do { fprintf(stdout, "["LOG_TAG"] %s(%d):"fmt"\n", __FUNCTION__, __LINE__, ##arg); } while (0)
-#define NOTIFICATION_DBG(fmt, arg...)\
- do { fprintf(stdout, "["LOG_TAG"] %s(%d):"fmt"\n", __FUNCTION__, __LINE__, ##arg); } while (0)
-#else
-#define NOTIFICATION_ERR(...) LOGE(__VA_ARGS__)
-#define NOTIFICATION_INFO(...) LOGI(__VA_ARGS__)
-#define NOTIFICATION_DBG(...) LOGD(__VA_ARGS__)
-#endif
+
+#define NOTIFICATION_DBG(fmt , args...) \
+ do{ \
+ printf("[D][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_INFO(fmt , args...) \
+ do{ \
+ printf("[I][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_WARN(fmt , args...) \
+ do{ \
+ printf("[W][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_ERR(fmt , args...) \
+ do{ \
+ printf("[E][%s : %d] "fmt"\n", __func__,__LINE__,##args ); \
+ } while(0)
+
+#else /* _DLOG_H_ */
+
+#define NOTIFICATION_DBG(fmt , args...) \
+ do{ \
+ LOGD("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_INFO(fmt , args...) \
+ do{ \
+ LOGI("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_WARN(fmt , args...) \
+ do{ \
+ LOGI("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+ } while(0)
+
+#define NOTIFICATION_ERR(fmt , args...) \
+ do{ \
+ LOGI("[%s : %d] "fmt"\n",__func__,__LINE__,##args ); \
+ } while(0)
+
+#endif /* _DLOG_H_ */
#endif /* __NOTIFICATION_DEBUG_H__ */
diff --git a/include/notification_error.h b/include/notification_error.h
index e91b57e..f249469 100644
--- a/include/notification_error.h
+++ b/include/notification_error.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/include/notification_group.h b/include/notification_group.h
index 5c79232..e362cf7 100755..100644
--- a/include/notification_group.h
+++ b/include/notification_group.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/include/notification_internal.h b/include/notification_internal.h
index 77b75c3..9ed1bdb 100755..100644
--- a/include/notification_internal.h
+++ b/include/notification_internal.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/include/notification_list.h b/include/notification_list.h
index 2a490e3..80f4805 100755..100644
--- a/include/notification_list.h
+++ b/include/notification_list.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/include/notification_noti.h b/include/notification_noti.h
index 9c84f60..fce9959 100644
--- a/include/notification_noti.h
+++ b/include/notification_noti.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/include/notification_ongoing.h b/include/notification_ongoing.h
index 39f7c96..440725b 100644
--- a/include/notification_ongoing.h
+++ b/include/notification_ongoing.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/include/notification_type.h b/include/notification_type.h
index 744f7e8..71bd418 100644
--- a/include/notification_type.h
+++ b/include/notification_type.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/notification.pc.in b/notification.pc.in
index a43f5b8..e17e700 100755..100644
--- a/notification.pc.in
+++ b/notification.pc.in
@@ -6,6 +6,6 @@ includedir=@INCLUDEDIR@
Name: notification
Description: Notification Library
Version: @VERSION@
-Requires: sqlite3 heynoti bundle db-util ail aul
+Requires: bundle
Libs: -L${libdir} -lnotification
Cflags: -I${includedir}
diff --git a/packaging/notification.spec b/packaging/notification.spec
index 1d2bbde..f45c5d9 100644
--- a/packaging/notification.spec
+++ b/packaging/notification.spec
@@ -1,12 +1,11 @@
Name: notification
Summary: notification library
Version: 0.1.1
-Release: 4.11
-Group: System/Library
+Release: 1
+Group: TBD
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(sqlite3)
-BuildRequires: pkgconfig(appsvc)
BuildRequires: pkgconfig(db-util)
BuildRequires: pkgconfig(heynoti)
BuildRequires: pkgconfig(vconf)
@@ -15,14 +14,17 @@ BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(ail)
BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(appsvc)
+BuildRequires: pkgconfig(dbus-glib-1)
+
BuildRequires: cmake
Requires(post): /sbin/ldconfig
Requires(post): /usr/bin/sqlite3
requires(postun): /sbin/ldconfig
+
%description
Notificaiton library.
-
%prep
%setup -q
@@ -30,14 +32,6 @@ Notificaiton library.
Summary: Notification library (devel)
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
-Requires: pkgconfig(sqlite3)
-Requires: pkgconfig(db-util)
-Requires: pkgconfig(heynoti)
-Requires: pkgconfig(vconf)
-Requires: pkgconfig(bundle)
-Requires: pkgconfig(dlog)
-Requires: pkgconfig(ail)
-Requires: pkgconfig(aul)
%description devel
Notificaiton library (devel).
@@ -48,13 +42,19 @@ LDFLAGS="$LDFLAGS" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
make %{?jobs:-j%jobs}
%install
+rm -rf %{buildroot}
%make_install
+%clean
+rm -rf %{buildroot}
%post
/sbin/ldconfig
-mkdir -p /opt/dbspace
+if [ ! -d /opt/dbspace ]
+then
+ mkdir /opt/dbspace
+fi
if [ ! -f /opt/dbspace/.notification.db ]
then
@@ -131,7 +131,6 @@ then
UNIQUE (caller_pkgname, priv_id)
);
'
-
fi
chown root:5000 /opt/dbspace/.notification.db
@@ -142,13 +141,11 @@ chmod 660 /opt/dbspace/.notification.db-journal
%postun -p /sbin/ldconfig
%files
-%{_libdir}/libnotification.so.0*
+%defattr(-,root,root,-)
+%{_libdir}/libnotification.so*
%files devel
-%{_includedir}/notification/notification.h
-%{_includedir}/notification/notification_error.h
-%{_includedir}/notification/notification_list.h
-%{_includedir}/notification/notification_type.h
-%{_libdir}/libnotification.so
+%defattr(-,root,root,-)
+%{_includedir}/notification/*.h
%{_libdir}/pkgconfig/notification.pc
diff --git a/src/notification.c b/src/notification.c
index 3525865..90f2314 100644
--- a/src/notification.c
+++ b/src/notification.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,11 +25,12 @@
#include <unistd.h>
#include <fcntl.h>
#include <libintl.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
#include <aul.h>
#include <ail.h>
#include <appsvc.h>
-#include <heynoti.h>
#include <vconf-keys.h>
#include <vconf.h>
@@ -52,12 +53,16 @@ struct _notification_cb_list {
};
static notification_cb_list_s *g_notification_cb_list = NULL;
-static int g_notification_heynoti_fd = -1;
+static DBusConnection *g_dbus_handle;
#define NOTI_PKGNAME_LEN 512
#define NOTI_CHANGED_NOTI "notification_noti_changed"
#define NOTI_CHANGED_ONGOING "notification_ontoing_changed"
+#define NOTI_DBUS_BUS_NAME "org.tizen.libnotification"
+#define NOTI_DBUS_PATH "/org/tizen/libnotification"
+#define NOTI_DBUS_INTERFACE "org.tizen.libnotification.signal"
+
static char *_notification_get_pkgname_by_pid(void)
{
char buf[NOTI_PKGNAME_LEN] = { 0, };
@@ -213,9 +218,126 @@ static void _notification_chagned_ongoing_cb(void *data)
static void _notification_changed(const char *type)
{
- heynoti_publish(type);
+ DBusConnection *connection = NULL;
+ DBusMessage *message = NULL;
+ DBusError err;
+ dbus_bool_t ret;
+
+ if (!type) {
+ NOTIFICATION_ERR("type is NULL");
+ return;
+ }
+
+ dbus_error_init(&err);
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+ if (!connection) {
+ NOTIFICATION_ERR("Fail to dbus_bus_get : %s", err.message);
+ return;
+ }
+
+ message = dbus_message_new_signal(NOTI_DBUS_PATH,
+ NOTI_DBUS_INTERFACE,
+ type);
+
+ if (!message) {
+ NOTIFICATION_ERR("fail to create dbus message");
+ goto release_n_return;
+ }
+
+ ret = dbus_connection_send(connection, message, NULL);
+ if (!ret) {
+ NOTIFICATION_ERR("fail to send dbus message : %s", type);
+ goto release_n_return;
+ }
+
+ dbus_connection_flush(connection);
+
+ NOTIFICATION_DBG("success to emit signal [%s]", type);
+
+release_n_return:
+ dbus_error_free(&err);
+
+ if (message)
+ dbus_message_unref(message);
+
+ if (connection)
+ dbus_connection_unref(connection);
+}
+
+static DBusHandlerResult _dbus_signal_filter(DBusConnection *conn,
+ DBusMessage *msg, void *user_data)
+{
+ const char *interface = NULL;
+
+ interface = dbus_message_get_interface(msg);
+ NOTIFICATION_DBG("path : %s", dbus_message_get_path(msg));
+ NOTIFICATION_DBG("interface : %s", interface);
+
+ if (strcmp(NOTI_DBUS_INTERFACE, interface))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+
+ switch (dbus_message_get_type(msg)) {
+ case DBUS_MESSAGE_TYPE_SIGNAL:
+ _notification_chagned_noti_cb(NULL);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ default:
+ break;
+ }
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static DBusConnection *_noti_changed_monitor_init()
+{
+ DBusError err;
+ DBusConnection *conn = NULL;
+ char rule[1024];
+
+ dbus_error_init(&err);
+ conn = dbus_bus_get_private(DBUS_BUS_SYSTEM, &err);
+ if (!conn) {
+ printf("fail to get bus\n");
+ return NULL;
+ }
+ dbus_connection_setup_with_g_main(conn, NULL);
+ snprintf(rule, 1024,
+ "path='%s',type='signal',interface='%s',member='%s'",
+ NOTI_DBUS_PATH,
+ NOTI_DBUS_INTERFACE,
+ NOTI_CHANGED_NOTI);
+
+ dbus_bus_add_match(conn, rule, &err);
+ if (dbus_connection_add_filter(conn,_dbus_signal_filter,
+ NULL, NULL) == FALSE) {
+ NOTIFICATION_ERR("fail to dbus_connection_add_filter");
+ dbus_connection_close(conn);
+ return NULL;
+ }
+
+ dbus_connection_set_exit_on_disconnect(conn, FALSE);
+ return conn;
}
+static void _noti_chanaged_monitor_fini()
+{
+ DBusConnection *conn = g_dbus_handle;
+ char rule[1024];
+
+ if (!conn)
+ return;
+ dbus_connection_remove_filter(conn, _dbus_signal_filter, NULL);
+
+ snprintf(rule, 1024,
+ "path='%s',type='signal',interface='%s',member='%s'",
+ NOTI_DBUS_PATH,
+ NOTI_DBUS_INTERFACE,
+ NOTI_CHANGED_NOTI);
+ dbus_bus_remove_match(conn, rule, NULL);
+
+ dbus_connection_close(conn);
+ g_dbus_handle = NULL;
+}
+
/* notification_set_icon will be removed */
EXPORT_API notification_error_e notification_set_icon(notification_h noti,
const char *icon_path)
@@ -2497,6 +2619,12 @@ notification_resister_changed_cb(void (*changed_cb)
notification_cb_list_s *noti_cb_list_new = NULL;
notification_cb_list_s *noti_cb_list = NULL;
+ if (!g_dbus_handle) {
+ g_dbus_handle = _noti_changed_monitor_init();
+ if (!g_dbus_handle)
+ return NOTIFICATION_ERROR_FROM_DBUS;
+ }
+
noti_cb_list_new =
(notification_cb_list_s *) malloc(sizeof(notification_cb_list_s));
@@ -2518,16 +2646,6 @@ notification_resister_changed_cb(void (*changed_cb)
noti_cb_list->next = noti_cb_list_new;
noti_cb_list_new->prev = noti_cb_list;
}
-
- if (g_notification_heynoti_fd < 0) {
- g_notification_heynoti_fd = heynoti_init();
-
- heynoti_subscribe(g_notification_heynoti_fd, NOTI_CHANGED_NOTI,
- _notification_chagned_noti_cb, NULL);
-
- heynoti_attach_handler(g_notification_heynoti_fd);
- }
-
return NOTIFICATION_ERROR_NONE;
}
@@ -2570,12 +2688,8 @@ notification_unresister_changed_cb(void (*changed_cb)
free(noti_cb_list);
- if (g_notification_cb_list == NULL) {
- heynoti_detach_handler
- (g_notification_heynoti_fd);
- heynoti_close(g_notification_heynoti_fd);
- g_notification_heynoti_fd = -1;
- }
+ if (g_notification_cb_list == NULL)
+ _noti_chanaged_monitor_fini();
return NOTIFICATION_ERROR_NONE;
}
diff --git a/src/notification_db.c b/src/notification_db.c
index 2f7d41a..4c722f7 100755..100644
--- a/src/notification_db.c
+++ b/src/notification_db.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/notification_group.c b/src/notification_group.c
index c217704..03c3e14 100644
--- a/src/notification_group.c
+++ b/src/notification_group.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/notification_list.c b/src/notification_list.c
index b066c74..db28842 100755..100644
--- a/src/notification_list.c
+++ b/src/notification_list.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/notification_noti.c b/src/notification_noti.c
index bb0a60f..9b06beb 100644
--- a/src/notification_noti.c
+++ b/src/notification_noti.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/notification_ongoing.c b/src/notification_ongoing.c
index 18a64e7..0800883 100644
--- a/src/notification_ongoing.c
+++ b/src/notification_ongoing.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
+ * Contact: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.