rename the obt_parse library to obt_xml (since it is very xml specific)
This commit is contained in:
parent
04dc598a1f
commit
b06b684589
30 changed files with 590 additions and 590 deletions
|
@ -129,8 +129,8 @@ obt_libobt_la_SOURCES = \
|
||||||
obt/keyboard.c \
|
obt/keyboard.c \
|
||||||
obt/mainloop.h \
|
obt/mainloop.h \
|
||||||
obt/mainloop.c \
|
obt/mainloop.c \
|
||||||
obt/parse.h \
|
obt/xml.h \
|
||||||
obt/parse.c \
|
obt/xml.c \
|
||||||
obt/paths.h \
|
obt/paths.h \
|
||||||
obt/paths.c \
|
obt/paths.c \
|
||||||
obt/prop.h \
|
obt/prop.h \
|
||||||
|
@ -423,7 +423,7 @@ obtpubinclude_HEADERS = \
|
||||||
obt/display.h \
|
obt/display.h \
|
||||||
obt/keyboard.h \
|
obt/keyboard.h \
|
||||||
obt/mainloop.h \
|
obt/mainloop.h \
|
||||||
obt/parse.h \
|
obt/xml.h \
|
||||||
obt/paths.h \
|
obt/paths.h \
|
||||||
obt/prop.h \
|
obt/prop.h \
|
||||||
obt/util.h \
|
obt/util.h \
|
||||||
|
|
89
obt/parse.h
89
obt/parse.h
|
@ -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 <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
|
|
|
@ -16,7 +16,7 @@
|
||||||
See the COPYING file for a copy of the GNU General Public License.
|
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 "obt/paths.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
@ -36,11 +36,11 @@
|
||||||
|
|
||||||
struct Callback {
|
struct Callback {
|
||||||
gchar *tag;
|
gchar *tag;
|
||||||
ObtParseCallback func;
|
ObtXmlCallback func;
|
||||||
gpointer data;
|
gpointer data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ObtParseInst {
|
struct _ObtXmlInst {
|
||||||
gint ref;
|
gint ref;
|
||||||
ObtPaths *xdg_paths;
|
ObtPaths *xdg_paths;
|
||||||
GHashTable *callbacks;
|
GHashTable *callbacks;
|
||||||
|
@ -55,9 +55,9 @@ static void destfunc(struct Callback *c)
|
||||||
g_free(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->ref = 1;
|
||||||
i->xdg_paths = obt_paths_new();
|
i->xdg_paths = obt_paths_new();
|
||||||
i->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
|
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;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void obt_parse_instance_ref(ObtParseInst *i)
|
void obt_xml_instance_ref(ObtXmlInst *i)
|
||||||
{
|
{
|
||||||
++i->ref;
|
++i->ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
void obt_parse_instance_unref(ObtParseInst *i)
|
void obt_xml_instance_unref(ObtXmlInst *i)
|
||||||
{
|
{
|
||||||
if (i && --i->ref == 0) {
|
if (i && --i->ref == 0) {
|
||||||
obt_paths_unref(i->xdg_paths);
|
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? */
|
g_assert(i->doc); /* a doc is open? */
|
||||||
return i->doc;
|
return i->doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlNodePtr obt_parse_root(ObtParseInst *i)
|
xmlNodePtr obt_xml_root(ObtXmlInst *i)
|
||||||
{
|
{
|
||||||
g_assert(i->doc); /* a doc is open? */
|
g_assert(i->doc); /* a doc is open? */
|
||||||
return i->root;
|
return i->root;
|
||||||
}
|
}
|
||||||
|
|
||||||
void obt_parse_register(ObtParseInst *i, const gchar *tag,
|
void obt_xml_register(ObtXmlInst *i, const gchar *tag,
|
||||||
ObtParseCallback func, gpointer data)
|
ObtXmlCallback func, gpointer data)
|
||||||
{
|
{
|
||||||
struct Callback *c;
|
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);
|
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 *domain,
|
||||||
const gchar *filename,
|
const gchar *filename,
|
||||||
const gchar *root_node,
|
const gchar *root_node,
|
||||||
|
@ -164,7 +164,7 @@ static gboolean load_file(ObtParseInst *i,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean obt_parse_load_file(ObtParseInst *i,
|
gboolean obt_xml_load_file(ObtXmlInst *i,
|
||||||
const gchar *path,
|
const gchar *path,
|
||||||
const gchar *root_node)
|
const gchar *root_node)
|
||||||
{
|
{
|
||||||
|
@ -182,7 +182,7 @@ gboolean obt_parse_load_file(ObtParseInst *i,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean obt_parse_load_config_file(ObtParseInst *i,
|
gboolean obt_xml_load_config_file(ObtXmlInst *i,
|
||||||
const gchar *domain,
|
const gchar *domain,
|
||||||
const gchar *filename,
|
const gchar *filename,
|
||||||
const gchar *root_node)
|
const gchar *root_node)
|
||||||
|
@ -202,7 +202,7 @@ gboolean obt_parse_load_config_file(ObtParseInst *i,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean obt_parse_load_data_file(ObtParseInst *i,
|
gboolean obt_xml_load_data_file(ObtXmlInst *i,
|
||||||
const gchar *domain,
|
const gchar *domain,
|
||||||
const gchar *filename,
|
const gchar *filename,
|
||||||
const gchar *root_node)
|
const gchar *root_node)
|
||||||
|
@ -222,7 +222,7 @@ gboolean obt_parse_load_data_file(ObtParseInst *i,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean obt_parse_load_theme_file(ObtParseInst *i,
|
gboolean obt_xml_load_theme_file(ObtXmlInst *i,
|
||||||
const gchar *theme,
|
const gchar *theme,
|
||||||
const gchar *domain,
|
const gchar *domain,
|
||||||
const gchar *filename,
|
const gchar *filename,
|
||||||
|
@ -249,7 +249,7 @@ gboolean obt_parse_load_theme_file(ObtParseInst *i,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gboolean obt_parse_load_mem(ObtParseInst *i,
|
gboolean obt_xml_load_mem(ObtXmlInst *i,
|
||||||
gpointer data, guint len, const gchar *root_node)
|
gpointer data, guint len, const gchar *root_node)
|
||||||
{
|
{
|
||||||
gboolean r = FALSE;
|
gboolean r = FALSE;
|
||||||
|
@ -277,14 +277,14 @@ gboolean obt_parse_load_mem(ObtParseInst *i,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean obt_parse_save_file(ObtParseInst *inst,
|
gboolean obt_xml_save_file(ObtXmlInst *inst,
|
||||||
const gchar *path,
|
const gchar *path,
|
||||||
gboolean pretty)
|
gboolean pretty)
|
||||||
{
|
{
|
||||||
return xmlSaveFormatFile(path, inst->doc, pretty) != -1;
|
return xmlSaveFormatFile(path, inst->doc, pretty) != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void obt_parse_close(ObtParseInst *i)
|
void obt_xml_close(ObtXmlInst *i)
|
||||||
{
|
{
|
||||||
if (i && i->doc) {
|
if (i && i->doc) {
|
||||||
xmlFreeDoc(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? */
|
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);
|
xmlChar *c = xmlNodeGetContent(node);
|
||||||
gchar *s;
|
gchar *s;
|
||||||
|
@ -321,7 +321,7 @@ gchar *obt_parse_node_string(xmlNodePtr node)
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
gint obt_parse_node_int(xmlNodePtr node)
|
gint obt_xml_node_int(xmlNodePtr node)
|
||||||
{
|
{
|
||||||
xmlChar *c = xmlNodeGetContent(node);
|
xmlChar *c = xmlNodeGetContent(node);
|
||||||
gint i;
|
gint i;
|
||||||
|
@ -331,7 +331,7 @@ gint obt_parse_node_int(xmlNodePtr node)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean obt_parse_node_bool(xmlNodePtr node)
|
gboolean obt_xml_node_bool(xmlNodePtr node)
|
||||||
{
|
{
|
||||||
xmlChar *c = xmlNodeGetContent(node);
|
xmlChar *c = xmlNodeGetContent(node);
|
||||||
gboolean b = FALSE;
|
gboolean b = FALSE;
|
||||||
|
@ -346,7 +346,7 @@ gboolean obt_parse_node_bool(xmlNodePtr node)
|
||||||
return b;
|
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);
|
xmlChar *c = xmlNodeGetContent(node);
|
||||||
gboolean r;
|
gboolean r;
|
||||||
|
@ -356,7 +356,7 @@ gboolean obt_parse_node_contains(xmlNodePtr node, const gchar *val)
|
||||||
return 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) {
|
while (node) {
|
||||||
if (!xmlStrcmp(node->name, (const xmlChar*) tag))
|
if (!xmlStrcmp(node->name, (const xmlChar*) tag))
|
||||||
|
@ -366,7 +366,7 @@ xmlNodePtr obt_parse_find_node(xmlNodePtr node, const gchar *tag)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean obt_parse_attr_bool(xmlNodePtr node, const gchar *name,
|
gboolean obt_xml_attr_bool(xmlNodePtr node, const gchar *name,
|
||||||
gboolean *value)
|
gboolean *value)
|
||||||
{
|
{
|
||||||
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
||||||
|
@ -390,7 +390,7 @@ gboolean obt_parse_attr_bool(xmlNodePtr node, const gchar *name,
|
||||||
return r;
|
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);
|
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
||||||
gboolean r = FALSE;
|
gboolean r = FALSE;
|
||||||
|
@ -403,7 +403,7 @@ gboolean obt_parse_attr_int(xmlNodePtr node, const gchar *name, gint *value)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean obt_parse_attr_string(xmlNodePtr node, const gchar *name,
|
gboolean obt_xml_attr_string(xmlNodePtr node, const gchar *name,
|
||||||
gchar **value)
|
gchar **value)
|
||||||
{
|
{
|
||||||
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
||||||
|
@ -417,7 +417,7 @@ gboolean obt_parse_attr_string(xmlNodePtr node, const gchar *name,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean obt_parse_attr_contains(xmlNodePtr node, const gchar *name,
|
gboolean obt_xml_attr_contains(xmlNodePtr node, const gchar *name,
|
||||||
const gchar *val)
|
const gchar *val)
|
||||||
{
|
{
|
||||||
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
|
89
obt/xml.h
Normal file
89
obt/xml.h
Normal file
|
@ -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 <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
|
|
@ -208,7 +208,7 @@ ObActionsAct* actions_parse(xmlNodePtr node)
|
||||||
gchar *name;
|
gchar *name;
|
||||||
ObActionsAct *act = NULL;
|
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))) {
|
if ((act = actions_build_act_from_string(name))) {
|
||||||
/* there is more stuff to parse here */
|
/* there is more stuff to parse here */
|
||||||
if (act->def->canbeinteractive) {
|
if (act->def->canbeinteractive) {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "obt/parse.h"
|
#include "obt/xml.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
|
@ -39,8 +39,8 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "where"))) {
|
if ((n = obt_xml_find_node(node, "where"))) {
|
||||||
gchar *s = obt_parse_node_string(n);
|
gchar *s = obt_xml_node_string(n);
|
||||||
if (!g_ascii_strcasecmp(s, "last"))
|
if (!g_ascii_strcasecmp(s, "last"))
|
||||||
o->current = FALSE;
|
o->current = FALSE;
|
||||||
else if (!g_ascii_strcasecmp(s, "current"))
|
else if (!g_ascii_strcasecmp(s, "current"))
|
||||||
|
|
|
@ -67,33 +67,33 @@ static gpointer setup_func(xmlNodePtr node,
|
||||||
o->bar = TRUE;
|
o->bar = TRUE;
|
||||||
o->dialog_mode = OB_FOCUS_CYCLE_POPUP_MODE_LIST;
|
o->dialog_mode = OB_FOCUS_CYCLE_POPUP_MODE_LIST;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "linear")))
|
if ((n = obt_xml_find_node(node, "linear")))
|
||||||
o->linear = obt_parse_node_bool(n);
|
o->linear = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "dialog"))) {
|
if ((n = obt_xml_find_node(node, "dialog"))) {
|
||||||
if (obt_parse_node_contains(n, "none"))
|
if (obt_xml_node_contains(n, "none"))
|
||||||
o->dialog_mode = OB_FOCUS_CYCLE_POPUP_MODE_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;
|
o->dialog_mode = OB_FOCUS_CYCLE_POPUP_MODE_ICONS;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "bar")))
|
if ((n = obt_xml_find_node(node, "bar")))
|
||||||
o->bar = obt_parse_node_bool(n);
|
o->bar = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "raise")))
|
if ((n = obt_xml_find_node(node, "raise")))
|
||||||
o->raise = obt_parse_node_bool(n);
|
o->raise = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "panels")))
|
if ((n = obt_xml_find_node(node, "panels")))
|
||||||
o->dock_windows = obt_parse_node_bool(n);
|
o->dock_windows = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "desktop")))
|
if ((n = obt_xml_find_node(node, "desktop")))
|
||||||
o->desktop_windows = obt_parse_node_bool(n);
|
o->desktop_windows = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "allDesktops")))
|
if ((n = obt_xml_find_node(node, "allDesktops")))
|
||||||
o->all_desktops = obt_parse_node_bool(n);
|
o->all_desktops = obt_xml_node_bool(n);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "finalactions"))) {
|
if ((n = obt_xml_find_node(node, "finalactions"))) {
|
||||||
xmlNodePtr m;
|
xmlNodePtr m;
|
||||||
|
|
||||||
m = obt_parse_find_node(n->children, "action");
|
m = obt_xml_find_node(n->children, "action");
|
||||||
while (m) {
|
while (m) {
|
||||||
ObActionsAct *action = actions_parse(m);
|
ObActionsAct *action = actions_parse(m);
|
||||||
if (action) o->actions = g_slist_append(o->actions, action);
|
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 {
|
else {
|
||||||
|
|
|
@ -21,8 +21,8 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "string")))
|
if ((n = obt_xml_find_node(node, "string")))
|
||||||
o->str = obt_parse_node_string(n);
|
o->str = obt_xml_node_string(n);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,8 +160,8 @@ static gpointer setup_func(xmlNodePtr node,
|
||||||
/* wrap by default - it's handy! */
|
/* wrap by default - it's handy! */
|
||||||
o->u.rel.wrap = TRUE;
|
o->u.rel.wrap = TRUE;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "to"))) {
|
if ((n = obt_xml_find_node(node, "to"))) {
|
||||||
gchar *s = obt_parse_node_string(n);
|
gchar *s = obt_xml_node_string(n);
|
||||||
if (!g_ascii_strcasecmp(s, "last"))
|
if (!g_ascii_strcasecmp(s, "last"))
|
||||||
o->type = LAST;
|
o->type = LAST;
|
||||||
else if (!g_ascii_strcasecmp(s, "next")) {
|
else if (!g_ascii_strcasecmp(s, "next")) {
|
||||||
|
@ -201,8 +201,8 @@ static gpointer setup_func(xmlNodePtr node,
|
||||||
g_free(s);
|
g_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "wrap")))
|
if ((n = obt_xml_find_node(node, "wrap")))
|
||||||
o->u.rel.wrap = obt_parse_node_bool(n);
|
o->u.rel.wrap = obt_xml_node_bool(n);
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
@ -240,8 +240,8 @@ static gpointer setup_send_func(xmlNodePtr node,
|
||||||
o->send = TRUE;
|
o->send = TRUE;
|
||||||
o->follow = TRUE;
|
o->follow = TRUE;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "follow")))
|
if ((n = obt_xml_find_node(node, "follow")))
|
||||||
o->follow = obt_parse_node_bool(n);
|
o->follow = obt_xml_node_bool(n);
|
||||||
|
|
||||||
if (o->type == RELATIVE && o->follow) {
|
if (o->type == RELATIVE && o->follow) {
|
||||||
o->interactive = TRUE;
|
o->interactive = TRUE;
|
||||||
|
@ -348,8 +348,8 @@ static gpointer setup_follow(xmlNodePtr node)
|
||||||
Options *o = g_new0(Options, 1);
|
Options *o = g_new0(Options, 1);
|
||||||
o->send = TRUE;
|
o->send = TRUE;
|
||||||
o->follow = TRUE;
|
o->follow = TRUE;
|
||||||
if ((n = obt_parse_find_node(node, "follow")))
|
if ((n = obt_xml_find_node(node, "follow")))
|
||||||
o->follow = obt_parse_node_bool(n);
|
o->follow = obt_xml_node_bool(n);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,8 +372,8 @@ static gpointer setup_go_abs_func(xmlNodePtr node)
|
||||||
xmlNodePtr n;
|
xmlNodePtr n;
|
||||||
Options *o = g_new0(Options, 1);
|
Options *o = g_new0(Options, 1);
|
||||||
o->type = ABSOLUTE;
|
o->type = ABSOLUTE;
|
||||||
if ((n = obt_parse_find_node(node, "desktop")))
|
if ((n = obt_xml_find_node(node, "desktop")))
|
||||||
o->u.abs.desktop = obt_parse_node_int(n) - 1;
|
o->u.abs.desktop = obt_xml_node_int(n) - 1;
|
||||||
else
|
else
|
||||||
o->u.abs.desktop = screen_desktop;
|
o->u.abs.desktop = screen_desktop;
|
||||||
return o;
|
return o;
|
||||||
|
@ -384,8 +384,8 @@ static gpointer setup_send_abs_func(xmlNodePtr node)
|
||||||
xmlNodePtr n;
|
xmlNodePtr n;
|
||||||
Options *o = setup_follow(node);
|
Options *o = setup_follow(node);
|
||||||
o->type = ABSOLUTE;
|
o->type = ABSOLUTE;
|
||||||
if ((n = obt_parse_find_node(node, "desktop")))
|
if ((n = obt_xml_find_node(node, "desktop")))
|
||||||
o->u.abs.desktop = obt_parse_node_int(n) - 1;
|
o->u.abs.desktop = obt_xml_node_int(n) - 1;
|
||||||
else
|
else
|
||||||
o->u.abs.desktop = screen_desktop;
|
o->u.abs.desktop = screen_desktop;
|
||||||
return o;
|
return o;
|
||||||
|
@ -404,8 +404,8 @@ static void setup_rel(Options *o, xmlNodePtr node, gboolean lin,
|
||||||
o->u.rel.dir = dir;
|
o->u.rel.dir = dir;
|
||||||
o->u.rel.wrap = TRUE;
|
o->u.rel.wrap = TRUE;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "wrap")))
|
if ((n = obt_xml_find_node(node, "wrap")))
|
||||||
o->u.rel.wrap = obt_parse_node_bool(n);
|
o->u.rel.wrap = obt_xml_node_bool(n);
|
||||||
|
|
||||||
if (input) {
|
if (input) {
|
||||||
o->interactive = TRUE;
|
o->interactive = TRUE;
|
||||||
|
|
|
@ -137,18 +137,18 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
o->dialog = TRUE;
|
o->dialog = TRUE;
|
||||||
o->bar = TRUE;
|
o->bar = TRUE;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "dialog")))
|
if ((n = obt_xml_find_node(node, "dialog")))
|
||||||
o->dialog = obt_parse_node_bool(n);
|
o->dialog = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "bar")))
|
if ((n = obt_xml_find_node(node, "bar")))
|
||||||
o->bar = obt_parse_node_bool(n);
|
o->bar = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "raise")))
|
if ((n = obt_xml_find_node(node, "raise")))
|
||||||
o->raise = obt_parse_node_bool(n);
|
o->raise = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "panels")))
|
if ((n = obt_xml_find_node(node, "panels")))
|
||||||
o->dock_windows = obt_parse_node_bool(n);
|
o->dock_windows = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "desktop")))
|
if ((n = obt_xml_find_node(node, "desktop")))
|
||||||
o->desktop_windows = obt_parse_node_bool(n);
|
o->desktop_windows = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "direction"))) {
|
if ((n = obt_xml_find_node(node, "direction"))) {
|
||||||
gchar *s = obt_parse_node_string(n);
|
gchar *s = obt_xml_node_string(n);
|
||||||
if (!g_ascii_strcasecmp(s, "north") ||
|
if (!g_ascii_strcasecmp(s, "north") ||
|
||||||
!g_ascii_strcasecmp(s, "up"))
|
!g_ascii_strcasecmp(s, "up"))
|
||||||
o->direction = OB_DIRECTION_NORTH;
|
o->direction = OB_DIRECTION_NORTH;
|
||||||
|
@ -172,14 +172,14 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
g_free(s);
|
g_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "finalactions"))) {
|
if ((n = obt_xml_find_node(node, "finalactions"))) {
|
||||||
xmlNodePtr m;
|
xmlNodePtr m;
|
||||||
|
|
||||||
m = obt_parse_find_node(n->children, "action");
|
m = obt_xml_find_node(n->children, "action");
|
||||||
while (m) {
|
while (m) {
|
||||||
ObActionsAct *action = actions_parse(m);
|
ObActionsAct *action = actions_parse(m);
|
||||||
if (action) o->actions = g_slist_append(o->actions, action);
|
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 {
|
else {
|
||||||
|
|
|
@ -43,27 +43,27 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "command")) ||
|
if ((n = obt_xml_find_node(node, "command")) ||
|
||||||
(n = obt_parse_find_node(node, "execute")))
|
(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);
|
o->cmd = obt_paths_expand_tilde(s);
|
||||||
g_free(s);
|
g_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "prompt")))
|
if ((n = obt_xml_find_node(node, "prompt")))
|
||||||
o->prompt = obt_parse_node_string(n);
|
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;
|
xmlNodePtr m;
|
||||||
if ((m = obt_parse_find_node(n->children, "enabled")))
|
if ((m = obt_xml_find_node(n->children, "enabled")))
|
||||||
o->sn = obt_parse_node_bool(m);
|
o->sn = obt_xml_node_bool(m);
|
||||||
if ((m = obt_parse_find_node(n->children, "name")))
|
if ((m = obt_xml_find_node(n->children, "name")))
|
||||||
o->sn_name = obt_parse_node_string(m);
|
o->sn_name = obt_xml_node_string(m);
|
||||||
if ((m = obt_parse_find_node(n->children, "icon")))
|
if ((m = obt_xml_find_node(n->children, "icon")))
|
||||||
o->sn_icon = obt_parse_node_string(m);
|
o->sn_icon = obt_xml_node_string(m);
|
||||||
if ((m = obt_parse_find_node(n->children, "wmclass")))
|
if ((m = obt_xml_find_node(n->children, "wmclass")))
|
||||||
o->sn_wmclass = obt_parse_node_string(m);
|
o->sn_wmclass = obt_xml_node_string(m);
|
||||||
}
|
}
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
o->prompt = TRUE;
|
o->prompt = TRUE;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "prompt")))
|
if ((n = obt_xml_find_node(node, "prompt")))
|
||||||
o->prompt = obt_parse_node_bool(n);
|
o->prompt = obt_xml_node_bool(n);
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "here")))
|
if ((n = obt_xml_find_node(node, "here")))
|
||||||
o->here = obt_parse_node_bool(n);
|
o->here = obt_xml_node_bool(n);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,8 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
o->dir = OB_DIRECTION_NORTH;
|
o->dir = OB_DIRECTION_NORTH;
|
||||||
o->shrink = FALSE;
|
o->shrink = FALSE;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "direction"))) {
|
if ((n = obt_xml_find_node(node, "direction"))) {
|
||||||
gchar *s = obt_parse_node_string(n);
|
gchar *s = obt_xml_node_string(n);
|
||||||
if (!g_ascii_strcasecmp(s, "north") ||
|
if (!g_ascii_strcasecmp(s, "north") ||
|
||||||
!g_ascii_strcasecmp(s, "up"))
|
!g_ascii_strcasecmp(s, "up"))
|
||||||
o->dir = OB_DIRECTION_NORTH;
|
o->dir = OB_DIRECTION_NORTH;
|
||||||
|
|
|
@ -39,61 +39,61 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "shaded"))) {
|
if ((n = obt_xml_find_node(node, "shaded"))) {
|
||||||
if (obt_parse_node_bool(n))
|
if (obt_xml_node_bool(n))
|
||||||
o->shaded_on = TRUE;
|
o->shaded_on = TRUE;
|
||||||
else
|
else
|
||||||
o->shaded_off = TRUE;
|
o->shaded_off = TRUE;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "maximized"))) {
|
if ((n = obt_xml_find_node(node, "maximized"))) {
|
||||||
if (obt_parse_node_bool(n))
|
if (obt_xml_node_bool(n))
|
||||||
o->maxfull_on = TRUE;
|
o->maxfull_on = TRUE;
|
||||||
else
|
else
|
||||||
o->maxfull_off = TRUE;
|
o->maxfull_off = TRUE;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "maximizedhorizontal"))) {
|
if ((n = obt_xml_find_node(node, "maximizedhorizontal"))) {
|
||||||
if (obt_parse_node_bool(n))
|
if (obt_xml_node_bool(n))
|
||||||
o->maxhorz_on = TRUE;
|
o->maxhorz_on = TRUE;
|
||||||
else
|
else
|
||||||
o->maxhorz_off = TRUE;
|
o->maxhorz_off = TRUE;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "maximizedvertical"))) {
|
if ((n = obt_xml_find_node(node, "maximizedvertical"))) {
|
||||||
if (obt_parse_node_bool(n))
|
if (obt_xml_node_bool(n))
|
||||||
o->maxvert_on = TRUE;
|
o->maxvert_on = TRUE;
|
||||||
else
|
else
|
||||||
o->maxvert_off = TRUE;
|
o->maxvert_off = TRUE;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "iconified"))) {
|
if ((n = obt_xml_find_node(node, "iconified"))) {
|
||||||
if (obt_parse_node_bool(n))
|
if (obt_xml_node_bool(n))
|
||||||
o->iconic_on = TRUE;
|
o->iconic_on = TRUE;
|
||||||
else
|
else
|
||||||
o->iconic_off = TRUE;
|
o->iconic_off = TRUE;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "focused"))) {
|
if ((n = obt_xml_find_node(node, "focused"))) {
|
||||||
if (obt_parse_node_bool(n))
|
if (obt_xml_node_bool(n))
|
||||||
o->focused = TRUE;
|
o->focused = TRUE;
|
||||||
else
|
else
|
||||||
o->unfocused = TRUE;
|
o->unfocused = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "then"))) {
|
if ((n = obt_xml_find_node(node, "then"))) {
|
||||||
xmlNodePtr m;
|
xmlNodePtr m;
|
||||||
|
|
||||||
m = obt_parse_find_node(n->children, "action");
|
m = obt_xml_find_node(n->children, "action");
|
||||||
while (m) {
|
while (m) {
|
||||||
ObActionsAct *action = actions_parse(m);
|
ObActionsAct *action = actions_parse(m);
|
||||||
if (action) o->thenacts = g_slist_append(o->thenacts, action);
|
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;
|
xmlNodePtr m;
|
||||||
|
|
||||||
m = obt_parse_find_node(n->children, "action");
|
m = obt_xml_find_node(n->children, "action");
|
||||||
while (m) {
|
while (m) {
|
||||||
ObActionsAct *action = actions_parse(m);
|
ObActionsAct *action = actions_parse(m);
|
||||||
if (action) o->elseacts = g_slist_append(o->elseacts, action);
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,8 @@ static gpointer setup_func_send(xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "layer"))) {
|
if ((n = obt_xml_find_node(node, "layer"))) {
|
||||||
gchar *s = obt_parse_node_string(n);
|
gchar *s = obt_xml_node_string(n);
|
||||||
if (!g_ascii_strcasecmp(s, "above") ||
|
if (!g_ascii_strcasecmp(s, "above") ||
|
||||||
!g_ascii_strcasecmp(s, "top"))
|
!g_ascii_strcasecmp(s, "top"))
|
||||||
o->layer = 1;
|
o->layer = 1;
|
||||||
|
|
|
@ -55,8 +55,8 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
o->dir = BOTH;
|
o->dir = BOTH;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "direction"))) {
|
if ((n = obt_xml_find_node(node, "direction"))) {
|
||||||
gchar *s = obt_parse_node_string(n);
|
gchar *s = obt_xml_node_string(n);
|
||||||
if (!g_ascii_strcasecmp(s, "vertical") ||
|
if (!g_ascii_strcasecmp(s, "vertical") ||
|
||||||
!g_ascii_strcasecmp(s, "vert"))
|
!g_ascii_strcasecmp(s, "vert"))
|
||||||
o->dir = VERT;
|
o->dir = VERT;
|
||||||
|
|
|
@ -24,10 +24,10 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "x")))
|
if ((n = obt_xml_find_node(node, "x")))
|
||||||
o->x = obt_parse_node_int(n);
|
o->x = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "y")))
|
if ((n = obt_xml_find_node(node, "y")))
|
||||||
o->y = obt_parse_node_int(n);
|
o->y = obt_xml_node_int(n);
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ void action_moveresizeto_startup(void)
|
||||||
static void parse_coord(xmlNodePtr n, gint *pos,
|
static void parse_coord(xmlNodePtr n, gint *pos,
|
||||||
gboolean *opposite, gboolean *center)
|
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, "current") != 0) {
|
||||||
if (!g_ascii_strcasecmp(s, "center"))
|
if (!g_ascii_strcasecmp(s, "center"))
|
||||||
*center = TRUE;
|
*center = TRUE;
|
||||||
|
@ -66,27 +66,27 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
o->h = G_MININT;
|
o->h = G_MININT;
|
||||||
o->monitor = CURRENT_MONITOR;
|
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);
|
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);
|
parse_coord(n, &o->y, &o->yopposite, &o->ycenter);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "width"))) {
|
if ((n = obt_xml_find_node(node, "width"))) {
|
||||||
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, "current") != 0)
|
||||||
o->w = obt_parse_node_int(n);
|
o->w = obt_xml_node_int(n);
|
||||||
g_free(s);
|
g_free(s);
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "height"))) {
|
if ((n = obt_xml_find_node(node, "height"))) {
|
||||||
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, "current") != 0)
|
||||||
o->h = obt_parse_node_int(n);
|
o->h = obt_xml_node_int(n);
|
||||||
g_free(s);
|
g_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "monitor"))) {
|
if ((n = obt_xml_find_node(node, "monitor"))) {
|
||||||
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, "current") != 0) {
|
||||||
if (!g_ascii_strcasecmp(s, "all"))
|
if (!g_ascii_strcasecmp(s, "all"))
|
||||||
o->monitor = ALL_MONITORS;
|
o->monitor = ALL_MONITORS;
|
||||||
|
@ -95,7 +95,7 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
else if(!g_ascii_strcasecmp(s, "prev"))
|
else if(!g_ascii_strcasecmp(s, "prev"))
|
||||||
o->monitor = PREV_MONITOR;
|
o->monitor = PREV_MONITOR;
|
||||||
else
|
else
|
||||||
o->monitor = obt_parse_node_int(n) - 1;
|
o->monitor = obt_xml_node_int(n) - 1;
|
||||||
}
|
}
|
||||||
g_free(s);
|
g_free(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,8 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
o->dir = OB_DIRECTION_NORTH;
|
o->dir = OB_DIRECTION_NORTH;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "direction"))) {
|
if ((n = obt_xml_find_node(node, "direction"))) {
|
||||||
gchar *s = obt_parse_node_string(n);
|
gchar *s = obt_xml_node_string(n);
|
||||||
if (!g_ascii_strcasecmp(s, "north") ||
|
if (!g_ascii_strcasecmp(s, "north") ||
|
||||||
!g_ascii_strcasecmp(s, "up"))
|
!g_ascii_strcasecmp(s, "up"))
|
||||||
o->dir = OB_DIRECTION_NORTH;
|
o->dir = OB_DIRECTION_NORTH;
|
||||||
|
|
|
@ -27,8 +27,8 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "edge"))) {
|
if ((n = obt_xml_find_node(node, "edge"))) {
|
||||||
gchar *s = obt_parse_node_string(n);
|
gchar *s = obt_xml_node_string(n);
|
||||||
|
|
||||||
o->corner_specified = TRUE;
|
o->corner_specified = TRUE;
|
||||||
if (!g_ascii_strcasecmp(s, "top"))
|
if (!g_ascii_strcasecmp(s, "top"))
|
||||||
|
|
|
@ -26,16 +26,16 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "left")))
|
if ((n = obt_xml_find_node(node, "left")))
|
||||||
o->left = obt_parse_node_int(n);
|
o->left = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "right")))
|
if ((n = obt_xml_find_node(node, "right")))
|
||||||
o->right = obt_parse_node_int(n);
|
o->right = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "top")) ||
|
if ((n = obt_xml_find_node(node, "top")) ||
|
||||||
(n = obt_parse_find_node(node, "up")))
|
(n = obt_xml_find_node(node, "up")))
|
||||||
o->top = obt_parse_node_int(n);
|
o->top = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "bottom")) ||
|
if ((n = obt_xml_find_node(node, "bottom")) ||
|
||||||
(n = obt_parse_find_node(node, "down")))
|
(n = obt_xml_find_node(node, "down")))
|
||||||
o->bottom = obt_parse_node_int(n);
|
o->bottom = obt_xml_node_int(n);
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,10 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "command")) ||
|
if ((n = obt_xml_find_node(node, "command")) ||
|
||||||
(n = obt_parse_find_node(node, "execute")))
|
(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);
|
o->cmd = obt_paths_expand_tilde(s);
|
||||||
g_free(s);
|
g_free(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ static gpointer setup_func(xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "menu")))
|
if ((n = obt_xml_find_node(node, "menu")))
|
||||||
o->name = obt_parse_node_string(n);
|
o->name = obt_xml_node_string(n);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
442
openbox/config.c
442
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)
|
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"))
|
if (!g_ascii_strcasecmp(s, "center"))
|
||||||
c->center = TRUE;
|
c->center = TRUE;
|
||||||
else {
|
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)
|
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;
|
gchar *name = NULL, *class = NULL, *role = NULL, *type = NULL;
|
||||||
gboolean name_set, class_set, type_set;
|
gboolean name_set, class_set, type_set;
|
||||||
gboolean x_pos_given;
|
gboolean x_pos_given;
|
||||||
|
@ -206,9 +206,9 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d)
|
||||||
while (app) {
|
while (app) {
|
||||||
x_pos_given = FALSE;
|
x_pos_given = FALSE;
|
||||||
|
|
||||||
class_set = obt_parse_attr_string(app, "class", &class);
|
class_set = obt_xml_attr_string(app, "class", &class);
|
||||||
name_set = obt_parse_attr_string(app, "name", &name);
|
name_set = obt_xml_attr_string(app, "name", &name);
|
||||||
type_set = obt_parse_attr_string(app, "type", &type);
|
type_set = obt_xml_attr_string(app, "type", &type);
|
||||||
if (class_set || name_set) {
|
if (class_set || name_set) {
|
||||||
xmlNodePtr n, c;
|
xmlNodePtr n, c;
|
||||||
ObAppSettings *settings = config_create_app_settings();;
|
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;
|
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);
|
settings->role = g_pattern_spec_new(role);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(app->children, "decor")))
|
if ((n = obt_xml_find_node(app->children, "decor")))
|
||||||
if (!obt_parse_node_contains(n, "default"))
|
if (!obt_xml_node_contains(n, "default"))
|
||||||
settings->decor = obt_parse_node_bool(n);
|
settings->decor = obt_xml_node_bool(n);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(app->children, "shade")))
|
if ((n = obt_xml_find_node(app->children, "shade")))
|
||||||
if (!obt_parse_node_contains(n, "default"))
|
if (!obt_xml_node_contains(n, "default"))
|
||||||
settings->shade = obt_parse_node_bool(n);
|
settings->shade = obt_xml_node_bool(n);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(app->children, "position"))) {
|
if ((n = obt_xml_find_node(app->children, "position"))) {
|
||||||
if ((c = obt_parse_find_node(n->children, "x")))
|
if ((c = obt_xml_find_node(n->children, "x")))
|
||||||
if (!obt_parse_node_contains(c, "default")) {
|
if (!obt_xml_node_contains(c, "default")) {
|
||||||
config_parse_gravity_coord(c, &settings->position.x);
|
config_parse_gravity_coord(c, &settings->position.x);
|
||||||
x_pos_given = TRUE;
|
x_pos_given = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x_pos_given && (c = obt_parse_find_node(n->children, "y")))
|
if (x_pos_given && (c = obt_xml_find_node(n->children, "y")))
|
||||||
if (!obt_parse_node_contains(c, "default")) {
|
if (!obt_xml_node_contains(c, "default")) {
|
||||||
config_parse_gravity_coord(c, &settings->position.y);
|
config_parse_gravity_coord(c, &settings->position.y);
|
||||||
settings->pos_given = TRUE;
|
settings->pos_given = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->pos_given &&
|
if (settings->pos_given &&
|
||||||
(c = obt_parse_find_node(n->children, "monitor")))
|
(c = obt_xml_find_node(n->children, "monitor")))
|
||||||
if (!obt_parse_node_contains(c, "default")) {
|
if (!obt_xml_node_contains(c, "default")) {
|
||||||
gchar *s = obt_parse_node_string(c);
|
gchar *s = obt_xml_node_string(c);
|
||||||
if (!g_ascii_strcasecmp(s, "mouse"))
|
if (!g_ascii_strcasecmp(s, "mouse"))
|
||||||
settings->monitor = 0;
|
settings->monitor = 0;
|
||||||
else
|
else
|
||||||
settings->monitor = obt_parse_node_int(c);
|
settings->monitor = obt_xml_node_int(c);
|
||||||
g_free(s);
|
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 ((n = obt_xml_find_node(app->children, "focus")))
|
||||||
if (!obt_parse_node_contains(n, "default"))
|
if (!obt_xml_node_contains(n, "default"))
|
||||||
settings->focus = obt_parse_node_bool(n);
|
settings->focus = obt_xml_node_bool(n);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(app->children, "desktop"))) {
|
if ((n = obt_xml_find_node(app->children, "desktop"))) {
|
||||||
if (!obt_parse_node_contains(n, "default")) {
|
if (!obt_xml_node_contains(n, "default")) {
|
||||||
gchar *s = obt_parse_node_string(n);
|
gchar *s = obt_xml_node_string(n);
|
||||||
if (!g_ascii_strcasecmp(s, "all"))
|
if (!g_ascii_strcasecmp(s, "all"))
|
||||||
settings->desktop = DESKTOP_ALL;
|
settings->desktop = DESKTOP_ALL;
|
||||||
else {
|
else {
|
||||||
gint i = obt_parse_node_int(n);
|
gint i = obt_xml_node_int(n);
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
settings->desktop = i;
|
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 ((n = obt_xml_find_node(app->children, "layer")))
|
||||||
if (!obt_parse_node_contains(n, "default")) {
|
if (!obt_xml_node_contains(n, "default")) {
|
||||||
gchar *s = obt_parse_node_string(n);
|
gchar *s = obt_xml_node_string(n);
|
||||||
if (!g_ascii_strcasecmp(s, "above"))
|
if (!g_ascii_strcasecmp(s, "above"))
|
||||||
settings->layer = 1;
|
settings->layer = 1;
|
||||||
else if (!g_ascii_strcasecmp(s, "below"))
|
else if (!g_ascii_strcasecmp(s, "below"))
|
||||||
|
@ -306,25 +306,25 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d)
|
||||||
g_free(s);
|
g_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(app->children, "iconic")))
|
if ((n = obt_xml_find_node(app->children, "iconic")))
|
||||||
if (!obt_parse_node_contains(n, "default"))
|
if (!obt_xml_node_contains(n, "default"))
|
||||||
settings->iconic = obt_parse_node_bool(n);
|
settings->iconic = obt_xml_node_bool(n);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(app->children, "skip_pager")))
|
if ((n = obt_xml_find_node(app->children, "skip_pager")))
|
||||||
if (!obt_parse_node_contains(n, "default"))
|
if (!obt_xml_node_contains(n, "default"))
|
||||||
settings->skip_pager = obt_parse_node_bool(n);
|
settings->skip_pager = obt_xml_node_bool(n);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(app->children, "skip_taskbar")))
|
if ((n = obt_xml_find_node(app->children, "skip_taskbar")))
|
||||||
if (!obt_parse_node_contains(n, "default"))
|
if (!obt_xml_node_contains(n, "default"))
|
||||||
settings->skip_taskbar = obt_parse_node_bool(n);
|
settings->skip_taskbar = obt_xml_node_bool(n);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(app->children, "fullscreen")))
|
if ((n = obt_xml_find_node(app->children, "fullscreen")))
|
||||||
if (!obt_parse_node_contains(n, "default"))
|
if (!obt_xml_node_contains(n, "default"))
|
||||||
settings->fullscreen = obt_parse_node_bool(n);
|
settings->fullscreen = obt_xml_node_bool(n);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(app->children, "maximized")))
|
if ((n = obt_xml_find_node(app->children, "maximized")))
|
||||||
if (!obt_parse_node_contains(n, "default")) {
|
if (!obt_xml_node_contains(n, "default")) {
|
||||||
gchar *s = obt_parse_node_string(n);
|
gchar *s = obt_xml_node_string(n);
|
||||||
if (!g_ascii_strcasecmp(s, "horizontal")) {
|
if (!g_ascii_strcasecmp(s, "horizontal")) {
|
||||||
settings->max_horz = TRUE;
|
settings->max_horz = TRUE;
|
||||||
settings->max_vert = FALSE;
|
settings->max_vert = FALSE;
|
||||||
|
@ -333,7 +333,7 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d)
|
||||||
settings->max_vert = TRUE;
|
settings->max_vert = TRUE;
|
||||||
} else
|
} else
|
||||||
settings->max_horz = settings->max_vert =
|
settings->max_horz = settings->max_vert =
|
||||||
obt_parse_node_bool(n);
|
obt_xml_node_bool(n);
|
||||||
g_free(s);
|
g_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d)
|
||||||
name = class = role = NULL;
|
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;
|
xmlNodePtr n;
|
||||||
gboolean is_chroot = FALSE;
|
gboolean is_chroot = FALSE;
|
||||||
|
|
||||||
if (!obt_parse_attr_string(node, "key", &key))
|
if (!obt_xml_attr_string(node, "key", &key))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
obt_parse_attr_bool(node, "chroot", &is_chroot);
|
obt_xml_attr_bool(node, "chroot", &is_chroot);
|
||||||
|
|
||||||
keylist = g_list_append(keylist, key);
|
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) {
|
while (n) {
|
||||||
parse_key(n, keylist);
|
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) {
|
while (n) {
|
||||||
ObActionsAct *action;
|
ObActionsAct *action;
|
||||||
|
|
||||||
action = actions_parse(n);
|
action = actions_parse(n);
|
||||||
if (action)
|
if (action)
|
||||||
keyboard_bind(keylist, 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();
|
keyboard_unbind_all();
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node->children, "chainQuitKey"))) {
|
if ((n = obt_xml_find_node(node->children, "chainQuitKey"))) {
|
||||||
key = obt_parse_node_string(n);
|
key = obt_xml_node_string(n);
|
||||||
translate_key(key, &config_keyboard_reset_state,
|
translate_key(key, &config_keyboard_reset_state,
|
||||||
&config_keyboard_reset_keycode);
|
&config_keyboard_reset_keycode);
|
||||||
g_free(key);
|
g_free(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node->children, "keybind")))
|
if ((n = obt_xml_find_node(node->children, "keybind")))
|
||||||
while (n) {
|
while (n) {
|
||||||
parse_key(n, NULL);
|
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;
|
node = node->children;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "dragThreshold")))
|
if ((n = obt_xml_find_node(node, "dragThreshold")))
|
||||||
config_mouse_threshold = obt_parse_node_int(n);
|
config_mouse_threshold = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "doubleClickTime")))
|
if ((n = obt_xml_find_node(node, "doubleClickTime")))
|
||||||
config_mouse_dclicktime = obt_parse_node_int(n);
|
config_mouse_dclicktime = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "screenEdgeWarpTime"))) {
|
if ((n = obt_xml_find_node(node, "screenEdgeWarpTime"))) {
|
||||||
config_mouse_screenedgetime = obt_parse_node_int(n);
|
config_mouse_screenedgetime = obt_xml_node_int(n);
|
||||||
/* minimum value of 25 for this property, when it is 1 and you hit the
|
/* minimum value of 25 for this property, when it is 1 and you hit the
|
||||||
edge it basically never stops */
|
edge it basically never stops */
|
||||||
if (config_mouse_screenedgetime && config_mouse_screenedgetime < 25)
|
if (config_mouse_screenedgetime && config_mouse_screenedgetime < 25)
|
||||||
config_mouse_screenedgetime = 25;
|
config_mouse_screenedgetime = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = obt_parse_find_node(node, "context");
|
n = obt_xml_find_node(node, "context");
|
||||||
while (n) {
|
while (n) {
|
||||||
if (!obt_parse_attr_string(n, "name", &contextstr))
|
if (!obt_xml_attr_string(n, "name", &contextstr))
|
||||||
goto next_n;
|
goto next_n;
|
||||||
nbut = obt_parse_find_node(n->children, "mousebind");
|
nbut = obt_xml_find_node(n->children, "mousebind");
|
||||||
while (nbut) {
|
while (nbut) {
|
||||||
if (!obt_parse_attr_string(nbut, "button", &buttonstr))
|
if (!obt_xml_attr_string(nbut, "button", &buttonstr))
|
||||||
goto next_nbut;
|
goto next_nbut;
|
||||||
if (obt_parse_attr_contains(nbut, "action", "press")) {
|
if (obt_xml_attr_contains(nbut, "action", "press")) {
|
||||||
mact = OB_MOUSE_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;
|
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;
|
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;
|
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;
|
mact = OB_MOUSE_ACTION_MOTION;
|
||||||
} else
|
} else
|
||||||
goto next_nbut;
|
goto next_nbut;
|
||||||
nact = obt_parse_find_node(nbut->children, "action");
|
nact = obt_xml_find_node(nbut->children, "action");
|
||||||
while (nact) {
|
while (nact) {
|
||||||
ObActionsAct *action;
|
ObActionsAct *action;
|
||||||
|
|
||||||
if ((action = actions_parse(nact)))
|
if ((action = actions_parse(nact)))
|
||||||
mouse_bind(buttonstr, contextstr, mact, action);
|
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);
|
g_free(buttonstr);
|
||||||
next_nbut:
|
next_nbut:
|
||||||
nbut = obt_parse_find_node(nbut->next, "mousebind");
|
nbut = obt_xml_find_node(nbut->next, "mousebind");
|
||||||
}
|
}
|
||||||
g_free(contextstr);
|
g_free(contextstr);
|
||||||
next_n:
|
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;
|
node = node->children;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "focusNew")))
|
if ((n = obt_xml_find_node(node, "focusNew")))
|
||||||
config_focus_new = obt_parse_node_bool(n);
|
config_focus_new = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "followMouse")))
|
if ((n = obt_xml_find_node(node, "followMouse")))
|
||||||
config_focus_follow = obt_parse_node_bool(n);
|
config_focus_follow = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "focusDelay")))
|
if ((n = obt_xml_find_node(node, "focusDelay")))
|
||||||
config_focus_delay = obt_parse_node_int(n);
|
config_focus_delay = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "raiseOnFocus")))
|
if ((n = obt_xml_find_node(node, "raiseOnFocus")))
|
||||||
config_focus_raise = obt_parse_node_bool(n);
|
config_focus_raise = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "focusLast")))
|
if ((n = obt_xml_find_node(node, "focusLast")))
|
||||||
config_focus_last = obt_parse_node_bool(n);
|
config_focus_last = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "underMouse")))
|
if ((n = obt_xml_find_node(node, "underMouse")))
|
||||||
config_focus_under_mouse = obt_parse_node_bool(n);
|
config_focus_under_mouse = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "unfocusOnLeave")))
|
if ((n = obt_xml_find_node(node, "unfocusOnLeave")))
|
||||||
config_unfocus_leave = obt_parse_node_bool(n);
|
config_unfocus_leave = obt_xml_node_bool(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_placement(xmlNodePtr node, gpointer d)
|
static void parse_placement(xmlNodePtr node, gpointer d)
|
||||||
|
@ -516,21 +516,21 @@ static void parse_placement(xmlNodePtr node, gpointer d)
|
||||||
|
|
||||||
node = node->children;
|
node = node->children;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "policy")))
|
if ((n = obt_xml_find_node(node, "policy")))
|
||||||
if (obt_parse_node_contains(n, "UnderMouse"))
|
if (obt_xml_node_contains(n, "UnderMouse"))
|
||||||
config_place_policy = OB_PLACE_POLICY_MOUSE;
|
config_place_policy = OB_PLACE_POLICY_MOUSE;
|
||||||
if ((n = obt_parse_find_node(node, "center")))
|
if ((n = obt_xml_find_node(node, "center")))
|
||||||
config_place_center = obt_parse_node_bool(n);
|
config_place_center = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "monitor"))) {
|
if ((n = obt_xml_find_node(node, "monitor"))) {
|
||||||
if (obt_parse_node_contains(n, "active"))
|
if (obt_xml_node_contains(n, "active"))
|
||||||
config_place_monitor = OB_PLACE_MONITOR_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;
|
config_place_monitor = OB_PLACE_MONITOR_MOUSE;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "primaryMonitor"))) {
|
if ((n = obt_xml_find_node(node, "primaryMonitor"))) {
|
||||||
config_primary_monitor_index = obt_parse_node_int(n);
|
config_primary_monitor_index = obt_xml_node_int(n);
|
||||||
if (!config_primary_monitor_index) {
|
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;
|
config_primary_monitor = OB_PLACE_MONITOR_MOUSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -542,14 +542,14 @@ static void parse_margins(xmlNodePtr node, gpointer d)
|
||||||
|
|
||||||
node = node->children;
|
node = node->children;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "top")))
|
if ((n = obt_xml_find_node(node, "top")))
|
||||||
config_margins.top = MAX(0, obt_parse_node_int(n));
|
config_margins.top = MAX(0, obt_xml_node_int(n));
|
||||||
if ((n = obt_parse_find_node(node, "left")))
|
if ((n = obt_xml_find_node(node, "left")))
|
||||||
config_margins.left = MAX(0, obt_parse_node_int(n));
|
config_margins.left = MAX(0, obt_xml_node_int(n));
|
||||||
if ((n = obt_parse_find_node(node, "right")))
|
if ((n = obt_xml_find_node(node, "right")))
|
||||||
config_margins.right = MAX(0, obt_parse_node_int(n));
|
config_margins.right = MAX(0, obt_xml_node_int(n));
|
||||||
if ((n = obt_parse_find_node(node, "bottom")))
|
if ((n = obt_xml_find_node(node, "bottom")))
|
||||||
config_margins.bottom = MAX(0, obt_parse_node_int(n));
|
config_margins.bottom = MAX(0, obt_xml_node_int(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_theme(xmlNodePtr node, gpointer d)
|
static void parse_theme(xmlNodePtr node, gpointer d)
|
||||||
|
@ -558,38 +558,38 @@ static void parse_theme(xmlNodePtr node, gpointer d)
|
||||||
|
|
||||||
node = node->children;
|
node = node->children;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "name"))) {
|
if ((n = obt_xml_find_node(node, "name"))) {
|
||||||
gchar *c;
|
gchar *c;
|
||||||
|
|
||||||
g_free(config_theme);
|
g_free(config_theme);
|
||||||
c = obt_parse_node_string(n);
|
c = obt_xml_node_string(n);
|
||||||
config_theme = obt_paths_expand_tilde(c);
|
config_theme = obt_paths_expand_tilde(c);
|
||||||
g_free(c);
|
g_free(c);
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "titleLayout"))) {
|
if ((n = obt_xml_find_node(node, "titleLayout"))) {
|
||||||
gchar *c, *d;
|
gchar *c, *d;
|
||||||
|
|
||||||
g_free(config_title_layout);
|
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 */
|
/* replace duplicates with spaces */
|
||||||
for (c = config_title_layout; *c != '\0'; ++c)
|
for (c = config_title_layout; *c != '\0'; ++c)
|
||||||
for (d = c+1; *d != '\0'; ++d)
|
for (d = c+1; *d != '\0'; ++d)
|
||||||
if (*c == *d) *d = ' ';
|
if (*c == *d) *d = ' ';
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "keepBorder")))
|
if ((n = obt_xml_find_node(node, "keepBorder")))
|
||||||
config_theme_keepborder = obt_parse_node_bool(n);
|
config_theme_keepborder = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "animateIconify")))
|
if ((n = obt_xml_find_node(node, "animateIconify")))
|
||||||
config_animate_iconify = obt_parse_node_bool(n);
|
config_animate_iconify = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "windowListIconSize"))) {
|
if ((n = obt_xml_find_node(node, "windowListIconSize"))) {
|
||||||
config_theme_window_list_icon_size = obt_parse_node_int(n);
|
config_theme_window_list_icon_size = obt_xml_node_int(n);
|
||||||
if (config_theme_window_list_icon_size < 16)
|
if (config_theme_window_list_icon_size < 16)
|
||||||
config_theme_window_list_icon_size = 16;
|
config_theme_window_list_icon_size = 16;
|
||||||
else if (config_theme_window_list_icon_size > 96)
|
else if (config_theme_window_list_icon_size > 96)
|
||||||
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) {
|
while (n) {
|
||||||
xmlNodePtr fnode;
|
xmlNodePtr fnode;
|
||||||
RrFont **font;
|
RrFont **font;
|
||||||
|
@ -598,39 +598,39 @@ static void parse_theme(xmlNodePtr node, gpointer d)
|
||||||
RrFontWeight weight = RrDefaultFontWeight;
|
RrFontWeight weight = RrDefaultFontWeight;
|
||||||
RrFontSlant slant = RrDefaultFontSlant;
|
RrFontSlant slant = RrDefaultFontSlant;
|
||||||
|
|
||||||
if (obt_parse_attr_contains(n, "place", "ActiveWindow"))
|
if (obt_xml_attr_contains(n, "place", "ActiveWindow"))
|
||||||
font = &config_font_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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
font = &config_font_inactiveosd;
|
||||||
else
|
else
|
||||||
goto next_font;
|
goto next_font;
|
||||||
|
|
||||||
if ((fnode = obt_parse_find_node(n->children, "name"))) {
|
if ((fnode = obt_xml_find_node(n->children, "name"))) {
|
||||||
g_free(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"))) {
|
if ((fnode = obt_xml_find_node(n->children, "size"))) {
|
||||||
int s = obt_parse_node_int(fnode);
|
int s = obt_xml_node_int(fnode);
|
||||||
if (s > 0) size = s;
|
if (s > 0) size = s;
|
||||||
}
|
}
|
||||||
if ((fnode = obt_parse_find_node(n->children, "weight"))) {
|
if ((fnode = obt_xml_find_node(n->children, "weight"))) {
|
||||||
gchar *w = obt_parse_node_string(fnode);
|
gchar *w = obt_xml_node_string(fnode);
|
||||||
if (!g_ascii_strcasecmp(w, "Bold"))
|
if (!g_ascii_strcasecmp(w, "Bold"))
|
||||||
weight = RR_FONTWEIGHT_BOLD;
|
weight = RR_FONTWEIGHT_BOLD;
|
||||||
g_free(w);
|
g_free(w);
|
||||||
}
|
}
|
||||||
if ((fnode = obt_parse_find_node(n->children, "slant"))) {
|
if ((fnode = obt_xml_find_node(n->children, "slant"))) {
|
||||||
gchar *s = obt_parse_node_string(fnode);
|
gchar *s = obt_xml_node_string(fnode);
|
||||||
if (!g_ascii_strcasecmp(s, "Italic"))
|
if (!g_ascii_strcasecmp(s, "Italic"))
|
||||||
slant = RR_FONTSLANT_ITALIC;
|
slant = RR_FONTSLANT_ITALIC;
|
||||||
if (!g_ascii_strcasecmp(s, "Oblique"))
|
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);
|
*font = RrFontOpen(ob_rr_inst, name, size, weight, slant);
|
||||||
g_free(name);
|
g_free(name);
|
||||||
next_font:
|
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;
|
node = node->children;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "number"))) {
|
if ((n = obt_xml_find_node(node, "number"))) {
|
||||||
gint d = obt_parse_node_int(n);
|
gint d = obt_xml_node_int(n);
|
||||||
if (d > 0)
|
if (d > 0)
|
||||||
config_desktops_num = (unsigned) d;
|
config_desktops_num = (unsigned) d;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "firstdesk"))) {
|
if ((n = obt_xml_find_node(node, "firstdesk"))) {
|
||||||
gint d = obt_parse_node_int(n);
|
gint d = obt_xml_node_int(n);
|
||||||
if (d > 0)
|
if (d > 0)
|
||||||
config_screen_firstdesk = (unsigned) d;
|
config_screen_firstdesk = (unsigned) d;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "names"))) {
|
if ((n = obt_xml_find_node(node, "names"))) {
|
||||||
GSList *it;
|
GSList *it;
|
||||||
xmlNodePtr nname;
|
xmlNodePtr nname;
|
||||||
|
|
||||||
|
@ -670,16 +670,16 @@ static void parse_desktops(xmlNodePtr node, gpointer d)
|
||||||
g_slist_free(config_desktops_names);
|
g_slist_free(config_desktops_names);
|
||||||
config_desktops_names = NULL;
|
config_desktops_names = NULL;
|
||||||
|
|
||||||
nname = obt_parse_find_node(n->children, "name");
|
nname = obt_xml_find_node(n->children, "name");
|
||||||
while (nname) {
|
while (nname) {
|
||||||
config_desktops_names =
|
config_desktops_names =
|
||||||
g_slist_append(config_desktops_names,
|
g_slist_append(config_desktops_names,
|
||||||
obt_parse_node_string(nname));
|
obt_xml_node_string(nname));
|
||||||
nname = obt_parse_find_node(nname->next, "name");
|
nname = obt_xml_find_node(nname->next, "name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "popupTime")))
|
if ((n = obt_xml_find_node(node, "popupTime")))
|
||||||
config_desktop_popup_time = obt_parse_node_int(n);
|
config_desktop_popup_time = obt_xml_node_int(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_resize(xmlNodePtr node, gpointer d)
|
static void parse_resize(xmlNodePtr node, gpointer d)
|
||||||
|
@ -688,32 +688,32 @@ static void parse_resize(xmlNodePtr node, gpointer d)
|
||||||
|
|
||||||
node = node->children;
|
node = node->children;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "drawContents")))
|
if ((n = obt_xml_find_node(node, "drawContents")))
|
||||||
config_resize_redraw = obt_parse_node_bool(n);
|
config_resize_redraw = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "popupShow"))) {
|
if ((n = obt_xml_find_node(node, "popupShow"))) {
|
||||||
config_resize_popup_show = obt_parse_node_int(n);
|
config_resize_popup_show = obt_xml_node_int(n);
|
||||||
if (obt_parse_node_contains(n, "Always"))
|
if (obt_xml_node_contains(n, "Always"))
|
||||||
config_resize_popup_show = 2;
|
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;
|
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;
|
config_resize_popup_show = 1;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "popupPosition"))) {
|
if ((n = obt_xml_find_node(node, "popupPosition"))) {
|
||||||
if (obt_parse_node_contains(n, "Top"))
|
if (obt_xml_node_contains(n, "Top"))
|
||||||
config_resize_popup_pos = OB_RESIZE_POS_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;
|
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;
|
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;
|
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_parse_gravity_coord(n2,
|
||||||
&config_resize_popup_fixed.x);
|
&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_parse_gravity_coord(n2,
|
||||||
&config_resize_popup_fixed.y);
|
&config_resize_popup_fixed.y);
|
||||||
|
|
||||||
|
@ -732,65 +732,65 @@ static void parse_dock(xmlNodePtr node, gpointer d)
|
||||||
|
|
||||||
node = node->children;
|
node = node->children;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "position"))) {
|
if ((n = obt_xml_find_node(node, "position"))) {
|
||||||
if (obt_parse_node_contains(n, "TopLeft"))
|
if (obt_xml_node_contains(n, "TopLeft"))
|
||||||
config_dock_floating = FALSE,
|
config_dock_floating = FALSE,
|
||||||
config_dock_pos = OB_DIRECTION_NORTHWEST;
|
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_floating = FALSE,
|
||||||
config_dock_pos = OB_DIRECTION_NORTH;
|
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_floating = FALSE,
|
||||||
config_dock_pos = OB_DIRECTION_NORTHEAST;
|
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_floating = FALSE,
|
||||||
config_dock_pos = OB_DIRECTION_EAST;
|
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_floating = FALSE,
|
||||||
config_dock_pos = OB_DIRECTION_SOUTHEAST;
|
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_floating = FALSE,
|
||||||
config_dock_pos = OB_DIRECTION_SOUTH;
|
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_floating = FALSE,
|
||||||
config_dock_pos = OB_DIRECTION_SOUTHWEST;
|
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_floating = FALSE,
|
||||||
config_dock_pos = OB_DIRECTION_WEST;
|
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;
|
config_dock_floating = TRUE;
|
||||||
}
|
}
|
||||||
if (config_dock_floating) {
|
if (config_dock_floating) {
|
||||||
if ((n = obt_parse_find_node(node, "floatingX")))
|
if ((n = obt_xml_find_node(node, "floatingX")))
|
||||||
config_dock_x = obt_parse_node_int(n);
|
config_dock_x = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "floatingY")))
|
if ((n = obt_xml_find_node(node, "floatingY")))
|
||||||
config_dock_y = obt_parse_node_int(n);
|
config_dock_y = obt_xml_node_int(n);
|
||||||
} else {
|
} else {
|
||||||
if ((n = obt_parse_find_node(node, "noStrut")))
|
if ((n = obt_xml_find_node(node, "noStrut")))
|
||||||
config_dock_nostrut = obt_parse_node_bool(n);
|
config_dock_nostrut = obt_xml_node_bool(n);
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "stacking"))) {
|
if ((n = obt_xml_find_node(node, "stacking"))) {
|
||||||
if (obt_parse_node_contains(n, "normal"))
|
if (obt_xml_node_contains(n, "normal"))
|
||||||
config_dock_layer = OB_STACKING_LAYER_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;
|
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;
|
config_dock_layer = OB_STACKING_LAYER_ABOVE;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "direction"))) {
|
if ((n = obt_xml_find_node(node, "direction"))) {
|
||||||
if (obt_parse_node_contains(n, "horizontal"))
|
if (obt_xml_node_contains(n, "horizontal"))
|
||||||
config_dock_orient = OB_ORIENTATION_HORZ;
|
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;
|
config_dock_orient = OB_ORIENTATION_VERT;
|
||||||
}
|
}
|
||||||
if ((n = obt_parse_find_node(node, "autoHide")))
|
if ((n = obt_xml_find_node(node, "autoHide")))
|
||||||
config_dock_hide = obt_parse_node_bool(n);
|
config_dock_hide = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "hideDelay")))
|
if ((n = obt_xml_find_node(node, "hideDelay")))
|
||||||
config_dock_hide_delay = obt_parse_node_int(n);
|
config_dock_hide_delay = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "showDelay")))
|
if ((n = obt_xml_find_node(node, "showDelay")))
|
||||||
config_dock_show_delay = obt_parse_node_int(n);
|
config_dock_show_delay = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "moveButton"))) {
|
if ((n = obt_xml_find_node(node, "moveButton"))) {
|
||||||
gchar *str = obt_parse_node_string(n);
|
gchar *str = obt_xml_node_string(n);
|
||||||
guint b, s;
|
guint b, s;
|
||||||
if (translate_button(str, &s, &b)) {
|
if (translate_button(str, &s, &b)) {
|
||||||
config_dock_app_move_button = b;
|
config_dock_app_move_button = b;
|
||||||
|
@ -807,19 +807,19 @@ static void parse_menu(xmlNodePtr node, gpointer d)
|
||||||
xmlNodePtr n;
|
xmlNodePtr n;
|
||||||
node = node->children;
|
node = node->children;
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node, "hideDelay")))
|
if ((n = obt_xml_find_node(node, "hideDelay")))
|
||||||
config_menu_hide_delay = obt_parse_node_int(n);
|
config_menu_hide_delay = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "middle")))
|
if ((n = obt_xml_find_node(node, "middle")))
|
||||||
config_menu_middle = obt_parse_node_bool(n);
|
config_menu_middle = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "submenuShowDelay")))
|
if ((n = obt_xml_find_node(node, "submenuShowDelay")))
|
||||||
config_submenu_show_delay = obt_parse_node_int(n);
|
config_submenu_show_delay = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "applicationIcons")))
|
if ((n = obt_xml_find_node(node, "applicationIcons")))
|
||||||
config_menu_client_list_icons = obt_parse_node_bool(n);
|
config_menu_client_list_icons = obt_xml_node_bool(n);
|
||||||
if ((n = obt_parse_find_node(node, "manageDesktops")))
|
if ((n = obt_xml_find_node(node, "manageDesktops")))
|
||||||
config_menu_manage_desktops = obt_parse_node_bool(n);
|
config_menu_manage_desktops = obt_xml_node_bool(n);
|
||||||
|
|
||||||
while ((node = obt_parse_find_node(node, "file"))) {
|
while ((node = obt_xml_find_node(node, "file"))) {
|
||||||
gchar *c = obt_parse_node_string(node);
|
gchar *c = obt_xml_node_string(node);
|
||||||
config_menu_files = g_slist_append(config_menu_files,
|
config_menu_files = g_slist_append(config_menu_files,
|
||||||
obt_paths_expand_tilde(c));
|
obt_paths_expand_tilde(c));
|
||||||
g_free(c);
|
g_free(c);
|
||||||
|
@ -832,10 +832,10 @@ static void parse_resistance(xmlNodePtr node, gpointer d)
|
||||||
xmlNodePtr n;
|
xmlNodePtr n;
|
||||||
|
|
||||||
node = node->children;
|
node = node->children;
|
||||||
if ((n = obt_parse_find_node(node, "strength")))
|
if ((n = obt_xml_find_node(node, "strength")))
|
||||||
config_resist_win = obt_parse_node_int(n);
|
config_resist_win = obt_xml_node_int(n);
|
||||||
if ((n = obt_parse_find_node(node, "screen_edge_strength")))
|
if ((n = obt_xml_find_node(node, "screen_edge_strength")))
|
||||||
config_resist_edge = obt_parse_node_int(n);
|
config_resist_edge = obt_xml_node_int(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -926,7 +926,7 @@ static void bind_default_mouse(void)
|
||||||
actions_parse_string(it->actname));
|
actions_parse_string(it->actname));
|
||||||
}
|
}
|
||||||
|
|
||||||
void config_startup(ObtParseInst *i)
|
void config_startup(ObtXmlInst *i)
|
||||||
{
|
{
|
||||||
config_focus_new = TRUE;
|
config_focus_new = TRUE;
|
||||||
config_focus_follow = FALSE;
|
config_focus_follow = FALSE;
|
||||||
|
@ -936,7 +936,7 @@ void config_startup(ObtParseInst *i)
|
||||||
config_focus_under_mouse = FALSE;
|
config_focus_under_mouse = FALSE;
|
||||||
config_unfocus_leave = 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_policy = OB_PLACE_POLICY_SMART;
|
||||||
config_place_center = TRUE;
|
config_place_center = TRUE;
|
||||||
|
@ -945,11 +945,11 @@ void config_startup(ObtParseInst *i)
|
||||||
config_primary_monitor_index = 1;
|
config_primary_monitor_index = 1;
|
||||||
config_primary_monitor = OB_PLACE_MONITOR_ACTIVE;
|
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);
|
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_theme = NULL;
|
||||||
|
|
||||||
|
@ -963,14 +963,14 @@ void config_startup(ObtParseInst *i)
|
||||||
config_font_menuitem = NULL;
|
config_font_menuitem = NULL;
|
||||||
config_font_menutitle = 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_desktops_num = 4;
|
||||||
config_screen_firstdesk = 1;
|
config_screen_firstdesk = 1;
|
||||||
config_desktops_names = NULL;
|
config_desktops_names = NULL;
|
||||||
config_desktop_popup_time = 875;
|
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_redraw = TRUE;
|
||||||
config_resize_popup_show = 1; /* nonpixel increments */
|
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.x, 0, FALSE, FALSE);
|
||||||
GRAVITY_COORD_SET(config_resize_popup_fixed.y, 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_layer = OB_STACKING_LAYER_ABOVE;
|
||||||
config_dock_pos = OB_DIRECTION_NORTHEAST;
|
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_button = 2; /* middle */
|
||||||
config_dock_app_move_modifiers = 0;
|
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,
|
translate_key("C-g", &config_keyboard_reset_state,
|
||||||
&config_keyboard_reset_keycode);
|
&config_keyboard_reset_keycode);
|
||||||
|
|
||||||
bind_default_keyboard();
|
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_threshold = 8;
|
||||||
config_mouse_dclicktime = 200;
|
config_mouse_dclicktime = 200;
|
||||||
|
@ -1008,12 +1008,12 @@ void config_startup(ObtParseInst *i)
|
||||||
|
|
||||||
bind_default_mouse();
|
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_win = 10;
|
||||||
config_resist_edge = 20;
|
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_hide_delay = 250;
|
||||||
config_menu_middle = FALSE;
|
config_menu_middle = FALSE;
|
||||||
|
@ -1022,11 +1022,11 @@ void config_startup(ObtParseInst *i)
|
||||||
config_menu_manage_desktops = TRUE;
|
config_menu_manage_desktops = TRUE;
|
||||||
config_menu_files = NULL;
|
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;
|
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)
|
void config_shutdown(void)
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "geom.h"
|
#include "geom.h"
|
||||||
#include "moveresize.h"
|
#include "moveresize.h"
|
||||||
#include "obrender/render.h"
|
#include "obrender/render.h"
|
||||||
#include "obt/parse.h"
|
#include "obt/xml.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ extern GSList *config_menu_files;
|
||||||
/*! Per app settings */
|
/*! Per app settings */
|
||||||
extern GSList *config_per_app_settings;
|
extern GSList *config_per_app_settings;
|
||||||
|
|
||||||
void config_startup(ObtParseInst *i);
|
void config_startup(ObtXmlInst *i);
|
||||||
void config_shutdown(void);
|
void config_shutdown(void);
|
||||||
|
|
||||||
/*! Create an ObAppSettings structure with the default values */
|
/*! Create an ObAppSettings structure with the default values */
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "client_list_menu.h"
|
#include "client_list_menu.h"
|
||||||
#include "client_list_combined_menu.h"
|
#include "client_list_combined_menu.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "obt/parse.h"
|
#include "obt/xml.h"
|
||||||
#include "obt/paths.h"
|
#include "obt/paths.h"
|
||||||
|
|
||||||
typedef struct _ObMenuParseState ObMenuParseState;
|
typedef struct _ObMenuParseState ObMenuParseState;
|
||||||
|
@ -46,7 +46,7 @@ struct _ObMenuParseState
|
||||||
};
|
};
|
||||||
|
|
||||||
static GHashTable *menu_hash = NULL;
|
static GHashTable *menu_hash = NULL;
|
||||||
static ObtParseInst *menu_parse_inst;
|
static ObtXmlInst *menu_parse_inst;
|
||||||
static ObMenuParseState menu_parse_state;
|
static ObMenuParseState menu_parse_state;
|
||||||
static gboolean menu_can_hide = FALSE;
|
static gboolean menu_can_hide = FALSE;
|
||||||
|
|
||||||
|
@ -77,37 +77,37 @@ void menu_startup(gboolean reconfig)
|
||||||
client_list_combined_menu_startup(reconfig);
|
client_list_combined_menu_startup(reconfig);
|
||||||
client_menu_startup();
|
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.parent = NULL;
|
||||||
menu_parse_state.pipe_creator = NULL;
|
menu_parse_state.pipe_creator = NULL;
|
||||||
obt_parse_register(menu_parse_inst, "menu", parse_menu, &menu_parse_state);
|
obt_xml_register(menu_parse_inst, "menu", parse_menu, &menu_parse_state);
|
||||||
obt_parse_register(menu_parse_inst, "item", parse_menu_item,
|
obt_xml_register(menu_parse_inst, "item", parse_menu_item,
|
||||||
&menu_parse_state);
|
&menu_parse_state);
|
||||||
obt_parse_register(menu_parse_inst, "separator",
|
obt_xml_register(menu_parse_inst, "separator",
|
||||||
parse_menu_separator, &menu_parse_state);
|
parse_menu_separator, &menu_parse_state);
|
||||||
|
|
||||||
for (it = config_menu_files; it; it = g_slist_next(it)) {
|
for (it = config_menu_files; it; it = g_slist_next(it)) {
|
||||||
if (obt_parse_load_config_file(menu_parse_inst,
|
if (obt_xml_load_config_file(menu_parse_inst,
|
||||||
"openbox",
|
"openbox",
|
||||||
it->data,
|
it->data,
|
||||||
"openbox_menu"))
|
"openbox_menu"))
|
||||||
{
|
{
|
||||||
loaded = TRUE;
|
loaded = TRUE;
|
||||||
obt_parse_tree_from_root(menu_parse_inst);
|
obt_xml_tree_from_root(menu_parse_inst);
|
||||||
obt_parse_close(menu_parse_inst);
|
obt_xml_close(menu_parse_inst);
|
||||||
} else
|
} else
|
||||||
g_message(_("Unable to find a valid menu file \"%s\""),
|
g_message(_("Unable to find a valid menu file \"%s\""),
|
||||||
(const gchar*)it->data);
|
(const gchar*)it->data);
|
||||||
}
|
}
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
if (obt_parse_load_config_file(menu_parse_inst,
|
if (obt_xml_load_config_file(menu_parse_inst,
|
||||||
"openbox",
|
"openbox",
|
||||||
"menu.xml",
|
"menu.xml",
|
||||||
"openbox_menu"))
|
"openbox_menu"))
|
||||||
{
|
{
|
||||||
obt_parse_tree_from_root(menu_parse_inst);
|
obt_xml_tree_from_root(menu_parse_inst);
|
||||||
obt_parse_close(menu_parse_inst);
|
obt_xml_close(menu_parse_inst);
|
||||||
} else
|
} else
|
||||||
g_message(_("Unable to find a valid menu file \"%s\""),
|
g_message(_("Unable to find a valid menu file \"%s\""),
|
||||||
"menu.xml");
|
"menu.xml");
|
||||||
|
@ -124,7 +124,7 @@ void menu_shutdown(gboolean reconfig)
|
||||||
if (!reconfig)
|
if (!reconfig)
|
||||||
client_remove_destroy_notify(client_dest);
|
client_remove_destroy_notify(client_dest);
|
||||||
|
|
||||||
obt_parse_instance_unref(menu_parse_inst);
|
obt_xml_instance_unref(menu_parse_inst);
|
||||||
menu_parse_inst = NULL;
|
menu_parse_inst = NULL;
|
||||||
|
|
||||||
client_list_menu_shutdown(reconfig);
|
client_list_menu_shutdown(reconfig);
|
||||||
|
@ -173,13 +173,13 @@ void menu_pipe_execute(ObMenu *self)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obt_parse_load_mem(menu_parse_inst, output, strlen(output),
|
if (obt_xml_load_mem(menu_parse_inst, output, strlen(output),
|
||||||
"openbox_pipe_menu"))
|
"openbox_pipe_menu"))
|
||||||
{
|
{
|
||||||
menu_parse_state.pipe_creator = self;
|
menu_parse_state.pipe_creator = self;
|
||||||
menu_parse_state.parent = self;
|
menu_parse_state.parent = self;
|
||||||
obt_parse_tree_from_root(menu_parse_inst);
|
obt_xml_tree_from_root(menu_parse_inst);
|
||||||
obt_parse_close(menu_parse_inst);
|
obt_xml_close(menu_parse_inst);
|
||||||
} else {
|
} else {
|
||||||
g_message(_("Invalid output from pipe-menu \"%s\""), self->execute);
|
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;
|
gchar *label;
|
||||||
|
|
||||||
if (state->parent) {
|
if (state->parent) {
|
||||||
if (obt_parse_attr_string(node, "label", &label)) {
|
if (obt_xml_attr_string(node, "label", &label)) {
|
||||||
GSList *acts = NULL;
|
GSList *acts = NULL;
|
||||||
|
|
||||||
for (node = node->children; node; node = node->next)
|
for (node = node->children; node; node = node->next)
|
||||||
|
@ -293,7 +293,7 @@ static void parse_menu_separator(xmlNodePtr node, gpointer data)
|
||||||
if (state->parent) {
|
if (state->parent) {
|
||||||
gchar *label;
|
gchar *label;
|
||||||
|
|
||||||
if (!obt_parse_attr_string(node, "label", &label))
|
if (!obt_xml_attr_string(node, "label", &label))
|
||||||
label = NULL;
|
label = NULL;
|
||||||
|
|
||||||
menu_add_separator(state->parent, -1, label);
|
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;
|
gchar *name = NULL, *title = NULL, *script = NULL;
|
||||||
ObMenu *menu;
|
ObMenu *menu;
|
||||||
|
|
||||||
if (!obt_parse_attr_string(node, "id", &name))
|
if (!obt_xml_attr_string(node, "id", &name))
|
||||||
goto parse_menu_fail;
|
goto parse_menu_fail;
|
||||||
|
|
||||||
if (!g_hash_table_lookup(menu_hash, name)) {
|
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;
|
goto parse_menu_fail;
|
||||||
|
|
||||||
if ((menu = menu_new(name, title, TRUE, NULL))) {
|
if ((menu = menu_new(name, title, TRUE, NULL))) {
|
||||||
menu->pipe_creator = state->pipe_creator;
|
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);
|
menu->execute = obt_paths_expand_tilde(script);
|
||||||
} else {
|
} else {
|
||||||
ObMenu *old;
|
ObMenu *old;
|
||||||
|
|
||||||
old = state->parent;
|
old = state->parent;
|
||||||
state->parent = menu;
|
state->parent = menu;
|
||||||
obt_parse_tree(menu_parse_inst, node->children);
|
obt_xml_tree(menu_parse_inst, node->children);
|
||||||
state->parent = old;
|
state->parent = old;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#include "obt/display.h"
|
#include "obt/display.h"
|
||||||
#include "obt/prop.h"
|
#include "obt/prop.h"
|
||||||
#include "obt/keyboard.h"
|
#include "obt/keyboard.h"
|
||||||
#include "obt/parse.h"
|
#include "obt/xml.h"
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
#ifdef HAVE_FCNTL_H
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
|
@ -226,11 +226,11 @@ gint main(gint argc, gchar **argv)
|
||||||
keys[OB_KEY_SPACE] = obt_keyboard_keysym_to_keycode(XK_space);
|
keys[OB_KEY_SPACE] = obt_keyboard_keysym_to_keycode(XK_space);
|
||||||
|
|
||||||
{
|
{
|
||||||
ObtParseInst *i;
|
ObtXmlInst *i;
|
||||||
|
|
||||||
/* startup the parsing so everything can register sections
|
/* startup the parsing so everything can register sections
|
||||||
of the rc */
|
of the rc */
|
||||||
i = obt_parse_instance_new();
|
i = obt_xml_instance_new();
|
||||||
|
|
||||||
/* register all the available actions */
|
/* register all the available actions */
|
||||||
actions_startup(reconfigure);
|
actions_startup(reconfigure);
|
||||||
|
@ -239,12 +239,12 @@ gint main(gint argc, gchar **argv)
|
||||||
|
|
||||||
/* parse/load user options */
|
/* parse/load user options */
|
||||||
if ((config_file &&
|
if ((config_file &&
|
||||||
obt_parse_load_file(i, config_file, "openbox_config")) ||
|
obt_xml_load_file(i, config_file, "openbox_config")) ||
|
||||||
obt_parse_load_config_file(i, "openbox", "rc.xml",
|
obt_xml_load_config_file(i, "openbox", "rc.xml",
|
||||||
"openbox_config"))
|
"openbox_config"))
|
||||||
{
|
{
|
||||||
obt_parse_tree_from_root(i);
|
obt_xml_tree_from_root(i);
|
||||||
obt_parse_close(i);
|
obt_xml_close(i);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g_message(_("Unable to find a valid config file, using some simple defaults"));
|
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);
|
OBT_PROP_ERASE(obt_root(ob_screen), OB_CONFIG_FILE);
|
||||||
|
|
||||||
/* we're done with parsing now, kill it */
|
/* 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 */
|
/* load the theme specified in the rc file */
|
||||||
|
|
|
@ -42,7 +42,7 @@ gboolean session_connected(void) { return FALSE; }
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "focus.h"
|
#include "focus.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "obt/parse.h"
|
#include "obt/xml.h"
|
||||||
#include "obt/paths.h"
|
#include "obt/paths.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -684,108 +684,108 @@ GList* session_state_find(ObClient *c)
|
||||||
|
|
||||||
static void session_load_file(const gchar *path)
|
static void session_load_file(const gchar *path)
|
||||||
{
|
{
|
||||||
ObtParseInst *i;
|
ObtXmlInst *i;
|
||||||
xmlNodePtr node, n, m;
|
xmlNodePtr node, n, m;
|
||||||
GList *it, *inext;
|
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");
|
ob_debug_type(OB_DEBUG_SM, "ERROR: session file is missing root node");
|
||||||
obt_parse_instance_unref(i);
|
obt_xml_instance_unref(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node = obt_parse_root(i);
|
node = obt_xml_root(i);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node->children, "desktop")))
|
if ((n = obt_xml_find_node(node->children, "desktop")))
|
||||||
session_desktop = obt_parse_node_int(n);
|
session_desktop = obt_xml_node_int(n);
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node->children, "numdesktops")))
|
if ((n = obt_xml_find_node(node->children, "numdesktops")))
|
||||||
session_num_desktops = obt_parse_node_int(n);
|
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 */
|
/* make sure they are all there for it to be valid */
|
||||||
if ((m = obt_parse_find_node(n->children, "orientation")))
|
if ((m = obt_xml_find_node(n->children, "orientation")))
|
||||||
session_desktop_layout.orientation = obt_parse_node_int(m);
|
session_desktop_layout.orientation = obt_xml_node_int(m);
|
||||||
if (m && (m = obt_parse_find_node(n->children, "startcorner")))
|
if (m && (m = obt_xml_find_node(n->children, "startcorner")))
|
||||||
session_desktop_layout.start_corner = obt_parse_node_int(m);
|
session_desktop_layout.start_corner = obt_xml_node_int(m);
|
||||||
if (m && (m = obt_parse_find_node(n->children, "columns")))
|
if (m && (m = obt_xml_find_node(n->children, "columns")))
|
||||||
session_desktop_layout.columns = obt_parse_node_int(m);
|
session_desktop_layout.columns = obt_xml_node_int(m);
|
||||||
if (m && (m = obt_parse_find_node(n->children, "rows")))
|
if (m && (m = obt_xml_find_node(n->children, "rows")))
|
||||||
session_desktop_layout.rows = obt_parse_node_int(m);
|
session_desktop_layout.rows = obt_xml_node_int(m);
|
||||||
session_desktop_layout_present = m != NULL;
|
session_desktop_layout_present = m != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n = obt_parse_find_node(node->children, "desktopnames"))) {
|
if ((n = obt_xml_find_node(node->children, "desktopnames"))) {
|
||||||
for (m = obt_parse_find_node(n->children, "name"); m;
|
for (m = obt_xml_find_node(n->children, "name"); m;
|
||||||
m = obt_parse_find_node(m->next, "name"))
|
m = obt_xml_find_node(m->next, "name"))
|
||||||
{
|
{
|
||||||
session_desktop_names = g_slist_append(session_desktop_names,
|
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");
|
ob_debug_type(OB_DEBUG_SM, "loading windows");
|
||||||
for (node = obt_parse_find_node(node->children, "window"); node != NULL;
|
for (node = obt_xml_find_node(node->children, "window"); node != NULL;
|
||||||
node = obt_parse_find_node(node->next, "window"))
|
node = obt_xml_find_node(node->next, "window"))
|
||||||
{
|
{
|
||||||
ObSessionState *state;
|
ObSessionState *state;
|
||||||
|
|
||||||
state = g_new0(ObSessionState, 1);
|
state = g_new0(ObSessionState, 1);
|
||||||
|
|
||||||
if (!obt_parse_attr_string(node, "id", &state->id))
|
if (!obt_xml_attr_string(node, "id", &state->id))
|
||||||
if (!obt_parse_attr_string(node, "command", &state->command))
|
if (!obt_xml_attr_string(node, "command", &state->command))
|
||||||
goto session_load_bail;
|
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;
|
goto session_load_bail;
|
||||||
state->name = obt_parse_node_string(n);
|
state->name = obt_xml_node_string(n);
|
||||||
if (!(n = obt_parse_find_node(node->children, "class")))
|
if (!(n = obt_xml_find_node(node->children, "class")))
|
||||||
goto session_load_bail;
|
goto session_load_bail;
|
||||||
state->class = obt_parse_node_string(n);
|
state->class = obt_xml_node_string(n);
|
||||||
if (!(n = obt_parse_find_node(node->children, "role")))
|
if (!(n = obt_xml_find_node(node->children, "role")))
|
||||||
goto session_load_bail;
|
goto session_load_bail;
|
||||||
state->role = obt_parse_node_string(n);
|
state->role = obt_xml_node_string(n);
|
||||||
if (!(n = obt_parse_find_node(node->children, "windowtype")))
|
if (!(n = obt_xml_find_node(node->children, "windowtype")))
|
||||||
goto session_load_bail;
|
goto session_load_bail;
|
||||||
state->type = obt_parse_node_int(n);
|
state->type = obt_xml_node_int(n);
|
||||||
if (!(n = obt_parse_find_node(node->children, "desktop")))
|
if (!(n = obt_xml_find_node(node->children, "desktop")))
|
||||||
goto session_load_bail;
|
goto session_load_bail;
|
||||||
state->desktop = obt_parse_node_int(n);
|
state->desktop = obt_xml_node_int(n);
|
||||||
if (!(n = obt_parse_find_node(node->children, "x")))
|
if (!(n = obt_xml_find_node(node->children, "x")))
|
||||||
goto session_load_bail;
|
goto session_load_bail;
|
||||||
state->x = obt_parse_node_int(n);
|
state->x = obt_xml_node_int(n);
|
||||||
if (!(n = obt_parse_find_node(node->children, "y")))
|
if (!(n = obt_xml_find_node(node->children, "y")))
|
||||||
goto session_load_bail;
|
goto session_load_bail;
|
||||||
state->y = obt_parse_node_int(n);
|
state->y = obt_xml_node_int(n);
|
||||||
if (!(n = obt_parse_find_node(node->children, "width")))
|
if (!(n = obt_xml_find_node(node->children, "width")))
|
||||||
goto session_load_bail;
|
goto session_load_bail;
|
||||||
state->w = obt_parse_node_int(n);
|
state->w = obt_xml_node_int(n);
|
||||||
if (!(n = obt_parse_find_node(node->children, "height")))
|
if (!(n = obt_xml_find_node(node->children, "height")))
|
||||||
goto session_load_bail;
|
goto session_load_bail;
|
||||||
state->h = obt_parse_node_int(n);
|
state->h = obt_xml_node_int(n);
|
||||||
|
|
||||||
state->shaded =
|
state->shaded =
|
||||||
obt_parse_find_node(node->children, "shaded") != NULL;
|
obt_xml_find_node(node->children, "shaded") != NULL;
|
||||||
state->iconic =
|
state->iconic =
|
||||||
obt_parse_find_node(node->children, "iconic") != NULL;
|
obt_xml_find_node(node->children, "iconic") != NULL;
|
||||||
state->skip_pager =
|
state->skip_pager =
|
||||||
obt_parse_find_node(node->children, "skip_pager") != NULL;
|
obt_xml_find_node(node->children, "skip_pager") != NULL;
|
||||||
state->skip_taskbar =
|
state->skip_taskbar =
|
||||||
obt_parse_find_node(node->children, "skip_taskbar") != NULL;
|
obt_xml_find_node(node->children, "skip_taskbar") != NULL;
|
||||||
state->fullscreen =
|
state->fullscreen =
|
||||||
obt_parse_find_node(node->children, "fullscreen") != NULL;
|
obt_xml_find_node(node->children, "fullscreen") != NULL;
|
||||||
state->above =
|
state->above =
|
||||||
obt_parse_find_node(node->children, "above") != NULL;
|
obt_xml_find_node(node->children, "above") != NULL;
|
||||||
state->below =
|
state->below =
|
||||||
obt_parse_find_node(node->children, "below") != NULL;
|
obt_xml_find_node(node->children, "below") != NULL;
|
||||||
state->max_horz =
|
state->max_horz =
|
||||||
obt_parse_find_node(node->children, "max_horz") != NULL;
|
obt_xml_find_node(node->children, "max_horz") != NULL;
|
||||||
state->max_vert =
|
state->max_vert =
|
||||||
obt_parse_find_node(node->children, "max_vert") != NULL;
|
obt_xml_find_node(node->children, "max_vert") != NULL;
|
||||||
state->undecorated =
|
state->undecorated =
|
||||||
obt_parse_find_node(node->children, "undecorated") != NULL;
|
obt_xml_find_node(node->children, "undecorated") != NULL;
|
||||||
state->focused =
|
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
|
/* save this. they are in the file in stacking order, so preserve
|
||||||
that order here */
|
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)
|
void session_request_logout(gboolean silent)
|
||||||
|
|
Loading…
Reference in a new issue