]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkfontsel.c
gtk: remove "gboolean homogeneous" from gtk_box_new()
[~andy/gtk] / gtk / gtkfontsel.c
index 84ee9dc85a9278cef64d07b0897af5ea56b0b8b0..e73b4ba426fafa63f5e1c91add8abde49744a72e 100644 (file)
 #include "gtkscrolledwindow.h"
 #include "gtkintl.h"
 #include "gtkaccessible.h"
-#include "gtkprivate.h"
 #include "gtkbuildable.h"
-#include "gtkalias.h"
+#include "gtkprivate.h"
+
+struct _GtkFontSelectionPrivate
+{
+  GtkWidget *font_entry;        /* Used _get_family_entry() for consistency, -mr */
+  GtkWidget *font_style_entry;  /* Used _get_face_entry() for consistency, -mr */
+
+  GtkWidget *size_entry;
+  GtkWidget *preview_entry;
+
+  GtkWidget *family_list;
+  GtkWidget *face_list;
+  GtkWidget *size_list;
+
+  PangoFontFamily *family;      /* Current family */
+  PangoFontFace *face;          /* Current face */
+
+  gint size;
+};
+
+
+struct _GtkFontSelectionDialogPrivate
+{
+  GtkWidget *fontsel;
+
+  GtkWidget *ok_button;
+  GtkWidget *apply_button;
+  GtkWidget *cancel_button;
+};
+
 
 /* We don't enable the font and style entries because they don't add
  * much in terms of visible effect and have a weird effect on keynav.
 /* These are what we use as the standard font sizes, for the size list.
  */
 static const guint16 font_sizes[] = {
-  6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 18, 20, 22, 24, 26, 28,
+  6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28,
   32, 36, 40, 48, 56, 64, 72
 };
 
 enum {
    PROP_0,
    PROP_FONT_NAME,
-   PROP_FONT,
    PROP_PREVIEW_TEXT
 };
 
@@ -164,7 +191,6 @@ static void     gtk_font_selection_scroll_to_selection   (GtkFontSelection *font
 static void    gtk_font_selection_load_font          (GtkFontSelection *fs);
 static void    gtk_font_selection_update_preview     (GtkFontSelection *fs);
 
-static GdkFont* gtk_font_selection_get_font_internal (GtkFontSelection *fontsel);
 static PangoFontDescription *gtk_font_selection_get_font_description (GtkFontSelection *fontsel);
 static gboolean gtk_font_selection_select_font_desc  (GtkFontSelection      *fontsel,
                                                      PangoFontDescription  *new_desc,
@@ -183,7 +209,8 @@ gtk_font_selection_class_init (GtkFontSelectionClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-  
+
+  gobject_class->finalize = gtk_font_selection_finalize;
   gobject_class->set_property = gtk_font_selection_set_property;
   gobject_class->get_property = gtk_font_selection_get_property;
 
@@ -197,13 +224,6 @@ gtk_font_selection_class_init (GtkFontSelectionClass *klass)
                                                         P_("The string that represents this font"),
                                                         DEFAULT_FONT_NAME,
                                                         GTK_PARAM_READWRITE));
-  g_object_class_install_property (gobject_class,
-                                  PROP_FONT,
-                                  g_param_spec_boxed ("font",
-                                                      P_("Font"),
-                                                      P_("The GdkFont that is currently selected"),
-                                                      GDK_TYPE_FONT,
-                                                      GTK_PARAM_READABLE));
   g_object_class_install_property (gobject_class,
                                    PROP_PREVIEW_TEXT,
                                    g_param_spec_string ("preview-text",
@@ -211,7 +231,8 @@ gtk_font_selection_class_init (GtkFontSelectionClass *klass)
                                                         P_("The text to display in order to demonstrate the selected font"),
                                                         _(PREVIEW_TEXT),
                                                         GTK_PARAM_READWRITE));
-  gobject_class->finalize = gtk_font_selection_finalize;
+
+  g_type_class_add_private (klass, sizeof (GtkFontSelectionPrivate));
 }
 
 static void 
@@ -252,9 +273,6 @@ static void gtk_font_selection_get_property (GObject         *object,
     case PROP_FONT_NAME:
       g_value_take_string (value, gtk_font_selection_get_font_name (fontsel));
       break;
-    case PROP_FONT:
-      g_value_set_boxed (value, gtk_font_selection_get_font_internal (fontsel));
-      break;
     case PROP_PREVIEW_TEXT:
       g_value_set_string (value, gtk_font_selection_get_preview_text (fontsel));
       break;
@@ -270,26 +288,30 @@ static void gtk_font_selection_get_property (GObject         *object,
 static gboolean
 list_row_activated (GtkWidget *widget)
 {
+  GtkWidget *default_widget, *focus_widget;
   GtkWindow *window;
   
   window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget)));
-  if (!GTK_WIDGET_TOPLEVEL (window))
+  if (!gtk_widget_is_toplevel (GTK_WIDGET (window)))
     window = NULL;
-  
-  if (window
-      && widget != window->default_widget
-      && !(widget == window->focus_widget &&
-          (!window->default_widget || !GTK_WIDGET_SENSITIVE (window->default_widget))))
+
+  if (window)
     {
-      gtk_window_activate_default (window);
+      default_widget = gtk_window_get_default_widget (window);
+      focus_widget = gtk_window_get_focus (window);
+
+      if (widget != default_widget &&
+          !(widget == focus_widget && (!default_widget || !gtk_widget_get_sensitive (default_widget))))
+        gtk_window_activate_default (window);
     }
