From 78d725009812d3aed87024264f0112ca9968519a Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 21 Apr 2007 22:06:47 +0000 Subject: add --debug-focus add --config-file: to specify a config file to use. set OPENBOX_RC property on the root window containing the path of the RC file being the full path to the RC file being used by openbox --- parser/parse.c | 21 ++++++++++++++++----- parser/parse.h | 3 ++- 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'parser') diff --git a/parser/parse.c b/parser/parse.c index 33f80546..552221ca 100644 --- a/parser/parse.c +++ b/parser/parse.c @@ -79,16 +79,27 @@ 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; + *fileused = NULL; + 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); + if (file) { + if ((r = parse_load(file, "openbox_config", doc, root))) + *fileused = g_strdup(file); + } else { + 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"); diff --git a/parser/parse.h b/parser/parse.h index d2a6606b..7039d8c4 100644 --- a/parser/parse.h +++ b/parser/parse.h @@ -35,7 +35,8 @@ ObParseInst* parse_startup(); void parse_shutdown(ObParseInst *inst); /* Loads Openbox's rc, from the normal paths */ -gboolean parse_load_rc(xmlDocPtr *doc, xmlNodePtr *root); +gboolean parse_load_rc(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root, + gchar **fileused); /* Loads an Openbox menu, from the normal paths */ gboolean parse_load_menu(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root); /* Loads an Openbox menu, from the normal paths */ -- cgit v1.2.3