use ob_debug for any debug printing and only display the output when its a debug...
[mikachu/openbox.git] / tools / obconf / main.c
1 #include "kernel/debug.h"
2 #include "obconf.h"
3 #include "plugins.h"
4 #include "parser/parse.h"
5
6 #include <gtk/gtk.h>
7 #include <glade/glade.h>
8
9 /*#include <X11/Xlib.h>
10 Display *ob_display;
11 int ob_screen;
12 Window ob_root;*/
13
14 GtkWindow *obconf_win;
15 GtkWindow *obconf_about = NULL;
16
17 GtkTreeView *obconf_sections;
18 GtkListStore *obconf_sections_store;
19 static GtkCellRenderer *obconf_sections_renderer;
20 static GtkTreeViewColumn *obconf_sections_column;
21
22 GtkNotebook *obconf_options;
23
24 static xmlDocPtr doc;
25 static xmlNodePtr root;
26
27 int main(int argc, char **argv)
28 {
29     GladeXML *xml;
30
31     gtk_init(&argc, &argv);
32
33     xml = glade_xml_new("obconf.glade", NULL, NULL);
34     glade_xml_signal_autoconnect(xml);
35
36     obconf_win = GTK_WINDOW(glade_xml_get_widget(xml, "mainwindow"));
37     gtk_window_set_role(obconf_win, "main");
38     obconf_about = GTK_WINDOW(glade_xml_get_widget(xml, "aboutdialog"));
39     gtk_window_set_role(obconf_about, "about");
40     gtk_window_set_transient_for(obconf_about, obconf_win);
41     obconf_sections = GTK_TREE_VIEW(glade_xml_get_widget(xml, "sectiontree"));
42     obconf_options = GTK_NOTEBOOK(glade_xml_get_widget(xml,"optionsnotebook"));
43
44     obconf_sections_store = gtk_list_store_new(1, G_TYPE_STRING);
45     gtk_tree_view_set_model(obconf_sections,
46                             GTK_TREE_MODEL(obconf_sections_store));
47     obconf_sections_renderer = gtk_cell_renderer_text_new();
48     obconf_sections_column = gtk_tree_view_column_new_with_attributes
49         ("Section", obconf_sections_renderer, "text", 0, NULL);
50     gtk_tree_view_append_column (obconf_sections, obconf_sections_column);
51
52     parse_load_rc(&doc, &root);
53
54     plugins_load();
55
56     gtk_widget_show(GTK_WIDGET(obconf_win));
57
58     gtk_main();
59     return 0;
60 }
61
62 gboolean on_mainwindow_delete_event(GtkWidget *w, GdkEvent *e, gpointer d)
63 {
64     gtk_main_quit();
65     return FALSE;
66 }
67
68 void on_quit_activate(GtkMenuItem *item, gpointer d)
69 {
70     gtk_main_quit();
71 }
72
73 void on_applybutton_clicked(GtkButton *but, gpointer d)
74 {
75     ob_debug("apply\n");
76 }
77
78 void on_revertbutton_clicked(GtkButton *but, gpointer d)
79 {
80     ob_debug("revert\n");
81 }
82
83 void on_helpbutton_clicked(GtkButton *but, gpointer d)
84 {
85     ob_debug("help\n");
86 }
87
88 void on_sectiontree_row_activated(GtkTreeView *tree, GtkTreePath *path,
89                                   GtkTreeViewColumn *col, gpointer p)
90 {
91     ob_debug("activated\n");
92 }