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

index 31be548da89259bdd72a2d527d5a5b41d61a516f..67d874a3ed977de88e66c4016c2e3262e6d53f32 100644 (file)
@@ -30,7 +30,8 @@ enum
        PROP_ORIGINAL_VALUE,
        PROP_VISIBLE,
        PROP_EDITABLE,
-       PROP_TO_LOAD
+       PROP_TO_LOAD,
+       PROP_TO_SAVE
 };
 
 static void zak_form_element_class_init (ZakFormElementClass *class);
@@ -64,6 +65,7 @@ typedef struct
                gboolean visible;
                gboolean editable;
                gboolean to_load;
+               gboolean to_save;
 
                GPtrArray *pa_filters;
                GPtrArray *pa_validators;
@@ -126,6 +128,13 @@ zak_form_element_class_init (ZakFormElementClass *class)
                                                               "To load",
                                                               TRUE,
                                                               G_PARAM_READWRITE));
+
+       g_object_class_install_property (object_class, PROP_TO_SAVE,
+                                        g_param_spec_boolean ("to-save",
+                                                              "To save",
+                                                              "To save",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE));
 }
 
 static void
@@ -137,6 +146,7 @@ zak_form_element_init (ZakFormElement *zak_form_element)
        priv->visible = TRUE;
        priv->editable = TRUE;
        priv->to_load = TRUE;
+       priv->to_save = TRUE;
 
        priv->pa_filters = NULL;
        priv->pa_validators = NULL;
@@ -485,6 +495,37 @@ zak_form_element_get_to_load (ZakFormElement *element)
        return priv->to_load;
 }
 
+/**
+ * zak_form_element_set_to_save:
+ * @element:
+ * @to_save:
+ *
+ */
+void
+zak_form_element_set_to_save (ZakFormElement *element, gboolean to_save)
+{
+       ZakFormElementPrivate *priv;
+
+       priv = zak_form_element_get_instance_private (element);
+
+       priv->to_save = to_save;
+}
+
+/**
+ * zak_form_element_get_to_save:
+ * @element:
+ *
+ */
+gboolean
+zak_form_element_get_to_save (ZakFormElement *element)
+{
+       ZakFormElementPrivate *priv;
+
+       priv = zak_form_element_get_instance_private (element);
+
+       return priv->to_save;
+}
+
 /**
  * zak_form_element_clear:
  * @element:
@@ -607,6 +648,10 @@ zak_form_element_set_property (GObject *object,
                    zak_form_element_set_to_load (zak_form_element, g_value_get_boolean (value));
                        break;
 
+               case PROP_TO_SAVE:
+                   zak_form_element_set_to_save (zak_form_element, g_value_get_boolean (value));
+                       break;
+
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                        break;
@@ -648,6 +693,10 @@ zak_form_element_get_property (GObject *object,
                        g_value_set_boolean (value, zak_form_element_get_to_load (zak_form_element));
                        break;
 
+               case PROP_TO_SAVE:
+                       g_value_set_boolean (value, zak_form_element_get_to_save (zak_form_element));
+                       break;
+
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                        break;
index 1bac73d00d5d186aa725f384674cc72fde112648..e4f47fb889a232dbc642cfee95ac1391c821c90d 100644 (file)
@@ -73,6 +73,9 @@ 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_set_to_save (ZakFormElement *element, gboolean to_save);
+gboolean zak_form_element_get_to_save (ZakFormElement *element);
+
 void zak_form_element_clear (ZakFormElement *element);
 
 void zak_form_element_add_filter (ZakFormElement *element, ZakFormElementFilter *filter);