From: Dana Jansens Date: Mon, 21 Dec 2009 19:06:45 +0000 (-0500) Subject: use the new obt_xml stuff X-Git-Tag: release-2.0.4~50 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=7562931bcf0857ce1522f81f9cb018a2f18ab817;p=dana%2Fobconf.git use the new obt_xml stuff --- diff --git a/src/desktops.c b/src/desktops.c index f1f0021..6f205c4 100644 --- a/src/desktops.c +++ b/src/desktops.c @@ -156,7 +156,7 @@ static void desktops_read_names() gchar *name; if (!xmlStrcmp(n->name, (const xmlChar*)"name")) { - name = obt_parse_node_string(n); + name = obt_xml_node_string(n); desktop_names = g_list_append(desktop_names, name); diff --git a/src/main.c b/src/main.c index f72976e..9035e8d 100644 --- a/src/main.c +++ b/src/main.c @@ -43,7 +43,7 @@ xmlNodePtr root; RrInstance *rrinst; gchar *obc_config_file = NULL; ObtPaths *paths; -ObtParseInst *parse_i; +ObtXmlInst *parse_i; static gchar *obc_theme_install = NULL; static gchar *obc_theme_archive = NULL; @@ -217,7 +217,7 @@ int main(int argc, char **argv) } paths = obt_paths_new(); - parse_i = obt_parse_instance_new(); + parse_i = obt_xml_instance_new(); rrinst = RrInstanceNew(GDK_DISPLAY(), gdk_x11_get_default_screen()); if (!obc_config_file) { @@ -233,18 +233,18 @@ int main(int argc, char **argv) } xmlIndentTreeOutput = 1; - if (!obt_parse_load_config_file(parse_i, - "openbox", - (obc_config_file ? - obc_config_file : "rc.xml"), - "openbox_config")) + if (!obt_xml_load_config_file(parse_i, + "openbox", + (obc_config_file ? + obc_config_file : "rc.xml"), + "openbox_config")) { obconf_error(_("Failed to load an rc.xml. You have probably failed to install Openbox properly."), TRUE); exit_with_error = TRUE; } else { - doc = obt_parse_doc(parse_i); - root = obt_parse_root(parse_i); + doc = obt_xml_doc(parse_i); + root = obt_xml_root(parse_i); } /* look for parsing errors */ @@ -303,7 +303,7 @@ int main(int argc, char **argv) } RrInstanceFree(rrinst); - obt_parse_instance_unref(parse_i); + obt_xml_instance_unref(parse_i); obt_paths_unref(paths); xmlFreeDoc(doc); diff --git a/src/main.h b/src/main.h index 2c06630..4f3213b 100644 --- a/src/main.h +++ b/src/main.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -32,7 +32,7 @@ extern RrInstance *rrinst; extern GtkWidget *mainwin; extern gchar *obc_config_file; extern ObtPaths *paths; -extern ObtParseInst *parse_i; +extern ObtXmlInst *parse_i; #define get_widget(s) glade_xml_get_widget(glade, s) diff --git a/src/mouse.c b/src/mouse.c index 831e2e5..88f13d9 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -19,7 +19,7 @@ #include "main.h" #include "tree.h" #include "gettext.h" -#include +#include static gboolean mapping = FALSE; static xmlNodePtr saved_custom = NULL; @@ -206,9 +206,9 @@ static gint read_doubleclick_action() while (n) { if (!xmlStrcmp(n->name, (const xmlChar*)"action")) { - if (obt_parse_attr_contains(n, "name", "ToggleMaximizeFull")) + if (obt_xml_attr_contains(n, "name", "ToggleMaximizeFull")) ++max; - else if (obt_parse_attr_contains(n, "name", "ToggleShade")) + else if (obt_xml_attr_contains(n, "name", "ToggleShade")) ++shade; else ++other; diff --git a/src/tree.c b/src/tree.c index 2b39840..cbe9b90 100644 --- a/src/tree.c +++ b/src/tree.c @@ -19,7 +19,7 @@ #include "tree.h" #include "main.h" -#include +#include #include xmlNodePtr tree_get_node(const gchar *path, const gchar *def) @@ -28,7 +28,7 @@ xmlNodePtr tree_get_node(const gchar *path, const gchar *def) gchar **nodes; gchar **it, **next; - n = obt_parse_root(parse_i); + n = obt_xml_root(parse_i); nodes = g_strsplit(path, "/", 0); for (it = nodes; *it; it = next) { @@ -39,19 +39,19 @@ xmlNodePtr tree_get_node(const gchar *path, const gchar *def) next = it + 1; /* match attributes */ - c = obt_parse_find_node(n->children, attrs[0]); + c = obt_xml_find_node(n->children, attrs[0]); while (c && !ok) { gint i; ok = TRUE; for (i = 1; attrs[i]; ++i) { gchar **eq = g_strsplit(attrs[i], "=", 2); - if (eq[1] && !obt_parse_attr_contains(c, eq[0], eq[1])) + if (eq[1] && !obt_xml_attr_contains(c, eq[0], eq[1])) ok = FALSE; g_strfreev(eq); } if (!ok) - c = obt_parse_find_node(c->next, attrs[0]); + c = obt_xml_find_node(c->next, attrs[0]); } if (!c) { @@ -100,7 +100,7 @@ void tree_apply() obt_paths_mkdir_path(d, 0700); g_free(d); - if (!obt_parse_save_file(parse_i, p, TRUE)) { + if (!obt_xml_save_file(parse_i, p, TRUE)) { gchar *s; s = g_strdup_printf("An error occured while saving the " "config file '%s'", p); @@ -166,7 +166,7 @@ gchar* tree_get_string(const gchar *node, const gchar *def) xmlNodePtr n; n = tree_get_node(node, def); - return obt_parse_node_string(n); + return obt_xml_node_string(n); } gint tree_get_int(const gchar *node, gint def) @@ -177,7 +177,7 @@ gint tree_get_int(const gchar *node, gint def) d = g_strdup_printf("%d", def); n = tree_get_node(node, d); g_free(d); - return obt_parse_node_int(n); + return obt_xml_node_int(n); } gboolean tree_get_bool(const gchar *node, gboolean def) @@ -185,5 +185,5 @@ gboolean tree_get_bool(const gchar *node, gboolean def) xmlNodePtr n; n = tree_get_node(node, (def ? "yes" : "no")); - return obt_parse_node_bool(n); + return obt_xml_node_bool(n); } diff --git a/src/tree.h b/src/tree.h index 62a20c8..4e9e170 100644 --- a/src/tree.h +++ b/src/tree.h @@ -19,7 +19,7 @@ #ifndef obconf__tree_h #define obconf__tree_h -#include +#include xmlNodePtr tree_get_node(const gchar *path, const gchar *def);