]> Dogcows Code - chaz/openbox/commitdiff
add cleanup functions to the client list menus that removes everything from them...
authorDana Jansens <danakj@orodu.net>
Tue, 11 May 2010 23:01:46 +0000 (19:01 -0400)
committerDana Jansens <danakj@orodu.net>
Tue, 11 May 2010 23:01:46 +0000 (19:01 -0400)
openbox/client_list_combined_menu.c
openbox/client_list_menu.c

index f664b776ad693ecea35457a9b5853b7015721015..c26b6fa036f3da35c874d068c07b67e50ee13b07 100644 (file)
@@ -37,6 +37,11 @@ static ObMenu *combined_menu;
 #define ADD_DESKTOP -2
 #define REMOVE_DESKTOP -3
 
+static void self_cleanup(ObMenu *menu, gpointer data)
+{
+    menu_clear_entries(menu);
+}
+
 static gboolean self_update(ObMenuFrame *frame, gpointer data)
 {
     ObMenu *menu = frame->menu;
@@ -151,6 +156,7 @@ void client_list_combined_menu_startup(gboolean reconfig)
 
     combined_menu = menu_new(MENU_NAME, _("Windows"), TRUE, NULL);
     menu_set_update_func(combined_menu, self_update);
+    menu_set_cleanup_func(combined_menu, self_cleanup);
     menu_set_execute_func(combined_menu, menu_execute);
 }
 
index b47ead02b30ed0fb8831152a1de6bbbba2b57318..f3df2a5aec1ba5a4e209bfad744e006cfd6e5ad3 100644 (file)
@@ -121,6 +121,16 @@ static void desk_menu_destroy(ObMenu *menu, gpointer data)
     desktop_menus = g_slist_remove(desktop_menus, menu);
 }
 
+static void self_cleanup(ObMenu *menu, gpointer data)
+{
+    menu_clear_entries(menu);
+
+    while (desktop_menus) {
+        menu_free(desktop_menus->data);
+        desktop_menus = g_slist_delete_link(desktop_menus, desktop_menus);
+    }
+}
+
 static gboolean self_update(ObMenuFrame *frame, gpointer data)
 {
     ObMenu *menu = frame->menu;
@@ -203,6 +213,7 @@ void client_list_menu_startup(gboolean reconfig)
 
     menu = menu_new(MENU_NAME, _("Desktops"), TRUE, NULL);
     menu_set_update_func(menu, self_update);
+    menu_set_cleanup_func(menu, self_cleanup);
     menu_set_execute_func(menu, self_execute);
 }
 
This page took 0.028608 seconds and 4 git commands to generate.