[gtk/pango2: 81/91] fontbutton: Simplify




commit 994ece597937030c29a46b1c193fc15b603d57f5
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 19 08:33:30 2022 -0700

    fontbutton: Simplify

 gtk/gtkfontbutton.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index d430826a4f..16b6630e46 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -227,6 +227,7 @@ gtk_font_button_update_font_data (GtkFontButton *font_button)
 {
   const char *name;
   PangoFontMap *font_map;
+  PangoFontFamily *family;
 
   g_assert (font_button->font_desc != NULL);
 
@@ -237,19 +238,8 @@ gtk_font_button_update_font_data (GtkFontButton *font_button)
     return;
 
   font_map = pango_context_get_font_map (gtk_widget_get_pango_context (font_button->font_label));
-  for (int i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (font_map)); i++)
-    {
-      PangoFontFamily *family = g_list_model_get_item (G_LIST_MODEL (font_map), i);
-
-      if (!g_ascii_strcasecmp (name, pango_font_family_get_name (family)))
-        {
-          g_set_object (&font_button->font_family, family);
-          g_object_unref (family);
-          break;
-        }
-
-      g_object_unref (family);
-    }
+  family = pango_font_map_get_family (font_map, name);
+  g_set_object (&font_button->font_family, family);
 
   for (int i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (font_button->font_family)); i++)
     {


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