summaryrefslogtreecommitdiffstats
path: root/gtk/src/ghbcompat.h
diff options
context:
space:
mode:
authorJohn Stebbins <jstebbins.hb@gmail.com>2017-11-07 07:48:44 -0800
committerJohn Stebbins <jstebbins.hb@gmail.com>2017-11-07 07:48:44 -0800
commit05b36baaa192c3bbbc0ccf4eb10acae887c6b0a1 (patch)
treec3e41915f209b319d835aed7afc25499ae7d9d21 /gtk/src/ghbcompat.h
parent84ae3245700be02a5c434ec8c74dab3fa44e2094 (diff)
LinGui: fix build with glib older than 2.44
Diffstat (limited to 'gtk/src/ghbcompat.h')
-rw-r--r--gtk/src/ghbcompat.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/gtk/src/ghbcompat.h b/gtk/src/ghbcompat.h
index cb27f307b..17cb125e2 100644
--- a/gtk/src/ghbcompat.h
+++ b/gtk/src/ghbcompat.h
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include <gdk/gdk.h>
+#include <string.h>
static inline PangoFontDescription* ghb_widget_get_font(GtkWidget *widget)
{
@@ -83,6 +84,28 @@ static inline void ghb_monitor_get_size(GdkWindow *window, gint *w, gint *h)
#endif
}
+static inline gboolean ghb_strv_contains(const char ** strv, const char * str)
+{
+#if GLIB_CHECK_VERSION(2, 44, 0)
+ return g_strv_contains(strv, str);
+#else
+ int ii;
+
+ if (strv == NULL)
+ {
+ return FALSE;
+ }
+ for (ii = 0; strv[ii] != NULL; ii++)
+ {
+ if (!strcmp(strv[ii], str))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+#endif
+}
+
#if !GTK_CHECK_VERSION(3, 10, 0)
#define gtk_image_set_from_icon_name gtk_image_set_from_stock
#define GHB_PLAY_ICON "gtk-media-play"