Use the openbox 3.5 libs
authorDana Jansens <danakj@orodu.net>
Mon, 21 Dec 2009 18:01:55 +0000 (13:01 -0500)
committerDana Jansens <danakj@orodu.net>
Mon, 21 Dec 2009 19:15:38 +0000 (14:15 -0500)
configure.ac
src/desktops.c
src/main.c
src/main.h
src/mouse.c
src/preview.c
src/preview.h
src/preview_update.h
src/theme.c
src/tree.c
src/tree.h

index bae2dfb46c86f4c23b0c12162365f1397130bb87..f9b0775756a3f75906289515f272c4bc7f98f893 100644 (file)
@@ -1,5 +1,5 @@
 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])
 
@@ -20,7 +20,7 @@ ALL_LINGUAS=""
 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)
 
index d7e981187ea49770cb2201ec25b901b40affafd8..f1f0021587f2fb7fe6b3965a740934e75f468db9 100644 (file)
@@ -156,7 +156,7 @@ static void desktops_read_names()
         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);
 
index 70837305c2198514a7c371c6a40d2b48391d71bb..875b783a0162f3ba8a5ed2e71c270fc92b5ed769 100644 (file)
@@ -42,6 +42,8 @@ xmlDocPtr doc;
 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;
@@ -214,7 +216,8 @@ int main(int argc, char **argv)
         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) {
@@ -230,10 +233,19 @@ int main(int argc, char **argv)
     }
 
     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 */
     {
@@ -290,7 +302,8 @@ int main(int argc, char **argv)
     }
 
     RrInstanceFree(rrinst);
-    parse_paths_shutdown();
+    obt_parse_instance_unref(parse_i);
+    obt_paths_unref(paths);
 
     xmlFreeDoc(doc);
     return 0;
index 7d6303c9275fb8cd8e59ab06f3a39e42a3de4ce5..2c06630fed73f2278a63693744fbbe12767fb9ef 100644 (file)
 #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)
 
index 68d9c552e4818c7f8921b403431c78d3ccd03662..831e2e53acd6a0e65c60d6da6ab9819c68464fad 100644 (file)
@@ -19,7 +19,7 @@
 #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;
@@ -206,9 +206,9 @@ static gint read_doubleclick_action()
 
     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;
index 7e463a80b28748a24640a1fd7253187401daa93a..a82cf15f4aa44e606ac4125f418db3a79ec98799 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <string.h>
 
-#include <openbox/theme.h>
+#include <obrender/theme.h>
 
 #define PADDING 2 /* openbox does it :/ */
 
@@ -491,7 +491,8 @@ 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)
 {
 
     GdkPixbuf *preview;
@@ -505,7 +506,8 @@ GdkPixbuf *preview_theme(const gchar *name, const gchar *titlelayout,
 
     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;
 
index ff43766df0b6acb42db33209f741e23ab584f443..772984b5477e28855a641966b0ce2cf25f6e8af9 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <glib.h>
 
-#include <openbox/font.h>
+#include <obrender/font.h>
 #include <gdk/gdkpixbuf.h>
 
 GdkPixbuf *preview_theme(const gchar *name, const gchar *titlelayout,
@@ -29,6 +29,7 @@ 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
index 1fe96740867593156add8c292d1a7d4e616c31c3..5163174d672079b962e41ccf9e2a6d2119a8f3e9 100644 (file)
@@ -1,7 +1,7 @@
 #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();
index 093dc215c3277bfde51b79cf608d654f8d17bab2..70206f9d6492e4b46ec568438a784d66d3d5f7d7 100644 (file)
@@ -193,7 +193,7 @@ void theme_load_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);
index 2c0f2dc018f91966a745e6868dc85d2cd089036b..2b3984045f7e2a80f49af3ffe8754c25dfa26783 100644 (file)
@@ -19,7 +19,7 @@
 #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)
@@ -28,7 +28,7 @@ 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) {
@@ -39,19 +39,19 @@ xmlNodePtr tree_get_node(const gchar *path, const gchar *def)
         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) {
@@ -76,6 +76,15 @@ xmlNodePtr tree_get_node(const gchar *path, const gchar *def)
     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;
@@ -84,15 +93,14 @@ void tree_apply()
     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);
@@ -158,7 +166,7 @@ gchar* tree_get_string(const gchar *node, const gchar *def)
     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)
@@ -169,7 +177,7 @@ gint tree_get_int(const gchar *node, gint def)
     d = g_strdup_printf("%d", def);
     n = tree_get_node(node, d);
     g_free(d);
-    return parse_int(doc, n);
+    return obt_parse_node_int(n);
 }
 
 gboolean tree_get_bool(const gchar *node, gboolean def)
@@ -177,5 +185,5 @@ 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);
 }
index 39c96b39565362a733f27d440037611b4ef26db2..62a20c8d3c8b07e714a731b979894f290b1724a7 100644 (file)
 #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);