summaryrefslogtreecommitdiff
path: root/parser/parse.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-05-05 23:54:04 +0000
committerDana Jansens <danakj@orodu.net>2007-05-05 23:54:04 +0000
commita6aaabe62c3651169dda9a1a34bcec64dad4ee92 (patch)
tree4e9c69a4d52180f7623fae71324645b014c97481 /parser/parse.c
parent37875f091d8a19818b6325923a57f6f7f3cd820c (diff)
change the --config-file to --config, which works differently..
change the _OPENBOX_RC root property to _OPENBOX_CONFIG which is also different.
Diffstat (limited to 'parser/parse.c')
-rw-r--r--parser/parse.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/parser/parse.c b/parser/parse.c
index 011808fb..43d076e1 100644
--- a/parser/parse.c
+++ b/parser/parse.c
@@ -79,29 +79,26 @@ void parse_register(ObParseInst *i, const gchar *tag,
g_hash_table_insert(i->callbacks, c->tag, c);
}
-gboolean parse_load_rc(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root,
- gchar **fileused)
+gboolean parse_load_rc(const gchar *type, xmlDocPtr *doc, xmlNodePtr *root)
{
GSList *it;
gboolean r = FALSE;
+ gchar *fname;
- *fileused = NULL;
+ if (type == NULL)
+ fname = g_strdup("rc.xml");
+ else
+ fname = g_strdup_printf("rc-%s.xml", type);
- 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;
+ 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);
- }
+ path = g_build_filename(it->data, "openbox", fname, NULL);
+ r = parse_load(path, "openbox_config", doc, root);
+ g_free(path);
}
+ g_free(fname);
+
return r;
}