]> granicus.if.org Git - handbrake/commitdiff
LinGui: fix build with glib older than 2.44
authorJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 7 Nov 2017 15:48:44 +0000 (07:48 -0800)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 7 Nov 2017 15:48:44 +0000 (07:48 -0800)
gtk/src/ghbcompat.h
gtk/src/hb-backend.c
gtk/src/presets.c

index cb27f307bc456fcfe7b1a807dd6d7c5b1225bbca..17cb125e29afa5a09eb208867ddd15091a5ac2e8 100644 (file)
@@ -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"
index 3f7b1fd680d73bef37ae3ba2f393429fa9724575..c2a2e556e198cc73991a47e944b237265e572541 100644 (file)
@@ -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;
index 31fa26d7c5484c60403311df07b68831eb71bc45..89e6cb8f26a6ab9c1de1f5043d67b7d770fd3750 100644 (file)
@@ -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);
                 }