aboutsummaryrefslogtreecommitdiff
path: root/src/notifications-service.c
diff options
context:
space:
mode:
authorJason Conti <jason.conti@gmail.com>2011-05-14 13:37:48 -0400
committerJason Conti <jason.conti@gmail.com>2011-05-14 13:37:48 -0400
commit706a3188fb4a4bc20db26cc277421413901320ca (patch)
treead8a4f40033fe445bfb1ce88036847b019f41aa6 /src/notifications-service.c
parent0b8c3b28db04160a071b215e19a95953f01f8f38 (diff)
downloadayatana-indicator-notifications-706a3188fb4a4bc20db26cc277421413901320ca.tar.gz
ayatana-indicator-notifications-706a3188fb4a4bc20db26cc277421413901320ca.tar.bz2
ayatana-indicator-notifications-706a3188fb4a4bc20db26cc277421413901320ca.zip
Adding back the functionality to clear the notifications.
Diffstat (limited to 'src/notifications-service.c')
-rw-r--r--src/notifications-service.c18
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 */