aboutsummaryrefslogtreecommitdiff
path: root/src/notifications-service.c
diff options
context:
space:
mode:
authorJason Conti <jason.conti@gmail.com>2011-05-13 14:34:34 -0400
committerJason Conti <jason.conti@gmail.com>2011-05-13 14:34:34 -0400
commit9c9ceb681c943447178c66fafb0fe825db3fd25d (patch)
treed9fbf8d6de07d3adff4760982ff74f835e92cd56 /src/notifications-service.c
parentc64309f5a4bcbc62d4ab5810735be97e7abcf335 (diff)
downloadayatana-indicator-notifications-9c9ceb681c943447178c66fafb0fe825db3fd25d.tar.gz
ayatana-indicator-notifications-9c9ceb681c943447178c66fafb0fe825db3fd25d.tar.bz2
ayatana-indicator-notifications-9c9ceb681c943447178c66fafb0fe825db3fd25d.zip
Integrated the dbus-spy. Menu items for notification summaries are appended as they arrive.
Diffstat (limited to 'src/notifications-service.c')
-rw-r--r--src/notifications-service.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/notifications-service.c b/src/notifications-service.c
index 2d551e9..7adfa68 100644
--- a/src/notifications-service.c
+++ b/src/notifications-service.c
@@ -32,12 +32,14 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libdbusmenu-glib/menuitem.h>
#include "dbus-shared.h"
+#include "dbus-spy.h"
#include "settings-shared.h"
static IndicatorService *service = NULL;
static GMainLoop *mainloop = NULL;
static DbusmenuServer *server = NULL;
static DbusmenuMenuitem *root = NULL;
+static DBusSpy *spy = NULL;
/* Global Items */
static DbusmenuMenuitem *item_1 = NULL;
@@ -79,6 +81,16 @@ build_menus(DbusmenuMenuitem *root)
return;
}
+static void
+message_received_cb(DBusSpy *spy, Notification *note, gpointer user_data)
+{
+ DbusmenuMenuitem *item;
+
+ item = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, notification_get_summary(note));
+ dbusmenu_menuitem_child_append(root, item);
+}
+
/* Responds to the service object saying it's time to shutdown.
It stops the mainloop. */
static void
@@ -112,9 +124,14 @@ main(int argc, char **argv)
build_menus(root);
+ /* Set up the notification spy */
+ spy = dbus_spy_new();
+ g_signal_connect(spy, DBUS_SPY_SIGNAL_MESSAGE_RECEIVED, G_CALLBACK(message_received_cb), NULL);
+
mainloop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(mainloop);
+ g_object_unref(G_OBJECT(spy));
g_object_unref(G_OBJECT(service));
g_object_unref(G_OBJECT(server));
g_object_unref(G_OBJECT(root));