Pass the GravityPoint as const* instead of by value
[mikachu/openbox.git] / openbox / menu.c
index 7d8f0ba..ae69acb 100644 (file)
@@ -90,7 +90,16 @@ void menu_startup(gboolean reconfig)
             loaded = TRUE;
             obt_xml_tree_from_root(menu_parse_inst);
             obt_xml_close(menu_parse_inst);
-        } else
+        }
+        else if (obt_xml_load_file(menu_parse_inst,
+                                   it->data,
+                                   "openbox_menu"))
+        {
+            loaded = TRUE;
+            obt_xml_tree_from_root(menu_parse_inst);
+            obt_xml_close(menu_parse_inst);
+        }
+        else
             g_message(_("Unable to find a valid menu file \"%s\""),
                       (const gchar*)it->data);
     }
@@ -268,7 +277,7 @@ static gunichar parse_shortcut(const gchar *label, gboolean allow_shortcut,
     return shortcut;
 }
 
-static void parse_menu_item(xmlNodePtr node,  gpointer data)
+static void parse_menu_item(xmlNodePtr node, gpointer data)
 {
     ObMenuParseState *state = data;
     gchar *label;
@@ -279,7 +288,7 @@ static void parse_menu_item(xmlNodePtr node,  gpointer data)
         /* Don't try to extract "icon" attribute if icons in user-defined
            menus are not enabled. */
 
-        if (obt_xml_attr_string(node, "label", &label)) {
+        if (obt_xml_attr_string_unstripped(node, "label", &label)) {
             xmlNodePtr c;
             GSList *acts = NULL;
 
@@ -314,7 +323,7 @@ static void parse_menu_separator(xmlNodePtr node, gpointer data)
     if (state->parent) {
         gchar *label;
 
-        if (!obt_xml_attr_string(node, "label", &label))
+        if (!obt_xml_attr_string_unstripped(node, "label", &label))
             label = NULL;
 
         menu_add_separator(state->parent, -1, label);
@@ -334,7 +343,7 @@ static void parse_menu(xmlNodePtr node, gpointer data)
         goto parse_menu_fail;
 
     if (!g_hash_table_lookup(menu_hash, name)) {
-        if (!obt_xml_attr_string(node, "label", &title))
+        if (!obt_xml_attr_string_unstripped(node, "label", &title))
             goto parse_menu_fail;
 
         if ((menu = menu_new(name, title, TRUE, NULL))) {
@@ -448,7 +457,8 @@ static gboolean menu_hide_delay_func(gpointer data)
     return FALSE; /* no repeat */
 }
 
-void menu_show(gchar *name, gint x, gint y, gboolean mouse, ObClient *client)
+void menu_show(gchar *name, const GravityPoint *pos, gint monitor,
+               gboolean mouse, gboolean user_positioned, ObClient *client)
 {
     ObMenu *self;
     ObMenuFrame *frame;
@@ -470,7 +480,7 @@ void menu_show(gchar *name, gint x, gint y, gboolean mouse, ObClient *client)
     menu_clear_pipe_caches();
 
     frame = menu_frame_new(self, 0, client);
-    if (!menu_frame_show_topmenu(frame, x, y, mouse))
+    if (!menu_frame_show_topmenu(frame, pos, monitor, mouse, user_positioned))
         menu_frame_free(frame);
     else {
         if (!mouse) {