[gtk+/wip/matthiasc/font-variations: 8/10] fontchooser: Small revision of the UI



commit 72516c68cb8303e920b06e707792cbbdfb58298f
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 19 17:10:34 2017 -0500

    fontchooser: Small revision of the UI
    
    Show only the font names in the list, in their own
    font, in order to make the list less noisy.

 gtk/gtkfontchooserwidget.c |   39 ++++++++++-----------------------------
 1 files changed, 10 insertions(+), 29 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index de81a9b..68fc3cb 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -976,35 +976,20 @@ gtk_font_chooser_widget_get_preview_text_height (GtkFontChooserWidget *fontchoos
 
 static PangoAttrList *
 gtk_font_chooser_widget_get_preview_attributes (GtkFontChooserWidget       *fontchooser,
-                                                const PangoFontDescription *font_desc,
-                                                gsize                       first_line_len)
+                                                const PangoFontDescription *font_desc)
 {
   PangoAttribute *attribute;
   PangoAttrList *attrs;
 
   attrs = pango_attr_list_new ();
 
-  attribute = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
-  attribute->end_index = first_line_len;
-  pango_attr_list_insert (attrs, attribute);
-
-  attribute = pango_attr_scale_new (PANGO_SCALE_SMALL);
-  attribute->end_index = first_line_len;
-  pango_attr_list_insert (attrs, attribute);
-
   if (font_desc)
     {
       attribute = pango_attr_font_desc_new (font_desc);
-      attribute->start_index = first_line_len;
       pango_attr_list_insert (attrs, attribute);
     }
 
-  attribute = pango_attr_fallback_new (FALSE);
-  attribute->start_index = first_line_len;
-  pango_attr_list_insert (attrs, attribute);
-
   attribute = pango_attr_size_new_absolute (gtk_font_chooser_widget_get_preview_text_height (fontchooser));
-  attribute->start_index = first_line_len;
   pango_attr_list_insert (attrs, attribute);
 
   return attrs;
@@ -1020,29 +1005,25 @@ gtk_font_chooser_widget_cell_data_func (GtkTreeViewColumn *column,
   GtkFontChooserWidget *fontchooser = user_data;
   GtkDelayedFontDescription *desc;
   PangoAttrList *attrs;
-  char *preview_title, *text;
-  gsize first_line_len;
+  char *preview_title;
 
   gtk_tree_model_get (tree_model, iter,
                       PREVIEW_TITLE_COLUMN, &preview_title,
                       FONT_DESC_COLUMN, &desc,
                       -1);
 
-  text = g_strconcat (preview_title, "\n", fontchooser->priv->preview_text, NULL);
-  first_line_len = strlen (preview_title) + 1;
-
   attrs = gtk_font_chooser_widget_get_preview_attributes (fontchooser,
-                                                          gtk_delayed_font_description_get (desc),
-                                                          first_line_len);
+              gtk_delayed_font_description_get (desc));
 
   g_object_set (cell,
+                "xpad", 20,
+                "ypad", 10,
                 "attributes", attrs,
-                "text", text,
+                "text", preview_title,
                 NULL);
 
   gtk_delayed_font_description_unref (desc);
   pango_attr_list_unref (attrs);
-  g_free (text);
   g_free (preview_title);
 }
 
@@ -1055,13 +1036,13 @@ gtk_font_chooser_widget_set_cell_size (GtkFontChooserWidget *fontchooser)
 
   gtk_cell_renderer_set_fixed_size (priv->family_face_cell, -1, -1);
 
-  attrs = gtk_font_chooser_widget_get_preview_attributes (fontchooser, 
-                                                          NULL,
-                                                          1);
+  attrs = gtk_font_chooser_widget_get_preview_attributes (fontchooser, NULL);
   
   g_object_set (priv->family_face_cell,
+                "xpad", 20,
+                "ypad", 10,
                 "attributes", attrs,
-                "text", "x\nx",
+                "text", "x",
                 NULL);
 
   pango_attr_list_unref (attrs);


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