From 7844a006f42647b11d3232cd77c07f86fca94eb0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 21 Nov 2005 16:24:59 +0000 Subject: [PATCH] Convert GtkSocket to g_type_class_add_private. 2005-11-21 Matthias Clasen * gtk/gtksocket.c: Convert GtkSocket to g_type_class_add_private. --- ChangeLog | 2 ++ ChangeLog.pre-2-10 | 2 ++ gtk/gtksocket.c | 23 ++++------------------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7863b29be7..94011d9dac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-11-21 Matthias Clasen + * gtk/gtksocket.c: Convert GtkSocket to g_type_class_add_private. + * gtk/gtkmenu.c: Convert GtkMenu to g_type_class_add_private. * gtk/gtk.symbols: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 7863b29be7..94011d9dac 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,7 @@ 2005-11-21 Matthias Clasen + * gtk/gtksocket.c: Convert GtkSocket to g_type_class_add_private. + * gtk/gtkmenu.c: Convert GtkMenu to g_type_class_add_private. * gtk/gtk.symbols: diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c index f89cc393f4..d15ad80795 100644 --- a/gtk/gtksocket.c +++ b/gtk/gtksocket.c @@ -99,26 +99,9 @@ static GtkWidgetClass *parent_class = NULL; GtkSocketPrivate * _gtk_socket_get_private (GtkSocket *socket) { - GtkSocketPrivate *private; - static GQuark private_quark = 0; - - if (!private_quark) - private_quark = g_quark_from_static_string ("gtk-socket-private"); - - private = g_object_get_qdata (G_OBJECT (socket), private_quark); - - if (!private) - { - private = g_new0 (GtkSocketPrivate, 1); - private->resize_count = 0; - - g_object_set_qdata_full (G_OBJECT (socket), private_quark, - private, (GDestroyNotify) g_free); - } - - return private; + return G_TYPE_INSTANCE_GET_PRIVATE (socket, GTK_TYPE_SOCKET, GtkSocketPrivate); } - + GType gtk_socket_get_type (void) { @@ -208,6 +191,8 @@ gtk_socket_class_init (GtkSocketClass *class) _gtk_boolean_handled_accumulator, NULL, _gtk_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0); + + g_type_class_add_private (gobject_class, sizeof (GtkSocketPrivate)); } static void