summaryrefslogtreecommitdiffstats
path: root/callbacks-gtk.h
diff options
context:
space:
mode:
Diffstat (limited to 'callbacks-gtk.h')
-rw-r--r--callbacks-gtk.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/callbacks-gtk.h b/callbacks-gtk.h
new file mode 100644
index 000000000..017a8c0ae
--- /dev/null
+++ b/callbacks-gtk.h
@@ -0,0 +1,17 @@
+#define UNITCALLBACK(name, type, value) \
+static void name(GtkWidget *w, gpointer data) \
+{ \
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) \
+ prefs.units.type = value; \
+ update_screen(); \
+}
+
+#define OPTIONCALLBACK(name, option) \
+static void name(GtkWidget *w, gpointer data) \
+{ \
+ GtkWidget **entry = data; \
+ option = GTK_TOGGLE_BUTTON(w)->active; \
+ update_screen(); \
+ if (entry) \
+ gtk_widget_set_sensitive(*entry, option);\
+}