tUse GTK3 style ButtonBox constructor - vaccinewars - be a doctor and try to va… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 94e930c8dce52bedbe605505568e5055e2b0cba6 | |
parent 004faf6d6de3c4aa1adbb2a94aa88636a4c46792 | |
Author: Ben Webb <[email protected]> | |
Date: Sun, 22 Nov 2020 21:16:29 -0800 | |
Use GTK3 style ButtonBox constructor | |
Use GTK3 style gtk_button_box_new() rather | |
tthan GTK2 style gtk_hbutton_box_new() and | |
gtk_vbutton_box_new(). Provide compatibility | |
wrapper so that things still work with GTK2. | |
Diffstat: | |
M src/gtkport/gtkport.c | 13 +++++++++++++ | |
M src/gtkport/gtkport.h | 5 +++++ | |
M src/gui_client/gtk_client.c | 4 ++-- | |
3 files changed, 20 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/src/gtkport/gtkport.c b/src/gtkport/gtkport.c | |
t@@ -5186,6 +5186,19 @@ gchar *GtkGetFile(const GtkWidget *parent, const gchar … | |
} | |
#else /* CYGWIN */ | |
+ | |
+#if GTK_MAJOR_VERSION == 2 | |
+GtkWidget *gtk_button_box_new(GtkOrientation orientation) | |
+{ | |
+ if (orientation == GTK_ORIENTATION_HORIZONTAL) { | |
+ return gtk_hbutton_box_new(); | |
+ } else { | |
+ return gtk_vbutton_box_new(); | |
+ } | |
+} | |
+ | |
+#endif | |
+ | |
guint SetAccelerator(GtkWidget *labelparent, gchar *Text, | |
GtkWidget *sendto, gchar *signal, | |
GtkAccelGroup *accel_group, gboolean needalt) | |
diff --git a/src/gtkport/gtkport.h b/src/gtkport/gtkport.h | |
t@@ -695,6 +695,11 @@ void MapWidgetOrigin(GtkWidget *widget, POINT *pt); | |
#include <gtk/gtk.h> | |
#include <gdk/gdkkeysyms.h> | |
+/* Provide compatibility functions for GTK+2 so we can use GTK+3 syntax */ | |
+#if GTK_MAJOR_VERSION == 2 | |
+GtkWidget *gtk_button_box_new(GtkOrientation orientation); | |
+#endif | |
+ | |
/* Defines for GtkMessageBox options */ | |
#define MB_OK 1 | |
#define MB_CANCEL 2 | |
diff --git a/src/gui_client/gtk_client.c b/src/gui_client/gtk_client.c | |
t@@ -205,7 +205,7 @@ static void LogMessage(const gchar *log_domain, GLogLevelF… | |
*/ | |
GtkWidget *my_hbbox_new(void) | |
{ | |
- GtkWidget *hbbox = gtk_hbutton_box_new(); | |
+ GtkWidget *hbbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); | |
gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_END); | |
gtk_box_set_spacing(GTK_BOX(hbbox), 8); | |
return hbbox; | |
t@@ -3114,7 +3114,7 @@ void CreateInventory(GtkWidget *hbox, gchar *Objects, | |
} | |
if (CreateButtons) { | |
- widgets->vbbox = vbbox = gtk_vbutton_box_new(); | |
+ widgets->vbbox = vbbox = gtk_button_box_new(GTK_ORIENTATION_VERTICAL); | |
gtk_button_box_set_layout(GTK_BUTTON_BOX(vbbox), GTK_BUTTONBOX_SPREAD); | |