From bbad88aa21f01a70faf824cbb2825bd7f9d95253 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 2 Feb 2008 09:22:50 -0500 Subject: add a --config-file command line option, and OB_CONFIG_FILE root hint --- parser/parse.c | 12 ++++-------- parser/parse.h | 6 +++--- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'parser') diff --git a/parser/parse.c b/parser/parse.c index 6daa8517..636b451f 100644 --- a/parser/parse.c +++ b/parser/parse.c @@ -79,25 +79,21 @@ void parse_register(ObParseInst *i, const gchar *tag, g_hash_table_insert(i->callbacks, c->tag, c); } -gboolean parse_load_rc(const gchar *type, xmlDocPtr *doc, xmlNodePtr *root) +gboolean parse_load_rc(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root) { GSList *it; gboolean r = FALSE; - gchar *fname; - if (type == NULL) - fname = g_strdup("rc.xml"); - else - fname = g_strdup_printf("rc-%s.xml", type); + if (file && parse_load(file, "openbox_config", doc, root)) + return TRUE; for (it = xdg_config_dir_paths; !r && it; it = g_slist_next(it)) { gchar *path; - path = g_build_filename(it->data, "openbox", fname, NULL); + path = g_build_filename(it->data, "openbox", "rc.xml", NULL); r = parse_load(path, "openbox_config", doc, root); g_free(path); } - g_free(fname); return r; } diff --git a/parser/parse.h b/parser/parse.h index 4a8ec9a7..28af64bc 100644 --- a/parser/parse.h +++ b/parser/parse.h @@ -35,10 +35,10 @@ ObParseInst* parse_startup(); void parse_shutdown(ObParseInst *inst); /*! Loads Openbox's rc, from the normal paths - @type The configuration type to load, or NULL to use the default. - e.g. "gnome" would load rc-gnome.xml. + @param file The path of the config to try load. NULL to load from the + default path */ -gboolean parse_load_rc(const gchar *type, xmlDocPtr *doc, xmlNodePtr *root); +gboolean parse_load_rc(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root); /* Loads an Openbox menu, from the normal paths */ gboolean parse_load_menu(const gchar *file, xmlDocPtr *doc, xmlNodePtr *root); /* Loads an Openbox theme, from the normal paths */ -- cgit v1.2.3