]> Pileus Git - ~andy/gtk/commitdiff
GtkFontChooser: Add deprecated calls to the test
authorAlberto Ruiz <aruiz@gnome.org>
Wed, 27 Apr 2011 23:58:36 +0000 (00:58 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 15 Aug 2011 22:57:53 +0000 (18:57 -0400)
gtk/gtkfontchooser.c
tests/testfontselection.c

index 8ac33ce479b5ed1fca1ff5a600797cea88da6175..2fc0aa40bd6c5496641526cb40d6f860281002b6 100644 (file)
@@ -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
index 04b777db76d5e039292e9c4fda49eb70567d550f..0b721f5b59d2b27ea351a0da0ebc3f761c142940 100644 (file)
 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);