-  
+
   return TRUE;
 }
 
 static void
 gtk_font_selection_init (GtkFontSelection *fontsel)
 {
+  GtkFontSelectionPrivate *priv;
   GtkWidget *scrolled_win;
   GtkWidget *text_box;
   GtkWidget *table, *label;
@@ -300,10 +322,15 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
   GList *focus_chain = NULL;
   AtkObject *atk_obj;
 
+  fontsel->priv = G_TYPE_INSTANCE_GET_PRIVATE (fontsel,
+                                               GTK_TYPE_FONT_SELECTION,
+                                               GtkFontSelectionPrivate);
+  priv = fontsel->priv;
+
   gtk_widget_push_composite_child ();
 
   gtk_box_set_spacing (GTK_BOX (fontsel), 12);
-  fontsel->size = 12 * PANGO_SCALE;
+  priv->size = 12 * PANGO_SCALE;
   
   /* Create the table of font, style & size. */
   table = gtk_table_new (3, 3, FALSE);
@@ -313,30 +340,30 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
   gtk_box_pack_start (GTK_BOX (fontsel), table, TRUE, TRUE, 0);
 
 #ifdef INCLUDE_FONT_ENTRIES
-  fontsel->font_entry = gtk_entry_new ();
-  gtk_editable_set_editable (GTK_EDITABLE (fontsel->font_entry), FALSE);
-  gtk_widget_set_size_request (fontsel->font_entry, 20, -1);
-  gtk_widget_show (fontsel->font_entry);
-  gtk_table_attach (GTK_TABLE (table), fontsel->font_entry, 0, 1, 1, 2,
+  priv->font_entry = gtk_entry_new ();
+  gtk_editable_set_editable (GTK_EDITABLE (priv->font_entry), FALSE);
+  gtk_widget_set_size_request (priv->font_entry, 20, -1);
+  gtk_widget_show (priv->font_entry);
+  gtk_table_attach (GTK_TABLE (table), priv->font_entry, 0, 1, 1, 2,
                    GTK_FILL, 0, 0, 0);
   
-  fontsel->font_style_entry = gtk_entry_new ();
-  gtk_editable_set_editable (GTK_EDITABLE (fontsel->font_style_entry), FALSE);
-  gtk_widget_set_size_request (fontsel->font_style_entry, 20, -1);
-  gtk_widget_show (fontsel->font_style_entry);
-  gtk_table_attach (GTK_TABLE (table), fontsel->font_style_entry, 1, 2, 1, 2,
+  priv->font_style_entry = gtk_entry_new ();
+  gtk_editable_set_editable (GTK_EDITABLE (priv->font_style_entry), FALSE);
+  gtk_widget_set_size_request (priv->font_style_entry, 20, -1);
+  gtk_widget_show (priv->font_style_entry);
+  gtk_table_attach (GTK_TABLE (table), priv->font_style_entry, 1, 2, 1, 2,
                    GTK_FILL, 0, 0, 0);
 #endif /* INCLUDE_FONT_ENTRIES */
   
-  fontsel->size_entry = gtk_entry_new ();
-  gtk_widget_set_size_request (fontsel->size_entry, 20, -1);
-  gtk_widget_show (fontsel->size_entry);
-  gtk_table_attach (GTK_TABLE (table), fontsel->size_entry, 2, 3, 1, 2,
+  priv->size_entry = gtk_entry_new ();
+  gtk_widget_set_size_request (priv->size_entry, 20, -1);
+  gtk_widget_show (priv->size_entry);
+  gtk_table_attach (GTK_TABLE (table), priv->size_entry, 2, 3, 1, 2,
                    GTK_FILL, 0, 0, 0);
-  g_signal_connect (fontsel->size_entry, "activate",
+  g_signal_connect (priv->size_entry, "activate",
                    G_CALLBACK (gtk_font_selection_size_activate),
                    fontsel);
-  g_signal_connect_after (fontsel->size_entry, "focus-out-event",
+  g_signal_connect_after (priv->size_entry, "focus-out-event",
                          G_CALLBACK (gtk_font_selection_size_focus_out),
                          fontsel);
   
@@ -354,7 +381,7 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
   
   label = gtk_label_new_with_mnemonic (_("Si_ze:"));
   gtk_label_set_mnemonic_widget (GTK_LABEL (label),
-                                 fontsel->size_entry);
+                                 priv->size_entry);
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_widget_show (label);
   gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1,
@@ -366,10 +393,10 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
   model = gtk_list_store_new (2,
                              G_TYPE_OBJECT,  /* FAMILY_COLUMN */
                              G_TYPE_STRING); /* FAMILY_NAME_COLUMN */
-  fontsel->family_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
+  priv->family_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
   g_object_unref (model);
 
-  g_signal_connect (fontsel->family_list, "row-activated",
+  g_signal_connect (priv->family_list, "row-activated",
                    G_CALLBACK (list_row_activated), fontsel);
 
   column = gtk_tree_view_column_new_with_attributes ("Family",
@@ -377,22 +404,22 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
                                                     "text", FAMILY_NAME_COLUMN,
                                                     NULL);
   gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-  gtk_tree_view_append_column (GTK_TREE_VIEW (fontsel->family_list), column);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (priv->family_list), column);
 
-  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (fontsel->family_list), FALSE);
-  gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->family_list)),
+  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->family_list), FALSE);
+  gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->family_list)),
                               GTK_SELECTION_BROWSE);
   
-  gtk_label_set_mnemonic_widget (GTK_LABEL (font_label), fontsel->family_list);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (font_label), priv->family_list);
 
   scrolled_win = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
   gtk_widget_set_size_request (scrolled_win,
                               FONT_LIST_WIDTH, FONT_LIST_HEIGHT);
-  gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->family_list);
+  gtk_container_add (GTK_CONTAINER (scrolled_win), priv->family_list);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
-  gtk_widget_show (fontsel->family_list);
+  gtk_widget_show (priv->family_list);
   gtk_widget_show (scrolled_win);
 
   gtk_table_attach (GTK_TABLE (table), scrolled_win, 0, 1, 1, 3,
@@ -403,44 +430,44 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
   model = gtk_list_store_new (2,
                              G_TYPE_OBJECT,  /* FACE_COLUMN */
                              G_TYPE_STRING); /* FACE_NAME_COLUMN */
-  fontsel->face_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
+  priv->face_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
   g_object_unref (model);
-  g_signal_connect (fontsel->face_list, "row-activated",
+  g_signal_connect (priv->face_list, "row-activated",
                    G_CALLBACK (list_row_activated), fontsel);
 
-  gtk_label_set_mnemonic_widget (GTK_LABEL (style_label), fontsel->face_list);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (style_label), priv->face_list);
 
   column = gtk_tree_view_column_new_with_attributes ("Face",
                                                     gtk_cell_renderer_text_new (),
                                                     "text", FACE_NAME_COLUMN,
                                                     NULL);
   gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-  gtk_tree_view_append_column (GTK_TREE_VIEW (fontsel->face_list), column);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (priv->face_list), column);
 
-  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (fontsel->face_list), FALSE);
-  gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->face_list)),
+  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->face_list), FALSE);
+  gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->face_list)),
                               GTK_SELECTION_BROWSE);
   
   scrolled_win = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
   gtk_widget_set_size_request (scrolled_win,
                               FONT_STYLE_LIST_WIDTH, FONT_LIST_HEIGHT);
-  gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->face_list);
+  gtk_container_add (GTK_CONTAINER (scrolled_win), priv->face_list);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
-  gtk_widget_show (fontsel->face_list);
+  gtk_widget_show (priv->face_list);
   gtk_widget_show (scrolled_win);
   gtk_table_attach (GTK_TABLE (table), scrolled_win, 1, 2, 1, 3,
                    GTK_EXPAND | GTK_FILL,
                    GTK_EXPAND | GTK_FILL, 0, 0);
   focus_chain = g_list_append (focus_chain, scrolled_win);
   
-  focus_chain = g_list_append (focus_chain, fontsel->size_entry);
+  focus_chain = g_list_append (focus_chain, priv->size_entry);
 
   model = gtk_list_store_new (1, G_TYPE_INT);
-  fontsel->size_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
+  priv->size_list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
   g_object_unref (model);
-  g_signal_connect (fontsel->size_list, "row-activated",
+  g_signal_connect (priv->size_list, "row-activated",
                    G_CALLBACK (list_row_activated), fontsel);
 
   column = gtk_tree_view_column_new_with_attributes ("Size",
@@ -448,19 +475,19 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
                                                     "text", SIZE_COLUMN,
                                                     NULL);
   gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-  gtk_tree_view_append_column (GTK_TREE_VIEW (fontsel->size_list), column);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (priv->size_list), column);
 
