[gtk+/a11y] widget: Use g_type_add_class_private()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/a11y] widget: Use g_type_add_class_private()
- Date: Mon, 20 Jun 2011 12:25:23 +0000 (UTC)
commit c4abb8724a87bc7e0974c9b9153660d12bce541d
Author: Benjamin Otte <otte redhat com>
Date: Mon Jun 20 13:58:10 2011 +0200
widget: Use g_type_add_class_private()
It turns out that that funciton does indeed exist and my rant was just
outdated. Shame on me.
gtk/gtkwidget.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 5c3ca8b..acb2507 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -773,6 +773,8 @@ gtk_widget_get_type (void)
widget_type = g_type_register_static (G_TYPE_INITIALLY_UNOWNED, "GtkWidget",
&widget_info, G_TYPE_FLAG_ABSTRACT);
+ g_type_add_class_private (widget_type, sizeof (GtkWidgetClassPrivate));
+
g_type_add_interface_static (widget_type, ATK_TYPE_IMPLEMENTOR,
&accessibility_info) ;
g_type_add_interface_static (widget_type, GTK_TYPE_BUILDABLE,
@@ -787,11 +789,7 @@ gtk_widget_base_class_init (gpointer g_class)
{
GtkWidgetClass *klass = g_class;
- if (GTK_IS_WIDGET_CLASS (g_type_class_peek_parent (klass)))
- klass->priv = g_slice_dup (GtkWidgetClassPrivate,
- GTK_WIDGET_CLASS (g_type_class_peek_parent (klass))->priv);
- else
- klass->priv = g_slice_new0 (GtkWidgetClassPrivate);
+ klass->priv = G_TYPE_CLASS_GET_PRIVATE (g_class, GTK_TYPE_WIDGET, GtkWidgetClassPrivate);
}
static void
@@ -3197,8 +3195,6 @@ gtk_widget_base_class_finalize (GtkWidgetClass *klass)
g_param_spec_unref (pspec);
}
g_list_free (list);
-
- g_slice_free (GtkWidgetClassPrivate, klass->priv);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]