From 4f2a9fe09089f0a2d4f4c4822309fd238d1041e6 Mon Sep 17 00:00:00 2001 From: eugeni Date: Tue, 18 Aug 2009 16:04:01 +0000 Subject: Support custom notifications (for netprofile). git-svn-id: svn+ssh://svn.mandriva.com/svn/soft/s2u/trunk@259384 99302b65-d5f7-0310-b3dd-f8cd6f4e3d94 --- README | 1 + s2u.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/README b/README index 380cac3..7947524 100644 --- a/README +++ b/README @@ -9,3 +9,4 @@ implemented actions are: o react to hostname changes to continue to have a working X11 session. o run update-menus if requested by the system o display msec notifications + o display custom notifications (netprofile, ...) diff --git a/s2u.c b/s2u.c index 03ee852..4cb73c0 100644 --- a/s2u.c +++ b/s2u.c @@ -168,6 +168,29 @@ filter_function (DBusConnection * connection, } dbus_error_free(&error); return DBUS_HANDLER_RESULT_HANDLED; + } else if (dbus_message_is_signal (message, + "com.mandriva.user", + "custom_notification")) { + /* msec */ + char *string, *title; + DBusError error; + dbus_error_init(&error); + if (dbus_message_get_args (message, + &error, + DBUS_TYPE_STRING, &title, + DBUS_TYPE_STRING, &string, + DBUS_TYPE_INVALID)) { + n = notify_notification_new(title, string, GTK_STOCK_INFO, NULL); + if (!notify_notification_show (n, NULL)) { + g_printerr("notify_notification_show: failed to show notification\n"); + } + g_object_unref(G_OBJECT(n)); + } + else { + fprintf (stderr, "an error occurred: %s\n", error.message); + } + dbus_error_free(&error); + return DBUS_HANDLER_RESULT_HANDLED; } else { return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } -- cgit v1.2.1