add a 'Switch to...' entry to empty desktops in the client-list-menu
authorDana Jansens <danakj@orodu.net>
Thu, 18 Sep 2003 06:17:51 +0000 (06:17 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 18 Sep 2003 06:17:51 +0000 (06:17 +0000)
openbox/client_list_menu.c

index 4011c42..acf9f07 100644 (file)
@@ -42,6 +42,7 @@ static void desk_menu_update(ObMenuFrame *frame, gpointer data)
     GList *it;
     gint i;
     gboolean icons = FALSE;
+    gboolean empty = TRUE;
 
     menu_clear_entries(menu);
 
@@ -53,6 +54,8 @@ static void desk_menu_update(ObMenuFrame *frame, gpointer data)
             ObMenuEntry *e;
             ObClientIcon *icon;
 
+            empty = FALSE;
+
             if (!icons && c->iconic) {
                 icons = TRUE;
                 menu_add_separator(menu, -1);
@@ -72,7 +75,17 @@ static void desk_menu_update(ObMenuFrame *frame, gpointer data)
             }
         }
     }
-    
+
+    if (empty) {
+        /* no entries */
+
+        GSList *acts;
+        ObAction* act;
+        act = action_from_string("Desktop", OB_USER_ACTION_MENU_SELECTION);
+        act->data.desktop.desk = d->desktop;
+        acts = g_slist_prepend(NULL, act);
+        menu_add_normal(menu, 0, "Switch to...", acts);
+    }
 }
 
 /* executes it using the client in the actions, since we set that