[gtk+/font-selection-new: 45/73] GtkFontSelection: Add deprecated calls to the test



commit 8ac67f62a855b8efbe200da45bcd4bbed48800a5
Author: Alberto Ruiz <aruiz gnome org>
Date:   Thu Apr 28 00:58:36 2011 +0100

    GtkFontSelection: Add deprecated calls to the test

 gtk/gtkfontsel.c          |   32 +++++++++++++++++---------------
 tests/testfontselection.c |   15 +++++++++++++++
 2 files changed, 32 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c
index 8ac33ce..2fc0aa4 100644
--- a/gtk/gtkfontsel.c
+++ b/gtk/gtkfontsel.c
@@ -160,7 +160,7 @@ enum {
   FACE_COLUMN,
   PREVIEW_TEXT_COLUMN,
   PREVIEW_TITLE_COLUMN,
-  /*FIXME: Remove two strings after deprecation removal */
+  /*FIXME: Remove these two strings for 4.0 */
   FAMILY_NAME_COLUMN,
   FACE_NAME_COLUMN
 };
@@ -194,9 +194,9 @@ static void
 gtk_font_selection_class_init (GtkFontSelectionClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
 #if 0
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
   widget_class->screen_changed = gtk_font_selection_screen_changed;
   widget_class->style_updated = gtk_font_selection_style_updated;
 #endif
@@ -422,10 +422,19 @@ set_range_marks (GtkFontSelectionPrivate *priv,
       priv->ignore_slider = TRUE; 
     }
   
-
-  /* FIXME: Ought to be removed for 4.0 to just populate the marks */
-  if (priv->_size_model)
+  if (!priv->_size_model)
     {
+      for (i=0; i<length; i++)
+        gtk_scale_add_mark (GTK_SCALE (size_slider),
+                            (gdouble) sizes[i],
+                            GTK_POS_BOTTOM, NULL);
+    }
+  else
+    {
+      /* FIXME: This populates the size list for the
+       *        deprecated size list tree view.
+       *        Should be removed for 4.0
+       */
       GString *size_str = g_string_new (NULL);
       gtk_list_store_clear (priv->_size_model);
       
@@ -444,16 +453,9 @@ set_range_marks (GtkFontSelectionPrivate *priv,
                               0, sizes[i],
                               1, size_str->str,
                               -1);
-       }
-       g_string_free (size_str, TRUE);
-   }
- else
-   {
-           for (i=0; i<length; i++)
-             gtk_scale_add_mark (GTK_SCALE (size_slider),
-                                (gdouble) sizes[i],
-                                 GTK_POS_BOTTOM, NULL);
-   }
+        }
+      g_string_free (size_str, TRUE);
+    }
 }
 
 void
diff --git a/tests/testfontselection.c b/tests/testfontselection.c
index 04b777d..0b721f5 100644
--- a/tests/testfontselection.c
+++ b/tests/testfontselection.c
@@ -25,11 +25,26 @@
 int
 main (int argc, char *argv[])
 {
+  GtkWidget *window;
+  GtkWidget *vbox;
   GtkWidget *dialog;
+  GtkWidget *fontsel;
   
   gtk_init (NULL, NULL);
     
   dialog = gtk_font_selection_dialog_new (NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  vbox = gtk_vbox_new (TRUE, 6);
+  gtk_container_add (GTK_CONTAINER (window), vbox);
+
+  fontsel = gtk_font_selection_dialog_get_font_selection (GTK_FONT_SELECTION_DIALOG (dialog));
+  gtk_container_add (GTK_CONTAINER (window), gtk_font_selection_get_size_list (GTK_FONT_SELECTION (fontsel)));
+  gtk_container_add (GTK_CONTAINER (window), gtk_font_selection_get_family_list (GTK_FONT_SELECTION (fontsel)));
+  gtk_container_add (GTK_CONTAINER (window), gtk_font_selection_get_face_list (GTK_FONT_SELECTION (fontsel)));
+
+  gtk_widget_show_all (window);
+
   gtk_dialog_run (GTK_DIALOG (dialog));
 
   gtk_widget_destroy (dialog);



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