]> Dogcows Code - chaz/openbox/commitdiff
new method for loading menu files etc
authorDana Jansens <danakj@orodu.net>
Thu, 28 Aug 2003 17:32:49 +0000 (17:32 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 28 Aug 2003 17:32:49 +0000 (17:32 +0000)
data/rc3
openbox/config.h
openbox/event.c
openbox/event.h
openbox/menu.c
openbox/menu.h
plugins/menu/client_list_menu.c

index f379d4c23d5d34609a41d59df821ddb3c5e1a229..49f004a48041d657c5888a62bf924bcd0a95bff4 100644 (file)
--- a/data/rc3
+++ b/data/rc3
 </mouse>
 
 <menu>
-  <location>~/.openbox/menu</location>
+  <!-- You can specify more than one menu file in here and they are all loaded,
+       just don't make menu ids clash or, well, it'll be kind of pointless -->
+
+  <!-- default menu file (or custom one in $HOME/.openbox/) -->
+  <file>menu</file>
+
+  <!-- debian menu file -->
+  <file>/etc/X11/openbox/openbox-menu</file>
 </menu>
 
 </openbox_config>
index 98a5340bea32e121c9906ccfe847e50141013949..777d895eff3779a338e0f4f44c894bc4a7dd1ac4 100644 (file)
@@ -72,8 +72,8 @@ gint config_resist_win;
 /*! Number of pixels to resist while crossing a screen's edge */
 gint config_resist_edge;
 
-/*! User-specified path to the menu file */
-extern gchar *config_menu_path;
+/*! User-specified menu files */
+extern GSList *config_menu_files;
 
 void config_startup(struct _ObParseInst *i);
 void config_shutdown();
index bbde397e7789c90efbb157e3ac9e5630a1525f37..094d19fe2267ce4b0045b3c9ee06f0bcd5119f02 100644 (file)
@@ -1102,14 +1102,15 @@ static void find_max_fd()
 #endif
 }
 
-void event_remove_fd(int n)
+void event_remove_fd(gint n)
 {
     FD_CLR(n, &allset);
     g_datalist_id_remove_data(&fd_handler_list, (GQuark)n);
     find_max_fd();
 }
 
-static void fd_event_handle_foreach(GQuark n, gpointer data, gpointer user_data)
+static void fd_event_handle_foreach(GQuark n,
+                                    gpointer data, gpointer user_data)
 {
     if (FD_ISSET( (int)n, &selset)) {
         event_fd_handler *h = (event_fd_handler *)data;
index b8f567a8d9c41978636d10cf2969db1957ba6029..6aade180b871ca185be36b0c5376b3cfd3156910 100644 (file)
@@ -7,21 +7,21 @@
 extern Time event_lasttime;
 
 /*! The value of the mask for the NumLock modifier */
-extern unsigned int NumLockMask;
+extern guint NumLockMask;
 /*! The value of the mask for the ScrollLock modifier */
-extern unsigned int ScrollLockMask;
+extern guint ScrollLockMask;
 
 void event_startup();
 void event_shutdown();
 
 typedef struct event_fd_handler {
-    int fd;
-    void *data;
-    void (*handler)(int fd, void *data);
+    gint fd;
+    gpointer data;
+    void (*handler)(gint fd, gpointer data);
 } event_fd_handler;
 
 void event_add_fd_handler(event_fd_handler *handler);
-void event_remove_fd(int n);
+void event_remove_fd(gint n);
 
 void event_loop();
 
index 84c5ded54154a7096051af01143b979e55171604..4ffcca0d397adf6eb4ddf7cb5f1b5432e5d27f0e 100644 (file)
@@ -193,7 +193,7 @@ void menu_parse()
     }
 }
 
-gboolean menu_new(gchar *name, gchar *title, gpointer data)
+ObMenu* menu_new(gchar *name, gchar *title, gpointer data)
 {
     ObMenu *self;
 
@@ -206,7 +206,7 @@ gboolean menu_new(gchar *name, gchar *title, gpointer data)
 
     g_hash_table_replace(menu_hash, self->name, self);
 
-    return TRUE;
+    return self;
 }
 
 void menu_free(gchar *name)