-  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (fontsel->size_list), FALSE);
-  gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list)),
+  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->size_list), FALSE);
+  gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->size_list)),
                               GTK_SELECTION_BROWSE);
   
   scrolled_win = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), GTK_SHADOW_IN);
-  gtk_container_add (GTK_CONTAINER (scrolled_win), fontsel->size_list);
+  gtk_container_add (GTK_CONTAINER (scrolled_win), priv->size_list);
   gtk_widget_set_size_request (scrolled_win, -1, FONT_LIST_HEIGHT);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
                                  GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
-  gtk_widget_show (fontsel->size_list);
+  gtk_widget_show (priv->size_list);
   gtk_widget_show (scrolled_win);
   gtk_table_attach (GTK_TABLE (table), scrolled_win, 2, 3, 2, 3,
                    GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
@@ -470,19 +497,19 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
   g_list_free (focus_chain);
   
   /* Insert the fonts. */
-  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->family_list)), "changed",
+  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->family_list)), "changed",
                    G_CALLBACK (gtk_font_selection_select_font), fontsel);
 
-  g_signal_connect_after (fontsel->family_list, "map",
+  g_signal_connect_after (priv->family_list, "map",
                          G_CALLBACK (gtk_font_selection_scroll_on_map),
                          fontsel);
   
-  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->face_list)), "changed",
+  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->face_list)), "changed",
                    G_CALLBACK (gtk_font_selection_select_style), fontsel);
 
-  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list)), "changed",
+  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->size_list)), "changed",
                    G_CALLBACK (gtk_font_selection_select_size), fontsel);
-  atk_obj = gtk_widget_get_accessible (fontsel->size_list);
+  atk_obj = gtk_widget_get_accessible (priv->size_list);
   if (GTK_IS_ACCESSIBLE (atk_obj))
     {
       /* Accessibility support is enabled.
@@ -521,10 +548,9 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
           atk_relation_set_add (relation_set, relation);
         }
       g_object_unref (relation_set);
-    }    
-      
+    }
 
-  vbox = gtk_vbox_new (FALSE, 6);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_widget_show (vbox);
   gtk_box_pack_start (GTK_BOX (fontsel), vbox, FALSE, TRUE, 0);
   
@@ -533,21 +559,21 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_widget_show (label);
   gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
-  
-  text_box = gtk_hbox_new (FALSE, 0);
+
+  text_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   gtk_widget_show (text_box);
   gtk_box_pack_start (GTK_BOX (vbox), text_box, FALSE, TRUE, 0);
   
-  fontsel->preview_entry = gtk_entry_new ();
-  gtk_label_set_mnemonic_widget (GTK_LABEL (label), fontsel->preview_entry);
-  gtk_entry_set_text (GTK_ENTRY (fontsel->preview_entry), _(PREVIEW_TEXT));
+  priv->preview_entry = gtk_entry_new ();
+  gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->preview_entry);
+  gtk_entry_set_text (GTK_ENTRY (priv->preview_entry), _(PREVIEW_TEXT));
   
-  gtk_widget_show (fontsel->preview_entry);
-  g_signal_connect (fontsel->preview_entry, "changed",
+  gtk_widget_show (priv->preview_entry);
+  g_signal_connect (priv->preview_entry, "changed",
                    G_CALLBACK (gtk_font_selection_preview_changed), fontsel);
-  gtk_widget_set_size_request (fontsel->preview_entry,
+  gtk_widget_set_size_request (priv->preview_entry,
                               -1, INITIAL_PREVIEW_HEIGHT);
-  gtk_box_pack_start (GTK_BOX (text_box), fontsel->preview_entry,
+  gtk_box_pack_start (GTK_BOX (text_box), priv->preview_entry,
                      TRUE, TRUE, 0);
   gtk_widget_pop_composite_child();
 }
@@ -572,14 +598,7 @@ gtk_font_selection_new (void)
 static void
 gtk_font_selection_finalize (GObject *object)
 {
-  GtkFontSelection *fontsel;
-  
-  g_return_if_fail (GTK_IS_FONT_SELECTION (object));
-  
-  fontsel = GTK_FONT_SELECTION (object);
-
-  if (fontsel->font)
-    gdk_font_unref (fontsel->font);
+  GtkFontSelection *fontsel = GTK_FONT_SELECTION (object);
 
   gtk_font_selection_ref_family (fontsel, NULL);
   gtk_font_selection_ref_face (fontsel, NULL);
@@ -591,21 +610,25 @@ static void
 gtk_font_selection_ref_family (GtkFontSelection *fontsel,
                               PangoFontFamily  *family)
 {
+  GtkFontSelectionPrivate *priv = fontsel->priv;
+
   if (family)
     family = g_object_ref (family);
-  if (fontsel->family)
-    g_object_unref (fontsel->family);
-  fontsel->family = family;
+  if (priv->family)
+    g_object_unref (priv->family);
+  priv->family = family;
 }
 
 static void gtk_font_selection_ref_face (GtkFontSelection *fontsel,
                                         PangoFontFace    *face)
 {
+  GtkFontSelectionPrivate *priv = fontsel->priv;
+
   if (face)
     face = g_object_ref (face);
-  if (fontsel->face)
-    g_object_unref (fontsel->face);
-  fontsel->face = face;
+  if (priv->face)
+    g_object_unref (priv->face);
+  priv->face = face;
 }
 
 static void
@@ -679,14 +702,16 @@ set_cursor_to_iter (GtkTreeView *view,
 static void
 gtk_font_selection_scroll_to_selection (GtkFontSelection *fontsel)
 {
+  GtkFontSelectionPrivate *priv = fontsel->priv;
+
   /* Try to scroll the font family list to the selected item */
-  scroll_to_selection (GTK_TREE_VIEW (fontsel->family_list));
-      
+  scroll_to_selection (GTK_TREE_VIEW (priv->family_list));
+
   /* Try to scroll the font family list to the selected item */
-  scroll_to_selection (GTK_TREE_VIEW (fontsel->face_list));
-      
+  scroll_to_selection (GTK_TREE_VIEW (priv->face_list));
+
   /* Try to scroll the font family list to the selected item */
-  scroll_to_selection (GTK_TREE_VIEW (fontsel->size_list));
+  scroll_to_selection (GTK_TREE_VIEW (priv->size_list));
 /* This is called when the list is mapped. Here we scroll to the current
    font if necessary. */
 }
