summaryrefslogtreecommitdiffstats
path: root/callbacks-gtk.h
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-01-11 13:24:15 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-11 05:54:35 -0800
commitc4ae58d589bdf315223c41716ca4b0ae747a8498 (patch)
tree4a3434b96c4ed82b789f875f5029549a59ba9075 /callbacks-gtk.h
parentac376ea379b50bab3b172842d9ce2e67e3b03783 (diff)
downloadsubsurface-c4ae58d589bdf315223c41716ca4b0ae747a8498.tar.gz
gtk-gui.c: Move the download dialog related code to a new file
A new file download-dialog.c now contains all code related to the download dialog, which was previously defined in gtk-gui.c. Also, a new file callbacks-gtk.h now has two macros OPTIONCALLBACK, UNITCALLBACK shared only between download-dialog.c and gtk-gui.c. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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);\
+}