[gnome-flashback] notifications: avoid deprecated g_type_class_add_private



commit b72460d542313b2b5c02d0d6630a5c4809c52ef4
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Sep 9 00:14:18 2018 +0300

    notifications: avoid deprecated g_type_class_add_private

 gnome-flashback/libnotifications/nd-notification-box.c | 8 ++------
 gnome-flashback/libnotifications/nd-queue.c            | 8 ++------
 gnome-flashback/libnotifications/nd-stack.c            | 8 ++------
 3 files changed, 6 insertions(+), 18 deletions(-)
---
diff --git a/gnome-flashback/libnotifications/nd-notification-box.c 
b/gnome-flashback/libnotifications/nd-notification-box.c
index 36e3703..e250d63 100644
--- a/gnome-flashback/libnotifications/nd-notification-box.c
+++ b/gnome-flashback/libnotifications/nd-notification-box.c
@@ -25,8 +25,6 @@
 #include "nd-notification.h"
 #include "nd-notification-box.h"
 
-#define ND_NOTIFICATION_BOX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ND_TYPE_NOTIFICATION_BOX, 
NdNotificationBoxPrivate))
-
 #define IMAGE_SIZE    48
 #define BODY_X_OFFSET (IMAGE_SIZE + 8)
 #define WIDTH         400
@@ -48,7 +46,7 @@ struct NdNotificationBoxPrivate
 
 static void     nd_notification_box_finalize    (GObject                *object);
 
-G_DEFINE_TYPE (NdNotificationBox, nd_notification_box, GTK_TYPE_EVENT_BOX)
+G_DEFINE_TYPE_WITH_PRIVATE (NdNotificationBox, nd_notification_box, GTK_TYPE_EVENT_BOX)
 
 NdNotification *
 nd_notification_box_get_notification (NdNotificationBox *notification_box)
@@ -77,8 +75,6 @@ nd_notification_box_class_init (NdNotificationBoxClass *klass)
 
         object_class->finalize = nd_notification_box_finalize;
         widget_class->button_release_event = nd_notification_box_button_release_event;
-
-        g_type_class_add_private (klass, sizeof (NdNotificationBoxPrivate));
 }
 
 static void
@@ -279,7 +275,7 @@ nd_notification_box_init (NdNotificationBox *notification_box)
         GtkWidget     *vbox;
         AtkObject     *atkobj;
 
-        notification_box->priv = ND_NOTIFICATION_BOX_GET_PRIVATE (notification_box);
+        notification_box->priv = nd_notification_box_get_instance_private (notification_box);
         box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
         gtk_container_add (GTK_CONTAINER (notification_box), box);
         gtk_widget_show (box);
diff --git a/gnome-flashback/libnotifications/nd-queue.c b/gnome-flashback/libnotifications/nd-queue.c
index e0a27c2..20efadd 100644
--- a/gnome-flashback/libnotifications/nd-queue.c
+++ b/gnome-flashback/libnotifications/nd-queue.c
@@ -32,8 +32,6 @@
 #include "nd-notification-box.h"
 #include "nd-stack.h"
 
-#define ND_QUEUE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ND_TYPE_QUEUE, NdQueuePrivate))
-
 #define WIDTH         400
 
 typedef struct
@@ -74,7 +72,7 @@ static void     on_notification_close   (NdNotification *notification,
 
 static gpointer queue_object = NULL;
 
-G_DEFINE_TYPE (NdQueue, nd_queue, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (NdQueue, nd_queue, G_TYPE_OBJECT)
 
 static void
 create_stack_for_monitor (NdQueue    *queue,
@@ -231,8 +229,6 @@ nd_queue_class_init (NdQueueClass *klass)
                               g_cclosure_marshal_VOID__VOID,
                               G_TYPE_NONE,
                               0);
-
-        g_type_class_add_private (klass, sizeof (NdQueuePrivate));
 }
 
 static void
@@ -454,7 +450,7 @@ create_dock (NdQueue *queue)
 static void
 nd_queue_init (NdQueue *queue)
 {
-        queue->priv = ND_QUEUE_GET_PRIVATE (queue);
+        queue->priv = nd_queue_get_instance_private (queue);
         queue->priv->notifications = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
         queue->priv->bubbles = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
         queue->priv->queue = g_queue_new ();
diff --git a/gnome-flashback/libnotifications/nd-stack.c b/gnome-flashback/libnotifications/nd-stack.c
index 4ebfbf2..fa45fd5 100644
--- a/gnome-flashback/libnotifications/nd-stack.c
+++ b/gnome-flashback/libnotifications/nd-stack.c
@@ -29,8 +29,6 @@
 
 #include "nd-stack.h"
 
-#define ND_STACK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ND_TYPE_STACK, NdStackPrivate))
-
 #define NOTIFY_STACK_SPACING 2
 #define WORKAREA_PADDING 6
 
@@ -45,7 +43,7 @@ struct NdStackPrivate
 
 static void     nd_stack_finalize    (GObject       *object);
 
-G_DEFINE_TYPE (NdStack, nd_stack, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (NdStack, nd_stack, G_TYPE_OBJECT)
 
 GList *
 nd_stack_get_bubbles (NdStack *stack)
@@ -236,14 +234,12 @@ nd_stack_class_init (NdStackClass *klass)
         GObjectClass   *object_class = G_OBJECT_CLASS (klass);
 
         object_class->finalize = nd_stack_finalize;
-
-        g_type_class_add_private (klass, sizeof (NdStackPrivate));
 }
 
 static void
 nd_stack_init (NdStack *stack)
 {
-        stack->priv = ND_STACK_GET_PRIVATE (stack);
+        stack->priv = nd_stack_get_instance_private (stack);
         stack->priv->location = ND_STACK_LOCATION_DEFAULT;
 }
 


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