@@ -704,6 +729,7 @@ gtk_font_selection_select_font (GtkTreeSelection *selection,
                                gpointer          data)
 {
   GtkFontSelection *fontsel;
+  GtkFontSelectionPrivate *priv;
   GtkTreeModel *model;
   GtkTreeIter iter;
 #ifdef INCLUDE_FONT_ENTRIES
@@ -711,21 +737,22 @@ gtk_font_selection_select_font (GtkTreeSelection *selection,
 #endif
 
   fontsel = GTK_FONT_SELECTION (data);
+  priv = fontsel->priv;
 
   if (gtk_tree_selection_get_selected (selection, &model, &iter))
     {
       PangoFontFamily *family;
-      
+
       gtk_tree_model_get (model, &iter, FAMILY_COLUMN, &family, -1);
-      if (fontsel->family != family)
+      if (priv->family != family)
        {
          gtk_font_selection_ref_family (fontsel, family);
-         
+
 #ifdef INCLUDE_FONT_ENTRIES
-         family_name = pango_font_family_get_name (fontsel->family);
-         gtk_entry_set_text (GTK_ENTRY (fontsel->font_entry), family_name);
+         family_name = pango_font_family_get_name (priv->family);
+         gtk_entry_set_text (GTK_ENTRY (priv->font_entry), family_name);
 #endif
-         
+
          gtk_font_selection_show_available_styles (fontsel);
          gtk_font_selection_select_best_style (fontsel, TRUE);
        }
@@ -746,14 +773,15 @@ cmp_families (const void *a, const void *b)
 static void
 gtk_font_selection_show_available_fonts (GtkFontSelection *fontsel)
 {
+  GtkFontSelectionPrivate *priv = fontsel->priv;
   GtkListStore *model;
   PangoFontFamily **families;
   PangoFontFamily *match_family = NULL;
   gint n_families, i;
   GtkTreeIter match_row;
-  
-  model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->family_list)));
-  
+
+  model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->family_list)));
+
   pango_context_list_families (gtk_widget_get_pango_context (GTK_WIDGET (fontsel)),
                               &families, &n_families);
   qsort (families, n_families, sizeof (PangoFontFamily *), cmp_families);
@@ -781,9 +809,9 @@ gtk_font_selection_show_available_fonts (GtkFontSelection *fontsel)
   gtk_font_selection_ref_family (fontsel, match_family);
   if (match_family)
     {
-      set_cursor_to_iter (GTK_TREE_VIEW (fontsel->family_list), &match_row);
+      set_cursor_to_iter (GTK_TREE_VIEW (priv->family_list), &match_row);
 #ifdef INCLUDE_FONT_ENTRIES
-      gtk_entry_set_text (GTK_ENTRY (fontsel->font_entry), 
+      gtk_entry_set_text (GTK_ENTRY (priv->font_entry), 
                          pango_font_family_get_name (match_family));
 #endif /* INCLUDE_FONT_ENTRIES */
     }
@@ -842,21 +870,22 @@ font_description_style_equal (const PangoFontDescription *a,
 static void
 gtk_font_selection_show_available_styles (GtkFontSelection *fontsel)
 {
+  GtkFontSelectionPrivate *priv = fontsel->priv;
   gint n_faces, i;
   PangoFontFace **faces;
   PangoFontDescription *old_desc;
   GtkListStore *model;
   GtkTreeIter match_row;
   PangoFontFace *match_face = NULL;
-  
-  model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->face_list)));
-  
-  if (fontsel->face)
-    old_desc = pango_font_face_describe (fontsel->face);
+
+  model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->face_list)));
+
+  if (priv->face)
+    old_desc = pango_font_face_describe (priv->face);
   else
     old_desc= NULL;
 
-  pango_font_family_list_faces (fontsel->family, &faces, &n_faces);
+  pango_font_family_list_faces (priv->family, &faces, &n_faces);
   qsort (faces, n_faces, sizeof (PangoFontFace *), faces_sort_func);
 
   gtk_list_store_clear (model);
@@ -898,11 +927,11 @@ gtk_font_selection_show_available_styles (GtkFontSelection *fontsel)
   if (match_face)
     {
 #ifdef INCLUDE_FONT_ENTRIES
-      const gchar *str = pango_font_face_get_face_name (fontsel->face);
+      const gchar *str = pango_font_face_get_face_name (priv->face);
 
-      gtk_entry_set_text (GTK_ENTRY (fontsel->font_style_entry), str);
-#endif      
-      set_cursor_to_iter (GTK_TREE_VIEW (fontsel->face_list), &match_row);
+      gtk_entry_set_text (GTK_ENTRY (priv->font_style_entry), str);
+#endif
+      set_cursor_to_iter (GTK_TREE_VIEW (priv->face_list), &match_row);
     }
 
   g_free (faces);
@@ -917,15 +946,16 @@ static void
 gtk_font_selection_select_best_style (GtkFontSelection *fontsel,
                                      gboolean          use_first)
 {
+  GtkFontSelectionPrivate *priv = fontsel->priv;
   GtkTreeIter iter;
   GtkTreeModel *model;
 
-  model = gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->face_list));
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->face_list));
 
   if (gtk_tree_model_get_iter_first (model, &iter))
     {
-      set_cursor_to_iter (GTK_TREE_VIEW (fontsel->face_list), &iter);
-      scroll_to_selection (GTK_TREE_VIEW (fontsel->face_list));
+      set_cursor_to_iter (GTK_TREE_VIEW (priv->face_list), &iter);
+      scroll_to_selection (GTK_TREE_VIEW (priv->face_list));
     }
 
   gtk_font_selection_show_available_sizes (fontsel, FALSE);
@@ -941,7 +971,7 @@ gtk_font_selection_select_style (GtkTreeSelection *selection,
   GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
   GtkTreeModel *model;
   GtkTreeIter iter;
-  
+
   if (gtk_tree_selection_get_selected (selection, &model, &iter))
     {
       PangoFontFace *face;
@@ -959,12 +989,13 @@ static void
 gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel,
                                         gboolean          first_time)
 {
+  GtkFontSelectionPrivate *priv = fontsel->priv;
   gint i;
   GtkListStore *model;
   gchar buffer[128];
   gchar *p;
-      
-  model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->size_list)));
+
+  model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->size_list)));
 
   /* Insert the standard font sizes */
   if (first_time)
@@ -974,25 +1005,25 @@ gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel,
       for (i = 0; i < G_N_ELEMENTS (font_sizes); i++)
        {
          GtkTreeIter iter;
-         
+
          gtk_list_store_append (model, &iter);
          gtk_list_store_set (model, &iter, SIZE_COLUMN, font_sizes[i], -1);
-         
-         if (font_sizes[i] * PANGO_SCALE == fontsel->size)
-           set_cursor_to_iter (GTK_TREE_VIEW (fontsel->size_list), &iter);
+
+         if (font_sizes[i] * PANGO_SCALE == priv->size)
+           set_cursor_to_iter (GTK_TREE_VIEW (priv->size_list), &iter);
        }
     }
   else
     {
       GtkTreeIter iter;
       gboolean found = FALSE;
-      
+
       gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter);
       for (i = 0; i < G_N_ELEMENTS (font_sizes) && !found; i++)
        {
-         if (font_sizes[i] * PANGO_SCALE == fontsel->size)
+         if (font_sizes[i] * PANGO_SCALE == priv->size)
            {
-             set_cursor_to_iter (GTK_TREE_VIEW (fontsel->size_list), &iter);
+             set_cursor_to_iter (GTK_TREE_VIEW (priv->size_list), &iter);
              found = TRUE;
            }
 
@@ -1001,7 +1032,7 @@ gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel,
 
       if (!found)
        {
-         GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list));
+         GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->size_list));
          gtk_tree_selection_unselect_all (selection);
        }
     }
