]> Pileus Git - aweather/blobdiff - src/compat.h
Convert GtkBox and GtkScale to GTK 3 version
[aweather] / src / compat.h
diff --git a/src/compat.h b/src/compat.h
new file mode 100644 (file)
index 0000000..3d530f6
--- /dev/null
@@ -0,0 +1,17 @@
+#include <gtk/gtk.h>
+
+#if ! GTK_CHECK_VERSION(3,0,0)
+static inline GtkWidget *gtk_box_new(GtkOrientation orientation, gint spacing)
+{
+       return orientation == GTK_ORIENTATION_HORIZONTAL
+               ? gtk_hbox_new(0, spacing)
+               : gtk_vbox_new(0, spacing);
+}
+static inline GtkWidget *gtk_scale_new_with_range(GtkOrientation orientation,
+               gdouble min, gdouble max, gdouble step)
+{
+       return orientation == GTK_ORIENTATION_HORIZONTAL
+               ? gtk_hscale_new_with_range(min, max, step)
+               : gtk_vscale_new_with_range(min, max, step);
+}
+#endif