1 #include "plugins/obconf_interface.h"
2 #include "parser/parse.h"
3 #include "resistance.h"
5 #include <glade/glade.h>
7 static GtkWidget
*conf_widget
;
8 static GtkCheckButton
*conf_resist_windows
;
9 static GtkSpinButton
*conf_resist_strength
;
10 static gboolean conf_edited
= FALSE
;
12 int plugin_interface_version() { return OBCONF_INTERFACE_VERSION
; }
14 char *plugin_name() { return "Resistance"; }
15 char *plugin_plugin_name() { return "resistance"; }
18 GtkWidget
*plugin_toplevel_widget() { return conf_widget
; }
20 gboolean
plugin_edited() { return conf_edited
; }
22 void plugin_load(xmlDocPtr doc
, xmlNodePtr root
)
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
);
30 node
= parse_find_node("resistance", root
);
32 if ((n
= parse_find_node("strength", node
)))
33 gtk_spin_button_set_value(conf_resist_strength
,
35 if ((n
= parse_find_node("windows", node
)))
36 gtk_toggle_button_set_active
37 (GTK_TOGGLE_BUTTON(conf_resist_windows
),
40 node
= parse_find_node("resistance", node
->next
);
44 void plugin_save(xmlDocPtr doc
, xmlNodePtr root
)
52 xml
= glade_xml_new("obconf.glade", NULL
, NULL
);
53 glade_xml_signal_autoconnect(xml
);
55 conf_widget
= glade_xml_get_widget(xml
, "resistwindow");
56 conf_resist_strength
=
57 GTK_SPIN_BUTTON(glade_xml_get_widget(xml
, "resist_strength"));
59 GTK_CHECK_BUTTON(glade_xml_get_widget(xml
, "resist_windows"));
62 void plugin_shutdown()