From: Manuel Bachmann Date: Sun, 1 Jun 2014 06:16:32 +0000 (+0200) Subject: Activate Wayland notifications in bluetooth_notification_client X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fappfw%2Fnotification-service.git;a=commitdiff_plain;h=6b6b7c8be462f3cd1aa206f62656b048f112b0d9 Activate Wayland notifications in bluetooth_notification_client Add a conditional dependency to libwlmessage, and make bluetooth_notification_client use it if found. Change-Id: Ic968858bdf52054516d0a3c4365a7c7874ad1916 Signed-off-by: Manuel Bachmann --- diff --git a/Makefile.am b/Makefile.am index 60a8844..e54f3de 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,6 +3,10 @@ bin_PROGRAMS = notification-service sample-display-client send-notification blue AM_CFLAGS = $(GCC_CFLAGS) AM_CPPFLAGS = $(GCC_CFLAGS) +if HAVE_WAYLAND +AM_CPPFLAGS += -DHAVE_WAYLAND +endif + notification_service_SOURCES = \ main.c \ notification_service.c \ diff --git a/bluetooth_notification_client.c b/bluetooth_notification_client.c index ffe475e..1b8ab7c 100644 --- a/bluetooth_notification_client.c +++ b/bluetooth_notification_client.c @@ -6,6 +6,9 @@ #include #include #include +#ifdef HAVE_WAYLAND +#include +#endif typedef enum { BT_AGENT_ACCEPT, @@ -102,6 +105,20 @@ __display_notification(bt_notification cb_1, bt_notification cb_2, DBusGProxy *p bt_yesno = 1; char line[4]; +#ifdef HAVE_WAYLAND + struct wlmessage *wlmessage = wlmessage_create(); + wlmessage_set_message(wlmessage, "Do you confirm ?"); + wlmessage_add_button(wlmessage, 1, "Yes"); + wlmessage_add_button(wlmessage, 0, "No"); + wlmessage_set_default_button(wlmessage, 1); + bt_yesno = wlmessage_show(wlmessage, NULL); + wlmessage_destroy(wlmessage); + + if (bt_yesno == 1) + (cb_1) (proxy); + else if (bt_yesno == 0) + (cb_2) (proxy); +#else fprintf(stdout, "Do you confirm yes or no ? "); while ( bt_yesno != 0){ if (!fgets(line, sizeof(line), stdin)) @@ -116,6 +133,7 @@ __display_notification(bt_notification cb_1, bt_notification cb_2, DBusGProxy *p fprintf(stdout," yes or no :"); } } +#endif err = notification_delete_all_by_type("bluetooth-frwk-bt-service", NOTIFICATION_TYPE_NOTI); if (err != NOTIFICATION_ERROR_NONE) { fprintf(stdout, "Unable to remove notifications"); diff --git a/configure.ac b/configure.ac index 9f7eae1..72aa0d8 100644 --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,12 @@ LT_PREREQ([2.2]) LT_INIT([disable-static]) PKG_PROG_PKG_CONFIG() -PKG_CHECK_MODULES([TIZEN], [eina ecore com-core notification dbus-1 bluetooth-api]) +AC_ARG_ENABLE(wayland, [ --enable-wayland],, enable_wayland=no) +AM_CONDITIONAL(HAVE_WAYLAND, test x$enable_wayland = xyes) +if test "x$enable_wayland" = "xyes"; then + wayland_libs="libwlmessage" +fi +PKG_CHECK_MODULES([TIZEN], [eina ecore com-core notification dbus-1 bluetooth-api $wayland_libs]) AC_SUBST(TIZEN_CFLAGS) AC_SUBST(TIZEN_LIBS) diff --git a/packaging/notification-service.spec b/packaging/notification-service.spec index 33aad4f..708f0f7 100644 --- a/packaging/notification-service.spec +++ b/packaging/notification-service.spec @@ -1,3 +1,5 @@ +%bcond_with wayland + Name: notification-service Summary: Simple notification service Version: 0.0.3 @@ -14,6 +16,9 @@ BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(bluetooth-api) BuildRequires: pkgconfig(bundle) +%if %{with wayland} +BuildRequires: pkgconfig(libwlmessage) +%endif %{?systemd_requires} %description @@ -31,7 +36,11 @@ This package provides unit test used in the development of the notification serv %setup -q -n %{name}-%{version} %build +%if %{with wayland} +%autogen --enable-wayland +%else %autogen +%endif make %{?_smp_mflags} %install