@@ -1009,7 +1040,7 @@ gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel,
   /* Set the entry to the new size, rounding to 1 digit,
    * trimming of trailing 0's and a trailing period
    */
-  g_snprintf (buffer, sizeof (buffer), "%.1f", fontsel->size / (1.0 * PANGO_SCALE));
+  g_snprintf (buffer, sizeof (buffer), "%.1f", priv->size / (1.0 * PANGO_SCALE));
   if (strchr (buffer, '.'))
     {
       p = buffer + strlen (buffer) - 1;
@@ -1021,8 +1052,8 @@ gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel,
     }
 
   /* Compare, to avoid moving the cursor unecessarily */
-  if (strcmp (gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry)), buffer) != 0)
-    gtk_entry_set_text (GTK_ENTRY (fontsel->size_entry), buffer);
+  if (strcmp (gtk_entry_get_text (GTK_ENTRY (priv->size_entry)), buffer) != 0)
+    gtk_entry_set_text (GTK_ENTRY (priv->size_entry), buffer);
 }
 
 static void
@@ -1035,9 +1066,11 @@ static void
 gtk_font_selection_set_size (GtkFontSelection *fontsel,
                             gint              new_size)
 {
-  if (fontsel->size != new_size)
+  GtkFontSelectionPrivate *priv = fontsel->priv;
+
+  if (priv->size != new_size)
     {
-      fontsel->size = new_size;
+      priv->size = new_size;
 
       gtk_font_selection_show_available_sizes (fontsel, FALSE);      
       gtk_font_selection_load_font (fontsel);
@@ -1050,16 +1083,15 @@ static void
 gtk_font_selection_size_activate (GtkWidget   *w,
                                   gpointer     data)
 {
-  GtkFontSelection *fontsel;
+  GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
+  GtkFontSelectionPrivate *priv = fontsel->priv;
   gint new_size;
   const gchar *text;
-  
-  fontsel = GTK_FONT_SELECTION (data);
 
-  text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry));
+  text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
   new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
 
-  if (fontsel->size != new_size)
+  if (priv->size != new_size)
     gtk_font_selection_set_size (fontsel, new_size);
   else 
     list_row_activated (w);
@@ -1070,17 +1102,16 @@ gtk_font_selection_size_focus_out (GtkWidget     *w,
                                   GdkEventFocus *event,
                                   gpointer       data)
 {
-  GtkFontSelection *fontsel;
+  GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
+  GtkFontSelectionPrivate *priv = fontsel->priv;
   gint new_size;
   const gchar *text;
-  
-  fontsel = GTK_FONT_SELECTION (data);
 
-  text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry));
+  text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
   new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
 
   gtk_font_selection_set_size (fontsel, new_size);
-  
+
   return TRUE;
 }
 
