[gnome-notes/108-fix-deprecated-warnings-compile-messages] compile: Fix obsolete warnings



commit 33ab575b51d7769b0dedb256bd150c516b92ad3c
Author: Isaque Galdino <igaldino gmail com>
Date:   Wed Sep 26 22:25:42 2018 -0300

    compile: Fix obsolete warnings
    
    This commit changes code to use G_DEFINE_TYPE_WITH_PRIVATE instead of
    G_DEFINE_TYPE.
    
    It removes *_GET_PRIVATE(obj) macros and replaces them by
    *_get_instance_private functions.
    
    Finally it removes calls to g_type_class_add_private from *_class_init
    functions.

 src/libbiji/editor/biji-editor-selection.c  | 10 ++--------
 src/libbiji/editor/biji-webkit-editor.c     |  6 ++----
 src/libbiji/provider/biji-import-provider.c |  7 ++-----
 src/libbiji/provider/biji-local-note.c      |  6 ++----
 src/libbiji/provider/biji-memo-note.c       |  6 ++----
 5 files changed, 10 insertions(+), 25 deletions(-)
---
diff --git a/src/libbiji/editor/biji-editor-selection.c b/src/libbiji/editor/biji-editor-selection.c
index e0bbfd1..18df909 100644
--- a/src/libbiji/editor/biji-editor-selection.c
+++ b/src/libbiji/editor/biji-editor-selection.c
@@ -26,16 +26,12 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#define E_EDITOR_SELECTION_GET_PRIVATE(obj) \
-       (G_TYPE_INSTANCE_GET_PRIVATE \
-       ((obj), E_TYPE_EDITOR_SELECTION, EEditorSelectionPrivate))
-
 struct _EEditorSelectionPrivate {
        WebKitWebView *webview;
         WebKitEditorTypingAttributes attrs;
 };
 
-G_DEFINE_TYPE (
+G_DEFINE_TYPE_WITH_PRIVATE (
        EEditorSelection,
        e_editor_selection,
        G_TYPE_OBJECT
@@ -180,8 +176,6 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
 {
        GObjectClass *object_class;
 
-       g_type_class_add_private (klass, sizeof (EEditorSelectionPrivate));
-
        object_class = G_OBJECT_CLASS (klass);
        object_class->get_property = e_editor_selection_get_property;
        object_class->set_property = e_editor_selection_set_property;
@@ -232,7 +226,7 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
 static void
 e_editor_selection_init (EEditorSelection *selection)
 {
-       selection->priv = E_EDITOR_SELECTION_GET_PRIVATE (selection);
+       selection->priv = e_editor_selection_get_instance_private (selection);
 }
 
 EEditorSelection *
diff --git a/src/libbiji/editor/biji-webkit-editor.c b/src/libbiji/editor/biji-webkit-editor.c
index a205450..66728a0 100644
--- a/src/libbiji/editor/biji-webkit-editor.c
+++ b/src/libbiji/editor/biji-webkit-editor.c
@@ -66,7 +66,7 @@ struct _BijiWebkitEditorPrivate
   EEditorSelection *sel;
 };
 
-G_DEFINE_TYPE (BijiWebkitEditor, biji_webkit_editor, WEBKIT_TYPE_WEB_VIEW);
+G_DEFINE_TYPE_WITH_PRIVATE (BijiWebkitEditor, biji_webkit_editor, WEBKIT_TYPE_WEB_VIEW);
 
 gboolean
 biji_webkit_editor_has_selection (BijiWebkitEditor *self)
@@ -281,7 +281,7 @@ biji_webkit_editor_set_text_size (BijiWebkitEditor *self,
 static void
 biji_webkit_editor_init (BijiWebkitEditor *self)
 {
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, BIJI_TYPE_WEBKIT_EDITOR, BijiWebkitEditorPrivate);
+  self->priv = biji_webkit_editor_get_instance_private (self);
 }
 
 static void
@@ -658,8 +658,6 @@ biji_webkit_editor_class_init (BijiWebkitEditorClass *klass)
                                          g_cclosure_marshal_VOID__VOID,
                                          G_TYPE_NONE,
                                          0);
-
-  g_type_class_add_private (klass, sizeof (BijiWebkitEditorPrivate));
 }
 
 BijiWebkitEditor *
