summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-11-07 07:48:44 -0800
committerJohn Stebbins <[email protected]>2017-11-07 07:48:44 -0800
commit05b36baaa192c3bbbc0ccf4eb10acae887c6b0a1 (patch)
treec3e41915f209b319d835aed7afc25499ae7d9d21 /gtk/src
parent84ae3245700be02a5c434ec8c74dab3fa44e2094 (diff)
LinGui: fix build with glib older than 2.44
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/ghbcompat.h23
-rw-r--r--gtk/src/hb-backend.c2
-rw-r--r--gtk/src/presets.c2
3 files changed, 25 insertions, 2 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"
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 3f7b1fd68..c2a2e556e 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -1945,7 +1945,7 @@ preset_category_opts_set(signal_user_data_t *ud, const gchar *name,
continue;
}
- if (g_strv_contains((const char**)categories, name))
+ if (ghb_strv_contains((const char**)categories, name))
{
// Category is already in the list
continue;
diff --git a/gtk/src/presets.c b/gtk/src/presets.c
index 31fa26d7c..89e6cb8f2 100644
--- a/gtk/src/presets.c
+++ b/gtk/src/presets.c
@@ -1237,7 +1237,7 @@ ghb_presets_menu_init(signal_user_data_t *ud)
free(detail_action);
}
if (type == 1 &&
- g_strv_contains((const char**)official_names, folder_name))
+ ghb_strv_contains((const char**)official_names, folder_name))
{
menu_item_name = g_strdup_printf("My %s", folder_name);
}