[file-roller: 1/2] don't use deprecated G_TYPE_INSTANCE_GET_PRIVATE



commit 69d86da7aab4c2ca6be0dbb2cd335784a2f34618
Author: Peter Keresztes Schmidt <carbenium outlook com>
Date:   Tue Aug 6 21:02:26 2019 +0200

    don't use deprecated G_TYPE_INSTANCE_GET_PRIVATE
    
    This includes a version bump of glib to 2.38
    to support the new API.

 meson.build                 | 2 +-
 src/fr-archive-libarchive.c | 9 ++++-----
 src/fr-archive.c            | 9 ++++-----
 src/fr-command.c            | 9 ++++-----
 src/fr-process.c            | 8 +++-----
 5 files changed, 16 insertions(+), 21 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5a742706..ee1cf69d 100644
--- a/meson.build
+++ b/meson.build
@@ -4,7 +4,7 @@ project('file-roller', 'c',
   meson_version : '>=0.43'
 )
 
-glib_version = '>=2.36'
+glib_version = '>=2.38'
 gtk_version = '>=3.13.2'
 nautilus_version = '>=2.22.2'
 json_glib_version = '>=0.14.0'
diff --git a/src/fr-archive-libarchive.c b/src/fr-archive-libarchive.c
index 1d451648..dd3e4bea 100644
--- a/src/fr-archive-libarchive.c
+++ b/src/fr-archive-libarchive.c
@@ -42,15 +42,15 @@
 #define FILE_ATTRIBUTES_NEEDED_BY_ARCHIVE_ENTRY ("standard::*,time::*,access::*,unix::*")
 
 
-G_DEFINE_TYPE (FrArchiveLibarchive, fr_archive_libarchive, FR_TYPE_ARCHIVE)
-
-
 struct _FrArchiveLibarchivePrivate {
        gssize compressed_size;
        gssize uncompressed_size;
 };
 
 
+G_DEFINE_TYPE_WITH_PRIVATE (FrArchiveLibarchive, fr_archive_libarchive, FR_TYPE_ARCHIVE)
+
+
 static void
 fr_archive_libarchive_finalize (GObject *object)
 {
@@ -2161,7 +2161,6 @@ fr_archive_libarchive_class_init (FrArchiveLibarchiveClass *klass)
        FrArchiveClass *archive_class;
 
        fr_archive_libarchive_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (FrArchiveLibarchivePrivate));
 
        gobject_class = G_OBJECT_CLASS (klass);
        gobject_class->finalize = fr_archive_libarchive_finalize;
@@ -2186,7 +2185,7 @@ fr_archive_libarchive_init (FrArchiveLibarchive *self)
 {
        FrArchive *base = FR_ARCHIVE (self);
 
-       self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, FR_TYPE_ARCHIVE_LIBARCHIVE, 
FrArchiveLibarchivePrivate);
+       self->priv = fr_archive_libarchive_get_instance_private (self);
 
        base->propAddCanReplace = TRUE;
        base->propAddCanUpdate = TRUE;
diff --git a/src/fr-archive.c b/src/fr-archive.c
index 163f035c..3043854a 100644
--- a/src/fr-archive.c
+++ b/src/fr-archive.c
@@ -65,9 +65,6 @@ char *action_names[] = { "NONE",
                         "UPDATING_FILES" };
 
 
-G_DEFINE_TYPE (FrArchive, fr_archive, G_TYPE_OBJECT)
-
-
 typedef struct _DroppedItemsData DroppedItemsData;
 
 
@@ -97,6 +94,9 @@ struct _FrArchivePrivate {
 };
 
 
+G_DEFINE_TYPE_WITH_PRIVATE (FrArchive, fr_archive, G_TYPE_OBJECT)
+
+
 enum {
        START,
        PROGRESS,
@@ -301,7 +301,6 @@ fr_archive_class_init (FrArchiveClass *klass)
        GObjectClass *gobject_class;
 
        fr_archive_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (FrArchivePrivate));
 
        gobject_class = G_OBJECT_CLASS (klass);
        gobject_class->finalize = fr_archive_finalize;
@@ -430,7 +429,7 @@ fr_archive_class_init (FrArchiveClass *klass)
 static void
 fr_archive_init (FrArchive *self)
 {
-       self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, FR_TYPE_ARCHIVE, FrArchivePrivate);
+       self->priv = fr_archive_get_instance_private (self);
 
        self->mime_type = NULL;
        self->files = g_ptr_array_sized_new (FILE_ARRAY_INITIAL_SIZE);
diff --git a/src/fr-command.c b/src/fr-command.c
index fa1c46a7..33783e57 100644
--- a/src/fr-command.c
+++ b/src/fr-command.c
@@ -89,9 +89,6 @@ xfer_data_free (XferData *data)
 /* -- FrCommand -- */
 
 
-G_DEFINE_TYPE (FrCommand, fr_command, FR_TYPE_ARCHIVE)
-
-
 /* Properties */
 enum {
         PROP_0,
@@ -109,6 +106,9 @@ struct _FrCommandPrivate {
 };
 
 
+G_DEFINE_TYPE_WITH_PRIVATE (FrCommand, fr_command, FR_TYPE_ARCHIVE)
+
+
 static void
 _fr_command_remove_temp_work_dir (FrCommand *self)
 {
@@ -2947,7 +2947,6 @@ fr_command_class_init (FrCommandClass *klass)
        FrArchiveClass *archive_class;
 
        fr_command_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (FrCommandPrivate));
 
        gobject_class = G_OBJECT_CLASS (klass);
        gobject_class->set_property = fr_command_set_property;
@@ -3073,7 +3072,7 @@ fr_command_init (FrCommand *self)
 {
        FrProcess *process;
 
-       self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, FR_TYPE_COMMAND, FrCommandPrivate);
+       self->priv = fr_command_get_instance_private (self);
 
        self->priv->local_copy = NULL;
        self->priv->is_remote = FALSE;
diff --git a/src/fr-process.c b/src/fr-process.c
index 66bd406e..e36f552a 100644
--- a/src/fr-process.c
+++ b/src/fr-process.c
@@ -232,9 +232,6 @@ execute_data_free (ExecuteData *exec_data)
 /* -- FrProcess  -- */
 
 
-G_DEFINE_TYPE (FrProcess, fr_process, G_TYPE_OBJECT)
-
-
 enum {
        STICKY_ONLY,
        LAST_SIGNAL
@@ -266,6 +263,8 @@ struct _FrProcessPrivate {
        ExecuteData *exec_data;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (FrProcess, fr_process, G_TYPE_OBJECT)
+
 
 static void
 fr_process_finalize (GObject *object)
@@ -294,7 +293,6 @@ fr_process_class_init (FrProcessClass *klass)
        GObjectClass *gobject_class;
 
        fr_process_parent_class = g_type_class_peek_parent (klass);
-       g_type_class_add_private (klass, sizeof (FrProcessPrivate));
 
        fr_process_signals[STICKY_ONLY] =
                g_signal_new ("sticky_only",
@@ -313,7 +311,7 @@ fr_process_class_init (FrProcessClass *klass)
 static void
 fr_process_init (FrProcess *process)
 {
-       process->priv = G_TYPE_INSTANCE_GET_PRIVATE (process, FR_TYPE_PROCESS, FrProcessPrivate);
+       process->priv = fr_process_get_instance_private (process);
 
        process->priv->comm = g_ptr_array_new ();
        process->priv->n_comm = -1;


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