diff --git a/src/libbiji/provider/biji-import-provider.c b/src/libbiji/provider/biji-import-provider.c
index d064b62..10f428d 100644
--- a/src/libbiji/provider/biji-import-provider.c
+++ b/src/libbiji/provider/biji-import-provider.c
@@ -55,7 +55,7 @@ struct BijiImportProviderPrivate_
 
 static void biji_import_provider_finalize (GObject *object);
 
-G_DEFINE_TYPE (BijiImportProvider, biji_import_provider, BIJI_TYPE_PROVIDER)
+G_DEFINE_TYPE_WITH_PRIVATE (BijiImportProvider, biji_import_provider, BIJI_TYPE_PROVIDER)
 
 
 #define ATTRIBUTES_FOR_NOTEBOOK "standard::content-type,standard::name"
@@ -334,9 +334,6 @@ biji_import_provider_class_init (BijiImportProviderClass *klass)
                          G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 
   g_object_class_install_properties (g_object_class, IMPORT_PROV_PROP, properties);
-
-
-  g_type_class_add_private ((gpointer)klass, sizeof (BijiImportProviderPrivate));
 }
 
 
@@ -350,7 +347,7 @@ biji_import_provider_finalize (GObject *object)
 static void
 biji_import_provider_init (BijiImportProvider *self)
 {
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, BIJI_TYPE_IMPORT_PROVIDER, BijiImportProviderPrivate);
+  self->priv = biji_import_provider_get_instance_private (self);
   self->priv->items = g_hash_table_new (g_str_hash, g_str_equal);
 }
 
diff --git a/src/libbiji/provider/biji-local-note.c b/src/libbiji/provider/biji-local-note.c
index 5273ae5..4c4ea9f 100644
--- a/src/libbiji/provider/biji-local-note.c
+++ b/src/libbiji/provider/biji-local-note.c
@@ -31,7 +31,7 @@ struct BijiLocalNotePrivate_
 };
 
 
-G_DEFINE_TYPE (BijiLocalNote, biji_local_note, BIJI_TYPE_NOTE_OBJ)
+G_DEFINE_TYPE_WITH_PRIVATE (BijiLocalNote, biji_local_note, BIJI_TYPE_NOTE_OBJ)
 
 /* Iface */
 
@@ -127,7 +127,7 @@ biji_local_note_finalize (GObject *object)
 static void
 biji_local_note_init (BijiLocalNote *self)
 {
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, BIJI_TYPE_LOCAL_NOTE, BijiLocalNotePrivate);
+  self->priv = biji_local_note_get_instance_private (self);
   self->priv->html = NULL;
   self->priv->trashed = FALSE;
 }
@@ -339,8 +339,6 @@ biji_local_note_class_init (BijiLocalNoteClass *klass)
   note_class->can_format = note_yes;
   note_class->archive = local_note_archive;
   note_class->is_trashed = local_note_is_trashed;
-
-  g_type_class_add_private ((gpointer)klass, sizeof (BijiLocalNotePrivate));
 }
 
 
diff --git a/src/libbiji/provider/biji-memo-note.c b/src/libbiji/provider/biji-memo-note.c
index 7dcbb9e..6a31abb 100644
--- a/src/libbiji/provider/biji-memo-note.c
+++ b/src/libbiji/provider/biji-memo-note.c
@@ -30,7 +30,7 @@ struct _BijiMemoNotePrivate
 };
 
 
-G_DEFINE_TYPE (BijiMemoNote, biji_memo_note, BIJI_TYPE_NOTE_OBJ);
+G_DEFINE_TYPE_WITH_PRIVATE (BijiMemoNote, biji_memo_note, BIJI_TYPE_NOTE_OBJ);
 
 
 /* Properties */
@@ -250,7 +250,7 @@ biji_memo_note_constructed (GObject *obj)
 static void
 biji_memo_note_init (BijiMemoNote *biji_memo_note)
 {
-  biji_memo_note->priv = G_TYPE_INSTANCE_GET_PRIVATE (biji_memo_note, BIJI_TYPE_MEMO_NOTE, 
BijiMemoNotePrivate);
+  biji_memo_note->priv = biji_memo_note_get_instance_private (biji_memo_note);
 
 }
 
@@ -424,8 +424,6 @@ biji_memo_note_class_init (BijiMemoNoteClass *klass)
   item_class = BIJI_ITEM_CLASS (klass);
   note_class = BIJI_NOTE_OBJ_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (BijiMemoNotePrivate));
-
   object_class->finalize = biji_memo_note_finalize;
   object_class->constructed = biji_memo_note_constructed;
   object_class->get_property = biji_memo_note_get_property;


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