[totem/gkarsay/totem-master: 6/6] main: Replace deprecated g_type_class_add_private()



commit 1d0e7d8e4f5ec2df33fa7ce44df0c682ae56ea57
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Sep 26 11:34:25 2019 +0200

    main: Replace deprecated g_type_class_add_private()
    
    g_type_class_add_private has been deprecated since GObject 2.58.

 src/totem-open-location.c | 7 ++-----
 src/totem-playlist.c      | 6 ++----
 src/totem-search-entry.c  | 8 +++-----
 3 files changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/src/totem-open-location.c b/src/totem-open-location.c
index ea26982d6..b9f34baab 100644
--- a/src/totem-open-location.c
+++ b/src/totem-open-location.c
@@ -46,9 +46,7 @@ struct TotemOpenLocationPrivate
        GtkEntry *uri_entry;
 };
 
-#define TOTEM_OPEN_LOCATION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TOTEM_TYPE_OPEN_LOCATION, 
TotemOpenLocationPrivate))
-
-G_DEFINE_TYPE (TotemOpenLocation, totem_open_location, GTK_TYPE_DIALOG)
+G_DEFINE_TYPE_WITH_PRIVATE (TotemOpenLocation, totem_open_location, GTK_TYPE_DIALOG)
 
 /* GtkBuilder callbacks */
 G_MODULE_EXPORT void uri_entry_changed_cb (GtkEditable *entry, GtkDialog *dialog);
@@ -56,7 +54,6 @@ G_MODULE_EXPORT void uri_entry_changed_cb (GtkEditable *entry, GtkDialog *dialog
 static void
 totem_open_location_class_init (TotemOpenLocationClass *klass)
 {
-       g_type_class_add_private (klass, sizeof (TotemOpenLocationPrivate));
 }
 
 static void
@@ -64,7 +61,7 @@ totem_open_location_init (TotemOpenLocation *self)
 {
        GtkBuilder *builder;
 
-       self->priv = TOTEM_OPEN_LOCATION_GET_PRIVATE (self);
+       self->priv = totem_open_location_get_instance_private (self);
        builder = totem_interface_load ("uri.ui", FALSE, NULL, self);
 
        if (builder == NULL)
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index 27db471ca..6867f8ab0 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -130,7 +130,7 @@ static void init_treeview (GtkWidget *treeview, TotemPlaylist *playlist);
 
 #define totem_playlist_unset_playing(x) totem_playlist_set_playing(x, TOTEM_PLAYLIST_STATUS_NONE)
 
-G_DEFINE_TYPE (TotemPlaylist, totem_playlist, GTK_TYPE_BOX)
+G_DEFINE_TYPE_WITH_PRIVATE (TotemPlaylist, totem_playlist, GTK_TYPE_BOX)
 
 /* Helper functions */
 void
@@ -819,7 +819,7 @@ totem_playlist_init (TotemPlaylist *playlist)
        gtk_orientable_set_orientation (GTK_ORIENTABLE (playlist),
                                        GTK_ORIENTATION_VERTICAL);
 
-       playlist->priv = G_TYPE_INSTANCE_GET_PRIVATE (playlist, TOTEM_TYPE_PLAYLIST, TotemPlaylistPrivate);
+       playlist->priv = totem_playlist_get_instance_private (playlist);
        playlist->priv->parser = totem_pl_parser_new ();
 
        totem_pl_parser_add_ignored_scheme (playlist->priv->parser, "dvd:");
@@ -2054,8 +2054,6 @@ totem_playlist_class_init (TotemPlaylistClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-       g_type_class_add_private (klass, sizeof (TotemPlaylistPrivate));
-
        object_class->set_property = totem_playlist_set_property;
        object_class->get_property = totem_playlist_get_property;
        object_class->dispose = totem_playlist_dispose;
diff --git a/src/totem-search-entry.c b/src/totem-search-entry.c
index 1fe82b818..82915ff0d 100644
--- a/src/totem-search-entry.c
+++ b/src/totem-search-entry.c
@@ -22,8 +22,6 @@
 #include "totem-search-entry.h"
 #include "libgd/gd-tagged-entry.h"
 
-G_DEFINE_TYPE (TotemSearchEntry, totem_search_entry, GTK_TYPE_BOX)
-
 enum {
        SIGNAL_ACTIVATE,
        LAST_SIGNAL
@@ -43,6 +41,8 @@ struct _TotemSearchEntryPrivate {
        GdTaggedEntryTag *tag;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (TotemSearchEntry, totem_search_entry, GTK_TYPE_BOX)
+
 static void
 totem_search_entry_finalize (GObject *obj)
 {
@@ -142,7 +142,7 @@ totem_search_entry_init (TotemSearchEntry *self)
 {
        GtkWidget *entry;
 
-       self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TOTEM_TYPE_SEARCH_ENTRY, TotemSearchEntryPrivate);
+       self->priv = totem_search_entry_get_instance_private (self);
 
        /* Entry */
        entry = GTK_WIDGET (gd_tagged_entry_new ());
@@ -231,8 +231,6 @@ totem_search_entry_class_init (TotemSearchEntryClass *klass)
                                                              NULL,
                                                              G_PARAM_READWRITE |
                                                              G_PARAM_STATIC_STRINGS));
-
-       g_type_class_add_private (klass, sizeof (TotemSearchEntryPrivate));
 }
 
 TotemSearchEntry *


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