[gtk+] fontchooser: Make changing the preview text fast



commit 6cbbc789d5a70fd08a12e8bc1fc744e380ae87af
Author: Benjamin Otte <otte redhat com>
Date:   Tue Sep 20 16:49:49 2011 +0200

    fontchooser: Make changing the preview text fast
    
    Instead of reloading the font list, we now just queue a redraw. This
    works, because the preview text is added using a cell data func instead
    of a custom column.

 gtk/gtkfontchooserwidget.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index f4789d7..6257e6d 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -1036,16 +1036,18 @@ static void
 gtk_font_chooser_widget_set_preview_text (GtkFontChooserWidget *fontchooser,
                                           const gchar          *text)
 {
-  g_free (fontchooser->priv->preview_text);
-  fontchooser->priv->preview_text = g_strdup (text);
+  GtkFontChooserWidgetPrivate *priv = fontchooser->priv;
 
-  populate_list (fontchooser,
-                 GTK_TREE_VIEW (fontchooser->priv->family_face_list),
-                 fontchooser->priv->model);
+  g_free (priv->preview_text);
+  priv->preview_text = g_strdup (text);
 
-  gtk_entry_set_text (GTK_ENTRY (fontchooser->priv->preview), text);
+  gtk_entry_set_text (GTK_ENTRY (priv->preview), text);
 
   g_object_notify (G_OBJECT (fontchooser), "preview-text");
+
+  /* XXX: There's no API to tell the treeview that a column has changed,
+   * so we just */
+  gtk_widget_queue_draw (priv->family_face_list);
 }
 
 static gboolean



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