[gtk+] API: cellrenderer: Add a private struct



commit acb73f99bbb0abe3c9d2a099a7311113417f7a58
Author: Benjamin Otte <otte redhat com>
Date:   Thu Dec 15 17:21:11 2011 +0100

    API: cellrenderer: Add a private struct

 gtk/gtkcellrenderer.c |   42 ++++++++++++++++++++++++++++++++++++++++--
 gtk/gtkcellrenderer.h |    4 +++-
 2 files changed, 43 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index 80f267d..9fa3d88 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@ -128,6 +128,9 @@ struct _GtkCellRendererPrivate
   GdkRGBA cell_background;
 };
 
+struct _GtkCellRendererClassPrivate
+{
+};
 
 enum {
   PROP_0,
@@ -158,8 +161,6 @@ enum {
 
 static guint  cell_renderer_signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_ABSTRACT_TYPE(GtkCellRenderer, gtk_cell_renderer, G_TYPE_INITIALLY_UNOWNED)
-
 static void
 gtk_cell_renderer_init (GtkCellRenderer *cell)
 {
@@ -418,6 +419,43 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
 }
 
 static void
+gtk_cell_renderer_base_class_init (gpointer g_class)
+{
+  GtkCellRendererClass *klass = g_class;
+
+  klass->priv = G_TYPE_CLASS_GET_PRIVATE (g_class, GTK_TYPE_CELL_RENDERER, GtkCellRendererClassPrivate);
+}
+
+GType
+gtk_cell_renderer_get_type (void)
+{
+  static GType cell_renderer_type = 0;
+
+  if (G_UNLIKELY (cell_renderer_type == 0))
+    {
+      const GTypeInfo cell_renderer_info =
+      {
+	sizeof (GtkCellRendererClass),
+	gtk_cell_renderer_base_class_init,
+        NULL,
+	(GClassInitFunc) gtk_cell_renderer_class_init,
+	NULL,		/* class_finalize */
+	NULL,		/* class_init */
+	sizeof (GtkWidget),
+	0,		/* n_preallocs */
+	(GInstanceInitFunc) gtk_cell_renderer_init,
+	NULL,		/* value_table */
+      };
+      cell_renderer_type = g_type_register_static (G_TYPE_INITIALLY_UNOWNED, "GtkCellRenderer",
+                                                   &cell_renderer_info, G_TYPE_FLAG_ABSTRACT);
+
+      g_type_add_class_private (cell_renderer_type, sizeof (GtkCellRendererClassPrivate));
+    }
+
+  return cell_renderer_type;
+}
+
+static void
 gtk_cell_renderer_get_property (GObject     *object,
 				guint        param_id,
 				GValue      *value,
diff --git a/gtk/gtkcellrenderer.h b/gtk/gtkcellrenderer.h
index 1e67c62..44aa12c 100644
--- a/gtk/gtkcellrenderer.h
+++ b/gtk/gtkcellrenderer.h
@@ -82,6 +82,7 @@ typedef enum
 typedef struct _GtkCellRenderer              GtkCellRenderer;
 typedef struct _GtkCellRendererPrivate       GtkCellRendererPrivate;
 typedef struct _GtkCellRendererClass         GtkCellRendererClass;
+typedef struct _GtkCellRendererClassPrivate  GtkCellRendererClassPrivate;
 
 struct _GtkCellRenderer
 {
@@ -154,8 +155,9 @@ struct _GtkCellRendererClass
 			     GtkCellEditable *editable,
 			     const gchar     *path);
 
+  GtkCellRendererClassPrivate *priv;
+
   /* Padding for future expansion */
-  void (*_gtk_reserved1) (void);
   void (*_gtk_reserved2) (void);
   void (*_gtk_reserved3) (void);
   void (*_gtk_reserved4) (void);



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