/*
- * Copyright (C) 2016 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2016-2017 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
static void zak_form_iprovider_interface_init (ZakFormIProviderInterface *iface);
static void zak_form_ini_provider_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void zak_form_ini_provider_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
static void zak_form_ini_provider_dispose (GObject *gobject);
static void zak_form_ini_provider_finalize (GObject *gobject);
};
G_DEFINE_TYPE_WITH_CODE (ZakFormIniProvider, zak_form_ini_provider, G_TYPE_OBJECT,
- G_ADD_PRIVATE (ZakFormIniProvider)
- G_IMPLEMENT_INTERFACE (ZAK_FORM_TYPE_IPROVIDER,
- zak_form_iprovider_interface_init))
+ G_ADD_PRIVATE (ZakFormIniProvider)
+ G_IMPLEMENT_INTERFACE (ZAK_FORM_TYPE_IPROVIDER,
+ zak_form_iprovider_interface_init))
static void
zak_form_ini_provider_class_init (ZakFormIniProviderClass *class)
if (!g_key_file_load_from_file (kfile, filename, G_KEY_FILE_NONE, &error))
{
g_warning ("Unable to open ini file: «%s»\n. %s",
- filename,
- error != NULL && error->message != NULL ? error->message : "No details.");
+ filename,
+ error != NULL && error->message != NULL ? error->message : "No details.");
return NULL;
}
zak_form_ini_provider = zak_form_ini_provider_new_from_gkeyfile (kfile, filename);
/* PRIVATE */
static void
zak_form_ini_provider_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
ZakFormIniProvider *zak_form_ini_provider = (ZakFormIniProvider *)object;
ZakFormIniProviderPrivate *priv = zak_form_ini_provider_get_instance_private (zak_form_ini_provider);
static void
zak_form_ini_provider_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
ZakFormIniProvider *zak_form_ini_provider = (ZakFormIniProvider *)object;
ZakFormIniProviderPrivate *priv = zak_form_ini_provider_get_instance_private (zak_form_ini_provider);
if (zak_form_element_get_is_key (element))
{
- value = zak_form_element_unformat (element, NULL);
+ value = zak_form_element_unformat (element, zak_form_element_get_value (element));
g_string_append_printf (key, "|%s", value);
g_free (value);
}
ZakFormElement *element = (ZakFormElement *)g_ptr_array_index (elements, i);
if (zak_form_element_get_to_save (element))
{
- value = zak_form_element_unformat (element, NULL);
+ value = zak_form_element_unformat (element, zak_form_element_get_value (element));
g_key_file_set_string (priv->kfile, group,
- zak_form_element_get_name (element),
- value);
+ zak_form_element_get_name (element),
+ value);
error = NULL;
if (!g_key_file_save_to_file (priv->kfile, priv->filename, &error)
|| error != NULL)
{
g_warning ("Unable to write to file «%s»: %s.",
- priv->filename,
- error != NULL && error->message != NULL ? error->message : "no details");
+ priv->filename,
+ error != NULL && error->message != NULL ? error->message : "no details");
}
g_free (value);
{
error = NULL;
g_key_file_remove_key (priv->kfile, group,
- zak_form_element_get_name (element),
- &error);
+ zak_form_element_get_name (element),
+ &error);
error = NULL;
if (!g_key_file_save_to_file (priv->kfile, priv->filename, &error)
|| error != NULL)
{
g_warning ("Unable to write to file «%s»: %s.",
- priv->filename,
- error != NULL && error->message != NULL ? error->message : "no details");
+ priv->filename,
+ error != NULL && error->message != NULL ? error->message : "no details");
}
}
}