return priv->pa_filters;
}
+/**
+ * zak_form_element_get_filter_by_id:
+ * @element:
+ * @id:
+ *
+ */
+ZakFormElementFilter
+*zak_form_element_get_filter_by_id (ZakFormElement *element, const gchar *id)
+{
+ ZakFormElementFilter *filter;
+
+ guint i;
+
+ ZakFormElementPrivate *priv = zak_form_element_get_instance_private (element);
+
+ filter = NULL;
+
+ for (i = 0; i < priv->pa_filters->len; i++)
+ {
+ if (g_strcmp0 (zak_form_element_filter_get_id ((ZakFormElementFilter *)g_ptr_array_index (priv->pa_filters, i)), id) == 0)
+ {
+ filter = (ZakFormElementFilter *)g_ptr_array_index (priv->pa_filters, i);
+ break;
+ }
+ }
+
+ return filter;
+}
+
/**
* zak_form_element_get_filters_by_type:
* @element:
}
return validator;
-
-
}
/**
void zak_form_element_filter (ZakFormElement *element);
GPtrArray *zak_form_element_get_filters (ZakFormElement *element);
+ZakFormElementFilter *zak_form_element_get_filter_by_id (ZakFormElement *element, const gchar *id);
GPtrArray *zak_form_element_get_filters_by_type (ZakFormElement *element, GType type);
void zak_form_element_add_validator (ZakFormElement *element, ZakFormElementValidator *validator);
enum
{
PROP_0,
+ PROP_ID,
PROP_ENABLED
};
typedef struct
{
+ gchar *id;
gboolean enabled;
} ZakFormElementFilterPrivate;
object_class->dispose = zak_form_element_filter_dispose;
object_class->finalize = zak_form_element_filter_finalize;
+ g_object_class_install_property (object_class, PROP_ID,
+ g_param_spec_string ("id",
+ "ID",
+ "ID",
+ "",
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
g_object_class_install_property (object_class, PROP_ENABLED,
g_param_spec_boolean ("enabled",
"Enabled",
{
gboolean ret;
+ gchar *prop;
+
g_return_val_if_fail (ZAK_FORM_IS_ELEMENT_FILTER (self), FALSE);
+ prop = (gchar *)xmlGetProp (xnode, (const xmlChar *)"id");
+ if (prop != NULL)
+ {
+ zak_form_element_filter_set_id (self, prop);
+ g_free (prop);
+ }
+
if (ZAK_FORM_ELEMENT_FILTER_GET_CLASS (self)->xml_parsing!= NULL)
{
ret = ZAK_FORM_ELEMENT_FILTER_GET_CLASS (self)->xml_parsing (self, xnode);
return ret;
}
+/**
+ * zak_form_element_filter_set_id:
+ * @filter:
+ * @id:
+ *
+ */
+void
+zak_form_element_filter_set_id (ZakFormElementFilter *filter,
+ const gchar *id)
+{
+ ZakFormElementFilterPrivate *priv = zak_form_element_filter_get_instance_private (filter);
+
+ if (id == NULL)
+ {
+ priv->id = g_strdup ("");
+ }
+ else
+ {
+ priv->id = g_strdup (id);
+ }
+}
+
+/**
+ * zak_form_element_filter_get_id:
+ * @filter:
+ *
+ * Returns:
+ */
+gchar
+*zak_form_element_filter_get_id (ZakFormElementFilter *filter)
+{
+ ZakFormElementFilterPrivate *priv = zak_form_element_filter_get_instance_private (filter);
+
+ return g_strdup (priv->id);
+}
+
gchar
*zak_form_element_filter_filter (ZakFormElementFilter *self, const gchar *value)
{
switch (property_id)
{
+ case PROP_ID:
+ zak_form_element_filter_set_id (zak_form_element_filter, g_value_get_string (value));
+ break;
+
case PROP_ENABLED:
zak_form_element_filter_set_enabled (zak_form_element_filter, g_value_get_boolean (value));
break;
switch (property_id)
{
+ case PROP_ID:
+ g_value_set_string (value, zak_form_element_filter_get_id (zak_form_element_filter));
+ break;
+
case PROP_ENABLED:
g_value_set_boolean (value, zak_form_element_filter_get_enabled (zak_form_element_filter));
break;
gboolean zak_form_element_filter_xml_parsing (ZakFormElementFilter *filter, xmlNode *xnode);
gchar *zak_form_element_filter_filter (ZakFormElementFilter *self, const gchar *value);
+void zak_form_element_filter_set_id (ZakFormElementFilter *filter,
+ const gchar *id);
+gchar *zak_form_element_filter_get_id (ZakFormElementFilter *filter);
+
gboolean zak_form_element_filter_get_enabled (ZakFormElementFilter *filter);
void zak_form_element_filter_set_enabled (ZakFormElementFilter *filter, gboolean enabled);