@@ -1089,13 +1120,11 @@ static void
 gtk_font_selection_select_size (GtkTreeSelection *selection,
                                gpointer          data)
 {
-  GtkFontSelection *fontsel;
+  GtkFontSelection *fontsel = GTK_FONT_SELECTION (data);
   GtkTreeModel *model;
   GtkTreeIter iter;
   gint new_size;
-  
-  fontsel = GTK_FONT_SELECTION (data);
-  
+
   if (gtk_tree_selection_get_selected (selection, &model, &iter))
     {
       gtk_tree_model_get (model, &iter, SIZE_COLUMN, &new_size, -1);
@@ -1106,22 +1135,19 @@ gtk_font_selection_select_size (GtkTreeSelection *selection,
 static void
 gtk_font_selection_load_font (GtkFontSelection *fontsel)
 {
-  if (fontsel->font)
-    gdk_font_unref (fontsel->font);
-  fontsel->font = NULL;
-
   gtk_font_selection_update_preview (fontsel);
 }
 
 static PangoFontDescription *
 gtk_font_selection_get_font_description (GtkFontSelection *fontsel)
 {
+  GtkFontSelectionPrivate *priv = fontsel->priv;
   PangoFontDescription *font_desc;
 
-  if (fontsel->face)
+  if (priv->face)
     {
-      font_desc = pango_font_face_describe (fontsel->face);
-      pango_font_description_set_size (font_desc, fontsel->size);
+      font_desc = pango_font_face_describe (priv->face);
+      pango_font_description_set_size (font_desc, priv->size);
     }
   else
     font_desc = pango_font_description_from_string (DEFAULT_FONT_NAME);
@@ -1138,24 +1164,25 @@ gtk_font_selection_get_font_description (GtkFontSelection *fontsel)
 static void
 gtk_font_selection_update_preview (GtkFontSelection *fontsel)
 {
+  GtkFontSelectionPrivate *priv = fontsel->priv;
   GtkRcStyle *rc_style;
   gint new_height;
-  GtkRequisition old_requisition;
-  GtkWidget *preview_entry = fontsel->preview_entry;
+  GtkRequisition old_requisition, new_requisition;
+  GtkWidget *preview_entry = priv->preview_entry;
   const gchar *text;
 
-  gtk_widget_get_child_requisition (preview_entry, &old_requisition);
-  
+  gtk_widget_get_preferred_size (preview_entry, &old_requisition, NULL);
+
   rc_style = gtk_rc_style_new ();
   rc_style->font_desc = gtk_font_selection_get_font_description (fontsel);
   
   gtk_widget_modify_style (preview_entry, rc_style);
   g_object_unref (rc_style);
 
-  gtk_widget_size_request (preview_entry, NULL);
+  gtk_widget_get_preferred_size (preview_entry, &new_requisition, NULL);
   
   /* We don't ever want to be over MAX_PREVIEW_HEIGHT pixels high. */
-  new_height = CLAMP (preview_entry->requisition.height, INITIAL_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT);
+  new_height = CLAMP (new_requisition.height, INITIAL_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT);
 
   if (new_height > old_requisition.height || new_height < old_requisition.height - 30)
     gtk_widget_set_size_request (preview_entry, -1, new_height);
@@ -1167,19 +1194,6 @@ gtk_font_selection_update_preview (GtkFontSelection *fontsel)
   gtk_editable_set_position (GTK_EDITABLE (preview_entry), 0);
 }
 
-static GdkFont*
-gtk_font_selection_get_font_internal (GtkFontSelection *fontsel)
-{
-  if (!fontsel->font)
-    {
-      PangoFontDescription *font_desc = gtk_font_selection_get_font_description (fontsel);
-      fontsel->font = gdk_font_from_description_for_display (gtk_widget_get_display (GTK_WIDGET (fontsel)), font_desc);
-      pango_font_description_free (font_desc);
-    }
-  
-  return fontsel->font;
-}
-
 
 /*****************************************************************************
  * These functions are the main public interface for getting/setting the font.
@@ -1191,8 +1205,8 @@ gtk_font_selection_get_font_internal (GtkFontSelection *fontsel)
  *
  * This returns the #GtkTreeView that lists font families, for
  * example, 'Sans', 'Serif', etc.
- * 
- * Return value: A #GtkWidget that is part of @fontsel
+ *
+ * Return value: (transfer none): A #GtkWidget that is part of @fontsel
  *
  * Since: 2.14
  */
@@ -1200,8 +1214,8 @@ GtkWidget *
 gtk_font_selection_get_family_list (GtkFontSelection *fontsel)
 {
   g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-  
-  return fontsel->family_list;
+
+  return fontsel->priv->family_list;
 }
 
 /**
@@ -1211,7 +1225,7 @@ gtk_font_selection_get_family_list (GtkFontSelection *fontsel)
  * This returns the #GtkTreeView which lists all styles available for
  * the selected font. For example, 'Regular', 'Bold', etc.
  * 
- * Return value: A #GtkWidget that is part of @fontsel
+ * Return value: (transfer none): A #GtkWidget that is part of @fontsel
  *
  * Since: 2.14
  */
@@ -1219,8 +1233,8 @@ GtkWidget *
 gtk_font_selection_get_face_list (GtkFontSelection *fontsel)
 {
   g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-  
-  return fontsel->face_list;
+
+  return fontsel->priv->face_list;
 }
 
 /**
@@ -1228,9 +1242,9 @@ gtk_font_selection_get_face_list (GtkFontSelection *fontsel)
  * @fontsel: a #GtkFontSelection
  *
  * This returns the #GtkEntry used to allow the user to edit the font
- * number manually instead of selecting it from the list of font sizes. 
- * 
- * Return value: A #GtkWidget that is part of @fontsel
+ * number manually instead of selecting it from the list of font sizes.
+ *
+ * Return value: (transfer none): A #GtkWidget that is part of @fontsel
  *
  * Since: 2.14
  */
@@ -1238,17 +1252,17 @@ GtkWidget *
 gtk_font_selection_get_size_entry (GtkFontSelection *fontsel)
 {
   g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-  
-  return fontsel->size_entry;
+
+  return fontsel->priv->size_entry;
 }
 
 /**
  * gtk_font_selection_get_size_list:
  * @fontsel: a #GtkFontSelection
  *
- * This returns the #GtkTreeeView used to list font sizes. 
- * 
- * Return value: A #GtkWidget that is part of @fontsel
+ * This returns the #GtkTreeeView used to list font sizes.
+ *
+ * Return value: (transfer none): A #GtkWidget that is part of @fontsel
  *
  * Since: 2.14
  */
@@ -1256,17 +1270,17 @@ GtkWidget *
 gtk_font_selection_get_size_list (GtkFontSelection *fontsel)
 {
   g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-  
-  return fontsel->size_list;
+
+  return fontsel->priv->size_list;
 }
 
 /**
  * gtk_font_selection_get_preview_entry:
  * @fontsel: a #GtkFontSelection
- * 
+ *
  * This returns the #GtkEntry used to display the font as a preview.
  *
- * Return value: A #GtkWidget that is part of @fontsel
+ * Return value: (transfer none): A #GtkWidget that is part of @fontsel
  *
  * Since: 2.14
  */
@@ -1274,20 +1288,20 @@ GtkWidget *
 gtk_font_selection_get_preview_entry (GtkFontSelection *fontsel)
 {
   g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-  
-  return fontsel->preview_entry;
+
+  return fontsel->priv->preview_entry;
 }
 
 /**
  * gtk_font_selection_get_family:
  * @fontsel: a #GtkFontSelection
- * 
+ *
  * Gets the #PangoFontFamily representing the selected font family.
  *
- * Return value: A #PangoFontFamily representing the selected font
- *     family. Font families are a collection of font faces. The 
- *     returned object is owned by @fontsel and must not be modified 
- *     or freed.
+ * Return value: (transfer none): A #PangoFontFamily representing the
+ *     selected font family. Font families are a collection of font
+ *     faces. The returned object is owned by @fontsel and must not
+ *     be modified or freed.
  *
  * Since: 2.14
  */
@@ -1295,20 +1309,20 @@ PangoFontFamily *
 gtk_font_selection_get_family (GtkFontSelection *fontsel)
 {
   g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-  
-  return fontsel->family;
+
+  return fontsel->priv->family;
 }
 
 /**
  * gtk_font_selection_get_face:
  * @fontsel: a #GtkFontSelection
- * 
+ *
  * Gets the #PangoFontFace representing the selected font group
- * details (i.e. family, slant, weight, width, etc).   
+ * details (i.e. family, slant, weight, width, etc).
  *
- * Return value: A #PangoFontFace representing the selected font 
- *     group details. The returned object is owned by @fontsel and
- *     must not be modified or freed. 
+ * Return value: (transfer none): A #PangoFontFace representing the
+ *     selected font group details. The returned object is owned by
+ *     @fontsel and must not be modified or freed.
  *
  * Since: 2.14
  */
@@ -1316,17 +1330,17 @@ PangoFontFace *
 gtk_font_selection_get_face (GtkFontSelection *fontsel)
 {
   g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-  
-  return fontsel->face;
+
+  return fontsel->priv->face;
 }
 
 /**
  * gtk_font_selection_get_size:
  * @fontsel: a #GtkFontSelection
- * 
+ *
  * The selected font size.
  *
- * Return value: A n integer representing the selected font size, 
+ * Return value: A n integer representing the selected font size,
  *     or -1 if no font size is selected.
  *
  * Since: 2.14
@@ -1335,26 +1349,8 @@ gint
 gtk_font_selection_get_size (GtkFontSelection *fontsel)
 {
   g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), -1);
-  
-  return fontsel->size;
-}
 
-/**
- * gtk_font_selection_get_font:
- * @fontsel: a #GtkFontSelection
- *
- * Gets the currently-selected font.
- * 
- * Return value: A #GdkFont.
- *
- * Deprecated: 2.0: Use gtk_font_selection_get_font_name() instead.
- */
-GdkFont *
-gtk_font_selection_get_font (GtkFontSelection *fontsel)
-{
-  g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
-
-  return gtk_font_selection_get_font_internal (fontsel);
+  return fontsel->priv->size;
 }
 
 /**
@@ -1396,6 +1392,7 @@ gtk_font_selection_select_font_desc (GtkFontSelection      *fontsel,
                                     PangoFontFamily      **pfamily,
                                     PangoFontFace        **pface)
 {
+  GtkFontSelectionPrivate *priv = fontsel->priv;
   PangoFontFamily *new_family = NULL;
   PangoFontFace *new_face = NULL;
   PangoFontFace *fallback_face = NULL;
@@ -1412,7 +1409,7 @@ gtk_font_selection_select_font_desc (GtkFontSelection      *fontsel,
 
   /* Check to make sure that this is in the list of allowed fonts 
    */
-  model = gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->family_list));
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->family_list));
   for (valid = gtk_tree_model_get_iter_first (model, &iter);
        valid;
        valid = gtk_tree_model_iter_next (model, &iter))
