this is a big one! im putting stats in here just cuz!
[dana/openbox.git] / plugins / resistance / resistance_config.c
1 #include "plugins/obconf_interface.h"
2 #include "parser/parse.h"
3 #include "resistance.h"
4 #include <gtk/gtk.h>
5 #include <glade/glade.h>
6
7 static GtkWidget *conf_widget;
8 static GtkCheckButton *conf_resist_windows;
9 static GtkSpinButton *conf_resist_strength;
10 static gboolean conf_edited = FALSE;
11
12 int plugin_interface_version() { return OBCONF_INTERFACE_VERSION; }
13
14 char *plugin_name() { return "Resistance"; }
15 char *plugin_plugin_name() { return "resistance"; }
16 void plugin_icon() {}
17
18 GtkWidget *plugin_toplevel_widget() { return conf_widget; }
19
20 gboolean plugin_edited() { return conf_edited; }
21
22 void plugin_load(xmlDocPtr doc, xmlNodePtr root)
23 {
24     xmlNodePtr node, n;
25
26     gtk_spin_button_set_value(conf_resist_strength, DEFAULT_RESISTANCE);
27     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(conf_resist_windows),
28                                  DEFAULT_RESIST_WINDOWS);
29
30     node = parse_find_node("resistance", root);
31     while (node) {
32         if ((n = parse_find_node("strength", node)))
33             gtk_spin_button_set_value(conf_resist_strength,
34                                       parse_int(doc, n));
35         if ((n = parse_find_node("windows", node)))
36             gtk_toggle_button_set_active
37                 (GTK_TOGGLE_BUTTON(conf_resist_windows),
38                  parse_bool(doc, n));
39
40         node = parse_find_node("resistance", node->next);
41     }
42 }
43
44 void plugin_save(xmlDocPtr doc, xmlNodePtr root)
45 {
46 }
47
48 void plugin_startup()
49 {
50     GladeXML *xml;
51
52     xml = glade_xml_new("obconf.glade", NULL, NULL);
53     glade_xml_signal_autoconnect(xml);
54
55     conf_widget = glade_xml_get_widget(xml, "resistwindow");
56     conf_resist_strength =
57         GTK_SPIN_BUTTON(glade_xml_get_widget(xml, "resist_strength"));
58     conf_resist_windows =
59         GTK_CHECK_BUTTON(glade_xml_get_widget(xml, "resist_windows"));
60 }
61
62 void plugin_shutdown()
63 {
64 }