#include "formelementvalidator.h"
#include "formelementvalidatornotempty.h"
+enum
+ {
+ PROP_0,
+ PROP_AS_EMPTY_STRING
+ };
+
static void zak_form_element_validator_notempty_class_init (ZakFormElementValidatorNotemptyClass *class);
static void zak_form_element_validator_notempty_init (ZakFormElementValidatorNotempty *zak_form_element);
parent_class->validate = zak_form_element_validator_notempty_validate;
g_type_class_add_private (object_class, sizeof (ZakFormElementValidatorNotemptyPrivate));
+
+ g_object_class_install_property (object_class, PROP_AS_EMPTY_STRING,
+ g_param_spec_string ("as-empty-string",
+ "As empty string",
+ "As empty string",
+ "",
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
}
static void
zak_form_element_validator_notempty_init (ZakFormElementValidatorNotempty *zak_form_element)
{
ZakFormElementValidatorNotemptyPrivate *priv = ZAK_FORM_ELEMENT_VALIDATOR_NOTEMPTY_GET_PRIVATE (zak_form_element);
-
- priv->as_empty_string = g_strdup ("");
}
/**
return TRUE;
}
+/**
+ * zak_form_element_validator_notempty_set_as_empty_string:
+ * @validator:
+ * @as_empty_string:
+ *
+ */
+void
+zak_form_element_validator_notempty_set_as_empty_string (ZakFormElementValidatorNotempty *validator, const gchar *as_empty_string)
+{
+ ZakFormElementValidatorNotemptyPrivate *priv = ZAK_FORM_ELEMENT_VALIDATOR_NOTEMPTY_GET_PRIVATE (validator);
+
+ if (priv->as_empty_string != NULL)
+ {
+ g_free (priv->as_empty_string);
+ }
+ if (as_empty_string == NULL)
+ {
+ priv->as_empty_string = g_strdup ("");
+ }
+ else
+ {
+ priv->as_empty_string = g_strdup (as_empty_string);
+ }
+}
+
+/**
+ * zak_form_element_validator_notempty_get_as_empty_string:
+ * @validator:
+ *
+ * Returns:
+ */
+gchar
+*zak_form_element_validator_notempty_get_as_empty_string (ZakFormElementValidatorNotempty *validator)
+{
+ ZakFormElementValidatorNotemptyPrivate *priv = ZAK_FORM_ELEMENT_VALIDATOR_NOTEMPTY_GET_PRIVATE (validator);
+
+ return g_strdup (priv->as_empty_string);
+}
+
/* PRIVATE */
static void
zak_form_element_validator_notempty_set_property (GObject *object,
switch (property_id)
{
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
+ case PROP_AS_EMPTY_STRING:
+ zak_form_element_validator_notempty_set_as_empty_string (validator, g_value_get_string (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
}
}
switch (property_id)
{
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
+ case PROP_AS_EMPTY_STRING:
+ g_value_set_string (value, zak_form_element_validator_notempty_get_as_empty_string (validator));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
}
}
G_DECLARE_FINAL_TYPE (ZakFormElementValidatorNotempty, zak_form_element_validator_notempty, ZAK_FORM, ELEMENT_VALIDATOR_NOTEMPTY, ZakFormElementValidator)
ZakFormElementValidatorNotempty *zak_form_element_validator_notempty_new (void);
+
gboolean zak_form_element_validator_notempty_xml_parsing (ZakFormElementValidator *validator, xmlNode *xnode);
+void zak_form_element_validator_notempty_set_as_empty_string (ZakFormElementValidatorNotempty *validator, const gchar *as_empty_string);
+gchar *zak_form_element_validator_notempty_get_as_empty_string (ZakFormElementValidatorNotempty *validator);
+
G_END_DECLS