@@ -1438,10 +1435,10 @@ gtk_font_selection_select_font_desc (GtkFontSelection      *fontsel,
     *pfamily = new_family;
   else
     g_object_unref (new_family);
-  set_cursor_to_iter (GTK_TREE_VIEW (fontsel->family_list), &iter);
+  set_cursor_to_iter (GTK_TREE_VIEW (priv->family_list), &iter);
   gtk_font_selection_show_available_styles (fontsel);
 
-  model = gtk_tree_view_get_model (GTK_TREE_VIEW (fontsel->face_list));
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->face_list));
   for (valid = gtk_tree_model_get_iter_first (model, &iter);
        valid;
        valid = gtk_tree_model_iter_next (model, &iter))
@@ -1480,7 +1477,7 @@ gtk_font_selection_select_font_desc (GtkFontSelection      *fontsel,
     *pface = new_face;
   else if (new_face)
     g_object_unref (new_face);
-  set_cursor_to_iter (GTK_TREE_VIEW (fontsel->face_list), &match_iter);  
+  set_cursor_to_iter (GTK_TREE_VIEW (priv->face_list), &match_iter);  
 
   gtk_font_selection_set_size (fontsel, pango_font_description_get_size (new_desc));
 
@@ -1533,10 +1530,7 @@ gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
 
   pango_font_description_free (new_desc);
   
-  g_object_freeze_notify (G_OBJECT (fontsel));
   g_object_notify (G_OBJECT (fontsel), "font-name");
-  g_object_notify (G_OBJECT (fontsel), "font");
-  g_object_thaw_notify (G_OBJECT (fontsel));
 
   return TRUE;
 }
@@ -1554,9 +1548,13 @@ gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
 G_CONST_RETURN gchar*
 gtk_font_selection_get_preview_text (GtkFontSelection *fontsel)
 {
+  GtkFontSelectionPrivate *priv;
+
   g_return_val_if_fail (GTK_IS_FONT_SELECTION (fontsel), NULL);
 
-  return gtk_entry_get_text (GTK_ENTRY (fontsel->preview_entry));
+  priv = fontsel->priv;
+
+  return gtk_entry_get_text (GTK_ENTRY (priv->preview_entry));
 }
 
 
@@ -1572,10 +1570,14 @@ void
 gtk_font_selection_set_preview_text  (GtkFontSelection *fontsel,
                                      const gchar      *text)
 {
+  GtkFontSelectionPrivate *priv;
+
   g_return_if_fail (GTK_IS_FONT_SELECTION (fontsel));
   g_return_if_fail (text != NULL);
 
-  gtk_entry_set_text (GTK_ENTRY (fontsel->preview_entry), text);
+  priv = fontsel->priv;
+
+  gtk_entry_set_text (GTK_ENTRY (priv->preview_entry), text);
 }
 
 /*****************************************************************************
@@ -1597,48 +1599,55 @@ static GtkBuildableIface *parent_buildable_iface;
 static void
 gtk_font_selection_dialog_class_init (GtkFontSelectionDialogClass *klass)
 {
+  g_type_class_add_private (klass, sizeof (GtkFontSelectionDialogPrivate));
 }
 
 static void
 gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
 {
+  GtkFontSelectionDialogPrivate *priv;
   GtkDialog *dialog = GTK_DIALOG (fontseldiag);
-  
-  gtk_dialog_set_has_separator (dialog, FALSE);
+  GtkWidget *action_area, *content_area;
+
+  fontseldiag->priv = G_TYPE_INSTANCE_GET_PRIVATE (fontseldiag,
+                                                   GTK_TYPE_FONT_SELECTION_DIALOG,
+                                                   GtkFontSelectionDialogPrivate);
+  priv = fontseldiag->priv;
+
+  content_area = gtk_dialog_get_content_area (dialog);
+  action_area = gtk_dialog_get_action_area (dialog);
+
   gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
-  gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
-  gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
-  gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
+  gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
+  gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+  gtk_box_set_spacing (GTK_BOX (action_area), 6);
 
   gtk_widget_push_composite_child ();
 
   gtk_window_set_resizable (GTK_WINDOW (fontseldiag), TRUE);
-  
-  fontseldiag->main_vbox = dialog->vbox;
-  
-  fontseldiag->fontsel = gtk_font_selection_new ();
-  gtk_container_set_border_width (GTK_CONTAINER (fontseldiag->fontsel), 5);
-  gtk_widget_show (fontseldiag->fontsel);
-  gtk_box_pack_start (GTK_BOX (fontseldiag->main_vbox),
-                     fontseldiag->fontsel, TRUE, TRUE, 0);
-  
+
+  /* Create the content area */
+  priv->fontsel = gtk_font_selection_new ();
+  gtk_container_set_border_width (GTK_CONTAINER (priv->fontsel), 5);
+  gtk_widget_show (priv->fontsel);
+  gtk_box_pack_start (GTK_BOX (content_area),
+                     priv->fontsel, TRUE, TRUE, 0);
+
   /* Create the action area */
-  fontseldiag->action_area = dialog->action_area;
+  priv->cancel_button = gtk_dialog_add_button (dialog,
+                                               GTK_STOCK_CANCEL,
+                                               GTK_RESPONSE_CANCEL);
 
-  fontseldiag->cancel_button = gtk_dialog_add_button (dialog,
-                                                      GTK_STOCK_CANCEL,
-                                                      GTK_RESPONSE_CANCEL);
+  priv->apply_button = gtk_dialog_add_button (dialog,
+                                              GTK_STOCK_APPLY,
+                                              GTK_RESPONSE_APPLY);
+  gtk_widget_hide (priv->apply_button);
 
-  fontseldiag->apply_button = gtk_dialog_add_button (dialog,
-                                                     GTK_STOCK_APPLY,
-                                                     GTK_RESPONSE_APPLY);
-  gtk_widget_hide (fontseldiag->apply_button);
+  priv->ok_button = gtk_dialog_add_button (dialog,
+                                           GTK_STOCK_OK,
+                                           GTK_RESPONSE_OK);
+  gtk_widget_grab_default (priv->ok_button);
 
-  fontseldiag->ok_button = gtk_dialog_add_button (dialog,
-                                                  GTK_STOCK_OK,
-                                                  GTK_RESPONSE_OK);
-  gtk_widget_grab_default (fontseldiag->ok_button);
-  
   gtk_dialog_set_alternative_button_order (GTK_DIALOG (fontseldiag),
                                           GTK_RESPONSE_OK,
                                           GTK_RESPONSE_APPLY,
@@ -1649,8 +1658,6 @@ gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
                         _("Font Selection"));
 
   gtk_widget_pop_composite_child ();
