[gtk+] fontchooser: Make all setters go through merge_font_desc()



commit a40d0b44e107400e94e2f3bb79de7acaed546d48
Author: Benjamin Otte <otte redhat com>
Date:   Wed Sep 21 02:51:08 2011 +0200

    fontchooser: Make all setters go through merge_font_desc()
    
    Don't special case cursor_changed anymore.

 gtk/gtkfontchooserwidget.c |   32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index d1d0890..337743a 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -145,6 +145,9 @@ static void     gtk_font_chooser_widget_set_font         (GtkFontChooserWidget *
                                                           const gchar          *fontname);
 
 static PangoFontDescription *gtk_font_chooser_widget_get_font_desc  (GtkFontChooserWidget *fontchooser);
+static void                  gtk_font_chooser_widget_merge_font_desc(GtkFontChooserWidget *fontchooser,
+                                                                     PangoFontDescription *font_desc,
+                                                                     GtkTreeIter          *iter);
 static void                  gtk_font_chooser_widget_take_font_desc (GtkFontChooserWidget *fontchooser,
                                                                      PangoFontDescription *font_desc);
 
@@ -395,7 +398,7 @@ cursor_changed_cb (GtkTreeView *treeview,
   GtkFontChooserWidget *fontchooser = user_data;
   GtkFontChooserWidgetPrivate *priv = fontchooser->priv;
   PangoFontDescription *desc;
-  GtkTreeIter  iter;
+  GtkTreeIter filter_iter, iter;
   GtkTreePath *path = NULL;
 
   gtk_tree_view_get_cursor (treeview, &path, NULL);
@@ -403,33 +406,22 @@ cursor_changed_cb (GtkTreeView *treeview,
   if (!path)
     return;
 
-  if (!gtk_tree_model_get_iter (priv->filter_model, &iter, path))
+  if (!gtk_tree_model_get_iter (priv->filter_model, &filter_iter, path))
     {
       gtk_tree_path_free (path);
       return;
     }
 
-  gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (priv->filter_model),
-                                                    &priv->font_iter,
-                                                    &iter);
-  gtk_tree_model_get (priv->filter_model, &iter,
-                      FONT_DESC_COLUMN, &desc,
-                      -1);
-
   gtk_tree_path_free (path);
-  path = NULL;
 
-  pango_font_description_set_size (desc, pango_font_description_get_size (priv->font_desc));
-  gtk_widget_override_font (priv->preview, desc);
-
-  gtk_font_chooser_widget_update_marks (fontchooser);
-
-  if (priv->font_desc)
-    pango_font_description_free (priv->font_desc);
-  priv->font_desc = desc;
+  gtk_tree_model_get (priv->filter_model, &filter_iter,
+                      FONT_DESC_COLUMN, &desc,
+                      -1);
+  gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (priv->filter_model),
+                                                    &iter,
+                                                    &filter_iter);
 
-  g_object_notify (G_OBJECT (fontchooser), "font");
-  g_object_notify (G_OBJECT (fontchooser), "font-desc");
+  gtk_font_chooser_widget_merge_font_desc (fontchooser, desc, &iter);
 }
 
 static gboolean



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