@@ -295,7 +295,8 @@ static void menu_clear_entries_internal(ObMenu *self)
     }
 }
 
-void menu_add_normal(gchar *name, gint id, gchar *label, GSList *actions)
+ObMenuEntry* menu_add_normal(gchar *name, gint id, gchar *label,
+                             GSList *actions)
 {
     ObMenu *self;
     ObMenuEntry *e;
@@ -307,9 +308,10 @@ void menu_add_normal(gchar *name, gint id, gchar *label, GSList *actions)
     e->data.normal.actions = actions;
 
     self->entries = g_list_append(self->entries, e);
+    return e;
 }
 
-void menu_add_submenu(gchar *name, gint id, gchar *submenu)
+ObMenuEntry* menu_add_submenu(gchar *name, gint id, gchar *submenu)
 {
     ObMenu *self;
     ObMenuEntry *e;
@@ -320,9 +322,10 @@ void menu_add_submenu(gchar *name, gint id, gchar *submenu)
     e->data.submenu.name = g_strdup(submenu);
 
     self->entries = g_list_append(self->entries, e);
+    return e;
 }
 
-void menu_add_separator(gchar *name, gint id)
+ObMenuEntry* menu_add_separator(gchar *name, gint id)
 {
     ObMenu *self;
     ObMenuEntry *e;
@@ -332,6 +335,7 @@ void menu_add_separator(gchar *name, gint id)
     e = menu_entry_new(self, OB_MENU_ENTRY_TYPE_SEPARATOR, id);
 
     self->entries = g_list_append(self->entries, e);
+    return e;
 }
 
 void menu_set_update_func(gchar *name, ObMenuUpdateFunc func)
index 74519343abb9ad1f8826768330c66fe34e725090..4780bda011b21fa66485ec49d7f138de3f689109 100644 (file)
@@ -93,7 +93,7 @@ void menu_shutdown();
 
 void menu_parse();
 
-gboolean menu_new(gchar *name, gchar *title, gpointer data);
+ObMenu* menu_new(gchar *name, gchar *title, gpointer data);
 void menu_free(gchar *name);
 
 gboolean menu_open_plugin(ObParseInst *i, gchar *name, gchar *plugin);
@@ -106,9 +106,10 @@ void menu_show(gchar *name, gint x, gint y, struct _ObClient *client);
 
 /* functions for building menus */
 void menu_clear_entries(gchar *name);
-void menu_add_normal(gchar *name, gint id, gchar *label, GSList *actions);
-void menu_add_submenu(gchar *name, gint id, gchar *submenu);
-void menu_add_separator(gchar *name, gint id);
+ObMenuEntry* menu_add_normal(gchar *name, gint id, gchar *label,
+                             GSList *actions);
+ObMenuEntry* menu_add_submenu(gchar *name, gint id, gchar *submenu);
+ObMenuEntry* menu_add_separator(gchar *name, gint id);
 
 ObMenuEntry* menu_find_entry_id(ObMenu *self, gint id);
 
index 054353fd7b6673d5cd038f7ad8ea9ea79e39a11d..5b9637bf2c04e59510be7f27ad18f466c190e1fe 100644 (file)
@@ -44,11 +44,10 @@ static void desk_menu_update(ObMenuFrame *frame, gpointer data)
             act = action_from_string("activate");
             act->data.activate.c = c;
             acts = g_slist_prepend(NULL, act);
-            menu_add_normal(menu->name, i,
-                            (c->iconic ? c->icon_title : c->title), acts);
+            e = menu_add_normal(menu->name, i,
+                                (c->iconic ? c->icon_title : c->title), acts);
 
             if ((icon = client_icon(c, 32, 32))) {
-                e = menu_find_entry_id(menu, i);
                 e->data.normal.icon_width = icon->width;
                 e->data.normal.icon_height = icon->height;
                 e->data.normal.icon_data = icon->data;
This page took 0.031729 seconds and 4 git commands to generate.