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 \
obt/display.h \
obt/keyboard.h \
obt/mainloop.h \
- obt/parse.h \
+ obt/xml.h \
obt/paths.h \
obt/prop.h \
obt/util.h \
+++ /dev/null
-/* -*- 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 <libxml/parser.h>
-#include <glib.h>
-
-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
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 <glib.h>
struct Callback {
gchar *tag;
- ObtParseCallback func;
+ ObtXmlCallback func;
gpointer data;
};
-struct _ObtParseInst {
+struct _ObtXmlInst {
gint ref;
ObtPaths *xdg_paths;
GHashTable *callbacks;
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,
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);
}
}
-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;
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,
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;
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;
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;
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;
}
-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;
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);
}
}
-void obt_parse_tree(ObtParseInst *i, xmlNodePtr node)
+void obt_xml_tree(ObtXmlInst *i, xmlNodePtr node)
{
g_assert(i->doc); /* a doc is open? */
}
}
-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;
return s;
}
-gint obt_parse_node_int(xmlNodePtr node)
+gint obt_xml_node_int(xmlNodePtr node)
{
xmlChar *c = xmlNodeGetContent(node);
gint i;
return i;
}
-gboolean obt_parse_node_bool(xmlNodePtr node)
+gboolean obt_xml_node_bool(xmlNodePtr node)
{
xmlChar *c = xmlNodeGetContent(node);
gboolean b = FALSE;
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;
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))
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;
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;
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;
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;
--- /dev/null
+/* -*- 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 <libxml/parser.h>
+#include <glib.h>
+
+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
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) {
#include "misc.h"
#include "frame.h"
-#include "obt/parse.h"
+#include "obt/xml.h"
#include <glib.h>
#include <X11/Xlib.h>
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"))
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 {
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;
}
/* 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")) {
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;
}
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;
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;
}
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;
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;
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;
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;
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 {
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;
}
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;
}
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;
}
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;
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");
}
}
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;
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;
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;
}
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;
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;
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);
}
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;
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"))
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;
}
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);
}
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;
}
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 {
*/
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;
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();;
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;
}
}
}
- 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"))
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;
settings->max_vert = TRUE;
} else
settings->max_horz = settings->max_vert =
- obt_parse_node_bool(n);
+ obt_xml_node_bool(n);
g_free(s);
}
name = class = role = NULL;
}
- app = obt_parse_find_node(app->next, "application");
+ app = obt_xml_find_node(app->next, "application");
}
}
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");
}
}
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");
}
}
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");
}
}
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)
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;
}
}
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)
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;
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"))
*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");
}
}
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;
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)
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);
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;
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);
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
actions_parse_string(it->actname));
}
-void config_startup(ObtParseInst *i)
+void config_startup(ObtXmlInst *i)
{
config_focus_new = TRUE;
config_focus_follow = FALSE;
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;
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;
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 */
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;
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;
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;
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)
#include "geom.h"
#include "moveresize.h"
#include "obrender/render.h"
-#include "obt/parse.h"
+#include "obt/xml.h"
#include <glib.h>
/*! 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 */
#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;
};
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;
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");
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);
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);
}
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)
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);
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;
}
}
#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 <fcntl.h>
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);
/* 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"));
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 */
#include "client.h"
#include "focus.h"
#include "gettext.h"
-#include "obt/parse.h"
+#include "obt/xml.h"
#include "obt/paths.h"
#include <time.h>
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 */
}
}
- obt_parse_instance_unref(i);
+ obt_xml_instance_unref(i);
}
void session_request_logout(gboolean silent)