[gtk+] Remove GtkFontChooser:[sg]et_font



commit 1b818f2e461dd85a7feed925334ad7b37498392c
Author: Christian Persch <chpe gnome org>
Date:   Mon Sep 5 22:55:05 2011 +0200

    Remove GtkFontChooser:[sg]et_font
    
    Now that the setter doesn't return a value anymore, we can just use
    g_object_[sg]et instead of having these vfuncs.

 gtk/gtkfontbutton.c        |   19 -------------------
 gtk/gtkfontchooser.c       |   10 +++++++---
 gtk/gtkfontchooser.h       |    4 +---
 gtk/gtkfontchooserutils.c  |   15 ---------------
 gtk/gtkfontchooserwidget.c |    2 --
 5 files changed, 8 insertions(+), 42 deletions(-)
---
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index dc0fde6..e05223c 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -193,23 +193,6 @@ gtk_font_button_set_show_preview_entry (GtkFontButton *font_button,
   priv->show_preview_entry = show != FALSE;
 }
 
-static gchar *
-gtk_font_button_font_chooser_get_font (GtkFontChooser *chooser)
-{
-  GtkFontButton *font_button = GTK_FONT_BUTTON (chooser);
-
-  return g_strdup (gtk_font_button_get_font_name (font_button));
-}
-
-static void
-gtk_font_button_font_chooser_set_font (GtkFontChooser *chooser,
-                                       const gchar    *fontname)
-{
-  GtkFontButton *font_button = GTK_FONT_BUTTON (chooser);
-
-  gtk_font_button_set_font_name (font_button, fontname);
-}
-
 static PangoFontFamily *
 gtk_font_button_font_chooser_get_font_family (GtkFontChooser *chooser)
 {
@@ -275,8 +258,6 @@ gtk_font_button_font_chooser_notify (GObject    *object,
 static void
 gtk_font_button_font_chooser_iface_init (GtkFontChooserIface *iface)
 {
-  iface->get_font = gtk_font_button_font_chooser_get_font;
-  iface->set_font = gtk_font_button_font_chooser_set_font;
   iface->get_font_family = gtk_font_button_font_chooser_get_font_family;
   iface->get_font_face = gtk_font_button_font_chooser_get_font_face;
   iface->get_font_size = gtk_font_button_font_chooser_get_font_size;
diff --git a/gtk/gtkfontchooser.c b/gtk/gtkfontchooser.c
index c83174f..dc7d2ec 100644
--- a/gtk/gtkfontchooser.c
+++ b/gtk/gtkfontchooser.c
@@ -186,9 +186,14 @@ gtk_font_chooser_get_size (GtkFontChooser *fontchooser)
 gchar *
 gtk_font_chooser_get_font (GtkFontChooser *fontchooser)
 {
+  gchar *fontname;
+
   g_return_val_if_fail (GTK_IS_FONT_CHOOSER (fontchooser), NULL);
 
-  return GTK_FONT_CHOOSER_GET_IFACE (fontchooser)->get_font (fontchooser);
+  g_object_get (fontchooser, "font", &fontname, NULL);
+
+
+  return fontname;
 }
 
 /**
@@ -207,8 +212,7 @@ gtk_font_chooser_set_font (GtkFontChooser *fontchooser,
   g_return_if_fail (GTK_IS_FONT_CHOOSER (fontchooser));
   g_return_if_fail (fontname != NULL);
 
-  GTK_FONT_CHOOSER_GET_IFACE (fontchooser)->set_font (fontchooser,
-                                                      fontname);
+  g_object_set (fontchooser, "font", fontname, NULL);
 }
 
 /**
diff --git a/gtk/gtkfontchooser.h b/gtk/gtkfontchooser.h
index 8573f8c..b436bed 100644
--- a/gtk/gtkfontchooser.h
+++ b/gtk/gtkfontchooser.h
@@ -59,12 +59,10 @@ struct _GtkFontChooserIface
   GTypeInterface base_iface;
 
   /* Methods */
-  gchar *           (* get_font)                (GtkFontChooser *chooser);
-  void              (* set_font)                (GtkFontChooser *chooser,
-                                                 const gchar    *fontname);
   PangoFontFamily * (* get_font_family)         (GtkFontChooser  *chooser);
   PangoFontFace *   (* get_font_face)           (GtkFontChooser  *chooser);
   gint              (* get_font_size)           (GtkFontChooser  *chooser);
+
   void              (* set_filter_func)         (GtkFontChooser   *chooser,
                                                  GtkFontFilterFunc filter,
                                                  gpointer          data,
diff --git a/gtk/gtkfontchooserutils.c b/gtk/gtkfontchooserutils.c
index 418442f..15bc770 100644
--- a/gtk/gtkfontchooserutils.c
+++ b/gtk/gtkfontchooserutils.c
@@ -35,19 +35,6 @@ get_delegate (GtkFontChooser *receiver)
                              GTK_FONT_CHOOSER_DELEGATE_QUARK);
 }
 
-static gchar *
-delegate_get_font (GtkFontChooser *chooser)
-{
-  return gtk_font_chooser_get_font (get_delegate (chooser));
-}
-
-static void
-delegate_set_font (GtkFontChooser *chooser,
-                        const gchar    *fontname)
-{
-  gtk_font_chooser_set_font (get_delegate (chooser), fontname);
-}
-
 static PangoFontFamily *
 delegate_get_font_family (GtkFontChooser *chooser)
 {
@@ -149,8 +136,6 @@ _gtk_font_chooser_install_properties (GObjectClass *klass)
 void
 _gtk_font_chooser_delegate_iface_init (GtkFontChooserIface *iface)
 {
-  iface->get_font = delegate_get_font;
-  iface->set_font = delegate_set_font;
   iface->get_font_family = delegate_get_font_family;
   iface->get_font_face = delegate_get_font_face;
   iface->get_font_size = delegate_get_font_size;
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 568df2f..956f596 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -1187,8 +1187,6 @@ gtk_font_chooser_widget_set_filter_func (GtkFontChooser  *chooser,
 static void
 gtk_font_chooser_widget_iface_init (GtkFontChooserIface *iface)
 {
-  iface->get_font = gtk_font_chooser_widget_get_font;
-  iface->set_font = gtk_font_chooser_widget_set_font;
   iface->get_font_family = gtk_font_chooser_widget_get_family;
   iface->get_font_face = gtk_font_chooser_widget_get_face;
   iface->get_font_size = gtk_font_chooser_widget_get_size;



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