[gtk+] fontchooser: Store the font description in the model



commit ae5f82e455b5daed58a2c8358df748d249e340aa
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 19 17:58:51 2011 +0200

    fontchooser: Store the font description in the model
    
    It's actually expensive to create (>5ms per font with >1000 fonts
    installed), so better cache it.

 gtk/gtkfontchooserwidget.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 1bd1405..e1cf90a 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -126,6 +126,7 @@ static const gint font_sizes[] = {
 enum {
   FAMILY_COLUMN,
   FACE_COLUMN,
+  FONT_DESC_COLUMN,
   PREVIEW_TEXT_COLUMN,
   PREVIEW_TITLE_COLUMN
 };
@@ -765,6 +766,7 @@ populate_list (GtkFontChooserWidget *fontchooser,
           gtk_list_store_insert_with_values (model, &iter, -1,
                                              FAMILY_COLUMN, families[i],
                                              FACE_COLUMN, faces[j],
+                                             FONT_DESC_COLUMN, pango_desc,
                                              PREVIEW_TITLE_COLUMN, family_and_face,
                                              PREVIEW_TEXT_COLUMN, tmp,
                                              -1);
@@ -886,9 +888,10 @@ gtk_font_chooser_widget_bootstrap_fontlist (GtkFontChooserWidget *fontchooser)
   GtkCellRenderer   *cell;
   GtkTreeViewColumn *col;
 
-  priv->model = gtk_list_store_new (4,
+  priv->model = gtk_list_store_new (5,
                                     PANGO_TYPE_FONT_FAMILY,
                                     PANGO_TYPE_FONT_FACE,
+                                    PANGO_TYPE_FONT_DESCRIPTION,
                                     G_TYPE_STRING,
                                     G_TYPE_STRING);
 



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