[gnome-dictionary] gdict: Drop deprecated API from SourceChooser



commit d078eaf43f3e95f5cc760381d799bb5c2a69bed7
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Feb 23 15:00:04 2015 +0000

    gdict: Drop deprecated API from SourceChooser
    
    Remove all the deprecation warnings.
    
    *** WARNING ***
    
    This is really an API change, since GtkBox is not a GtkVBox; on the
    other hand:
    
     • nothing is really subclassing this type
     • GtkVBox does not have any API except a constructor
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745022

 libgdict/gdict-source-chooser.c |   30 ++++++------------------------
 libgdict/gdict-source-chooser.h |    4 ++--
 2 files changed, 8 insertions(+), 26 deletions(-)
---
diff --git a/libgdict/gdict-source-chooser.c b/libgdict/gdict-source-chooser.c
index eab00ef..49beb77 100644
--- a/libgdict/gdict-source-chooser.c
+++ b/libgdict/gdict-source-chooser.c
@@ -46,11 +46,6 @@
 #include "gdict-enum-types.h"
 #include "gdict-marshal.h"
 
-#define GDICT_SOURCE_CHOOSER_GET_PRIVATE(obj)   \
-        (G_TYPE_INSTANCE_GET_PRIVATE ((obj),    \
-         GDICT_TYPE_SOURCE_CHOOSER,             \
-         GdictSourceChooserPrivate))
-
 struct _GdictSourceChooserPrivate
 {
   GtkListStore *store;
@@ -61,8 +56,6 @@ struct _GdictSourceChooserPrivate
 
   GdictSourceLoader *loader;
   gint n_sources;
-
-  GdkCursor *busy_cursor;
   
   gchar *current_source;
 };
@@ -95,7 +88,7 @@ enum
 
 static guint source_chooser_signals[LAST_SIGNAL] = { 0, };
 
-G_DEFINE_TYPE (GdictSourceChooser, gdict_source_chooser, GTK_TYPE_VBOX);
+G_DEFINE_TYPE_WITH_PRIVATE (GdictSourceChooser, gdict_source_chooser, GTK_TYPE_BOX)
 
 static void
 gdict_source_chooser_finalize (GObject *gobject)
@@ -126,8 +119,6 @@ gdict_source_chooser_dispose (GObject *gobject)
       priv->loader = NULL;
     }
 
-  g_clear_object (&priv->busy_cursor);
-
   G_OBJECT_CLASS (gdict_source_chooser_parent_class)->dispose (gobject);
 }
 
@@ -245,10 +236,7 @@ gdict_source_chooser_constructor (GType                  gtype,
   chooser = GDICT_SOURCE_CHOOSER (retval);
   priv = chooser->priv;
 
-  gtk_widget_push_composite_child ();
-
   sw = gtk_scrolled_window_new (NULL, NULL);
-  gtk_widget_set_composite_name (sw, "gdict-source-chooser-scrolled-window");
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                   GTK_POLICY_AUTOMATIC,
                                   GTK_POLICY_AUTOMATIC);
@@ -264,7 +252,6 @@ gdict_source_chooser_constructor (GType                  gtype,
                                                      "weight", SOURCE_CURRENT,
                                                      NULL);
   priv->treeview = gtk_tree_view_new ();
-  gtk_widget_set_composite_name (priv->treeview, "gdict-source-chooser-treeview");
   gtk_tree_view_set_model (GTK_TREE_VIEW (priv->treeview),
                            GTK_TREE_MODEL (priv->store));
   gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->treeview), FALSE);
@@ -295,8 +282,6 @@ gdict_source_chooser_constructor (GType                  gtype,
   gtk_box_pack_end (GTK_BOX (chooser), hbox, FALSE, FALSE, 0);
   gtk_widget_show (hbox);
 
-  gtk_widget_pop_composite_child ();
-
   return retval;
 }
 
@@ -305,8 +290,6 @@ gdict_source_chooser_class_init (GdictSourceChooserClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (GdictSourceChooserPrivate));
-
   gobject_class->finalize = gdict_source_chooser_finalize;
   gobject_class->dispose = gdict_source_chooser_dispose;
   gobject_class->set_property = gdict_source_chooser_set_property;
@@ -390,7 +373,9 @@ gdict_source_chooser_init (GdictSourceChooser *chooser)
 {
   GdictSourceChooserPrivate *priv;
 
-  chooser->priv = priv = GDICT_SOURCE_CHOOSER_GET_PRIVATE (chooser);
+  chooser->priv = priv = gdict_source_chooser_get_instance_private (chooser);
+
+  gtk_orientable_set_orientation (GTK_ORIENTABLE (chooser), GTK_ORIENTATION_VERTICAL);
 
   priv->store = gtk_list_store_new (SOURCE_N_COLUMNS,
                                     G_TYPE_INT,    /* TRANSPORT */
@@ -400,8 +385,6 @@ gdict_source_chooser_init (GdictSourceChooser *chooser)
 
   priv->loader = NULL;
   priv->n_sources = -1;
-
-  priv->busy_cursor = gdk_cursor_new (GDK_WATCH);
 }
 
 /**
@@ -879,8 +862,7 @@ gdict_source_chooser_refresh (GdictSourceChooser *chooser)
  * @button_text: text of the button
  *
  * Adds a #GtkButton with @button_text to the button area on
- * the bottom of @chooser. The @button_text can also be a
- * stock ID.
+ * the bottom of @chooser.
  *
  * Return value: (transfer none): the newly packed button.
  *
@@ -898,7 +880,7 @@ gdict_source_chooser_add_button (GdictSourceChooser *chooser,
 
   priv = chooser->priv;
 
-  button = gtk_button_new_from_stock (button_text);
+  button = gtk_button_new_with_label (button_text);
 
   gtk_widget_set_can_default (button, TRUE);
 
diff --git a/libgdict/gdict-source-chooser.h b/libgdict/gdict-source-chooser.h
index 2b927fe..0f8cc93 100644
--- a/libgdict/gdict-source-chooser.h
+++ b/libgdict/gdict-source-chooser.h
@@ -38,7 +38,7 @@ typedef struct _GdictSourceChooserClass         GdictSourceChooserClass;
 struct _GdictSourceChooser
 {
   /*< private >*/
-  GtkVBox parent_instance;
+  GtkBox parent_instance;
 
   GdictSourceChooserPrivate *priv;
 };
@@ -46,7 +46,7 @@ struct _GdictSourceChooser
 struct _GdictSourceChooserClass
 {
   /*< private >*/
-  GtkVBoxClass parent_class;
+  GtkBoxClass parent_class;
 
   /*< public >*/
   void (*source_activated)  (GdictSourceChooser *chooser,


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