[gtk/fix-double-underscore-mnemonic] Avoid pango deprecations




commit 1c70b220b160c04adde72fa4bca5e55a329550fb
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Aug 1 22:43:43 2021 -0400

    Avoid pango deprecations
    
    This function has been deprecated on the main
    branch of pango. Since we don't want to bump our
    pango dependency to 1.49 yet, ignore the deprecation.

 gtk/gtkfontchooserwidget.c | 38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index be3b4cd027..867c9c17ad 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -386,15 +386,18 @@ user_filter_cb (gpointer item,
 
           ret = FALSE;
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
           langs = pango_fc_font_get_languages (PANGO_FC_FONT (font));
-          for (i = 0; langs[i]; i++)
-            {
-              if (langs[i] == self->filter_language)
-                {
-                  ret = TRUE;
-                  break;
-                }
-            }
+G_GNUC_END_IGNORE_DEPRECATIONS
+          if (langs)
+            for (i = 0; langs[i]; i++)
+              {
+                if (langs[i] == self->filter_language)
+                  {
+                    ret = TRUE;
+                    break;
+                  }
+              }
         }
 
       g_object_unref (font);
@@ -600,17 +603,20 @@ maybe_update_preview_text (GtkFontChooserWidget *self,
           alt_default = pango_language_from_string (q);
         }
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
       languages = pango_fc_font_get_languages (PANGO_FC_FONT (font));
+G_GNUC_END_IGNORE_DEPRECATIONS
 
       /* If the font supports the default language, just use it. */
-      for (i = 0; languages[i]; i++)
-        {
-          if (languages[i] == default_lang || languages[i] == alt_default)
-            {
-              lang = default_lang;
-              goto found;
-            }
-        }
+      if (languages)
+        for (i = 0; languages[i]; i++)
+          {
+            if (languages[i] == default_lang || languages[i] == alt_default)
+              {
+                lang = default_lang;
+                goto found;
+              }
+          }
 
       /* Otherwise, we make a list of representative languages */
       langs = g_hash_table_new (NULL, NULL);


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