aboutsummaryrefslogtreecommitdiff
path: root/src/im-phone-menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/im-phone-menu.c')
-rw-r--r--src/im-phone-menu.c20
1 files changed, 20 insertions, 0 deletions
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);
+}