]> Dogcows Code - chaz/openbox/commitdiff
restarting work on obconf
authorDana Jansens <danakj@orodu.net>
Sat, 26 Jul 2003 07:44:15 +0000 (07:44 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 26 Jul 2003 07:44:15 +0000 (07:44 +0000)
Makefile.am
configure.ac
tools/obconf/.cvsignore
tools/obconf/Makefile [new file with mode: 0644]
tools/obconf/main.c

index 3b6f19ff840a878854f6d85808d3d499c2dda718..f84dc6fe14d47346a761fd06239f6af0777274e7 100644 (file)
@@ -5,6 +5,7 @@ localedir       = $(datadir)/locale
 rcdir           = $(datadir)/openbox
 plugindir       = $(libdir)/openbox/plugins
 desktopfilesdir = $(datadir)/gnome/wm-properties
+pixmapdir       = $(datadir)/pixmaps
 
 theme = operation
 
@@ -34,8 +35,11 @@ plugin_LTLIBRARIES = \
        plugins/menu/include_menu.la
 
 if OBCONF
-plugin_LTLIBRARIES += \
-       plugins/resistance/resistance-config.la
+bin_PROGRAMS += \
+       tools/obconf/obconf
+
+#plugin_LTLIBRARIES += \
+#      plugins/resistance/resistance-config.la
 endif
 
 ## render ##
@@ -328,6 +332,28 @@ plugins_menu_include_menu_la_SOURCES = \
        plugins/menu/include_menu.c
 
 
+## obconf ##
+
+tools_obconf_obconf_CPPFLAGS = \
+       $(GTK_CFLAGS) \
+       $(GDK_PIXBUF_CFLAGS) \
+       $(XML_CFLAGS) \
+       -DLOCALEDIR=\"$(localedir)\" \
+       -DPLUGINDIR=\"$(plugindir)\" \
+       -DRCDIR=\"$(rcdir)\" \
+       -DPIXMAPDIR=\"$(pixmapdir)\" \
+       -DG_LOG_DOMAIN=\"Obconf\"
+tools_obconf_obconf_LDADD = \
+       $(GTK_LIBS) \
+       $(GDK_PIXBUF_LIBS) \
+       $(LIBINTL) \
+       render/libobrender.la \
+       parser/libobparser.la
+tools_obconf_obconf_SOURCES = \
+       gettext.h \
+       tools/obconf/main.c
+
+
 ## themes ##
 
 dist_theme_DATA = \
index fa8e1e76abf9da93acc325bc3cf89da2275f42f7..f0f9b571e1b437d3385b01a5c0726c56a4f22a3f 100644 (file)
@@ -67,14 +67,14 @@ PKG_CHECK_MODULES(GTK, [gtk+-2.0],
     AC_SUBST(GTK_LIBS)
     use_gtk="yes"
 
-    PKG_CHECK_MODULES(GLADE, [libglade-2.0],
+    PKG_CHECK_MODULES(GDK_PIXBUF, [gdk-pixbuf-2.0],
       [
-        AC_SUBST(GLADE_CFLAGS)
-        AC_SUBST(GLADE_LIBS)
-        use_glade="yes"
+        AC_SUBST(GDK_PIXBUF_CFLAGS)
+        AC_SUBST(GDK_PIXBUF_LIBS)
+        use_gdk_pixbuf="yes"
       ],
       [
-        use_glade="no"
+        use_gdk_pixbuf="no"
         AC_MSG_WARN([disabling build of the configuration tool])
       ]
     )
@@ -84,8 +84,8 @@ PKG_CHECK_MODULES(GTK, [gtk+-2.0],
     AC_MSG_WARN([disabling build of the configuration tool])
   ]
 )
-#AM_CONDITIONAL(OBCONF, [test "$use_gtk" = "yes" && test "$use_glade" = "yes"])
-AM_CONDITIONAL(OBCONF, [false])
+AM_CONDITIONAL(OBCONF,
+               [test "$use_gtk" = "yes" && test "$use_gdk_pixbuf" = "yes"])
 
 # Check for session management
 X11_SM
index b35c97a581560653f57923b7141598fcab4b72ff..278f5f1e03786e2627c82865d86f0ac57f5311c8 100644 (file)
@@ -3,3 +3,4 @@
 Makefile
 Makefile.in
 obconf
+.dirstamp
diff --git a/tools/obconf/Makefile b/tools/obconf/Makefile
new file mode 100644 (file)
index 0000000..cfc4653
--- /dev/null
@@ -0,0 +1,4 @@
+all clean install:
+       $(MAKE) -C ../.. -$(MAKEFLAGS) $@
+
+.PHONY: all clean install
index 645556c68e4b1cc098d3dca6be26f00b6485b2dd..9abd8716b4061bbbc7fb89daa32ab3e340df447a 100644 (file)
@@ -1,59 +1,69 @@
-#include "kernel/debug.h"
 #include "obconf.h"
 #include "plugins.h"
 #include "parser/parse.h"
+#include "gettext.h"
 
 #include <gtk/gtk.h>
-#include <glade/glade.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
 
-/*#include <X11/Xlib.h>
-Display *ob_display;
-int ob_screen;
-Window ob_root;*/
+#define OB_ICON "openbox-icon"
 
-GtkWindow *obconf_win;
-GtkWindow *obconf_about = NULL;
+static GtkWidget *mainwin;
+static GdkPixbuf *ob_icon;
 
-GtkTreeView *obconf_sections;
-GtkListStore *obconf_sections_store;
-static GtkCellRenderer *obconf_sections_renderer;
-static GtkTreeViewColumn *obconf_sections_column;
-
-GtkNotebook *obconf_options;
+static void obconf_error(GError *e)
+{
+    GtkWidget *d;
+
+    d = gtk_message_dialog_new(mainwin ? GTK_WINDOW(mainwin) : NULL,
+                               GTK_DIALOG_DESTROY_WITH_PARENT,
+                               GTK_MESSAGE_ERROR,
+                               GTK_BUTTONS_CLOSE,
+                               "%s", e->message);
+    gtk_dialog_run(GTK_DIALOG(d));
+    gtk_widget_destroy(d);
+}
 
-static xmlDocPtr doc;
-static xmlNodePtr root;
+static void load_stock ()
+{
+    GtkIconFactory *factory;
+    GError *e = NULL;
+
+    gtk_icon_factory_add_default (factory = gtk_icon_factory_new ());
+
+    ob_icon = gdk_pixbuf_new_from_file (PIXMAPDIR G_DIR_SEPARATOR_S
+                                        "openbox.png", &e);
+    if (!ob_icon) {
+        gchar *msg = g_strdup_printf 
+            (_("Failed to load the Openbox icon, Openbox is probably not "
+               "installed correctly. The error given was '%s'."),
+             e->message);
+        g_free (e->message);
+        e->message = msg;
+        obconf_error (e);
+    } else {
+        GtkIconSet *set;
+
+        set = gtk_icon_set_new_from_pixbuf (ob_icon);
+        gtk_icon_factory_add (factory, OB_ICON, set);
+        gtk_icon_set_unref (set);
+    }
+}
 
 int main(int argc, char **argv)
 {
-    GladeXML *xml;
-
+    gtk_set_locale();
     gtk_init(&argc, &argv);
 
-    xml = glade_xml_new("obconf.glade", NULL, NULL);
-    glade_xml_signal_autoconnect(xml);
-
-    obconf_win = GTK_WINDOW(glade_xml_get_widget(xml, "mainwindow"));
-    gtk_window_set_role(obconf_win, "main");
-    obconf_about = GTK_WINDOW(glade_xml_get_widget(xml, "aboutdialog"));
-    gtk_window_set_role(obconf_about, "about");
-    gtk_window_set_transient_for(obconf_about, obconf_win);
-    obconf_sections = GTK_TREE_VIEW(glade_xml_get_widget(xml, "sectiontree"));
-    obconf_options = GTK_NOTEBOOK(glade_xml_get_widget(xml,"optionsnotebook"));
-
-    obconf_sections_store = gtk_list_store_new(1, G_TYPE_STRING);
-    gtk_tree_view_set_model(obconf_sections,
-                            GTK_TREE_MODEL(obconf_sections_store));
-    obconf_sections_renderer = gtk_cell_renderer_text_new();
-    obconf_sections_column = gtk_tree_view_column_new_with_attributes
-        ("Section", obconf_sections_renderer, "text", 0, NULL);
-    gtk_tree_view_append_column (obconf_sections, obconf_sections_column);
-
-    parse_load_rc(&doc, &root);
+    load_stock();
 
-    plugins_load();
+    mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    gtk_window_set_title(GTK_WINDOW(mainwin), "Obconf");
+    gtk_window_set_wmclass(GTK_WINDOW(mainwin), "obconf", "Obconf");
+    gtk_window_set_role(GTK_WINDOW(mainwin), "main window");
+    if (ob_icon) gtk_window_set_icon(GTK_WINDOW(mainwin), ob_icon);
 
-    gtk_widget_show(GTK_WIDGET(obconf_win));
+    gtk_widget_show_all(mainwin);
 
     gtk_main();
     return 0;
@@ -72,21 +82,21 @@ void on_quit_activate(GtkMenuItem *item, gpointer d)
 
 void on_applybutton_clicked(GtkButton *but, gpointer d)
 {
-    ob_debug("apply\n");
+    g_message("apply\n");
 }
 
 void on_revertbutton_clicked(GtkButton *but, gpointer d)
 {
-    ob_debug("revert\n");
+    g_message("revert\n");
 }
 
 void on_helpbutton_clicked(GtkButton *but, gpointer d)
 {
-    ob_debug("help\n");
+    g_message("help\n");
 }
 
 void on_sectiontree_row_activated(GtkTreeView *tree, GtkTreePath *path,
                                   GtkTreeViewColumn *col, gpointer p)
 {
-    ob_debug("activated\n");
+    g_message("activated\n");
 }
This page took 0.030406 seconds and 4 git commands to generate.