From: Dana Jansens Date: Mon, 21 Dec 2009 19:04:39 +0000 (-0500) Subject: rename the obt_parse library to obt_xml (since it is very xml specific) X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=b06b684589a618a2481ccc2745d5e03abb6bd5e0;p=chaz%2Fopenbox rename the obt_parse library to obt_xml (since it is very xml specific) --- diff --git a/Makefile.am b/Makefile.am index 0bcb8b28..45a3bd2f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -129,8 +129,8 @@ obt_libobt_la_SOURCES = \ obt/keyboard.c \ obt/mainloop.h \ obt/mainloop.c \ - obt/parse.h \ - obt/parse.c \ + obt/xml.h \ + obt/xml.c \ obt/paths.h \ obt/paths.c \ obt/prop.h \ @@ -423,7 +423,7 @@ obtpubinclude_HEADERS = \ obt/display.h \ obt/keyboard.h \ obt/mainloop.h \ - obt/parse.h \ + obt/xml.h \ obt/paths.h \ obt/prop.h \ obt/util.h \ diff --git a/obt/parse.h b/obt/parse.h deleted file mode 100644 index 400acf94..00000000 --- a/obt/parse.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- - - obt/parse.h for the Openbox window manager - Copyright (c) 2003-2007 Dana Jansens - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - See the COPYING file for a copy of the GNU General Public License. -*/ - -#ifndef __obt_parse_h -#define __obt_parse_h - -#include -#include - -G_BEGIN_DECLS - -typedef struct _ObtParseInst ObtParseInst; - -typedef void (*ObtParseCallback)(xmlNodePtr node, gpointer data); - -ObtParseInst* obt_parse_instance_new(void); -void obt_parse_instance_ref(ObtParseInst *inst); -void obt_parse_instance_unref(ObtParseInst *inst); - -gboolean obt_parse_load_file(ObtParseInst *inst, - const gchar *path, - const gchar *root_node); -gboolean obt_parse_load_config_file(ObtParseInst *inst, - const gchar *domain, - const gchar *filename, - const gchar *root_node); -gboolean obt_parse_load_data_file(ObtParseInst *inst, - const gchar *domain, - const gchar *filename, - const gchar *root_node); -gboolean obt_parse_load_theme_file(ObtParseInst *inst, - const gchar *theme, - const gchar *domain, - const gchar *filename, - const gchar *root_node); -gboolean obt_parse_load_mem(ObtParseInst *inst, - gpointer data, guint len, const gchar *root_node); - -gboolean obt_parse_save_file(ObtParseInst *inst, - const gchar *path, - gboolean pretty); - -xmlDocPtr obt_parse_doc(ObtParseInst *inst); -xmlNodePtr obt_parse_root(ObtParseInst *inst); - -void obt_parse_close(ObtParseInst *inst); - -void obt_parse_register(ObtParseInst *inst, const gchar *tag, - ObtParseCallback func, gpointer data); -void obt_parse_tree(ObtParseInst *i, xmlNodePtr node); -void obt_parse_tree_from_root(ObtParseInst *i); - - -/* helpers */ - -xmlNodePtr obt_parse_find_node(xmlNodePtr node, const gchar *name); - -gboolean obt_parse_node_contains (xmlNodePtr node, const gchar *val); -gchar *obt_parse_node_string (xmlNodePtr node); -gint obt_parse_node_int (xmlNodePtr node); -gboolean obt_parse_node_bool (xmlNodePtr node); - -gboolean obt_parse_attr_contains (xmlNodePtr node, const gchar *name, - const gchar *val); -gboolean obt_parse_attr_string (xmlNodePtr node, const gchar *name, - gchar **value); -gboolean obt_parse_attr_int (xmlNodePtr node, const gchar *name, - gint *value); -gboolean obt_parse_attr_bool (xmlNodePtr node, const gchar *name, - gboolean *value); - -G_END_DECLS - -#endif diff --git a/obt/parse.c b/obt/xml.c similarity index 80% rename from obt/parse.c rename to obt/xml.c index b44e968d..35f3d83c 100644 --- a/obt/parse.c +++ b/obt/xml.c @@ -16,7 +16,7 @@ See the COPYING file for a copy of the GNU General Public License. */ -#include "obt/parse.h" +#include "obt/xml.h" #include "obt/paths.h" #include @@ -36,11 +36,11 @@ struct Callback { gchar *tag; - ObtParseCallback func; + ObtXmlCallback func; gpointer data; }; -struct _ObtParseInst { +struct _ObtXmlInst { gint ref; ObtPaths *xdg_paths; GHashTable *callbacks; @@ -55,9 +55,9 @@ static void destfunc(struct Callback *c) g_free(c); } -ObtParseInst* obt_parse_instance_new(void) +ObtXmlInst* obt_xml_instance_new(void) { - ObtParseInst *i = g_new(ObtParseInst, 1); + ObtXmlInst *i = g_new(ObtXmlInst, 1); i->ref = 1; i->xdg_paths = obt_paths_new(); i->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, @@ -68,12 +68,12 @@ ObtParseInst* obt_parse_instance_new(void) return i; } -void obt_parse_instance_ref(ObtParseInst *i) +void obt_xml_instance_ref(ObtXmlInst *i) { ++i->ref; } -void obt_parse_instance_unref(ObtParseInst *i) +void obt_xml_instance_unref(ObtXmlInst *i) { if (i && --i->ref == 0) { obt_paths_unref(i->xdg_paths); @@ -82,20 +82,20 @@ void obt_parse_instance_unref(ObtParseInst *i) } } -xmlDocPtr obt_parse_doc(ObtParseInst *i) +xmlDocPtr obt_xml_doc(ObtXmlInst *i) { g_assert(i->doc); /* a doc is open? */ return i->doc; } -xmlNodePtr obt_parse_root(ObtParseInst *i) +xmlNodePtr obt_xml_root(ObtXmlInst *i) { g_assert(i->doc); /* a doc is open? */ return i->root; } -void obt_parse_register(ObtParseInst *i, const gchar *tag, - ObtParseCallback func, gpointer data) +void obt_xml_register(ObtXmlInst *i, const gchar *tag, + ObtXmlCallback func, gpointer data) { struct Callback *c; @@ -111,7 +111,7 @@ void obt_parse_register(ObtParseInst *i, const gchar *tag, g_hash_table_insert(i->callbacks, c->tag, c); } -static gboolean load_file(ObtParseInst *i, +static gboolean load_file(ObtXmlInst *i, const gchar *domain, const gchar *filename, const gchar *root_node, @@ -164,9 +164,9 @@ static gboolean load_file(ObtParseInst *i, return r; } -gboolean obt_parse_load_file(ObtParseInst *i, - const gchar *path, - const gchar *root_node) +gboolean obt_xml_load_file(ObtXmlInst *i, + const gchar *path, + const gchar *root_node) { GSList *paths; gboolean r; @@ -182,10 +182,10 @@ gboolean obt_parse_load_file(ObtParseInst *i, return r; } -gboolean obt_parse_load_config_file(ObtParseInst *i, - const gchar *domain, - const gchar *filename, - const gchar *root_node) +gboolean obt_xml_load_config_file(ObtXmlInst *i, + const gchar *domain, + const gchar *filename, + const gchar *root_node) { GSList *it, *paths = NULL; gboolean r; @@ -202,10 +202,10 @@ gboolean obt_parse_load_config_file(ObtParseInst *i, return r; } -gboolean obt_parse_load_data_file(ObtParseInst *i, - const gchar *domain, - const gchar *filename, - const gchar *root_node) +gboolean obt_xml_load_data_file(ObtXmlInst *i, + const gchar *domain, + const gchar *filename, + const gchar *root_node) { GSList *it, *paths = NULL; gboolean r; @@ -222,11 +222,11 @@ gboolean obt_parse_load_data_file(ObtParseInst *i, return r; } -gboolean obt_parse_load_theme_file(ObtParseInst *i, - const gchar *theme, - const gchar *domain, - const gchar *filename, - const gchar *root_node) +gboolean obt_xml_load_theme_file(ObtXmlInst *i, + const gchar *theme, + const gchar *domain, + const gchar *filename, + const gchar *root_node) { GSList *it, *paths = NULL; gboolean r; @@ -249,8 +249,8 @@ gboolean obt_parse_load_theme_file(ObtParseInst *i, } -gboolean obt_parse_load_mem(ObtParseInst *i, - gpointer data, guint len, const gchar *root_node) +gboolean obt_xml_load_mem(ObtXmlInst *i, + gpointer data, guint len, const gchar *root_node) { gboolean r = FALSE; @@ -277,14 +277,14 @@ gboolean obt_parse_load_mem(ObtParseInst *i, return r; } -gboolean obt_parse_save_file(ObtParseInst *inst, - const gchar *path, - gboolean pretty) +gboolean obt_xml_save_file(ObtXmlInst *inst, + const gchar *path, + gboolean pretty) { return xmlSaveFormatFile(path, inst->doc, pretty) != -1; } -void obt_parse_close(ObtParseInst *i) +void obt_xml_close(ObtXmlInst *i) { if (i && i->doc) { xmlFreeDoc(i->doc); @@ -295,7 +295,7 @@ void obt_parse_close(ObtParseInst *i) } } -void obt_parse_tree(ObtParseInst *i, xmlNodePtr node) +void obt_xml_tree(ObtXmlInst *i, xmlNodePtr node) { g_assert(i->doc); /* a doc is open? */ @@ -306,12 +306,12 @@ void obt_parse_tree(ObtParseInst *i, xmlNodePtr node) } } -void obt_parse_tree_from_root(ObtParseInst *i) +void obt_xml_tree_from_root(ObtXmlInst *i) { - obt_parse_tree(i, i->root->children); + obt_xml_tree(i, i->root->children); } -gchar *obt_parse_node_string(xmlNodePtr node) +gchar *obt_xml_node_string(xmlNodePtr node) { xmlChar *c = xmlNodeGetContent(node); gchar *s; @@ -321,7 +321,7 @@ gchar *obt_parse_node_string(xmlNodePtr node) return s; } -gint obt_parse_node_int(xmlNodePtr node) +gint obt_xml_node_int(xmlNodePtr node) { xmlChar *c = xmlNodeGetContent(node); gint i; @@ -331,7 +331,7 @@ gint obt_parse_node_int(xmlNodePtr node) return i; } -gboolean obt_parse_node_bool(xmlNodePtr node) +gboolean obt_xml_node_bool(xmlNodePtr node) { xmlChar *c = xmlNodeGetContent(node); gboolean b = FALSE; @@ -346,7 +346,7 @@ gboolean obt_parse_node_bool(xmlNodePtr node) return b; } -gboolean obt_parse_node_contains(xmlNodePtr node, const gchar *val) +gboolean obt_xml_node_contains(xmlNodePtr node, const gchar *val) { xmlChar *c = xmlNodeGetContent(node); gboolean r; @@ -356,7 +356,7 @@ gboolean obt_parse_node_contains(xmlNodePtr node, const gchar *val) return r; } -xmlNodePtr obt_parse_find_node(xmlNodePtr node, const gchar *tag) +xmlNodePtr obt_xml_find_node(xmlNodePtr node, const gchar *tag) { while (node) { if (!xmlStrcmp(node->name, (const xmlChar*) tag)) @@ -366,8 +366,8 @@ xmlNodePtr obt_parse_find_node(xmlNodePtr node, const gchar *tag) return NULL; } -gboolean obt_parse_attr_bool(xmlNodePtr node, const gchar *name, - gboolean *value) +gboolean obt_xml_attr_bool(xmlNodePtr node, const gchar *name, + gboolean *value) { xmlChar *c = xmlGetProp(node, (const xmlChar*) name); gboolean r = FALSE; @@ -390,7 +390,7 @@ gboolean obt_parse_attr_bool(xmlNodePtr node, const gchar *name, return r; } -gboolean obt_parse_attr_int(xmlNodePtr node, const gchar *name, gint *value) +gboolean obt_xml_attr_int(xmlNodePtr node, const gchar *name, gint *value) { xmlChar *c = xmlGetProp(node, (const xmlChar*) name); gboolean r = FALSE; @@ -403,8 +403,8 @@ gboolean obt_parse_attr_int(xmlNodePtr node, const gchar *name, gint *value) return r; } -gboolean obt_parse_attr_string(xmlNodePtr node, const gchar *name, - gchar **value) +gboolean obt_xml_attr_string(xmlNodePtr node, const gchar *name, + gchar **value) { xmlChar *c = xmlGetProp(node, (const xmlChar*) name); gboolean r = FALSE; @@ -417,8 +417,8 @@ gboolean obt_parse_attr_string(xmlNodePtr node, const gchar *name, return r; } -gboolean obt_parse_attr_contains(xmlNodePtr node, const gchar *name, - const gchar *val) +gboolean obt_xml_attr_contains(xmlNodePtr node, const gchar *name, + const gchar *val) { xmlChar *c = xmlGetProp(node, (const xmlChar*) name); gboolean r = FALSE; diff --git a/obt/xml.h b/obt/xml.h new file mode 100644 index 00000000..006ab503 --- /dev/null +++ b/obt/xml.h @@ -0,0 +1,89 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + obt/parse.h for the Openbox window manager + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#ifndef __obt_xml_h +#define __obt_xml_h + +#include +#include + +G_BEGIN_DECLS + +typedef struct _ObtXmlInst ObtXmlInst; + +typedef void (*ObtXmlCallback)(xmlNodePtr node, gpointer data); + +ObtXmlInst* obt_xml_instance_new(void); +void obt_xml_instance_ref(ObtXmlInst *inst); +void obt_xml_instance_unref(ObtXmlInst *inst); + +gboolean obt_xml_load_file(ObtXmlInst *inst, + const gchar *path, + const gchar *root_node); +gboolean obt_xml_load_config_file(ObtXmlInst *inst, + const gchar *domain, + const gchar *filename, + const gchar *root_node); +gboolean obt_xml_load_data_file(ObtXmlInst *inst, + const gchar *domain, + const gchar *filename, + const gchar *root_node); +gboolean obt_xml_load_theme_file(ObtXmlInst *inst, + const gchar *theme, + const gchar *domain, + const gchar *filename, + const gchar *root_node); +gboolean obt_xml_load_mem(ObtXmlInst *inst, + gpointer data, guint len, const gchar *root_node); + +gboolean obt_xml_save_file(ObtXmlInst *inst, + const gchar *path, + gboolean pretty); + +xmlDocPtr obt_xml_doc(ObtXmlInst *inst); +xmlNodePtr obt_xml_root(ObtXmlInst *inst); + +void obt_xml_close(ObtXmlInst *inst); + +void obt_xml_register(ObtXmlInst *inst, const gchar *tag, + ObtXmlCallback func, gpointer data); +void obt_xml_tree(ObtXmlInst *i, xmlNodePtr node); +void obt_xml_tree_from_root(ObtXmlInst *i); + + +/* helpers */ + +xmlNodePtr obt_xml_find_node (xmlNodePtr node, const gchar *name); + +gboolean obt_xml_node_contains (xmlNodePtr node, const gchar *val); +gchar *obt_xml_node_string (xmlNodePtr node); +gint obt_xml_node_int (xmlNodePtr node); +gboolean obt_xml_node_bool (xmlNodePtr node); + +gboolean obt_xml_attr_contains (xmlNodePtr node, const gchar *name, + const gchar *val); +gboolean obt_xml_attr_string (xmlNodePtr node, const gchar *name, + gchar **value); +gboolean obt_xml_attr_int (xmlNodePtr node, const gchar *name, + gint *value); +gboolean obt_xml_attr_bool (xmlNodePtr node, const gchar *name, + gboolean *value); + +G_END_DECLS + +#endif diff --git a/openbox/actions.c b/openbox/actions.c index 5d47b33f..023fab3a 100644 --- a/openbox/actions.c +++ b/openbox/actions.c @@ -208,7 +208,7 @@ ObActionsAct* actions_parse(xmlNodePtr node) gchar *name; ObActionsAct *act = NULL; - if (obt_parse_attr_string(node, "name", &name)) { + if (obt_xml_attr_string(node, "name", &name)) { if ((act = actions_build_act_from_string(name))) { /* there is more stuff to parse here */ if (act->def->canbeinteractive) { diff --git a/openbox/actions.h b/openbox/actions.h index 94fc15cb..afcc96b7 100644 --- a/openbox/actions.h +++ b/openbox/actions.h @@ -18,7 +18,7 @@ #include "misc.h" #include "frame.h" -#include "obt/parse.h" +#include "obt/xml.h" #include #include diff --git a/openbox/actions/addremovedesktop.c b/openbox/actions/addremovedesktop.c index 111742c1..e21e9e66 100644 --- a/openbox/actions/addremovedesktop.c +++ b/openbox/actions/addremovedesktop.c @@ -39,8 +39,8 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); - if ((n = obt_parse_find_node(node, "where"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "where"))) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "last")) o->current = FALSE; else if (!g_ascii_strcasecmp(s, "current")) diff --git a/openbox/actions/cyclewindows.c b/openbox/actions/cyclewindows.c index 28618ef3..d1112242 100644 --- a/openbox/actions/cyclewindows.c +++ b/openbox/actions/cyclewindows.c @@ -67,33 +67,33 @@ static gpointer setup_func(xmlNodePtr node, o->bar = TRUE; o->dialog_mode = OB_FOCUS_CYCLE_POPUP_MODE_LIST; - if ((n = obt_parse_find_node(node, "linear"))) - o->linear = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "dialog"))) { - if (obt_parse_node_contains(n, "none")) + if ((n = obt_xml_find_node(node, "linear"))) + o->linear = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "dialog"))) { + if (obt_xml_node_contains(n, "none")) o->dialog_mode = OB_FOCUS_CYCLE_POPUP_MODE_NONE; - else if (obt_parse_node_contains(n, "icons")) + else if (obt_xml_node_contains(n, "icons")) o->dialog_mode = OB_FOCUS_CYCLE_POPUP_MODE_ICONS; } - if ((n = obt_parse_find_node(node, "bar"))) - o->bar = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "raise"))) - o->raise = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "panels"))) - o->dock_windows = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "desktop"))) - o->desktop_windows = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "allDesktops"))) - o->all_desktops = obt_parse_node_bool(n); - - if ((n = obt_parse_find_node(node, "finalactions"))) { + if ((n = obt_xml_find_node(node, "bar"))) + o->bar = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "raise"))) + o->raise = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "panels"))) + o->dock_windows = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "desktop"))) + o->desktop_windows = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "allDesktops"))) + o->all_desktops = obt_xml_node_bool(n); + + if ((n = obt_xml_find_node(node, "finalactions"))) { xmlNodePtr m; - m = obt_parse_find_node(n->children, "action"); + m = obt_xml_find_node(n->children, "action"); while (m) { ObActionsAct *action = actions_parse(m); if (action) o->actions = g_slist_append(o->actions, action); - m = obt_parse_find_node(m->next, "action"); + m = obt_xml_find_node(m->next, "action"); } } else { diff --git a/openbox/actions/debug.c b/openbox/actions/debug.c index 3ae09016..9ba7b1b0 100644 --- a/openbox/actions/debug.c +++ b/openbox/actions/debug.c @@ -21,8 +21,8 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); - if ((n = obt_parse_find_node(node, "string"))) - o->str = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "string"))) + o->str = obt_xml_node_string(n); return o; } diff --git a/openbox/actions/desktop.c b/openbox/actions/desktop.c index 14f6ef20..5b0282cc 100644 --- a/openbox/actions/desktop.c +++ b/openbox/actions/desktop.c @@ -160,8 +160,8 @@ static gpointer setup_func(xmlNodePtr node, /* wrap by default - it's handy! */ o->u.rel.wrap = TRUE; - if ((n = obt_parse_find_node(node, "to"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "to"))) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "last")) o->type = LAST; else if (!g_ascii_strcasecmp(s, "next")) { @@ -201,8 +201,8 @@ static gpointer setup_func(xmlNodePtr node, g_free(s); } - if ((n = obt_parse_find_node(node, "wrap"))) - o->u.rel.wrap = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(node, "wrap"))) + o->u.rel.wrap = obt_xml_node_bool(n); return o; } @@ -240,8 +240,8 @@ static gpointer setup_send_func(xmlNodePtr node, o->send = TRUE; o->follow = TRUE; - if ((n = obt_parse_find_node(node, "follow"))) - o->follow = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(node, "follow"))) + o->follow = obt_xml_node_bool(n); if (o->type == RELATIVE && o->follow) { o->interactive = TRUE; @@ -348,8 +348,8 @@ static gpointer setup_follow(xmlNodePtr node) Options *o = g_new0(Options, 1); o->send = TRUE; o->follow = TRUE; - if ((n = obt_parse_find_node(node, "follow"))) - o->follow = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(node, "follow"))) + o->follow = obt_xml_node_bool(n); return o; } @@ -372,8 +372,8 @@ static gpointer setup_go_abs_func(xmlNodePtr node) xmlNodePtr n; Options *o = g_new0(Options, 1); o->type = ABSOLUTE; - if ((n = obt_parse_find_node(node, "desktop"))) - o->u.abs.desktop = obt_parse_node_int(n) - 1; + if ((n = obt_xml_find_node(node, "desktop"))) + o->u.abs.desktop = obt_xml_node_int(n) - 1; else o->u.abs.desktop = screen_desktop; return o; @@ -384,8 +384,8 @@ static gpointer setup_send_abs_func(xmlNodePtr node) xmlNodePtr n; Options *o = setup_follow(node); o->type = ABSOLUTE; - if ((n = obt_parse_find_node(node, "desktop"))) - o->u.abs.desktop = obt_parse_node_int(n) - 1; + if ((n = obt_xml_find_node(node, "desktop"))) + o->u.abs.desktop = obt_xml_node_int(n) - 1; else o->u.abs.desktop = screen_desktop; return o; @@ -404,8 +404,8 @@ static void setup_rel(Options *o, xmlNodePtr node, gboolean lin, o->u.rel.dir = dir; o->u.rel.wrap = TRUE; - if ((n = obt_parse_find_node(node, "wrap"))) - o->u.rel.wrap = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(node, "wrap"))) + o->u.rel.wrap = obt_xml_node_bool(n); if (input) { o->interactive = TRUE; diff --git a/openbox/actions/directionalwindows.c b/openbox/actions/directionalwindows.c index 0d1476c7..2cca450c 100644 --- a/openbox/actions/directionalwindows.c +++ b/openbox/actions/directionalwindows.c @@ -137,18 +137,18 @@ static gpointer setup_func(xmlNodePtr node) o->dialog = TRUE; o->bar = TRUE; - if ((n = obt_parse_find_node(node, "dialog"))) - o->dialog = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "bar"))) - o->bar = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "raise"))) - o->raise = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "panels"))) - o->dock_windows = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "desktop"))) - o->desktop_windows = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "direction"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "dialog"))) + o->dialog = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "bar"))) + o->bar = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "raise"))) + o->raise = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "panels"))) + o->dock_windows = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "desktop"))) + o->desktop_windows = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "direction"))) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "north") || !g_ascii_strcasecmp(s, "up")) o->direction = OB_DIRECTION_NORTH; @@ -172,14 +172,14 @@ static gpointer setup_func(xmlNodePtr node) g_free(s); } - if ((n = obt_parse_find_node(node, "finalactions"))) { + if ((n = obt_xml_find_node(node, "finalactions"))) { xmlNodePtr m; - m = obt_parse_find_node(n->children, "action"); + m = obt_xml_find_node(n->children, "action"); while (m) { ObActionsAct *action = actions_parse(m); if (action) o->actions = g_slist_append(o->actions, action); - m = obt_parse_find_node(m->next, "action"); + m = obt_xml_find_node(m->next, "action"); } } else { diff --git a/openbox/actions/execute.c b/openbox/actions/execute.c index bde7f5d2..77244d8f 100644 --- a/openbox/actions/execute.c +++ b/openbox/actions/execute.c @@ -43,27 +43,27 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); - if ((n = obt_parse_find_node(node, "command")) || - (n = obt_parse_find_node(node, "execute"))) + if ((n = obt_xml_find_node(node, "command")) || + (n = obt_xml_find_node(node, "execute"))) { - gchar *s = obt_parse_node_string(n); + gchar *s = obt_xml_node_string(n); o->cmd = obt_paths_expand_tilde(s); g_free(s); } - if ((n = obt_parse_find_node(node, "prompt"))) - o->prompt = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "prompt"))) + o->prompt = obt_xml_node_string(n); - if ((n = obt_parse_find_node(node, "startupnotify"))) { + if ((n = obt_xml_find_node(node, "startupnotify"))) { xmlNodePtr m; - if ((m = obt_parse_find_node(n->children, "enabled"))) - o->sn = obt_parse_node_bool(m); - if ((m = obt_parse_find_node(n->children, "name"))) - o->sn_name = obt_parse_node_string(m); - if ((m = obt_parse_find_node(n->children, "icon"))) - o->sn_icon = obt_parse_node_string(m); - if ((m = obt_parse_find_node(n->children, "wmclass"))) - o->sn_wmclass = obt_parse_node_string(m); + if ((m = obt_xml_find_node(n->children, "enabled"))) + o->sn = obt_xml_node_bool(m); + if ((m = obt_xml_find_node(n->children, "name"))) + o->sn_name = obt_xml_node_string(m); + if ((m = obt_xml_find_node(n->children, "icon"))) + o->sn_icon = obt_xml_node_string(m); + if ((m = obt_xml_find_node(n->children, "wmclass"))) + o->sn_wmclass = obt_xml_node_string(m); } return o; } diff --git a/openbox/actions/exit.c b/openbox/actions/exit.c index 55d89a0b..f2b0cafb 100644 --- a/openbox/actions/exit.c +++ b/openbox/actions/exit.c @@ -25,8 +25,8 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); o->prompt = TRUE; - if ((n = obt_parse_find_node(node, "prompt"))) - o->prompt = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(node, "prompt"))) + o->prompt = obt_xml_node_bool(n); return o; } diff --git a/openbox/actions/focus.c b/openbox/actions/focus.c index 0e546dea..40c2c80d 100644 --- a/openbox/actions/focus.c +++ b/openbox/actions/focus.c @@ -23,8 +23,8 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); - if ((n = obt_parse_find_node(node, "here"))) - o->here = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(node, "here"))) + o->here = obt_xml_node_bool(n); return o; } diff --git a/openbox/actions/growtoedge.c b/openbox/actions/growtoedge.c index 0c39a63e..9589d3f6 100644 --- a/openbox/actions/growtoedge.c +++ b/openbox/actions/growtoedge.c @@ -41,8 +41,8 @@ static gpointer setup_func(xmlNodePtr node) o->dir = OB_DIRECTION_NORTH; o->shrink = FALSE; - if ((n = obt_parse_find_node(node, "direction"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "direction"))) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "north") || !g_ascii_strcasecmp(s, "up")) o->dir = OB_DIRECTION_NORTH; diff --git a/openbox/actions/if.c b/openbox/actions/if.c index 47ff2fd5..dd86086b 100644 --- a/openbox/actions/if.c +++ b/openbox/actions/if.c @@ -39,61 +39,61 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); - if ((n = obt_parse_find_node(node, "shaded"))) { - if (obt_parse_node_bool(n)) + if ((n = obt_xml_find_node(node, "shaded"))) { + if (obt_xml_node_bool(n)) o->shaded_on = TRUE; else o->shaded_off = TRUE; } - if ((n = obt_parse_find_node(node, "maximized"))) { - if (obt_parse_node_bool(n)) + if ((n = obt_xml_find_node(node, "maximized"))) { + if (obt_xml_node_bool(n)) o->maxfull_on = TRUE; else o->maxfull_off = TRUE; } - if ((n = obt_parse_find_node(node, "maximizedhorizontal"))) { - if (obt_parse_node_bool(n)) + if ((n = obt_xml_find_node(node, "maximizedhorizontal"))) { + if (obt_xml_node_bool(n)) o->maxhorz_on = TRUE; else o->maxhorz_off = TRUE; } - if ((n = obt_parse_find_node(node, "maximizedvertical"))) { - if (obt_parse_node_bool(n)) + if ((n = obt_xml_find_node(node, "maximizedvertical"))) { + if (obt_xml_node_bool(n)) o->maxvert_on = TRUE; else o->maxvert_off = TRUE; } - if ((n = obt_parse_find_node(node, "iconified"))) { - if (obt_parse_node_bool(n)) + if ((n = obt_xml_find_node(node, "iconified"))) { + if (obt_xml_node_bool(n)) o->iconic_on = TRUE; else o->iconic_off = TRUE; } - if ((n = obt_parse_find_node(node, "focused"))) { - if (obt_parse_node_bool(n)) + if ((n = obt_xml_find_node(node, "focused"))) { + if (obt_xml_node_bool(n)) o->focused = TRUE; else o->unfocused = TRUE; } - if ((n = obt_parse_find_node(node, "then"))) { + if ((n = obt_xml_find_node(node, "then"))) { xmlNodePtr m; - m = obt_parse_find_node(n->children, "action"); + m = obt_xml_find_node(n->children, "action"); while (m) { ObActionsAct *action = actions_parse(m); if (action) o->thenacts = g_slist_append(o->thenacts, action); - m = obt_parse_find_node(m->next, "action"); + m = obt_xml_find_node(m->next, "action"); } } - if ((n = obt_parse_find_node(node, "else"))) { + if ((n = obt_xml_find_node(node, "else"))) { xmlNodePtr m; - m = obt_parse_find_node(n->children, "action"); + m = obt_xml_find_node(n->children, "action"); while (m) { ObActionsAct *action = actions_parse(m); if (action) o->elseacts = g_slist_append(o->elseacts, action); - m = obt_parse_find_node(m->next, "action"); + m = obt_xml_find_node(m->next, "action"); } } diff --git a/openbox/actions/layer.c b/openbox/actions/layer.c index 1dc7c4cf..2b4d325a 100644 --- a/openbox/actions/layer.c +++ b/openbox/actions/layer.c @@ -55,8 +55,8 @@ static gpointer setup_func_send(xmlNodePtr node) o = g_new0(Options, 1); - if ((n = obt_parse_find_node(node, "layer"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "layer"))) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "above") || !g_ascii_strcasecmp(s, "top")) o->layer = 1; diff --git a/openbox/actions/maximize.c b/openbox/actions/maximize.c index 90a84039..4c615078 100644 --- a/openbox/actions/maximize.c +++ b/openbox/actions/maximize.c @@ -55,8 +55,8 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); o->dir = BOTH; - if ((n = obt_parse_find_node(node, "direction"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "direction"))) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "vertical") || !g_ascii_strcasecmp(s, "vert")) o->dir = VERT; diff --git a/openbox/actions/moverelative.c b/openbox/actions/moverelative.c index 5bcdda44..ff9f719b 100644 --- a/openbox/actions/moverelative.c +++ b/openbox/actions/moverelative.c @@ -24,10 +24,10 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); - if ((n = obt_parse_find_node(node, "x"))) - o->x = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "y"))) - o->y = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node, "x"))) + o->x = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "y"))) + o->y = obt_xml_node_int(n); return o; } diff --git a/openbox/actions/moveresizeto.c b/openbox/actions/moveresizeto.c index 3c135c89..f0472797 100644 --- a/openbox/actions/moveresizeto.c +++ b/openbox/actions/moveresizeto.c @@ -38,7 +38,7 @@ void action_moveresizeto_startup(void) static void parse_coord(xmlNodePtr n, gint *pos, gboolean *opposite, gboolean *center) { - gchar *s = obt_parse_node_string(n); + gchar *s = obt_xml_node_string(n); if (g_ascii_strcasecmp(s, "current") != 0) { if (!g_ascii_strcasecmp(s, "center")) *center = TRUE; @@ -66,27 +66,27 @@ static gpointer setup_func(xmlNodePtr node) o->h = G_MININT; o->monitor = CURRENT_MONITOR; - if ((n = obt_parse_find_node(node, "x"))) + if ((n = obt_xml_find_node(node, "x"))) parse_coord(n, &o->x, &o->xopposite, &o->xcenter); - if ((n = obt_parse_find_node(node, "y"))) + if ((n = obt_xml_find_node(node, "y"))) parse_coord(n, &o->y, &o->yopposite, &o->ycenter); - if ((n = obt_parse_find_node(node, "width"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "width"))) { + gchar *s = obt_xml_node_string(n); if (g_ascii_strcasecmp(s, "current") != 0) - o->w = obt_parse_node_int(n); + o->w = obt_xml_node_int(n); g_free(s); } - if ((n = obt_parse_find_node(node, "height"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "height"))) { + gchar *s = obt_xml_node_string(n); if (g_ascii_strcasecmp(s, "current") != 0) - o->h = obt_parse_node_int(n); + o->h = obt_xml_node_int(n); g_free(s); } - if ((n = obt_parse_find_node(node, "monitor"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "monitor"))) { + gchar *s = obt_xml_node_string(n); if (g_ascii_strcasecmp(s, "current") != 0) { if (!g_ascii_strcasecmp(s, "all")) o->monitor = ALL_MONITORS; @@ -95,7 +95,7 @@ static gpointer setup_func(xmlNodePtr node) else if(!g_ascii_strcasecmp(s, "prev")) o->monitor = PREV_MONITOR; else - o->monitor = obt_parse_node_int(n) - 1; + o->monitor = obt_xml_node_int(n) - 1; } g_free(s); } diff --git a/openbox/actions/movetoedge.c b/openbox/actions/movetoedge.c index e7384dad..f81ded41 100644 --- a/openbox/actions/movetoedge.c +++ b/openbox/actions/movetoedge.c @@ -35,8 +35,8 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); o->dir = OB_DIRECTION_NORTH; - if ((n = obt_parse_find_node(node, "direction"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "direction"))) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "north") || !g_ascii_strcasecmp(s, "up")) o->dir = OB_DIRECTION_NORTH; diff --git a/openbox/actions/resize.c b/openbox/actions/resize.c index 3df44b6c..fbcdf24a 100644 --- a/openbox/actions/resize.c +++ b/openbox/actions/resize.c @@ -27,8 +27,8 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); - if ((n = obt_parse_find_node(node, "edge"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "edge"))) { + gchar *s = obt_xml_node_string(n); o->corner_specified = TRUE; if (!g_ascii_strcasecmp(s, "top")) diff --git a/openbox/actions/resizerelative.c b/openbox/actions/resizerelative.c index b4db73b7..c5fc1ea1 100644 --- a/openbox/actions/resizerelative.c +++ b/openbox/actions/resizerelative.c @@ -26,16 +26,16 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); - if ((n = obt_parse_find_node(node, "left"))) - o->left = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "right"))) - o->right = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "top")) || - (n = obt_parse_find_node(node, "up"))) - o->top = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "bottom")) || - (n = obt_parse_find_node(node, "down"))) - o->bottom = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node, "left"))) + o->left = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "right"))) + o->right = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "top")) || + (n = obt_xml_find_node(node, "up"))) + o->top = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "bottom")) || + (n = obt_xml_find_node(node, "down"))) + o->bottom = obt_xml_node_int(n); return o; } diff --git a/openbox/actions/restart.c b/openbox/actions/restart.c index 01de4f9a..7d1689cb 100644 --- a/openbox/actions/restart.c +++ b/openbox/actions/restart.c @@ -22,10 +22,10 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); - if ((n = obt_parse_find_node(node, "command")) || - (n = obt_parse_find_node(node, "execute"))) + if ((n = obt_xml_find_node(node, "command")) || + (n = obt_xml_find_node(node, "execute"))) { - gchar *s = obt_parse_node_string(n); + gchar *s = obt_xml_node_string(n); o->cmd = obt_paths_expand_tilde(s); g_free(s); } diff --git a/openbox/actions/showmenu.c b/openbox/actions/showmenu.c index 546be5a8..e60f1c69 100644 --- a/openbox/actions/showmenu.c +++ b/openbox/actions/showmenu.c @@ -22,8 +22,8 @@ static gpointer setup_func(xmlNodePtr node) o = g_new0(Options, 1); - if ((n = obt_parse_find_node(node, "menu"))) - o->name = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "menu"))) + o->name = obt_xml_node_string(n); return o; } diff --git a/openbox/config.c b/openbox/config.c index 6bdae9ff..92445517 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -154,7 +154,7 @@ void config_app_settings_copy_non_defaults(const ObAppSettings *src, static void config_parse_gravity_coord(xmlNodePtr node, GravityCoord *c) { - gchar *s = obt_parse_node_string(node); + gchar *s = obt_xml_node_string(node); if (!g_ascii_strcasecmp(s, "center")) c->center = TRUE; else { @@ -198,7 +198,7 @@ static void config_parse_gravity_coord(xmlNodePtr node, GravityCoord *c) */ static void parse_per_app_settings(xmlNodePtr node, gpointer d) { - xmlNodePtr app = obt_parse_find_node(node->children, "application"); + xmlNodePtr app = obt_xml_find_node(node->children, "application"); gchar *name = NULL, *class = NULL, *role = NULL, *type = NULL; gboolean name_set, class_set, type_set; gboolean x_pos_given; @@ -206,9 +206,9 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) while (app) { x_pos_given = FALSE; - class_set = obt_parse_attr_string(app, "class", &class); - name_set = obt_parse_attr_string(app, "name", &name); - type_set = obt_parse_attr_string(app, "type", &type); + class_set = obt_xml_attr_string(app, "class", &class); + name_set = obt_xml_attr_string(app, "name", &name); + type_set = obt_xml_attr_string(app, "type", &type); if (class_set || name_set) { xmlNodePtr n, c; ObAppSettings *settings = config_create_app_settings();; @@ -238,55 +238,55 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) settings->type = OB_CLIENT_TYPE_DESKTOP; } - if (obt_parse_attr_string(app, "role", &role)) + if (obt_xml_attr_string(app, "role", &role)) settings->role = g_pattern_spec_new(role); - if ((n = obt_parse_find_node(app->children, "decor"))) - if (!obt_parse_node_contains(n, "default")) - settings->decor = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(app->children, "decor"))) + if (!obt_xml_node_contains(n, "default")) + settings->decor = obt_xml_node_bool(n); - if ((n = obt_parse_find_node(app->children, "shade"))) - if (!obt_parse_node_contains(n, "default")) - settings->shade = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(app->children, "shade"))) + if (!obt_xml_node_contains(n, "default")) + settings->shade = obt_xml_node_bool(n); - if ((n = obt_parse_find_node(app->children, "position"))) { - if ((c = obt_parse_find_node(n->children, "x"))) - if (!obt_parse_node_contains(c, "default")) { + if ((n = obt_xml_find_node(app->children, "position"))) { + if ((c = obt_xml_find_node(n->children, "x"))) + if (!obt_xml_node_contains(c, "default")) { config_parse_gravity_coord(c, &settings->position.x); x_pos_given = TRUE; } - if (x_pos_given && (c = obt_parse_find_node(n->children, "y"))) - if (!obt_parse_node_contains(c, "default")) { + if (x_pos_given && (c = obt_xml_find_node(n->children, "y"))) + if (!obt_xml_node_contains(c, "default")) { config_parse_gravity_coord(c, &settings->position.y); settings->pos_given = TRUE; } if (settings->pos_given && - (c = obt_parse_find_node(n->children, "monitor"))) - if (!obt_parse_node_contains(c, "default")) { - gchar *s = obt_parse_node_string(c); + (c = obt_xml_find_node(n->children, "monitor"))) + if (!obt_xml_node_contains(c, "default")) { + gchar *s = obt_xml_node_string(c); if (!g_ascii_strcasecmp(s, "mouse")) settings->monitor = 0; else - settings->monitor = obt_parse_node_int(c); + settings->monitor = obt_xml_node_int(c); g_free(s); } - obt_parse_attr_bool(n, "force", &settings->pos_force); + obt_xml_attr_bool(n, "force", &settings->pos_force); } - if ((n = obt_parse_find_node(app->children, "focus"))) - if (!obt_parse_node_contains(n, "default")) - settings->focus = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(app->children, "focus"))) + if (!obt_xml_node_contains(n, "default")) + settings->focus = obt_xml_node_bool(n); - if ((n = obt_parse_find_node(app->children, "desktop"))) { - if (!obt_parse_node_contains(n, "default")) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(app->children, "desktop"))) { + if (!obt_xml_node_contains(n, "default")) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "all")) settings->desktop = DESKTOP_ALL; else { - gint i = obt_parse_node_int(n); + gint i = obt_xml_node_int(n); if (i > 0) settings->desktop = i; } @@ -294,9 +294,9 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) } } - if ((n = obt_parse_find_node(app->children, "layer"))) - if (!obt_parse_node_contains(n, "default")) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(app->children, "layer"))) + if (!obt_xml_node_contains(n, "default")) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "above")) settings->layer = 1; else if (!g_ascii_strcasecmp(s, "below")) @@ -306,25 +306,25 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) g_free(s); } - if ((n = obt_parse_find_node(app->children, "iconic"))) - if (!obt_parse_node_contains(n, "default")) - settings->iconic = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(app->children, "iconic"))) + if (!obt_xml_node_contains(n, "default")) + settings->iconic = obt_xml_node_bool(n); - if ((n = obt_parse_find_node(app->children, "skip_pager"))) - if (!obt_parse_node_contains(n, "default")) - settings->skip_pager = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(app->children, "skip_pager"))) + if (!obt_xml_node_contains(n, "default")) + settings->skip_pager = obt_xml_node_bool(n); - if ((n = obt_parse_find_node(app->children, "skip_taskbar"))) - if (!obt_parse_node_contains(n, "default")) - settings->skip_taskbar = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(app->children, "skip_taskbar"))) + if (!obt_xml_node_contains(n, "default")) + settings->skip_taskbar = obt_xml_node_bool(n); - if ((n = obt_parse_find_node(app->children, "fullscreen"))) - if (!obt_parse_node_contains(n, "default")) - settings->fullscreen = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(app->children, "fullscreen"))) + if (!obt_xml_node_contains(n, "default")) + settings->fullscreen = obt_xml_node_bool(n); - if ((n = obt_parse_find_node(app->children, "maximized"))) - if (!obt_parse_node_contains(n, "default")) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(app->children, "maximized"))) + if (!obt_xml_node_contains(n, "default")) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "horizontal")) { settings->max_horz = TRUE; settings->max_vert = FALSE; @@ -333,7 +333,7 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) settings->max_vert = TRUE; } else settings->max_horz = settings->max_vert = - obt_parse_node_bool(n); + obt_xml_node_bool(n); g_free(s); } @@ -345,7 +345,7 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) name = class = role = NULL; } - app = obt_parse_find_node(app->next, "application"); + app = obt_xml_find_node(app->next, "application"); } } @@ -365,27 +365,27 @@ static void parse_key(xmlNodePtr node, GList *keylist) xmlNodePtr n; gboolean is_chroot = FALSE; - if (!obt_parse_attr_string(node, "key", &key)) + if (!obt_xml_attr_string(node, "key", &key)) return; - obt_parse_attr_bool(node, "chroot", &is_chroot); + obt_xml_attr_bool(node, "chroot", &is_chroot); keylist = g_list_append(keylist, key); - if ((n = obt_parse_find_node(node->children, "keybind"))) { + if ((n = obt_xml_find_node(node->children, "keybind"))) { while (n) { parse_key(n, keylist); - n = obt_parse_find_node(n->next, "keybind"); + n = obt_xml_find_node(n->next, "keybind"); } } - else if ((n = obt_parse_find_node(node->children, "action"))) { + else if ((n = obt_xml_find_node(node->children, "action"))) { while (n) { ObActionsAct *action; action = actions_parse(n); if (action) keyboard_bind(keylist, action); - n = obt_parse_find_node(n->next, "action"); + n = obt_xml_find_node(n->next, "action"); } } @@ -403,17 +403,17 @@ static void parse_keyboard(xmlNodePtr node, gpointer d) keyboard_unbind_all(); - if ((n = obt_parse_find_node(node->children, "chainQuitKey"))) { - key = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node->children, "chainQuitKey"))) { + key = obt_xml_node_string(n); translate_key(key, &config_keyboard_reset_state, &config_keyboard_reset_keycode); g_free(key); } - if ((n = obt_parse_find_node(node->children, "keybind"))) + if ((n = obt_xml_find_node(node->children, "keybind"))) while (n) { parse_key(n, NULL); - n = obt_parse_find_node(n->next, "keybind"); + n = obt_xml_find_node(n->next, "keybind"); } } @@ -438,53 +438,53 @@ static void parse_mouse(xmlNodePtr node, gpointer d) node = node->children; - if ((n = obt_parse_find_node(node, "dragThreshold"))) - config_mouse_threshold = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "doubleClickTime"))) - config_mouse_dclicktime = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "screenEdgeWarpTime"))) { - config_mouse_screenedgetime = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node, "dragThreshold"))) + config_mouse_threshold = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "doubleClickTime"))) + config_mouse_dclicktime = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "screenEdgeWarpTime"))) { + config_mouse_screenedgetime = obt_xml_node_int(n); /* minimum value of 25 for this property, when it is 1 and you hit the edge it basically never stops */ if (config_mouse_screenedgetime && config_mouse_screenedgetime < 25) config_mouse_screenedgetime = 25; } - n = obt_parse_find_node(node, "context"); + n = obt_xml_find_node(node, "context"); while (n) { - if (!obt_parse_attr_string(n, "name", &contextstr)) + if (!obt_xml_attr_string(n, "name", &contextstr)) goto next_n; - nbut = obt_parse_find_node(n->children, "mousebind"); + nbut = obt_xml_find_node(n->children, "mousebind"); while (nbut) { - if (!obt_parse_attr_string(nbut, "button", &buttonstr)) + if (!obt_xml_attr_string(nbut, "button", &buttonstr)) goto next_nbut; - if (obt_parse_attr_contains(nbut, "action", "press")) { + if (obt_xml_attr_contains(nbut, "action", "press")) { mact = OB_MOUSE_ACTION_PRESS; - } else if (obt_parse_attr_contains(nbut, "action", "release")) { + } else if (obt_xml_attr_contains(nbut, "action", "release")) { mact = OB_MOUSE_ACTION_RELEASE; - } else if (obt_parse_attr_contains(nbut, "action", "click")) { + } else if (obt_xml_attr_contains(nbut, "action", "click")) { mact = OB_MOUSE_ACTION_CLICK; - } else if (obt_parse_attr_contains(nbut, "action","doubleclick")) { + } else if (obt_xml_attr_contains(nbut, "action","doubleclick")) { mact = OB_MOUSE_ACTION_DOUBLE_CLICK; - } else if (obt_parse_attr_contains(nbut, "action", "drag")) { + } else if (obt_xml_attr_contains(nbut, "action", "drag")) { mact = OB_MOUSE_ACTION_MOTION; } else goto next_nbut; - nact = obt_parse_find_node(nbut->children, "action"); + nact = obt_xml_find_node(nbut->children, "action"); while (nact) { ObActionsAct *action; if ((action = actions_parse(nact))) mouse_bind(buttonstr, contextstr, mact, action); - nact = obt_parse_find_node(nact->next, "action"); + nact = obt_xml_find_node(nact->next, "action"); } g_free(buttonstr); next_nbut: - nbut = obt_parse_find_node(nbut->next, "mousebind"); + nbut = obt_xml_find_node(nbut->next, "mousebind"); } g_free(contextstr); next_n: - n = obt_parse_find_node(n->next, "context"); + n = obt_xml_find_node(n->next, "context"); } } @@ -494,20 +494,20 @@ static void parse_focus(xmlNodePtr node, gpointer d) node = node->children; - if ((n = obt_parse_find_node(node, "focusNew"))) - config_focus_new = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "followMouse"))) - config_focus_follow = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "focusDelay"))) - config_focus_delay = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "raiseOnFocus"))) - config_focus_raise = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "focusLast"))) - config_focus_last = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "underMouse"))) - config_focus_under_mouse = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "unfocusOnLeave"))) - config_unfocus_leave = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(node, "focusNew"))) + config_focus_new = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "followMouse"))) + config_focus_follow = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "focusDelay"))) + config_focus_delay = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "raiseOnFocus"))) + config_focus_raise = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "focusLast"))) + config_focus_last = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "underMouse"))) + config_focus_under_mouse = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "unfocusOnLeave"))) + config_unfocus_leave = obt_xml_node_bool(n); } static void parse_placement(xmlNodePtr node, gpointer d) @@ -516,21 +516,21 @@ static void parse_placement(xmlNodePtr node, gpointer d) node = node->children; - if ((n = obt_parse_find_node(node, "policy"))) - if (obt_parse_node_contains(n, "UnderMouse")) + if ((n = obt_xml_find_node(node, "policy"))) + if (obt_xml_node_contains(n, "UnderMouse")) config_place_policy = OB_PLACE_POLICY_MOUSE; - if ((n = obt_parse_find_node(node, "center"))) - config_place_center = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "monitor"))) { - if (obt_parse_node_contains(n, "active")) + if ((n = obt_xml_find_node(node, "center"))) + config_place_center = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "monitor"))) { + if (obt_xml_node_contains(n, "active")) config_place_monitor = OB_PLACE_MONITOR_ACTIVE; - else if (obt_parse_node_contains(n, "mouse")) + else if (obt_xml_node_contains(n, "mouse")) config_place_monitor = OB_PLACE_MONITOR_MOUSE; } - if ((n = obt_parse_find_node(node, "primaryMonitor"))) { - config_primary_monitor_index = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node, "primaryMonitor"))) { + config_primary_monitor_index = obt_xml_node_int(n); if (!config_primary_monitor_index) { - if (obt_parse_node_contains(n, "mouse")) + if (obt_xml_node_contains(n, "mouse")) config_primary_monitor = OB_PLACE_MONITOR_MOUSE; } } @@ -542,14 +542,14 @@ static void parse_margins(xmlNodePtr node, gpointer d) node = node->children; - if ((n = obt_parse_find_node(node, "top"))) - config_margins.top = MAX(0, obt_parse_node_int(n)); - if ((n = obt_parse_find_node(node, "left"))) - config_margins.left = MAX(0, obt_parse_node_int(n)); - if ((n = obt_parse_find_node(node, "right"))) - config_margins.right = MAX(0, obt_parse_node_int(n)); - if ((n = obt_parse_find_node(node, "bottom"))) - config_margins.bottom = MAX(0, obt_parse_node_int(n)); + if ((n = obt_xml_find_node(node, "top"))) + config_margins.top = MAX(0, obt_xml_node_int(n)); + if ((n = obt_xml_find_node(node, "left"))) + config_margins.left = MAX(0, obt_xml_node_int(n)); + if ((n = obt_xml_find_node(node, "right"))) + config_margins.right = MAX(0, obt_xml_node_int(n)); + if ((n = obt_xml_find_node(node, "bottom"))) + config_margins.bottom = MAX(0, obt_xml_node_int(n)); } static void parse_theme(xmlNodePtr node, gpointer d) @@ -558,38 +558,38 @@ static void parse_theme(xmlNodePtr node, gpointer d) node = node->children; - if ((n = obt_parse_find_node(node, "name"))) { + if ((n = obt_xml_find_node(node, "name"))) { gchar *c; g_free(config_theme); - c = obt_parse_node_string(n); + c = obt_xml_node_string(n); config_theme = obt_paths_expand_tilde(c); g_free(c); } - if ((n = obt_parse_find_node(node, "titleLayout"))) { + if ((n = obt_xml_find_node(node, "titleLayout"))) { gchar *c, *d; g_free(config_title_layout); - config_title_layout = obt_parse_node_string(n); + config_title_layout = obt_xml_node_string(n); /* replace duplicates with spaces */ for (c = config_title_layout; *c != '\0'; ++c) for (d = c+1; *d != '\0'; ++d) if (*c == *d) *d = ' '; } - if ((n = obt_parse_find_node(node, "keepBorder"))) - config_theme_keepborder = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "animateIconify"))) - config_animate_iconify = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "windowListIconSize"))) { - config_theme_window_list_icon_size = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node, "keepBorder"))) + config_theme_keepborder = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "animateIconify"))) + config_animate_iconify = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "windowListIconSize"))) { + config_theme_window_list_icon_size = obt_xml_node_int(n); if (config_theme_window_list_icon_size < 16) config_theme_window_list_icon_size = 16; else if (config_theme_window_list_icon_size > 96) config_theme_window_list_icon_size = 96; } - n = obt_parse_find_node(node, "font"); + n = obt_xml_find_node(node, "font"); while (n) { xmlNodePtr fnode; RrFont **font; @@ -598,39 +598,39 @@ static void parse_theme(xmlNodePtr node, gpointer d) RrFontWeight weight = RrDefaultFontWeight; RrFontSlant slant = RrDefaultFontSlant; - if (obt_parse_attr_contains(n, "place", "ActiveWindow")) + if (obt_xml_attr_contains(n, "place", "ActiveWindow")) font = &config_font_activewindow; - else if (obt_parse_attr_contains(n, "place", "InactiveWindow")) + else if (obt_xml_attr_contains(n, "place", "InactiveWindow")) font = &config_font_inactivewindow; - else if (obt_parse_attr_contains(n, "place", "MenuHeader")) + else if (obt_xml_attr_contains(n, "place", "MenuHeader")) font = &config_font_menutitle; - else if (obt_parse_attr_contains(n, "place", "MenuItem")) + else if (obt_xml_attr_contains(n, "place", "MenuItem")) font = &config_font_menuitem; - else if (obt_parse_attr_contains(n, "place", "ActiveOnScreenDisplay")) + else if (obt_xml_attr_contains(n, "place", "ActiveOnScreenDisplay")) font = &config_font_activeosd; - else if (obt_parse_attr_contains(n, "place", "OnScreenDisplay")) + else if (obt_xml_attr_contains(n, "place", "OnScreenDisplay")) font = &config_font_activeosd; - else if (obt_parse_attr_contains(n, "place","InactiveOnScreenDisplay")) + else if (obt_xml_attr_contains(n, "place","InactiveOnScreenDisplay")) font = &config_font_inactiveosd; else goto next_font; - if ((fnode = obt_parse_find_node(n->children, "name"))) { + if ((fnode = obt_xml_find_node(n->children, "name"))) { g_free(name); - name = obt_parse_node_string(fnode); + name = obt_xml_node_string(fnode); } - if ((fnode = obt_parse_find_node(n->children, "size"))) { - int s = obt_parse_node_int(fnode); + if ((fnode = obt_xml_find_node(n->children, "size"))) { + int s = obt_xml_node_int(fnode); if (s > 0) size = s; } - if ((fnode = obt_parse_find_node(n->children, "weight"))) { - gchar *w = obt_parse_node_string(fnode); + if ((fnode = obt_xml_find_node(n->children, "weight"))) { + gchar *w = obt_xml_node_string(fnode); if (!g_ascii_strcasecmp(w, "Bold")) weight = RR_FONTWEIGHT_BOLD; g_free(w); } - if ((fnode = obt_parse_find_node(n->children, "slant"))) { - gchar *s = obt_parse_node_string(fnode); + if ((fnode = obt_xml_find_node(n->children, "slant"))) { + gchar *s = obt_xml_node_string(fnode); if (!g_ascii_strcasecmp(s, "Italic")) slant = RR_FONTSLANT_ITALIC; if (!g_ascii_strcasecmp(s, "Oblique")) @@ -641,7 +641,7 @@ static void parse_theme(xmlNodePtr node, gpointer d) *font = RrFontOpen(ob_rr_inst, name, size, weight, slant); g_free(name); next_font: - n = obt_parse_find_node(n->next, "font"); + n = obt_xml_find_node(n->next, "font"); } } @@ -651,17 +651,17 @@ static void parse_desktops(xmlNodePtr node, gpointer d) node = node->children; - if ((n = obt_parse_find_node(node, "number"))) { - gint d = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node, "number"))) { + gint d = obt_xml_node_int(n); if (d > 0) config_desktops_num = (unsigned) d; } - if ((n = obt_parse_find_node(node, "firstdesk"))) { - gint d = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node, "firstdesk"))) { + gint d = obt_xml_node_int(n); if (d > 0) config_screen_firstdesk = (unsigned) d; } - if ((n = obt_parse_find_node(node, "names"))) { + if ((n = obt_xml_find_node(node, "names"))) { GSList *it; xmlNodePtr nname; @@ -670,16 +670,16 @@ static void parse_desktops(xmlNodePtr node, gpointer d) g_slist_free(config_desktops_names); config_desktops_names = NULL; - nname = obt_parse_find_node(n->children, "name"); + nname = obt_xml_find_node(n->children, "name"); while (nname) { config_desktops_names = g_slist_append(config_desktops_names, - obt_parse_node_string(nname)); - nname = obt_parse_find_node(nname->next, "name"); + obt_xml_node_string(nname)); + nname = obt_xml_find_node(nname->next, "name"); } } - if ((n = obt_parse_find_node(node, "popupTime"))) - config_desktop_popup_time = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node, "popupTime"))) + config_desktop_popup_time = obt_xml_node_int(n); } static void parse_resize(xmlNodePtr node, gpointer d) @@ -688,32 +688,32 @@ static void parse_resize(xmlNodePtr node, gpointer d) node = node->children; - if ((n = obt_parse_find_node(node, "drawContents"))) - config_resize_redraw = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "popupShow"))) { - config_resize_popup_show = obt_parse_node_int(n); - if (obt_parse_node_contains(n, "Always")) + if ((n = obt_xml_find_node(node, "drawContents"))) + config_resize_redraw = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "popupShow"))) { + config_resize_popup_show = obt_xml_node_int(n); + if (obt_xml_node_contains(n, "Always")) config_resize_popup_show = 2; - else if (obt_parse_node_contains(n, "Never")) + else if (obt_xml_node_contains(n, "Never")) config_resize_popup_show = 0; - else if (obt_parse_node_contains(n, "Nonpixel")) + else if (obt_xml_node_contains(n, "Nonpixel")) config_resize_popup_show = 1; } - if ((n = obt_parse_find_node(node, "popupPosition"))) { - if (obt_parse_node_contains(n, "Top")) + if ((n = obt_xml_find_node(node, "popupPosition"))) { + if (obt_xml_node_contains(n, "Top")) config_resize_popup_pos = OB_RESIZE_POS_TOP; - else if (obt_parse_node_contains(n, "Center")) + else if (obt_xml_node_contains(n, "Center")) config_resize_popup_pos = OB_RESIZE_POS_CENTER; - else if (obt_parse_node_contains(n, "Fixed")) { + else if (obt_xml_node_contains(n, "Fixed")) { config_resize_popup_pos = OB_RESIZE_POS_FIXED; - if ((n = obt_parse_find_node(node, "popupFixedPosition"))) { + if ((n = obt_xml_find_node(node, "popupFixedPosition"))) { xmlNodePtr n2; - if ((n2 = obt_parse_find_node(n->children, "x"))) + if ((n2 = obt_xml_find_node(n->children, "x"))) config_parse_gravity_coord(n2, &config_resize_popup_fixed.x); - if ((n2 = obt_parse_find_node(n->children, "y"))) + if ((n2 = obt_xml_find_node(n->children, "y"))) config_parse_gravity_coord(n2, &config_resize_popup_fixed.y); @@ -732,65 +732,65 @@ static void parse_dock(xmlNodePtr node, gpointer d) node = node->children; - if ((n = obt_parse_find_node(node, "position"))) { - if (obt_parse_node_contains(n, "TopLeft")) + if ((n = obt_xml_find_node(node, "position"))) { + if (obt_xml_node_contains(n, "TopLeft")) config_dock_floating = FALSE, config_dock_pos = OB_DIRECTION_NORTHWEST; - else if (obt_parse_node_contains(n, "Top")) + else if (obt_xml_node_contains(n, "Top")) config_dock_floating = FALSE, config_dock_pos = OB_DIRECTION_NORTH; - else if (obt_parse_node_contains(n, "TopRight")) + else if (obt_xml_node_contains(n, "TopRight")) config_dock_floating = FALSE, config_dock_pos = OB_DIRECTION_NORTHEAST; - else if (obt_parse_node_contains(n, "Right")) + else if (obt_xml_node_contains(n, "Right")) config_dock_floating = FALSE, config_dock_pos = OB_DIRECTION_EAST; - else if (obt_parse_node_contains(n, "BottomRight")) + else if (obt_xml_node_contains(n, "BottomRight")) config_dock_floating = FALSE, config_dock_pos = OB_DIRECTION_SOUTHEAST; - else if (obt_parse_node_contains(n, "Bottom")) + else if (obt_xml_node_contains(n, "Bottom")) config_dock_floating = FALSE, config_dock_pos = OB_DIRECTION_SOUTH; - else if (obt_parse_node_contains(n, "BottomLeft")) + else if (obt_xml_node_contains(n, "BottomLeft")) config_dock_floating = FALSE, config_dock_pos = OB_DIRECTION_SOUTHWEST; - else if (obt_parse_node_contains(n, "Left")) + else if (obt_xml_node_contains(n, "Left")) config_dock_floating = FALSE, config_dock_pos = OB_DIRECTION_WEST; - else if (obt_parse_node_contains(n, "Floating")) + else if (obt_xml_node_contains(n, "Floating")) config_dock_floating = TRUE; } if (config_dock_floating) { - if ((n = obt_parse_find_node(node, "floatingX"))) - config_dock_x = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "floatingY"))) - config_dock_y = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node, "floatingX"))) + config_dock_x = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "floatingY"))) + config_dock_y = obt_xml_node_int(n); } else { - if ((n = obt_parse_find_node(node, "noStrut"))) - config_dock_nostrut = obt_parse_node_bool(n); + if ((n = obt_xml_find_node(node, "noStrut"))) + config_dock_nostrut = obt_xml_node_bool(n); } - if ((n = obt_parse_find_node(node, "stacking"))) { - if (obt_parse_node_contains(n, "normal")) + if ((n = obt_xml_find_node(node, "stacking"))) { + if (obt_xml_node_contains(n, "normal")) config_dock_layer = OB_STACKING_LAYER_NORMAL; - else if (obt_parse_node_contains(n, "below")) + else if (obt_xml_node_contains(n, "below")) config_dock_layer = OB_STACKING_LAYER_BELOW; - else if (obt_parse_node_contains(n, "above")) + else if (obt_xml_node_contains(n, "above")) config_dock_layer = OB_STACKING_LAYER_ABOVE; } - if ((n = obt_parse_find_node(node, "direction"))) { - if (obt_parse_node_contains(n, "horizontal")) + if ((n = obt_xml_find_node(node, "direction"))) { + if (obt_xml_node_contains(n, "horizontal")) config_dock_orient = OB_ORIENTATION_HORZ; - else if (obt_parse_node_contains(n, "vertical")) + else if (obt_xml_node_contains(n, "vertical")) config_dock_orient = OB_ORIENTATION_VERT; } - if ((n = obt_parse_find_node(node, "autoHide"))) - config_dock_hide = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "hideDelay"))) - config_dock_hide_delay = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "showDelay"))) - config_dock_show_delay = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "moveButton"))) { - gchar *str = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "autoHide"))) + config_dock_hide = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "hideDelay"))) + config_dock_hide_delay = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "showDelay"))) + config_dock_show_delay = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "moveButton"))) { + gchar *str = obt_xml_node_string(n); guint b, s; if (translate_button(str, &s, &b)) { config_dock_app_move_button = b; @@ -807,19 +807,19 @@ static void parse_menu(xmlNodePtr node, gpointer d) xmlNodePtr n; node = node->children; - if ((n = obt_parse_find_node(node, "hideDelay"))) - config_menu_hide_delay = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "middle"))) - config_menu_middle = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "submenuShowDelay"))) - config_submenu_show_delay = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "applicationIcons"))) - config_menu_client_list_icons = obt_parse_node_bool(n); - if ((n = obt_parse_find_node(node, "manageDesktops"))) - config_menu_manage_desktops = obt_parse_node_bool(n); - - while ((node = obt_parse_find_node(node, "file"))) { - gchar *c = obt_parse_node_string(node); + if ((n = obt_xml_find_node(node, "hideDelay"))) + config_menu_hide_delay = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "middle"))) + config_menu_middle = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "submenuShowDelay"))) + config_submenu_show_delay = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "applicationIcons"))) + config_menu_client_list_icons = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "manageDesktops"))) + config_menu_manage_desktops = obt_xml_node_bool(n); + + while ((node = obt_xml_find_node(node, "file"))) { + gchar *c = obt_xml_node_string(node); config_menu_files = g_slist_append(config_menu_files, obt_paths_expand_tilde(c)); g_free(c); @@ -832,10 +832,10 @@ static void parse_resistance(xmlNodePtr node, gpointer d) xmlNodePtr n; node = node->children; - if ((n = obt_parse_find_node(node, "strength"))) - config_resist_win = obt_parse_node_int(n); - if ((n = obt_parse_find_node(node, "screen_edge_strength"))) - config_resist_edge = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node, "strength"))) + config_resist_win = obt_xml_node_int(n); + if ((n = obt_xml_find_node(node, "screen_edge_strength"))) + config_resist_edge = obt_xml_node_int(n); } typedef struct @@ -926,7 +926,7 @@ static void bind_default_mouse(void) actions_parse_string(it->actname)); } -void config_startup(ObtParseInst *i) +void config_startup(ObtXmlInst *i) { config_focus_new = TRUE; config_focus_follow = FALSE; @@ -936,7 +936,7 @@ void config_startup(ObtParseInst *i) config_focus_under_mouse = FALSE; config_unfocus_leave = FALSE; - obt_parse_register(i, "focus", parse_focus, NULL); + obt_xml_register(i, "focus", parse_focus, NULL); config_place_policy = OB_PLACE_POLICY_SMART; config_place_center = TRUE; @@ -945,11 +945,11 @@ void config_startup(ObtParseInst *i) config_primary_monitor_index = 1; config_primary_monitor = OB_PLACE_MONITOR_ACTIVE; - obt_parse_register(i, "placement", parse_placement, NULL); + obt_xml_register(i, "placement", parse_placement, NULL); STRUT_PARTIAL_SET(config_margins, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - obt_parse_register(i, "margins", parse_margins, NULL); + obt_xml_register(i, "margins", parse_margins, NULL); config_theme = NULL; @@ -963,14 +963,14 @@ void config_startup(ObtParseInst *i) config_font_menuitem = NULL; config_font_menutitle = NULL; - obt_parse_register(i, "theme", parse_theme, NULL); + obt_xml_register(i, "theme", parse_theme, NULL); config_desktops_num = 4; config_screen_firstdesk = 1; config_desktops_names = NULL; config_desktop_popup_time = 875; - obt_parse_register(i, "desktops", parse_desktops, NULL); + obt_xml_register(i, "desktops", parse_desktops, NULL); config_resize_redraw = TRUE; config_resize_popup_show = 1; /* nonpixel increments */ @@ -978,7 +978,7 @@ void config_startup(ObtParseInst *i) GRAVITY_COORD_SET(config_resize_popup_fixed.x, 0, FALSE, FALSE); GRAVITY_COORD_SET(config_resize_popup_fixed.y, 0, FALSE, FALSE); - obt_parse_register(i, "resize", parse_resize, NULL); + obt_xml_register(i, "resize", parse_resize, NULL); config_dock_layer = OB_STACKING_LAYER_ABOVE; config_dock_pos = OB_DIRECTION_NORTHEAST; @@ -993,14 +993,14 @@ void config_startup(ObtParseInst *i) config_dock_app_move_button = 2; /* middle */ config_dock_app_move_modifiers = 0; - obt_parse_register(i, "dock", parse_dock, NULL); + obt_xml_register(i, "dock", parse_dock, NULL); translate_key("C-g", &config_keyboard_reset_state, &config_keyboard_reset_keycode); bind_default_keyboard(); - obt_parse_register(i, "keyboard", parse_keyboard, NULL); + obt_xml_register(i, "keyboard", parse_keyboard, NULL); config_mouse_threshold = 8; config_mouse_dclicktime = 200; @@ -1008,12 +1008,12 @@ void config_startup(ObtParseInst *i) bind_default_mouse(); - obt_parse_register(i, "mouse", parse_mouse, NULL); + obt_xml_register(i, "mouse", parse_mouse, NULL); config_resist_win = 10; config_resist_edge = 20; - obt_parse_register(i, "resistance", parse_resistance, NULL); + obt_xml_register(i, "resistance", parse_resistance, NULL); config_menu_hide_delay = 250; config_menu_middle = FALSE; @@ -1022,11 +1022,11 @@ void config_startup(ObtParseInst *i) config_menu_manage_desktops = TRUE; config_menu_files = NULL; - obt_parse_register(i, "menu", parse_menu, NULL); + obt_xml_register(i, "menu", parse_menu, NULL); config_per_app_settings = NULL; - obt_parse_register(i, "applications", parse_per_app_settings, NULL); + obt_xml_register(i, "applications", parse_per_app_settings, NULL); } void config_shutdown(void) diff --git a/openbox/config.h b/openbox/config.h index 5c18ad3a..d6295f52 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -27,7 +27,7 @@ #include "geom.h" #include "moveresize.h" #include "obrender/render.h" -#include "obt/parse.h" +#include "obt/xml.h" #include @@ -200,7 +200,7 @@ extern GSList *config_menu_files; /*! Per app settings */ extern GSList *config_per_app_settings; -void config_startup(ObtParseInst *i); +void config_startup(ObtXmlInst *i); void config_shutdown(void); /*! Create an ObAppSettings structure with the default values */ diff --git a/openbox/menu.c b/openbox/menu.c index 3e45fb93..a78cd612 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -34,7 +34,7 @@ #include "client_list_menu.h" #include "client_list_combined_menu.h" #include "gettext.h" -#include "obt/parse.h" +#include "obt/xml.h" #include "obt/paths.h" typedef struct _ObMenuParseState ObMenuParseState; @@ -46,7 +46,7 @@ struct _ObMenuParseState }; static GHashTable *menu_hash = NULL; -static ObtParseInst *menu_parse_inst; +static ObtXmlInst *menu_parse_inst; static ObMenuParseState menu_parse_state; static gboolean menu_can_hide = FALSE; @@ -77,37 +77,37 @@ void menu_startup(gboolean reconfig) client_list_combined_menu_startup(reconfig); client_menu_startup(); - menu_parse_inst = obt_parse_instance_new(); + menu_parse_inst = obt_xml_instance_new(); menu_parse_state.parent = NULL; menu_parse_state.pipe_creator = NULL; - obt_parse_register(menu_parse_inst, "menu", parse_menu, &menu_parse_state); - obt_parse_register(menu_parse_inst, "item", parse_menu_item, - &menu_parse_state); - obt_parse_register(menu_parse_inst, "separator", + obt_xml_register(menu_parse_inst, "menu", parse_menu, &menu_parse_state); + obt_xml_register(menu_parse_inst, "item", parse_menu_item, + &menu_parse_state); + obt_xml_register(menu_parse_inst, "separator", parse_menu_separator, &menu_parse_state); for (it = config_menu_files; it; it = g_slist_next(it)) { - if (obt_parse_load_config_file(menu_parse_inst, - "openbox", - it->data, - "openbox_menu")) + if (obt_xml_load_config_file(menu_parse_inst, + "openbox", + it->data, + "openbox_menu")) { loaded = TRUE; - obt_parse_tree_from_root(menu_parse_inst); - obt_parse_close(menu_parse_inst); + 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); } if (!loaded) { - if (obt_parse_load_config_file(menu_parse_inst, - "openbox", - "menu.xml", - "openbox_menu")) + if (obt_xml_load_config_file(menu_parse_inst, + "openbox", + "menu.xml", + "openbox_menu")) { - obt_parse_tree_from_root(menu_parse_inst); - obt_parse_close(menu_parse_inst); + 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\""), "menu.xml"); @@ -124,7 +124,7 @@ void menu_shutdown(gboolean reconfig) if (!reconfig) client_remove_destroy_notify(client_dest); - obt_parse_instance_unref(menu_parse_inst); + obt_xml_instance_unref(menu_parse_inst); menu_parse_inst = NULL; client_list_menu_shutdown(reconfig); @@ -173,13 +173,13 @@ void menu_pipe_execute(ObMenu *self) return; } - if (obt_parse_load_mem(menu_parse_inst, output, strlen(output), - "openbox_pipe_menu")) + if (obt_xml_load_mem(menu_parse_inst, output, strlen(output), + "openbox_pipe_menu")) { menu_parse_state.pipe_creator = self; menu_parse_state.parent = self; - obt_parse_tree_from_root(menu_parse_inst); - obt_parse_close(menu_parse_inst); + obt_xml_tree_from_root(menu_parse_inst); + obt_xml_close(menu_parse_inst); } else { g_message(_("Invalid output from pipe-menu \"%s\""), self->execute); } @@ -271,7 +271,7 @@ static void parse_menu_item(xmlNodePtr node, gpointer data) gchar *label; if (state->parent) { - if (obt_parse_attr_string(node, "label", &label)) { + if (obt_xml_attr_string(node, "label", &label)) { GSList *acts = NULL; for (node = node->children; node; node = node->next) @@ -293,7 +293,7 @@ static void parse_menu_separator(xmlNodePtr node, gpointer data) if (state->parent) { gchar *label; - if (!obt_parse_attr_string(node, "label", &label)) + if (!obt_xml_attr_string(node, "label", &label)) label = NULL; menu_add_separator(state->parent, -1, label); @@ -307,23 +307,23 @@ static void parse_menu(xmlNodePtr node, gpointer data) gchar *name = NULL, *title = NULL, *script = NULL; ObMenu *menu; - if (!obt_parse_attr_string(node, "id", &name)) + if (!obt_xml_attr_string(node, "id", &name)) goto parse_menu_fail; if (!g_hash_table_lookup(menu_hash, name)) { - if (!obt_parse_attr_string(node, "label", &title)) + if (!obt_xml_attr_string(node, "label", &title)) goto parse_menu_fail; if ((menu = menu_new(name, title, TRUE, NULL))) { menu->pipe_creator = state->pipe_creator; - if (obt_parse_attr_string(node, "execute", &script)) { + if (obt_xml_attr_string(node, "execute", &script)) { menu->execute = obt_paths_expand_tilde(script); } else { ObMenu *old; old = state->parent; state->parent = menu; - obt_parse_tree(menu_parse_inst, node->children); + obt_xml_tree(menu_parse_inst, node->children); state->parent = old; } } diff --git a/openbox/openbox.c b/openbox/openbox.c index c597d23f..792dae2e 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -48,7 +48,7 @@ #include "obt/display.h" #include "obt/prop.h" #include "obt/keyboard.h" -#include "obt/parse.h" +#include "obt/xml.h" #ifdef HAVE_FCNTL_H # include @@ -226,11 +226,11 @@ gint main(gint argc, gchar **argv) keys[OB_KEY_SPACE] = obt_keyboard_keysym_to_keycode(XK_space); { - ObtParseInst *i; + ObtXmlInst *i; /* startup the parsing so everything can register sections of the rc */ - i = obt_parse_instance_new(); + i = obt_xml_instance_new(); /* register all the available actions */ actions_startup(reconfigure); @@ -239,12 +239,12 @@ gint main(gint argc, gchar **argv) /* parse/load user options */ if ((config_file && - obt_parse_load_file(i, config_file, "openbox_config")) || - obt_parse_load_config_file(i, "openbox", "rc.xml", - "openbox_config")) + obt_xml_load_file(i, config_file, "openbox_config")) || + obt_xml_load_config_file(i, "openbox", "rc.xml", + "openbox_config")) { - obt_parse_tree_from_root(i); - obt_parse_close(i); + obt_xml_tree_from_root(i); + obt_xml_close(i); } else { g_message(_("Unable to find a valid config file, using some simple defaults")); @@ -263,7 +263,7 @@ gint main(gint argc, gchar **argv) OBT_PROP_ERASE(obt_root(ob_screen), OB_CONFIG_FILE); /* we're done with parsing now, kill it */ - obt_parse_instance_unref(i); + obt_xml_instance_unref(i); } /* load the theme specified in the rc file */ diff --git a/openbox/session.c b/openbox/session.c index 758e9887..ba51ed32 100644 --- a/openbox/session.c +++ b/openbox/session.c @@ -42,7 +42,7 @@ gboolean session_connected(void) { return FALSE; } #include "client.h" #include "focus.h" #include "gettext.h" -#include "obt/parse.h" +#include "obt/xml.h" #include "obt/paths.h" #include @@ -684,108 +684,108 @@ GList* session_state_find(ObClient *c) static void session_load_file(const gchar *path) { - ObtParseInst *i; + ObtXmlInst *i; xmlNodePtr node, n, m; GList *it, *inext; - i = obt_parse_instance_new(); + i = obt_xml_instance_new(); - if (!obt_parse_load_file(i, path, "openbox_session")) { + if (!obt_xml_load_file(i, path, "openbox_session")) { ob_debug_type(OB_DEBUG_SM, "ERROR: session file is missing root node"); - obt_parse_instance_unref(i); + obt_xml_instance_unref(i); return; } - node = obt_parse_root(i); + node = obt_xml_root(i); - if ((n = obt_parse_find_node(node->children, "desktop"))) - session_desktop = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node->children, "desktop"))) + session_desktop = obt_xml_node_int(n); - if ((n = obt_parse_find_node(node->children, "numdesktops"))) - session_num_desktops = obt_parse_node_int(n); + if ((n = obt_xml_find_node(node->children, "numdesktops"))) + session_num_desktops = obt_xml_node_int(n); - if ((n = obt_parse_find_node(node->children, "desktoplayout"))) { + if ((n = obt_xml_find_node(node->children, "desktoplayout"))) { /* make sure they are all there for it to be valid */ - if ((m = obt_parse_find_node(n->children, "orientation"))) - session_desktop_layout.orientation = obt_parse_node_int(m); - if (m && (m = obt_parse_find_node(n->children, "startcorner"))) - session_desktop_layout.start_corner = obt_parse_node_int(m); - if (m && (m = obt_parse_find_node(n->children, "columns"))) - session_desktop_layout.columns = obt_parse_node_int(m); - if (m && (m = obt_parse_find_node(n->children, "rows"))) - session_desktop_layout.rows = obt_parse_node_int(m); + if ((m = obt_xml_find_node(n->children, "orientation"))) + session_desktop_layout.orientation = obt_xml_node_int(m); + if (m && (m = obt_xml_find_node(n->children, "startcorner"))) + session_desktop_layout.start_corner = obt_xml_node_int(m); + if (m && (m = obt_xml_find_node(n->children, "columns"))) + session_desktop_layout.columns = obt_xml_node_int(m); + if (m && (m = obt_xml_find_node(n->children, "rows"))) + session_desktop_layout.rows = obt_xml_node_int(m); session_desktop_layout_present = m != NULL; } - if ((n = obt_parse_find_node(node->children, "desktopnames"))) { - for (m = obt_parse_find_node(n->children, "name"); m; - m = obt_parse_find_node(m->next, "name")) + if ((n = obt_xml_find_node(node->children, "desktopnames"))) { + for (m = obt_xml_find_node(n->children, "name"); m; + m = obt_xml_find_node(m->next, "name")) { session_desktop_names = g_slist_append(session_desktop_names, - obt_parse_node_string(m)); + obt_xml_node_string(m)); } } ob_debug_type(OB_DEBUG_SM, "loading windows"); - for (node = obt_parse_find_node(node->children, "window"); node != NULL; - node = obt_parse_find_node(node->next, "window")) + for (node = obt_xml_find_node(node->children, "window"); node != NULL; + node = obt_xml_find_node(node->next, "window")) { ObSessionState *state; state = g_new0(ObSessionState, 1); - if (!obt_parse_attr_string(node, "id", &state->id)) - if (!obt_parse_attr_string(node, "command", &state->command)) + if (!obt_xml_attr_string(node, "id", &state->id)) + if (!obt_xml_attr_string(node, "command", &state->command)) goto session_load_bail; - if (!(n = obt_parse_find_node(node->children, "name"))) + if (!(n = obt_xml_find_node(node->children, "name"))) goto session_load_bail; - state->name = obt_parse_node_string(n); - if (!(n = obt_parse_find_node(node->children, "class"))) + state->name = obt_xml_node_string(n); + if (!(n = obt_xml_find_node(node->children, "class"))) goto session_load_bail; - state->class = obt_parse_node_string(n); - if (!(n = obt_parse_find_node(node->children, "role"))) + state->class = obt_xml_node_string(n); + if (!(n = obt_xml_find_node(node->children, "role"))) goto session_load_bail; - state->role = obt_parse_node_string(n); - if (!(n = obt_parse_find_node(node->children, "windowtype"))) + state->role = obt_xml_node_string(n); + if (!(n = obt_xml_find_node(node->children, "windowtype"))) goto session_load_bail; - state->type = obt_parse_node_int(n); - if (!(n = obt_parse_find_node(node->children, "desktop"))) + state->type = obt_xml_node_int(n); + if (!(n = obt_xml_find_node(node->children, "desktop"))) goto session_load_bail; - state->desktop = obt_parse_node_int(n); - if (!(n = obt_parse_find_node(node->children, "x"))) + state->desktop = obt_xml_node_int(n); + if (!(n = obt_xml_find_node(node->children, "x"))) goto session_load_bail; - state->x = obt_parse_node_int(n); - if (!(n = obt_parse_find_node(node->children, "y"))) + state->x = obt_xml_node_int(n); + if (!(n = obt_xml_find_node(node->children, "y"))) goto session_load_bail; - state->y = obt_parse_node_int(n); - if (!(n = obt_parse_find_node(node->children, "width"))) + state->y = obt_xml_node_int(n); + if (!(n = obt_xml_find_node(node->children, "width"))) goto session_load_bail; - state->w = obt_parse_node_int(n); - if (!(n = obt_parse_find_node(node->children, "height"))) + state->w = obt_xml_node_int(n); + if (!(n = obt_xml_find_node(node->children, "height"))) goto session_load_bail; - state->h = obt_parse_node_int(n); + state->h = obt_xml_node_int(n); state->shaded = - obt_parse_find_node(node->children, "shaded") != NULL; + obt_xml_find_node(node->children, "shaded") != NULL; state->iconic = - obt_parse_find_node(node->children, "iconic") != NULL; + obt_xml_find_node(node->children, "iconic") != NULL; state->skip_pager = - obt_parse_find_node(node->children, "skip_pager") != NULL; + obt_xml_find_node(node->children, "skip_pager") != NULL; state->skip_taskbar = - obt_parse_find_node(node->children, "skip_taskbar") != NULL; + obt_xml_find_node(node->children, "skip_taskbar") != NULL; state->fullscreen = - obt_parse_find_node(node->children, "fullscreen") != NULL; + obt_xml_find_node(node->children, "fullscreen") != NULL; state->above = - obt_parse_find_node(node->children, "above") != NULL; + obt_xml_find_node(node->children, "above") != NULL; state->below = - obt_parse_find_node(node->children, "below") != NULL; + obt_xml_find_node(node->children, "below") != NULL; state->max_horz = - obt_parse_find_node(node->children, "max_horz") != NULL; + obt_xml_find_node(node->children, "max_horz") != NULL; state->max_vert = - obt_parse_find_node(node->children, "max_vert") != NULL; + obt_xml_find_node(node->children, "max_vert") != NULL; state->undecorated = - obt_parse_find_node(node->children, "undecorated") != NULL; + obt_xml_find_node(node->children, "undecorated") != NULL; state->focused = - obt_parse_find_node(node->children, "focused") != NULL; + obt_xml_find_node(node->children, "focused") != NULL; /* save this. they are in the file in stacking order, so preserve that order here */ @@ -844,7 +844,7 @@ static void session_load_file(const gchar *path) } } - obt_parse_instance_unref(i); + obt_xml_instance_unref(i); } void session_request_logout(gboolean silent)