summaryrefslogtreecommitdiff
path: root/mate-dictionary/libgdict
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-05-30 13:53:33 +0200
committerraveit65 <[email protected]>2016-05-30 17:33:02 +0200
commite3052b485d8ded6e02475fa6f5d0b60e98b2565e (patch)
tree0109b072186aa7d13bc14e4b2535118bb4997630 /mate-dictionary/libgdict
parent4ce13708f03884cc231b89f04ace3dadfe4afe2e (diff)
downloadmate-utils-e3052b485d8ded6e02475fa6f5d0b60e98b2565e.tar.bz2
mate-utils-e3052b485d8ded6e02475fa6f5d0b60e98b2565e.tar.xz
GTK+3 mdict: Drop deprecated API from SourceChooser
Remove all the deprecation warnings. 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 taken from: https://git.gnome.org/browse/gnome-dictionary/commit/?id=d078eaf
Diffstat (limited to 'mate-dictionary/libgdict')
-rw-r--r--mate-dictionary/libgdict/gdict-source-chooser.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/mate-dictionary/libgdict/gdict-source-chooser.c b/mate-dictionary/libgdict/gdict-source-chooser.c
index 6e9edd4f..217bf412 100644
--- a/mate-dictionary/libgdict/gdict-source-chooser.c
+++ b/mate-dictionary/libgdict/gdict-source-chooser.c
@@ -47,10 +47,12 @@
#include "gdict-enum-types.h"
#include "gdict-marshal.h"
+#if !GTK_CHECK_VERSION(3,0,0)
#define GDICT_SOURCE_CHOOSER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
GDICT_TYPE_SOURCE_CHOOSER, \
GdictSourceChooserPrivate))
+#endif
struct _GdictSourceChooserPrivate
{
@@ -63,7 +65,9 @@ struct _GdictSourceChooserPrivate
GdictSourceLoader *loader;
gint n_sources;
+#if !GTK_CHECK_VERSION(3,0,0)
GdkCursor *busy_cursor;
+#endif
gchar *current_source;
};
@@ -96,7 +100,11 @@ enum
static guint source_chooser_signals[LAST_SIGNAL] = { 0, };
+#if GTK_CHECK_VERSION(3,0,0)
+G_DEFINE_TYPE_WITH_PRIVATE (GdictSourceChooser, gdict_source_chooser, GTK_TYPE_BOX)
+#else
G_DEFINE_TYPE (GdictSourceChooser, gdict_source_chooser, GTK_TYPE_BOX);
+#endif
static void
gdict_source_chooser_finalize (GObject *gobject)
@@ -127,15 +135,13 @@ gdict_source_chooser_dispose (GObject *gobject)
priv->loader = NULL;
}
+#if !GTK_CHECK_VERSION(3,0,0)
if (priv->busy_cursor)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
- g_object_unref (priv->busy_cursor);
-#else
gdk_cursor_unref (priv->busy_cursor);
-#endif
priv->busy_cursor = NULL;
}
+#endif
G_OBJECT_CLASS (gdict_source_chooser_parent_class)->dispose (gobject);
}
@@ -254,13 +260,17 @@ gdict_source_chooser_constructor (GType gtype,
chooser = GDICT_SOURCE_CHOOSER (retval);
priv = chooser->priv;
+#if !GTK_CHECK_VERSION(3,0,0)
gtk_widget_push_composite_child ();
+#endif
sw = gtk_scrolled_window_new (NULL, NULL);
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_vexpand (sw, TRUE);
#endif
+#if !GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_composite_name (sw, "gdict-source-chooser-scrolled-window");
+#endif
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
@@ -276,7 +286,9 @@ gdict_source_chooser_constructor (GType gtype,
"weight", SOURCE_CURRENT,
NULL);
priv->treeview = gtk_tree_view_new ();
+#if !GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_composite_name (priv->treeview, "gdict-source-chooser-treeview");
+#endif
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);
@@ -312,7 +324,9 @@ gdict_source_chooser_constructor (GType gtype,
gtk_box_pack_end (GTK_BOX (chooser), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
+#if !GTK_CHECK_VERSION(3,0,0)
gtk_widget_pop_composite_child ();
+#endif
return retval;
}
@@ -322,7 +336,9 @@ gdict_source_chooser_class_init (GdictSourceChooserClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+#if !GTK_CHECK_VERSION(3,0,0)
g_type_class_add_private (klass, sizeof (GdictSourceChooserPrivate));
+#endif
gobject_class->finalize = gdict_source_chooser_finalize;
gobject_class->dispose = gdict_source_chooser_dispose;
@@ -407,8 +423,13 @@ gdict_source_chooser_init (GdictSourceChooser *chooser)
{
GdictSourceChooserPrivate *priv;
- gtk_orientable_set_orientation (GTK_ORIENTABLE (chooser), GTK_ORIENTATION_VERTICAL);
+#if GTK_CHECK_VERSION(3,0,0)
+ chooser->priv = priv = gdict_source_chooser_get_instance_private (chooser);
+#else
chooser->priv = priv = GDICT_SOURCE_CHOOSER_GET_PRIVATE (chooser);
+#endif
+
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (chooser), GTK_ORIENTATION_VERTICAL);
priv->store = gtk_list_store_new (SOURCE_N_COLUMNS,
G_TYPE_INT, /* TRANSPORT */
@@ -419,7 +440,9 @@ gdict_source_chooser_init (GdictSourceChooser *chooser)
priv->loader = NULL;
priv->n_sources = -1;
+#if !GTK_CHECK_VERSION(3,0,0)
priv->busy_cursor = gdk_cursor_new (GDK_WATCH);
+#endif
}
/**