/*
- * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2015-2016 Andrea Zagli <azagli@libero.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
{
PROP_0,
PROP_NAME,
+ PROP_LONG_NAME,
PROP_IS_KEY,
PROP_TYPE,
PROP_VALUE,
typedef struct
{
gchar *name;
+ gchar *long_name;
gboolean is_key;
gchar *type;
gchar *value;
"",
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_LONG_NAME,
+ g_param_spec_string ("long-name",
+ "Long name",
+ "Long name",
+ NULL,
+ G_PARAM_READWRITE));
+
g_object_class_install_property (object_class, PROP_IS_KEY,
g_param_spec_boolean ("is-key",
"Is key",
ZakFormElementPrivate *priv = zak_form_element_get_instance_private (zak_form_element);
priv->name = g_strdup ("");
+ priv->long_name = NULL;
priv->is_key = FALSE;
priv->type = g_strdup ("");
priv->value = g_strdup ("");
return ret;
}
+/**
+ * zak_form_element_set_long_name:
+ * @element:
+ * @long_name:
+ *
+ */
+void
+zak_form_element_set_long_name (ZakFormElement *element, const gchar *long_name)
+{
+ ZakFormElementPrivate *priv;
+
+ priv = zak_form_element_get_instance_private (element);
+
+ if (priv->long_name != NULL)
+ {
+ g_free (priv->long_name);
+ }
+
+ priv->long_name = g_strdup (long_name);
+}
+
+/**
+ * zak_form_element_get_long_name:
+ * @element:
+ *
+ */
+gchar
+*zak_form_element_get_long_name (ZakFormElement *element)
+{
+ ZakFormElementPrivate *priv;
+
+ gchar *ret;
+
+ priv = zak_form_element_get_instance_private (element);
+
+ if (priv->long_name == NULL)
+ {
+ ret = zak_form_element_get_name (element);
+ }
+ else
+ {
+ ret = g_strdup (priv->long_name);
+ }
+
+ return ret;
+}
+
/**
* zak_form_element_set_is_key:
* @element:
zak_form_element_set_name (zak_form_element, g_value_dup_string (value));
break;
+ case PROP_LONG_NAME:
+ zak_form_element_set_long_name (zak_form_element, g_value_dup_string (value));
+ break;
+
case PROP_IS_KEY:
zak_form_element_set_is_key (zak_form_element, g_value_get_boolean (value));
break;
g_value_set_string (value, zak_form_element_get_name (zak_form_element));
break;
+ case PROP_LONG_NAME:
+ g_value_set_string (value, zak_form_element_get_long_name (zak_form_element));
+ break;
+
case PROP_IS_KEY:
g_value_set_boolean (value, zak_form_element_get_is_key (zak_form_element));
break;
/*
- * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2015-2016 Andrea Zagli <azagli@libero.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
void zak_form_element_set_name (ZakFormElement *element, const gchar *name);
gchar *zak_form_element_get_name (ZakFormElement *element);
+void zak_form_element_set_long_name (ZakFormElement *element, const gchar *long_name);
+gchar *zak_form_element_get_long_name (ZakFormElement *element);
+
void zak_form_element_set_to_is_key (ZakFormElement *element, gboolean is_key);
gboolean zak_form_element_get_is_key (ZakFormElement *element);
{
gdt1 = zak_utils_get_gdatetime_from_string (zak_form_element_get_value (priv->v1), priv->format1);
gdt2 = zak_utils_get_gdatetime_from_string (zak_form_element_get_value (priv->v2), priv->format2);
- g_warning ("gdt1 %s; gdt2 %s",g_date_time_format(gdt1,"%d/%m/%Y"),g_date_time_format(gdt2,"%d/%m/%Y"));
+
if (gdt1 == NULL
|| gdt2 == NULL)
{
if (!ret)
{
msg = g_strdup_printf ("«%s» must be %s «%s»",
- zak_form_element_get_name (priv->v1),
+ zak_form_element_get_long_name (priv->v1),
msgs[priv->type],
- zak_form_element_get_name (priv->v2));
+ zak_form_element_get_long_name (priv->v2));
zak_form_validator_set_message (validator, msg);
g_free (msg);
}