diff options
author | Jason Conti <jason.conti@gmail.com> | 2011-05-14 13:37:48 -0400 |
---|---|---|
committer | Jason Conti <jason.conti@gmail.com> | 2011-05-14 13:37:48 -0400 |
commit | ee9296638703d6a1200d07b5a287b8f625072191 (patch) | |
tree | ad8a4f40033fe445bfb1ce88036847b019f41aa6 /src | |
parent | 900d476b2c2292612e918b173b7c109f060d68bc (diff) | |
download | ayatana-indicator-notifications-ee9296638703d6a1200d07b5a287b8f625072191.tar.gz ayatana-indicator-notifications-ee9296638703d6a1200d07b5a287b8f625072191.tar.bz2 ayatana-indicator-notifications-ee9296638703d6a1200d07b5a287b8f625072191.zip |
Adding back the functionality to clear the notifications.
Diffstat (limited to 'src')
-rw-r--r-- | src/notifications-service.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/notifications-service.c b/src/notifications-service.c index d07547b..4e21de9 100644 --- a/src/notifications-service.c +++ b/src/notifications-service.c @@ -52,6 +52,7 @@ static guint notification_limit = 5; static GOutputStream *log_file = NULL; static gboolean add_notification_item(gpointer); +static gboolean clear_notification_items(gpointer); static void build_menus(DbusmenuMenuitem *); static void clear_notifications_cb(DbusmenuMenuitem *, guint, gpointer); static void log_to_file_cb(GObject *, GAsyncResult *, gpointer); @@ -87,6 +88,22 @@ add_notification_item(gpointer user_data) return FALSE; } +static gboolean +clear_notification_items(gpointer user_data) +{ + DbusmenuMenuitem *item; + + while(!g_queue_is_empty(notification_items)) { + item = DBUSMENU_MENUITEM(g_queue_pop_tail(notification_items)); + dbusmenu_menuitem_child_delete(root, item); + g_object_unref(item); + } + + item = NULL; + + return FALSE; +} + static void build_menus(DbusmenuMenuitem *root) { @@ -111,6 +128,7 @@ build_menus(DbusmenuMenuitem *root) static void clear_notifications_cb(DbusmenuMenuitem *item, guint timestamp, gpointer user_data) { + g_idle_add(clear_notification_items, NULL); } /* from indicator-applet */ |