summaryrefslogtreecommitdiff
path: root/tests/test7/test7.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test7/test7.c')
-rw-r--r--tests/test7/test7.c52
1 files changed, 13 insertions, 39 deletions
diff --git a/tests/test7/test7.c b/tests/test7/test7.c
index 158ead2..7f557ca 100644
--- a/tests/test7/test7.c
+++ b/tests/test7/test7.c
@@ -6,6 +6,12 @@
GtkBuilder *builder=NULL;
GtkToggleButton *buttons[FUNC_COUNT]={NULL};
+// Applicative actions
+void switch_to_func(gint func_id) {
+ printf("switch_to_func(%i)\n", func_id);
+}
+
+// GUI events
void on_win_main_destroy(GtkObject *object, gpointer user_data) {
gtk_main_quit();
}
@@ -22,47 +28,15 @@ void on_mi_about_activate(GtkObject *object, gpointer user_data) {
gtk_widget_show_all(GTK_WIDGET(dialog));
}
-void switch_to_func(gint func_id) {
- gint i;
- // Toggle off all buttons but the active one
- for (i=0;i<FUNC_COUNT;i++) {
- if (i==func_id) continue;
- gtk_toggle_button_set_active(buttons[i],FALSE);
- printf("buttons[%i]==%p\n", i, buttons[i]);
- }
-
-}
-
-void on_action1_activate(GtkObject *object, gpointer user_data) {
- switch_to_func(0);
-}
-
-void on_action2_activate(GtkObject *object, gpointer user_data) {
- switch_to_func(1);
-}
+void on_action1_activate(GtkObject *object, gpointer user_data) { switch_to_func(0); }
+void on_action2_activate(GtkObject *object, gpointer user_data) { switch_to_func(1); }
+void on_action3_activate(GtkObject *object, gpointer user_data) { switch_to_func(2); }
+void on_action4_activate(GtkObject *object, gpointer user_data) { switch_to_func(3); }
-void on_action3_activate(GtkObject *object, gpointer user_data) {
- switch_to_func(2);
-}
-
-void on_action4_activate(GtkObject *object, gpointer user_data) {
- switch_to_func(3);
-}
-
-void on_but_func1_realize(GtkObject *object, gpointer user_data) {
- buttons[0]=GTK_TOGGLE_BUTTON(object);
-}
-
-void on_but_func2_realize(GtkObject *object, gpointer user_data) {
- buttons[1]=GTK_TOGGLE_BUTTON(object);
-}
-
-void on_but_func3_realize(GtkObject *object, gpointer user_data) {
- buttons[2]=GTK_TOGGLE_BUTTON(object);
-}
-void on_but_func4_realize(GtkObject *object, gpointer user_data) {
- buttons[3]=GTK_TOGGLE_BUTTON(object);
+void on_radbut_func_realize(GtkObject *object, gpointer user_data) {
+ // This makes the radio buttons look like a Toogle Button (that's a fucking trick)
+ gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(object),FALSE);
}
int main (int argc, char *argv[]) {