]> saetta.ns0.it Git - libgtkform/commitdiff
Get/set GtkFormWidget property label via g_object_set.
authorAndrea Zagli <azagli@libero.it>
Sat, 24 Jul 2010 10:45:12 +0000 (12:45 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 24 Jul 2010 10:45:12 +0000 (12:45 +0200)
src/widget.c

index ce3221b74b874794e39fdef99f41097b154cddc6..92fb30c73fb9d47824297ba2f0e4e0e42e910da6 100644 (file)
@@ -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;