]> saetta.ns0.it Git - zakform/libzakform/commitdiff
Added property to-load to ZakFormElement.
authorAndrea Zagli <azagli@libero.it>
Tue, 1 Dec 2015 10:15:31 +0000 (11:15 +0100)
committerAndrea Zagli <azagli@libero.it>
Tue, 1 Dec 2015 10:15:31 +0000 (11:15 +0100)
src/formelement.c
src/formelement.h

index da9775a054f41ba2a070779f6fab5694aefd39e0..31be548da89259bdd72a2d527d5a5b41d61a516f 100644 (file)
@@ -29,7 +29,8 @@ enum
        PROP_DEFAULT_VALUE,
        PROP_ORIGINAL_VALUE,
        PROP_VISIBLE,
-       PROP_EDITABLE
+       PROP_EDITABLE,
+       PROP_TO_LOAD
 };
 
 static void zak_form_element_class_init (ZakFormElementClass *class);
@@ -62,6 +63,8 @@ typedef struct
                gchar *original_value;
                gboolean visible;
                gboolean editable;
+               gboolean to_load;
+
                GPtrArray *pa_filters;
                GPtrArray *pa_validators;
                GPtrArray *pa_messages;
@@ -116,6 +119,13 @@ zak_form_element_class_init (ZakFormElementClass *class)
                                                               "Editable",
                                                               TRUE,
                                                               G_PARAM_READWRITE));
+
+       g_object_class_install_property (object_class, PROP_TO_LOAD,
+                                        g_param_spec_boolean ("to-load",
+                                                              "To load",
+                                                              "To load",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE));
 }
 
 static void
@@ -126,6 +136,8 @@ zak_form_element_init (ZakFormElement *zak_form_element)
        priv->value = g_strdup ("");
        priv->visible = TRUE;
        priv->editable = TRUE;
+       priv->to_load = TRUE;
+
        priv->pa_filters = NULL;
        priv->pa_validators = NULL;
        priv->pa_messages = NULL;
@@ -442,6 +454,37 @@ zak_form_element_get_editable (ZakFormElement *element)
        return ret;
 }
 
+/**
+ * zak_form_element_set_to_load:
+ * @element:
+ * @to_load:
+ *
+ */
+void
+zak_form_element_set_to_load (ZakFormElement *element, gboolean to_load)
+{
+       ZakFormElementPrivate *priv;
+
+       priv = zak_form_element_get_instance_private (element);
+
+       priv->to_load = to_load;
+}
+
+/**
+ * zak_form_element_get_to_load:
+ * @element:
+ *
+ */
+gboolean
+zak_form_element_get_to_load (ZakFormElement *element)
+{
+       ZakFormElementPrivate *priv;
+
+       priv = zak_form_element_get_instance_private (element);
+
+       return priv->to_load;
+}
+
 /**
  * zak_form_element_clear:
  * @element:
@@ -560,6 +603,10 @@ zak_form_element_set_property (GObject *object,
                    zak_form_element_set_editable (zak_form_element, g_value_get_boolean (value));
                        break;
 
+               case PROP_TO_LOAD:
+                   zak_form_element_set_to_load (zak_form_element, g_value_get_boolean (value));
+                       break;
+
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                        break;
@@ -597,6 +644,10 @@ zak_form_element_get_property (GObject *object,
                        g_value_set_boolean (value, zak_form_element_get_editable (zak_form_element));
                        break;
 
+               case PROP_TO_LOAD:
+                       g_value_set_boolean (value, zak_form_element_get_to_load (zak_form_element));
+                       break;
+
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                        break;
index 6640edb7c1c6c2291178e2ca5120f69244d9f7f9..1bac73d00d5d186aa725f384674cc72fde112648 100644 (file)
@@ -70,6 +70,9 @@ gboolean zak_form_element_get_visible (ZakFormElement *element);
 void zak_form_element_set_editable (ZakFormElement *element, gboolean editable);
 gboolean zak_form_element_get_editable (ZakFormElement *element);
 
+void zak_form_element_set_to_load (ZakFormElement *element, gboolean to_load);
+gboolean zak_form_element_get_to_load (ZakFormElement *element);
+
 void zak_form_element_clear (ZakFormElement *element);
 
 void zak_form_element_add_filter (ZakFormElement *element, ZakFormElementFilter *filter);