[gtk+] gdk: Use new macros for defining private data



commit 9f2ca8d851342c815dde4baefd77b05dffd209d4
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Jun 24 18:54:05 2013 +0100

    gdk: Use new macros for defining private data
    
    Drop the g_type_class_add_private() function, and use the macros
    instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702996

 gdk/gdkframeclock.c     |   11 +++--------
 gdk/gdkframeclockidle.c |   10 +++-------
 2 files changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/gdk/gdkframeclock.c b/gdk/gdkframeclock.c
index 29dd5a2..1c0a90e 100644
--- a/gdk/gdkframeclock.c
+++ b/gdk/gdkframeclock.c
@@ -69,8 +69,6 @@
  * they will stay exactly synchronized.
  */
 
-G_DEFINE_ABSTRACT_TYPE (GdkFrameClock, gdk_frame_clock, G_TYPE_OBJECT)
-
 enum {
   FLUSH_EVENTS,
   BEFORE_PAINT,
@@ -94,6 +92,8 @@ struct _GdkFrameClockPrivate
   GdkFrameTimings *timings[FRAME_HISTORY_MAX_LENGTH];
 };
 
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkFrameClock, gdk_frame_clock, G_TYPE_OBJECT)
+
 static void
 gdk_frame_clock_finalize (GObject *object)
 {
@@ -236,8 +236,6 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
                   NULL, NULL,
                   g_cclosure_marshal_VOID__VOID,
                   G_TYPE_NONE, 0);
-
-  g_type_class_add_private (klass, sizeof (GdkFrameClockPrivate));
 }
 
 static void
@@ -245,10 +243,7 @@ gdk_frame_clock_init (GdkFrameClock *clock)
 {
   GdkFrameClockPrivate *priv;
 
-  clock->priv = G_TYPE_INSTANCE_GET_PRIVATE (clock,
-                                             GDK_TYPE_FRAME_CLOCK,
-                                             GdkFrameClockPrivate);
-  priv = clock->priv;
+  clock->priv = priv = gdk_frame_clock_get_instance_private (clock);
 
   priv->frame_counter = -1;
   priv->current = FRAME_HISTORY_MAX_LENGTH - 1;
diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c
index b514d65..100f305 100644
--- a/gdk/gdkframeclockidle.c
+++ b/gdk/gdkframeclockidle.c
@@ -63,7 +63,7 @@ struct _GdkFrameClockIdlePrivate
 static gboolean gdk_frame_clock_flush_idle (void *data);
 static gboolean gdk_frame_clock_paint_idle (void *data);
 
-G_DEFINE_TYPE (GdkFrameClockIdle, gdk_frame_clock_idle, GDK_TYPE_FRAME_CLOCK)
+G_DEFINE_TYPE_WITH_PRIVATE (GdkFrameClockIdle, gdk_frame_clock_idle, GDK_TYPE_FRAME_CLOCK)
 
 static gint64 sleep_serial;
 static gint64 sleep_source_prepare_time;
@@ -122,10 +122,8 @@ gdk_frame_clock_idle_init (GdkFrameClockIdle *frame_clock_idle)
 {
   GdkFrameClockIdlePrivate *priv;
 
-  frame_clock_idle->priv = G_TYPE_INSTANCE_GET_PRIVATE (frame_clock_idle,
-                                                        GDK_TYPE_FRAME_CLOCK_IDLE,
-                                                        GdkFrameClockIdlePrivate);
-  priv = frame_clock_idle->priv;
+  frame_clock_idle->priv = priv =
+    gdk_frame_clock_idle_get_instance_private (frame_clock_idle);
 
   priv->freeze_count = 0;
 }
@@ -581,8 +579,6 @@ gdk_frame_clock_idle_class_init (GdkFrameClockIdleClass *klass)
   frame_clock_class->end_updating = gdk_frame_clock_idle_end_updating;
   frame_clock_class->freeze = gdk_frame_clock_idle_freeze;
   frame_clock_class->thaw = gdk_frame_clock_idle_thaw;
-
-  g_type_class_add_private (klass, sizeof (GdkFrameClockIdlePrivate));
 }
 
 GdkFrameClock *


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