-
-  _gtk_dialog_set_ignore_separator (dialog, TRUE);
 }
 
 /**
@@ -1675,41 +1682,41 @@ gtk_font_selection_dialog_new (const gchar *title)
 }
 
 /**
- * gtk_font_selection_dialog_get_ok_button:
+ * gtk_font_selection_dialog_get_font_selection:
  * @fsd: a #GtkFontSelectionDialog
  *
- * Gets the 'OK' button.
+ * Retrieves the #GtkFontSelection widget embedded in the dialog.
  *
- * Return value: the #GtkWidget used in the dialog for the 'OK' button.
+ * Returns: (transfer none): the embedded #GtkFontSelection
  *
- * Since: 2.14
- */
-GtkWidget *
-gtk_font_selection_dialog_get_ok_button (GtkFontSelectionDialog *fsd)
+ * Since: 2.22
+ **/
+GtkWidget*
+gtk_font_selection_dialog_get_font_selection (GtkFontSelectionDialog *fsd)
 {
   g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
 
-  return fsd->ok_button;
+  return fsd->priv->fontsel;
 }
 
+
 /**
- * gtk_font_selection_dialog_get_apply_button:
+ * gtk_font_selection_dialog_get_ok_button:
  * @fsd: a #GtkFontSelectionDialog
  *
- * Obtains a button. The button doesn't have any function.
+ * Gets the 'OK' button.
  *
- * Return value: a #GtkWidget
+ * Return value: (transfer none): the #GtkWidget used in the dialog
+ *     for the 'OK' button.
  *
  * Since: 2.14
- *
- * Deprecated: 2.16: Don't use this function.
  */
 GtkWidget *
-gtk_font_selection_dialog_get_apply_button (GtkFontSelectionDialog *fsd)
+gtk_font_selection_dialog_get_ok_button (GtkFontSelectionDialog *fsd)
 {
   g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
 
-  return fsd->apply_button;
+  return fsd->priv->ok_button;
 }
 
 /**
@@ -1718,7 +1725,8 @@ gtk_font_selection_dialog_get_apply_button (GtkFontSelectionDialog *fsd)
  *
  * Gets the 'Cancel' button.
  *
- * Return value: the #GtkWidget used in the dialog for the 'Cancel' button.
+ * Return value: (transfer none): the #GtkWidget used in the dialog
+ *     for the 'Cancel' button.
  *
  * Since: 2.14
  */
@@ -1727,7 +1735,7 @@ gtk_font_selection_dialog_get_cancel_button (GtkFontSelectionDialog *fsd)
 {
   g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
 
-  return fsd->cancel_button;
+  return fsd->priv->cancel_button;
 }
 
 static void
@@ -1742,16 +1750,20 @@ gtk_font_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
                                                        GtkBuilder   *builder,
                                                        const gchar  *childname)
 {
-    if (strcmp(childname, "ok_button") == 0)
-       return G_OBJECT (GTK_FONT_SELECTION_DIALOG(buildable)->ok_button);
-    else if (strcmp(childname, "cancel_button") == 0)
-       return G_OBJECT (GTK_FONT_SELECTION_DIALOG (buildable)->cancel_button);
-    else if (strcmp(childname, "apply_button") == 0)
-       return G_OBJECT (GTK_FONT_SELECTION_DIALOG(buildable)->apply_button);
-    else if (strcmp(childname, "font_selection") == 0)
-       return G_OBJECT (GTK_FONT_SELECTION_DIALOG(buildable)->fontsel);
-
-    return parent_buildable_iface->get_internal_child (buildable, builder, childname);
+  GtkFontSelectionDialogPrivate *priv;
+
+  priv = GTK_FONT_SELECTION_DIALOG (buildable)->priv;
+
+  if (g_strcmp0 (childname, "ok_button") == 0)
+    return G_OBJECT (priv->ok_button);
+  else if (g_strcmp0 (childname, "cancel_button") == 0)
+    return G_OBJECT (priv->cancel_button);
+  else if (g_strcmp0 (childname, "apply_button") == 0)
+    return G_OBJECT (priv->apply_button);
+  else if (g_strcmp0 (childname, "font_selection") == 0)
+    return G_OBJECT (priv->fontsel);
+
+  return parent_buildable_iface->get_internal_child (buildable, builder, childname);
 }
 
 /**
@@ -1773,28 +1785,13 @@ gtk_font_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
 gchar*
 gtk_font_selection_dialog_get_font_name (GtkFontSelectionDialog *fsd)
 {
-  g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
+  GtkFontSelectionDialogPrivate *priv;
 
-  return gtk_font_selection_get_font_name (GTK_FONT_SELECTION (fsd->fontsel));
-}
-
-/**
- * gtk_font_selection_dialog_get_font:
- * @fsd: a #GtkFontSelectionDialog
- *
- * Gets the currently-selected font.
- *
- * Return value: the #GdkFont from the #GtkFontSelection for the
- *     currently selected font in the dialog, or %NULL if no font is selected
- *
- * Deprecated: 2.0: Use gtk_font_selection_dialog_get_font_name() instead.
- */
-GdkFont*
-gtk_font_selection_dialog_get_font (GtkFontSelectionDialog *fsd)
-{
   g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
 
-  return gtk_font_selection_get_font_internal (GTK_FONT_SELECTION (fsd->fontsel));
+  priv = fsd->priv;
+
+  return gtk_font_selection_get_font_name (GTK_FONT_SELECTION (priv->fontsel));
 }
 
 /**
@@ -1811,10 +1808,14 @@ gboolean
 gtk_font_selection_dialog_set_font_name (GtkFontSelectionDialog *fsd,
                                         const gchar            *fontname)
 {
+  GtkFontSelectionDialogPrivate *priv;
+
   g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), FALSE);
   g_return_val_if_fail (fontname, FALSE);
 
-  return gtk_font_selection_set_font_name (GTK_FONT_SELECTION (fsd->fontsel), fontname);
+  priv = fsd->priv;
+
+  return gtk_font_selection_set_font_name (GTK_FONT_SELECTION (priv->fontsel), fontname);
 }
 
 /**
@@ -1830,9 +1831,13 @@ gtk_font_selection_dialog_set_font_name (GtkFontSelectionDialog *fsd,
 G_CONST_RETURN gchar*
 gtk_font_selection_dialog_get_preview_text (GtkFontSelectionDialog *fsd)
 {
+  GtkFontSelectionDialogPrivate *priv;
+
   g_return_val_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd), NULL);
 
-  return gtk_font_selection_get_preview_text (GTK_FONT_SELECTION (fsd->fontsel));
+  priv = fsd->priv;
+
+  return gtk_font_selection_get_preview_text (GTK_FONT_SELECTION (priv->fontsel));
 }
 
 /**
@@ -1846,11 +1851,12 @@ void
 gtk_font_selection_dialog_set_preview_text (GtkFontSelectionDialog *fsd,
                                            const gchar            *text)
 {
+  GtkFontSelectionDialogPrivate *priv;
+
   g_return_if_fail (GTK_IS_FONT_SELECTION_DIALOG (fsd));
   g_return_if_fail (text != NULL);
 
-  gtk_font_selection_set_preview_text (GTK_FONT_SELECTION (fsd->fontsel), text);
-}
+  priv = fsd->priv;
 
-#define __GTK_FONTSEL_C__
-#include "gtkaliasdef.c"
+  gtk_font_selection_set_preview_text (GTK_FONT_SELECTION (priv->fontsel), text);
+}