gchar *value;
gchar *default_value;
gchar *original_value;
- gchar *format;
+ GHashTable *format;
gboolean visible;
gboolean editable;
gboolean to_load;
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_FORMAT,
- g_param_spec_string ("format",
- "Format",
- "Format",
- "",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_param_spec_boxed ("format",
+ "Format",
+ "Format",
+ G_TYPE_HASH_TABLE,
+ G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_VISIBLE,
g_param_spec_boolean ("visible",
priv->is_key = FALSE;
priv->type = g_strdup ("");
priv->value = g_strdup ("");
+ priv->format = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
priv->visible = TRUE;
priv->editable = TRUE;
priv->to_load = TRUE;
*
*/
gboolean
-zak_form_element_set_format (ZakFormElement *element, const gchar *format)
+zak_form_element_set_format (ZakFormElement *element, GHashTable *format)
{
ZakFormElementPrivate *priv;
if (priv->format != NULL)
{
- g_free (priv->format);
+ g_hash_table_destroy (priv->format);
}
- priv->format = g_strdup (format);
+ priv->format = g_hash_table_ref (format);
return TRUE;
}
* @element:
*
*/
-gchar
+GHashTable
*zak_form_element_get_format (ZakFormElement *element)
{
ZakFormElementPrivate *priv;
- gchar *ret;
+ GHashTable *ret;
priv = zak_form_element_get_instance_private (element);
- ret = g_strdup (priv->format);
+ ret = g_hash_table_ref (priv->format);
return ret;
}
break;
case PROP_FORMAT:
- zak_form_element_set_format (zak_form_element, g_value_get_string (value));
+ zak_form_element_set_format (zak_form_element, (GHashTable *)g_value_get_boxed (value));
break;
case PROP_VISIBLE:
break;
case PROP_FORMAT:
- g_value_set_string (value, zak_form_element_get_format (zak_form_element));
+ g_value_set_boxed (value, zak_form_element_get_format (zak_form_element));
break;
case PROP_VISIBLE:
}
else if (xmlStrcmp (cur->name, (const xmlChar *)"format") == 0)
{
- zak_form_element_set_format (element, (const gchar *)xmlNodeGetContent (cur));
+ GHashTable *ht;
+
+ ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+ xmlAttr *attr;
+ attr = cur->properties;
+ while (attr)
+ {
+ g_hash_table_insert (ht, g_strdup (attr->name), g_strdup ((const gchar *)xmlNodeGetContent (attr->children)));
+
+ attr = attr->next;
+ }
+
+ g_hash_table_insert (ht, "content", g_strdup ((const gchar *)xmlNodeGetContent (cur)));
+
+ zak_form_element_set_format (element, ht);
+ g_hash_table_unref (ht);
}
else if (xmlStrcmp (cur->name, (const xmlChar *)"visible") == 0)
{
void zak_form_element_set_as_original_value (ZakFormElement *element);
gboolean zak_form_element_is_changed (ZakFormElement *element);
-gboolean zak_form_element_set_format (ZakFormElement *element, const gchar *format);
-gchar *zak_form_element_get_format (ZakFormElement *element);
+gboolean zak_form_element_set_format (ZakFormElement *element, GHashTable *format);
+GHashTable *zak_form_element_get_format (ZakFormElement *element);
void zak_form_element_set_visible (ZakFormElement *element, gboolean visible);
gboolean zak_form_element_get_visible (ZakFormElement *element);