AC_PREREQ([2.54])
-AC_INIT([obconf], [2.0.3], [http://bugzilla.icculus.org])
+AC_INIT([obconf], [2.0.4], [http://bugzilla.icculus.org])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/main.c])
AM_GNU_GETTEXT_VERSION(0.15)
AM_GNU_GETTEXT([external])
-PKG_CHECK_MODULES(OPENBOX, [obrender-3.0 >= 3.4.2 obparser-3.0 >= 3.4.2])
+PKG_CHECK_MODULES(OPENBOX, [obrender-3.5 obt-3.5])
AC_SUBST(OPENBOX_CFLAGS)
AC_SUBST(OPENBOX_LIBS)
gchar *name;
if (!xmlStrcmp(n->name, (const xmlChar*)"name")) {
- name = parse_string(doc, n);
+ name = obt_parse_node_string(n);
desktop_names = g_list_append(desktop_names, name);
xmlNodePtr root;
RrInstance *rrinst;
gchar *obc_config_file = NULL;
+ObtPaths *paths;
+ObtParseInst *parse_i;
static gchar *obc_theme_install = NULL;
static gchar *obc_theme_archive = NULL;
exit_with_error = TRUE;
}
- parse_paths_startup();
+ paths = obt_paths_new();
+ parse_i = obt_parse_instance_new();
rrinst = RrInstanceNew(GDK_DISPLAY(), gdk_x11_get_default_screen());
if (!obc_config_file) {
}
xmlIndentTreeOutput = 1;
- if (!parse_load_rc(obc_config_file, &doc, &root)) {
+ if (!obt_parse_load_config_file(parse_i,
+ "openbox",
+ (obc_config_file ?
+ obc_config_file : "rc.xml"),
+ "openbox_config"))
+ {
obconf_error(_("Failed to load an rc.xml. You have probably failed to install Openbox properly."), TRUE);
exit_with_error = TRUE;
}
+ else {
+ doc = obt_parse_doc(parse_i);
+ root = obt_parse_root(parse_i);
+ }
/* look for parsing errors */
{
}
RrInstanceFree(rrinst);
- parse_paths_shutdown();
+ obt_parse_instance_unref(parse_i);
+ obt_paths_unref(paths);
xmlFreeDoc(doc);
return 0;
#ifndef obconf__main_h
#define obconf__main_h
-#include <openbox/render.h>
-#include <openbox/instance.h>
-#include <openbox/parse.h>
+#include <obrender/render.h>
+#include <obrender/instance.h>
+#include <obt/parse.h>
+#include <obt/paths.h>
#include <gtk/gtk.h>
#include <glade/glade-xml.h>
extern GladeXML *glade;
-extern xmlDocPtr doc;
-extern xmlNodePtr root;
extern RrInstance *rrinst;
extern GtkWidget *mainwin;
extern gchar *obc_config_file;
+extern ObtPaths *paths;
+extern ObtParseInst *parse_i;
#define get_widget(s) glade_xml_get_widget(glade, s)
#include "main.h"
#include "tree.h"
#include "gettext.h"
-#include <openbox/parse.h>
+#include <obt/parse.h>
static gboolean mapping = FALSE;
static xmlNodePtr saved_custom = NULL;
while (n) {
if (!xmlStrcmp(n->name, (const xmlChar*)"action")) {
- if (parse_attr_contains("ToggleMaximizeFull", n, "name"))
+ if (obt_parse_attr_contains(n, "name", "ToggleMaximizeFull"))
++max;
- else if (parse_attr_contains("ToggleShade", n, "name"))
+ else if (obt_parse_attr_contains(n, "name", "ToggleShade"))
++shade;
else
++other;
#include <string.h>
-#include <openbox/theme.h>
+#include <obrender/theme.h>
#define PADDING 2 /* openbox does it :/ */
RrFont *inactive_window_font,
RrFont *menu_title_font,
RrFont *menu_item_font,
- RrFont *osd_font)
+ RrFont *osd_active_font,
+ RrFont *osd_inactive_font)
{
GdkPixbuf *preview;
RrTheme *theme = RrThemeNew(rrinst, name, FALSE,
active_window_font, inactive_window_font,
- menu_title_font, menu_item_font, osd_font);
+ menu_title_font, menu_item_font,
+ osd_active_font, osd_inactive_font);
if (!theme)
return NULL;
#include <glib.h>
-#include <openbox/font.h>
+#include <obrender/font.h>
#include <gdk/gdkpixbuf.h>
GdkPixbuf *preview_theme(const gchar *name, const gchar *titlelayout,
RrFont *inactive_window_font,
RrFont *menu_title_font,
RrFont *menu_item_font,
- RrFont *osd_font);
+ RrFont *osd_active_font,
+ RrFont *osd_inactive_font);
#endif
#ifndef obconf__preview_update_h
#define obconf__preview_update_h
-#include <openbox/render.h>
+#include <obrender/render.h>
#include <gtk/gtk.h>
void preview_update_all();
{
GSList *it;
- for (it = parse_xdg_data_dir_paths(); it; it = g_slist_next(it)) {
+ for (it = obt_paths_data_dirs(paths); it; it = g_slist_next(it)) {
p = g_build_filename(it->data, "themes", NULL);
add_theme_dir(p);
g_free(p);
#include "tree.h"
#include "main.h"
-#include <openbox/parse.h>
+#include <obt/parse.h>
#include <gdk/gdkx.h>
xmlNodePtr tree_get_node(const gchar *path, const gchar *def)
gchar **nodes;
gchar **it, **next;
- n = root;
+ n = obt_parse_root(parse_i);
nodes = g_strsplit(path, "/", 0);
for (it = nodes; *it; it = next) {
next = it + 1;
/* match attributes */
- c = parse_find_node(attrs[0], n->children);
+ c = obt_parse_find_node(n->children, attrs[0]);
while (c && !ok) {
gint i;
ok = TRUE;
for (i = 1; attrs[i]; ++i) {
gchar **eq = g_strsplit(attrs[i], "=", 2);
- if (eq[1] && !parse_attr_contains(eq[1], c, eq[0]))
+ if (eq[1] && !obt_parse_attr_contains(c, eq[0], eq[1]))
ok = FALSE;
g_strfreev(eq);
}
if (!ok)
- c = parse_find_node(attrs[0], c->next);
+ c = obt_parse_find_node(c->next, attrs[0]);
}
if (!c) {
return n;
}
+void tree_delete_node(const gchar *path)
+{
+ xmlNodePtr n;
+
+ n = tree_get_node(path, NULL);
+ xmlUnlinkNode(n);
+ xmlFreeNode(n);
+}
+
void tree_apply()
{
gchar *p, *d;
if (obc_config_file)
p = g_strdup(obc_config_file);
else
- p = g_build_filename(parse_xdg_config_home_path(), "openbox",
+ p = g_build_filename(obt_paths_config_home(paths), "openbox",
"rc.xml", NULL);
d = g_path_get_dirname(p);
- parse_mkdir_path(d, 0700);
+ obt_paths_mkdir_path(d, 0700);
g_free(d);
- err = xmlSaveFormatFile(p, doc, 1) == -1;
- if (err) {
+ if (!obt_parse_save_file(parse_i, p, TRUE)) {
gchar *s;
s = g_strdup_printf("An error occured while saving the "
"config file '%s'", p);
xmlNodePtr n;
n = tree_get_node(node, def);
- return parse_string(doc, n);
+ return obt_parse_node_string(n);
}
gint tree_get_int(const gchar *node, gint def)
d = g_strdup_printf("%d", def);
n = tree_get_node(node, d);
g_free(d);
- return parse_int(doc, n);
+ return obt_parse_node_int(n);
}
gboolean tree_get_bool(const gchar *node, gboolean def)
xmlNodePtr n;
n = tree_get_node(node, (def ? "yes" : "no"));
- return parse_bool(doc, n);
+ return obt_parse_node_bool(n);
}
#ifndef obconf__tree_h
#define obconf__tree_h
-#include "openbox/parse.h"
+#include <obt/parse.h>
xmlNodePtr tree_get_node(const gchar *path, const gchar *def);
+void tree_delete_node(const gchar *path);
+
gchar* tree_get_string(const gchar *node, const gchar *def);
gint tree_get_int(const gchar *node, gint def);
gboolean tree_get_bool(const gchar *node, gboolean def);