[gtk/wip/otte/listview: 4/152] xxx: Add a hack to make GtkFontList work with Pango < 1.46



commit 38e67741a5c57de299f28a4c1dafcefaf7a30551
Author: Benjamin Otte <otte redhat com>
Date:   Tue Nov 26 16:44:49 2019 +0100

    xxx: Add a hack to make GtkFontList work with Pango < 1.46

 gtk/gtkfontlist.c        | 7 +++++++
 testsuite/gtk/fontlist.c | 4 ++++
 2 files changed, 11 insertions(+)
---
diff --git a/gtk/gtkfontlist.c b/gtk/gtkfontlist.c
index f3b735b3c6..3e6be2e51b 100644
--- a/gtk/gtkfontlist.c
+++ b/gtk/gtkfontlist.c
@@ -65,6 +65,10 @@ struct _GtkFontListClass
 
 static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
 
+#if PANGO_VERSION < G_ENCODE_VERSION (1, 46)
+#define pango_font_face_get_family(_face) g_object_get_data (G_OBJECT (_face), "-gtk-font-family")
+#endif
+
 static GType
 gtk_font_list_get_item_type (GListModel *list)
 {
@@ -248,6 +252,9 @@ gtk_font_list_rescan (GtkFontList *self)
                 }
             }
           MARK_CHANGED (iter, TRUE);
+#if PANGO_VERSION < G_ENCODE_VERSION (1, 46)
+          g_object_set_data_full (G_OBJECT (faces[j]), "-gtk-font-family", g_object_ref (families[i]), 
g_object_unref);
+#endif
           g_sequence_insert_before (iter, g_object_ref (faces[j]));
         }
 
diff --git a/testsuite/gtk/fontlist.c b/testsuite/gtk/fontlist.c
index 55b7d93d05..2b4de3efa9 100644
--- a/testsuite/gtk/fontlist.c
+++ b/testsuite/gtk/fontlist.c
@@ -21,6 +21,10 @@
 
 static GQuark changes_quark;
 
+#if PANGO_VERSION < G_ENCODE_VERSION (1, 46)
+#define pango_font_face_get_family(_face) g_object_get_data (G_OBJECT (_face), "-gtk-font-family")
+#endif
+
 static char *
 model_to_string (GListModel *model)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]