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