forked from AuroraMiddleware/gtk
Convert to use instance private data.
2006-01-10 Matthias Clasen <mclasen@redhat.com> * gtk/gtkimmulticontext.c: * gtk/gtkhsv.c: * gtk/gtkhandlebox.c: Convert to use instance private data.
This commit is contained in:
parent
7d109b26b7
commit
0a314300cf
@ -274,27 +274,14 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class)
|
||||
_gtk_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_WIDGET);
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkHandleBoxPrivate));
|
||||
}
|
||||
|
||||
static GtkHandleBoxPrivate *
|
||||
gtk_handle_box_get_private (GtkHandleBox *hb)
|
||||
{
|
||||
GtkHandleBoxPrivate *private;
|
||||
static GQuark private_quark = 0;
|
||||
|
||||
if (!private_quark)
|
||||
private_quark = g_quark_from_static_string ("gtk-handle-box-private");
|
||||
|
||||
private = g_object_get_qdata (G_OBJECT (hb), private_quark);
|
||||
|
||||
if (!private)
|
||||
{
|
||||
private = g_new0 (GtkHandleBoxPrivate, 1);
|
||||
g_object_set_qdata_full (G_OBJECT (hb), private_quark,
|
||||
private, g_free);
|
||||
}
|
||||
|
||||
return private;
|
||||
return G_TYPE_INSTANCE_GET_PRIVATE (hb, GTK_TYPE_HANDLE_BOX, GtkHandleBoxPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
|
22
gtk/gtkhsv.c
22
gtk/gtkhsv.c
@ -156,11 +156,13 @@ gtk_hsv_get_type (void)
|
||||
static void
|
||||
gtk_hsv_class_init (GtkHSVClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkHSVClass *hsv_class;
|
||||
GtkBindingSet *binding_set;
|
||||
|
||||
gobject_class = (GObjectClass *) class;
|
||||
object_class = (GtkObjectClass *) class;
|
||||
widget_class = (GtkWidgetClass *) class;
|
||||
hsv_class = GTK_HSV_CLASS (class);
|
||||
@ -233,6 +235,8 @@ gtk_hsv_class_init (GtkHSVClass *class)
|
||||
gtk_binding_entry_add_signal (binding_set, GDK_KP_Left, 0,
|
||||
"move", 1,
|
||||
G_TYPE_ENUM, GTK_DIR_LEFT);
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (HSVPrivate));
|
||||
}
|
||||
|
||||
/* Object initialization function for the HSV color selector */
|
||||
@ -240,10 +244,11 @@ static void
|
||||
gtk_hsv_init (GtkHSV *hsv)
|
||||
{
|
||||
HSVPrivate *priv;
|
||||
|
||||
priv = G_TYPE_INSTANCE_GET_PRIVATE (hsv, GTK_TYPE_HSV, HSVPrivate);
|
||||
|
||||
priv = g_new0 (HSVPrivate, 1);
|
||||
hsv->priv = priv;
|
||||
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (hsv, GTK_NO_WINDOW);
|
||||
GTK_WIDGET_SET_FLAGS (hsv, GTK_CAN_FOCUS);
|
||||
|
||||
@ -259,18 +264,6 @@ gtk_hsv_init (GtkHSV *hsv)
|
||||
static void
|
||||
gtk_hsv_destroy (GtkObject *object)
|
||||
{
|
||||
GtkHSV *hsv;
|
||||
|
||||
g_return_if_fail (GTK_IS_HSV (object));
|
||||
|
||||
hsv = GTK_HSV (object);
|
||||
|
||||
if (hsv->priv)
|
||||
{
|
||||
g_free (hsv->priv);
|
||||
hsv->priv = NULL;
|
||||
}
|
||||
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
@ -1431,7 +1424,6 @@ gtk_hsv_set_color (GtkHSV *hsv,
|
||||
{
|
||||
HSVPrivate *priv;
|
||||
|
||||
g_return_if_fail (hsv != NULL);
|
||||
g_return_if_fail (GTK_IS_HSV (hsv));
|
||||
g_return_if_fail (h >= 0.0 && h <= 1.0);
|
||||
g_return_if_fail (s >= 0.0 && s <= 1.0);
|
||||
|
@ -138,6 +138,8 @@ gtk_im_multicontext_class_init (GtkIMMulticontextClass *class)
|
||||
im_context_class->get_surrounding = gtk_im_multicontext_get_surrounding;
|
||||
|
||||
gobject_class->finalize = gtk_im_multicontext_finalize;
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkIMMulticontextPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -145,7 +147,7 @@ gtk_im_multicontext_init (GtkIMMulticontext *multicontext)
|
||||
{
|
||||
multicontext->slave = NULL;
|
||||
|
||||
multicontext->priv = g_new0 (GtkIMMulticontextPrivate, 1);
|
||||
multicontext->priv = G_TYPE_INSTANCE_GET_PRIVATE (multicontext, GTK_TYPE_IM_MULTICONTEXT, GtkIMMulticontextPrivate);
|
||||
multicontext->priv->use_preedit = TRUE;
|
||||
multicontext->priv->have_cursor_location = FALSE;
|
||||
multicontext->priv->focus_in = FALSE;
|
||||
@ -170,7 +172,6 @@ gtk_im_multicontext_finalize (GObject *object)
|
||||
GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (object);
|
||||
|
||||
gtk_im_multicontext_set_slave (multicontext, NULL, TRUE);
|
||||
g_free (multicontext->priv);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user