]> Dogcows Code - chaz/openbox/blobdiff - parser/parse.c
only pass thru events when the menu is open, don't for other stuff
[chaz/openbox] / parser / parse.c
index 33f80546c7c625113048037fb00571fb4ecf3117..52ab920b7f50692a041369cc88ce3b115ac8e53c 100644 (file)
@@ -79,16 +79,28 @@ void parse_register(ObParseInst *i, const gchar *tag,
     g_hash_table_insert(i->callbacks, c->tag, c);
 }
 
-gboolean parse_load_rc(xmlDocPtr *doc, xmlNodePtr *root)
+gboolean parse_load_rc(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root,
+                       gchar **fileused)
 {
     GSList *it;
-    gchar *path;
     gboolean r = FALSE;
 
-    for (it = xdg_config_dir_paths; !r && it; it = g_slist_next(it)) {
-        path = g_build_filename(it->data, "openbox", "rc.xml", NULL);
-        r = parse_load(path, "openbox_config", doc, root);
-        g_free(path);
+    *fileused = NULL;
+
+    if (file) {
+        if ((r = parse_load(file, "openbox_config", doc, root)))
+            *fileused = g_strdup(file);
+    } else {
+        /* this won't run if the above code loaded a config */
+        for (it = xdg_config_dir_paths; !r && it; it = g_slist_next(it)) {
+            gchar *path;
+
+            path = g_build_filename(it->data, "openbox", "rc.xml", NULL);
+            if ((r = parse_load(path, "openbox_config", doc, root)))
+                *fileused = path;
+            else
+                g_free(path);
+        }
     }
     if (!r)
         g_warning("Unable to find a valid config file, using defaults");
@@ -381,14 +393,14 @@ void parse_paths_startup()
     if (path && path[0] != '\0') /* not unset or empty */
         xdg_config_dir_paths = split_paths(path);
     else {
+        xdg_config_dir_paths = slist_path_add(xdg_config_dir_paths,
+                                              g_strdup(CONFIGDIR),
+                                              (GSListFunc) g_slist_append);
         xdg_config_dir_paths = slist_path_add(xdg_config_dir_paths,
                                               g_build_filename
                                               (G_DIR_SEPARATOR_S,
                                                "etc", "xdg", NULL),
                                               (GSListFunc) g_slist_append);
-        xdg_config_dir_paths = slist_path_add(xdg_config_dir_paths,
-                                              g_strdup(CONFIGDIR),
-                                              (GSListFunc) g_slist_append);
     }
     xdg_config_dir_paths = slist_path_add(xdg_config_dir_paths,
                                           g_strdup(xdg_config_home_path),
This page took 0.023497 seconds and 4 git commands to generate.