-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>
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}")
+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
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.
*
* 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.
*
* 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.
*
* 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.
#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__ */
*
* 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.
*
* 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.
*
* 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.
*
* 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.
*
* 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.
*
* 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.
*
* 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.
Name: notification
Description: Notification Library
Version: @VERSION@
-Requires: sqlite3 heynoti bundle db-util ail aul
+Requires: bundle
Libs: -L${libdir} -lnotification
Cflags: -I${includedir}
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)
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
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).
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
UNIQUE (caller_pkgname, priv_id)
);
'
-
fi
chown root:5000 /opt/dbspace/.notification.db
%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
*
* 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.
#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>
};
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, };
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)
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));
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;
}
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;
}
*
* 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.
*
* 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.
*
* 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.
*
* 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.
*
* 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.