From 29a85874524c137bee4374a4a99b4fd1e498f5e2 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 24 Jul 2010 12:45:12 +0200 Subject: [PATCH] Get/set GtkFormWidget property label via g_object_set. --- src/widget.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/widget.c b/src/widget.c index ce3221b..92fb30c 100644 --- a/src/widget.c +++ b/src/widget.c @@ -30,7 +30,8 @@ enum { PROP_0, PROP_WIDGET, - PROP_NAME + PROP_NAME, + PROP_LABEL }; static void gtk_form_widget_class_init (GtkFormWidgetClass *klass); @@ -85,12 +86,24 @@ gtk_form_widget_class_init (GtkFormWidgetClass *klass) "", G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_LABEL, + g_param_spec_object ("label", + "GtkLabel", + "The GtkLabel", + GTK_TYPE_WIDGET, + G_PARAM_READWRITE)); + g_type_class_add_private (object_class, sizeof (GtkFormWidgetPrivate)); } static void gtk_form_widget_init (GtkFormWidget *gtk_form_widget) { + GtkFormWidgetPrivate *priv = GTK_FORM_WIDGET_GET_PRIVATE (gtk_form_widget); + + priv->widget = NULL; + priv->widget_name = NULL; + priv->label = NULL; } /** @@ -328,6 +341,10 @@ gtk_form_widget_set_property (GObject *object, priv->widget_name = g_strstrip (g_strdup (g_value_get_string (value))); break; + case PROP_LABEL: + gtk_form_widget_set_label (fwidget, GTK_WIDGET (g_value_get_object (value))); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -354,6 +371,10 @@ gtk_form_widget_get_property (GObject *object, g_value_set_string (value, priv->widget_name); break; + case PROP_LABEL: + g_value_set_object (value, gtk_form_widget_get_label (fwidget)); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; -- 2.49.0