[libgd/wip/rishi/modernize-gobject: 2/5] toggle-pixbuf-renderer: Use G_DEFINE_WITH_PRIVATE



commit 6d254dc701b8b29745edd54ff4e7643a8feeb8a1
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Oct 6 17:42:28 2018 +0200

    toggle-pixbuf-renderer: Use G_DEFINE_WITH_PRIVATE
    
    This paves the way for improving our GObject use and reducing the
    amount of boilerplate.
    
    G_DEFINE_WITH_WITH_PRIVATE was introduced in GLib 2.38, which should be
    old enough for all users.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774709

 libgd/gd-toggle-pixbuf-renderer.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/libgd/gd-toggle-pixbuf-renderer.c b/libgd/gd-toggle-pixbuf-renderer.c
index ac6a6c3..92de575 100644
--- a/libgd/gd-toggle-pixbuf-renderer.c
+++ b/libgd/gd-toggle-pixbuf-renderer.c
@@ -21,8 +21,6 @@
 
 #include "gd-toggle-pixbuf-renderer.h"
 
-G_DEFINE_TYPE (GdTogglePixbufRenderer, gd_toggle_pixbuf_renderer, GTK_TYPE_CELL_RENDERER_PIXBUF)
-
 enum {
   PROP_ACTIVE = 1,
   PROP_TOGGLE_VISIBLE,
@@ -39,6 +37,8 @@ struct _GdTogglePixbufRendererPrivate {
   guint pulse;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GdTogglePixbufRenderer, gd_toggle_pixbuf_renderer, GTK_TYPE_CELL_RENDERER_PIXBUF)
+
 static void
 render_check (GdTogglePixbufRenderer *self,
               cairo_t                *cr,
@@ -252,15 +252,13 @@ gd_toggle_pixbuf_renderer_class_init (GdTogglePixbufRendererClass *klass)
                       G_PARAM_READWRITE |
                       G_PARAM_STATIC_STRINGS);
 
-  g_type_class_add_private (klass, sizeof (GdTogglePixbufRendererPrivate));
   g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
 }
 
 static void
 gd_toggle_pixbuf_renderer_init (GdTogglePixbufRenderer *self)
 {
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GD_TYPE_TOGGLE_PIXBUF_RENDERER,
-                                            GdTogglePixbufRendererPrivate);
+  self->priv = gd_toggle_pixbuf_renderer_get_instance_private (self);
 }
 
 GtkCellRenderer *


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