aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog6
-rw-r--r--src/im-application-list.c12
-rw-r--r--src/im-phone-menu.c20
-rw-r--r--src/im-phone-menu.h2
-rw-r--r--src/messages-service.c2
5 files changed, 42 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 84d5bc4..a255341 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+indicator-messages (12.10.6-0ubuntu1phablet9) quantal; urgency=low
+
+ * add "remove-all" signal to imapplicationlist (temporarily)
+
+ -- Lars Uebernickel <lars.uebernickel@ubuntu.com> Thu, 20 Dec 2012 18:49:50 +0100
+
indicator-messages (12.10.6-0ubuntu1phablet8) quantal; urgency=low
* Make messaging_menu_app_remove_message() work for messages with a ref count of 1
diff --git a/src/im-application-list.c b/src/im-application-list.c
index 959a820..9a673c9 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -45,6 +45,7 @@ enum
MESSAGE_ADDED,
MESSAGE_REMOVED,
APP_STOPPED,
+ REMOVE_ALL,
N_SIGNALS
};
@@ -251,6 +252,8 @@ im_application_list_remove_all (GSimpleAction *action,
GHashTableIter iter;
Application *app;
+ g_signal_emit (list, signals[REMOVE_ALL], 0);
+
g_hash_table_iter_init (&iter, list->applications);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &app))
{
@@ -377,6 +380,15 @@ im_application_list_class_init (ImApplicationListClass *klass)
G_TYPE_NONE,
1,
G_TYPE_STRING);
+
+ signals[REMOVE_ALL] = g_signal_new ("remove-all",
+ IM_TYPE_APPLICATION_LIST,
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
}
static void
diff --git a/src/im-phone-menu.c b/src/im-phone-menu.c
index 922dc82..3d5f94d 100644
--- a/src/im-phone-menu.c
+++ b/src/im-phone-menu.c
@@ -309,3 +309,23 @@ im_phone_menu_remove_application (ImPhoneMenu *menu,
im_phone_menu_remove_all_for_app (menu->source_section, app_id);
im_phone_menu_remove_all_for_app (menu->message_section, app_id);
}
+
+void
+im_phone_menu_remove_all (ImPhoneMenu *menu)
+{
+ g_return_if_fail (IM_IS_PHONE_MENU (menu));
+
+ while (g_menu_model_get_n_items (G_MENU_MODEL (menu->toplevel_menu)))
+ g_menu_remove (menu->toplevel_menu, 0);
+
+ g_object_unref (menu->message_section);
+ g_object_unref (menu->source_section);
+
+ menu->message_section = g_menu_new ();
+ menu->source_section = g_menu_new ();
+
+ g_signal_connect_swapped (menu->message_section, "items-changed",
+ G_CALLBACK (im_phone_menu_update_toplevel), menu);
+ g_signal_connect_swapped (menu->source_section, "items-changed",
+ G_CALLBACK (im_phone_menu_update_toplevel), menu);
+}
diff --git a/src/im-phone-menu.h b/src/im-phone-menu.h
index 84908e2..258ce73 100644
--- a/src/im-phone-menu.h
+++ b/src/im-phone-menu.h
@@ -65,4 +65,6 @@ void im_phone_menu_remove_source (ImPhoneMenu *men
void im_phone_menu_remove_application (ImPhoneMenu *menu,
const gchar *app_id);
+void im_phone_menu_remove_all (ImPhoneMenu *menu);
+
#endif
diff --git a/src/messages-service.c b/src/messages-service.c
index 27bce4e..c2ca1a0 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -172,6 +172,8 @@ main (int argc, char ** argv)
G_CALLBACK (im_phone_menu_remove_message), menu);
g_signal_connect_swapped (applications, "app-stopped",
G_CALLBACK (im_phone_menu_remove_application), menu);
+ g_signal_connect_swapped (applications, "remove-all",
+ G_CALLBACK (im_phone_menu_remove_all), menu);
g_main_loop_run(mainloop);