[gtk+/font-chooser: 58/84] GtkFontChooser: Update size when selecting an item of the deprecated size list



commit 7bafa5ada7c52ec6e5b9fef4393268502bec82a4
Author: Alberto Ruiz <aruiz gnome org>
Date:   Sun May 1 02:25:13 2011 +0100

    GtkFontChooser: Update size when selecting an item of the deprecated size list

 gtk/gtkfontchooser.c |   47 +++++++++++++++++++++++++++++++++--------------
 1 files changed, 33 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkfontchooser.c b/gtk/gtkfontchooser.c
index 83c6ece..010b0f0 100644
--- a/gtk/gtkfontchooser.c
+++ b/gtk/gtkfontchooser.c
@@ -1154,43 +1154,62 @@ update_size_list_selection (GtkFontSelection *fontsel)
     }
 }
 
+
 static void
-size_list_cursor_changed_cb (GtkTreeView *treeview, gpointer data)
+family_list_cursor_changed_cb (GtkTreeView *treeview, gpointer data)
 {
   GtkFontSelection *fontsel = (GtkFontSelection*)data;
 
-  if (fontsel->priv->ignore_size)
+  if (fontsel->priv->ignore_font)
     {
-      fontsel->priv->ignore_size = FALSE;
+      fontsel->priv->ignore_font = FALSE;
       return;
     }
-  g_debug ("size");
+
 }
 
-static void
-family_list_cursor_changed_cb (GtkTreeView *treeview, gpointer data)
+face_list_cursor_changed_cb (GtkTreeView *treeview, gpointer data)
 {
   GtkFontSelection *fontsel = (GtkFontSelection*)data;
 
-
-  if (fontsel->priv->ignore_font)
+  if (fontsel->priv->ignore_face)
     {
-      fontsel->priv->ignore_font = FALSE;
+      fontsel->priv->ignore_face = FALSE;
       return;
     }
-  g_debug ("family");    
 }
 
-face_list_cursor_changed_cb (GtkTreeView *treeview, gpointer data)
+static void
+size_list_cursor_changed_cb (GtkTreeView *treeview, gpointer data)
 {
+  GtkWidget        *tv;
+  GtkTreeIter       iter;
+  GtkTreePath      *path;
   GtkFontSelection *fontsel = (GtkFontSelection*)data;
+  gint              value;
 
-  if (fontsel->priv->ignore_face)
+  if (fontsel->priv->ignore_size)
     {
-      fontsel->priv->ignore_face = FALSE;
+      fontsel->priv->ignore_size = FALSE;
       return;
     }
-  g_debug ("face");
+
+  tv = gtk_bin_get_child (GTK_BIN (fontsel->priv->size_list));
+  gtk_tree_view_get_cursor (GTK_TREE_VIEW (tv), &path, NULL);
+
+  if (!path)
+    return;
+
+  gtk_tree_model_get_iter (GTK_TREE_MODEL (fontsel->priv->_size_model),
+                           &iter,
+                           path);
+  
+  gtk_tree_model_get (GTK_TREE_MODEL (fontsel->priv->_size_model), &iter,
+                      0, &value,
+                      -1);
+
+  gtk_spin_button_set_value (fontsel->priv->size_spin, value);
+  gtk_tree_path_free (path);
 }
 
 static void



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