From aa5ea3056600e4d9c6feb1f128273ef9659be57b Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 14 May 2017 12:40:06 +0200 Subject: [PATCH] Migration to GValue for element value. --- src/formelementcheck.c | 34 ++++++++++++++++--------------- src/formelementcombo.c | 32 +++++++++++++++-------------- src/formelemententry.c | 30 +++++++++++++++------------- src/formelementlabel.c | 28 ++++++++++++++------------ src/formelementradio.c | 39 ++++++++++++++++++++---------------- src/formelementspin.c | 30 +++++++++++++++------------- src/formelementtextview.c | 42 ++++++++++++++++++++------------------- 7 files changed, 126 insertions(+), 109 deletions(-) diff --git a/src/formelementcheck.c b/src/formelementcheck.c index da2ea53..f1599ac 100644 --- a/src/formelementcheck.c +++ b/src/formelementcheck.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Andrea Zagli + * Copyright (C) 2015-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,25 +20,27 @@ #include #endif +#include + #include "formelementcheck.h" static void zak_form_gtk_form_element_check_class_init (ZakFormGtkFormElementCheckClass *class); static void zak_form_gtk_form_element_check_init (ZakFormGtkFormElementCheck *zak_form_gtk_form_element_check); static void zak_form_gtk_form_element_check_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); + guint property_id, + const GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_check_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); + guint property_id, + GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_check_dispose (GObject *gobject); static void zak_form_gtk_form_element_check_finalize (GObject *gobject); -static gchar *zak_form_gtk_form_element_check_get_value (ZakFormGtkFormElementCheck *element); -static gboolean zak_form_gtk_form_element_check_set_value (ZakFormGtkFormElementCheck *element, const gchar *value); +static GValue *zak_form_gtk_form_element_check_get_value (ZakFormGtkFormElementCheck *element); +static gboolean zak_form_gtk_form_element_check_set_value (ZakFormGtkFormElementCheck *element, GValue *value); #define ZAK_FORM_GTK_FORM_ELEMENT_CHECK_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_GTK_TYPE_FORM_ELEMENT_CHECK, ZakFormGtkFormElementCheckPrivate)) @@ -162,31 +164,31 @@ zak_form_gtk_form_element_check_finalize (GObject *gobject) parent_class->finalize (gobject); } -static gchar +static GValue *zak_form_gtk_form_element_check_get_value (ZakFormGtkFormElementCheck *element) { - gchar *ret; + GValue *ret; GtkWidget *w; - ret = g_strdup ("FALSE"); + ret = zak_utils_gvalue_new_string ("FALSE"); w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w))) { - ret = g_strdup ("TRUE"); + g_value_set_string (ret, "TRUE"); } else if (gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (w))) { - ret = g_strdup (""); + g_value_set_string (ret, ""); } return ret; } static gboolean -zak_form_gtk_form_element_check_set_value (ZakFormGtkFormElementCheck *element, const gchar *value) +zak_form_gtk_form_element_check_set_value (ZakFormGtkFormElementCheck *element, GValue *value) { GtkWidget *w; @@ -195,7 +197,7 @@ zak_form_gtk_form_element_check_set_value (ZakFormGtkFormElementCheck *element, w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); - str_value = g_strstrip (g_strdup (value)); + str_value = g_strstrip (g_strdup (g_value_get_string (value))); if (strcmp (str_value, "0") == 0 || strcasecmp (str_value, "f") == 0 diff --git a/src/formelementcombo.c b/src/formelementcombo.c index ca41328..afd4f6b 100644 --- a/src/formelementcombo.c +++ b/src/formelementcombo.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Andrea Zagli + * Copyright (C) 2016-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,8 @@ #include #endif +#include + #include "formelementcombo.h" enum @@ -32,19 +34,19 @@ static void zak_form_gtk_form_element_combo_class_init (ZakFormGtkFormElementCom static void zak_form_gtk_form_element_combo_init (ZakFormGtkFormElementCombo *zak_form_gtk_form_element_combo); static void zak_form_gtk_form_element_combo_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); + guint property_id, + const GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_combo_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); + guint property_id, + GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_combo_dispose (GObject *gobject); static void zak_form_gtk_form_element_combo_finalize (GObject *gobject); -static gchar *zak_form_gtk_form_element_combo_get_value (ZakFormGtkFormElementCombo *element); -static gboolean zak_form_gtk_form_element_combo_set_value (ZakFormGtkFormElementCombo *element, const gchar *value); +static GValue *zak_form_gtk_form_element_combo_get_value (ZakFormGtkFormElementCombo *element); +static gboolean zak_form_gtk_form_element_combo_set_value (ZakFormGtkFormElementCombo *element, GValue *value); #define ZAK_FORM_GTK_FORM_ELEMENT_COMBO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_GTK_TYPE_FORM_ELEMENT_COMBO, ZakFormGtkFormElementComboPrivate)) @@ -226,10 +228,10 @@ zak_form_gtk_form_element_combo_finalize (GObject *gobject) parent_class->finalize (gobject); } -static gchar +static GValue *zak_form_gtk_form_element_combo_get_value (ZakFormGtkFormElementCombo *element) { - gchar *ret; + GValue *ret; GtkWidget *w; GtkTreeModel *tmodel; @@ -243,7 +245,7 @@ static gchar w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); - ret = g_strdup (""); + ret = zak_utils_gvalue_new_string (""); tmodel = gtk_combo_box_get_model (GTK_COMBO_BOX (w)); if (tmodel != NULL) @@ -259,7 +261,7 @@ static gchar g_value_transform (gvalue, gvstr); g_free (ret); - ret = g_strdup (g_value_get_string (gvstr)); + g_value_set_string (ret, g_strdup (g_value_get_string (gvstr))); g_value_unset (gvstr); g_value_unset (gvalue); @@ -270,7 +272,7 @@ static gchar } static gboolean -zak_form_gtk_form_element_combo_set_value (ZakFormGtkFormElementCombo *element, const gchar *value) +zak_form_gtk_form_element_combo_set_value (ZakFormGtkFormElementCombo *element, GValue *value) { GtkWidget *w; @@ -300,7 +302,7 @@ zak_form_gtk_form_element_combo_set_value (ZakFormGtkFormElementCombo *element, g_value_init (gvstr, G_TYPE_STRING); g_value_transform (gvalue, gvstr); - if (g_strcmp0 (g_value_get_string (gvstr), value) == 0) + if (g_strcmp0 (g_value_get_string (gvstr), g_value_get_string (value)) == 0) { gtk_combo_box_set_active_iter (GTK_COMBO_BOX (w), &iter); diff --git a/src/formelemententry.c b/src/formelemententry.c index 09d133f..e6114b9 100644 --- a/src/formelemententry.c +++ b/src/formelemententry.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Andrea Zagli + * Copyright (C) 2015-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,25 +20,27 @@ #include #endif +#include + #include "formelemententry.h" static void zak_form_gtk_form_element_entry_class_init (ZakFormGtkFormElementEntryClass *class); static void zak_form_gtk_form_element_entry_init (ZakFormGtkFormElementEntry *zak_form_gtk_form_element_entry); static void zak_form_gtk_form_element_entry_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); + guint property_id, + const GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_entry_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); + guint property_id, + GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_entry_dispose (GObject *gobject); static void zak_form_gtk_form_element_entry_finalize (GObject *gobject); -static gchar *zak_form_gtk_form_element_entry_get_value (ZakFormGtkFormElementEntry *element); -static gboolean zak_form_gtk_form_element_entry_set_value (ZakFormGtkFormElementEntry *element, const gchar *value); +static GValue *zak_form_gtk_form_element_entry_get_value (ZakFormGtkFormElementEntry *element); +static gboolean zak_form_gtk_form_element_entry_set_value (ZakFormGtkFormElementEntry *element, GValue *value); #define ZAK_FORM_GTK_FORM_ELEMENT_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_GTK_TYPE_FORM_ELEMENT_ENTRY, ZakFormGtkFormElementEntryPrivate)) @@ -162,28 +164,28 @@ zak_form_gtk_form_element_entry_finalize (GObject *gobject) parent_class->finalize (gobject); } -static gchar +static GValue *zak_form_gtk_form_element_entry_get_value (ZakFormGtkFormElementEntry *element) { - gchar *ret; + GValue *ret; GtkWidget *w; w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); - ret = (gchar *)gtk_entry_get_text (GTK_ENTRY (w)); + ret = zak_utils_gvalue_new_string ((gchar *)gtk_entry_get_text (GTK_ENTRY (w))); return ret; } static gboolean -zak_form_gtk_form_element_entry_set_value (ZakFormGtkFormElementEntry *element, const gchar *value) +zak_form_gtk_form_element_entry_set_value (ZakFormGtkFormElementEntry *element, GValue *value) { GtkWidget *w; w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); - gtk_entry_set_text (GTK_ENTRY (w), value); + gtk_entry_set_text (GTK_ENTRY (w), g_value_get_string (value)); return TRUE; } diff --git a/src/formelementlabel.c b/src/formelementlabel.c index 7947fb8..3eedb75 100644 --- a/src/formelementlabel.c +++ b/src/formelementlabel.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Andrea Zagli + * Copyright (C) 2015-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,25 +20,27 @@ #include #endif +#include + #include "formelementlabel.h" static void zak_form_gtk_form_element_label_class_init (ZakFormGtkFormElementLabelClass *class); static void zak_form_gtk_form_element_label_init (ZakFormGtkFormElementLabel *zak_form_gtk_form_element_label); static void zak_form_gtk_form_element_label_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); + guint property_id, + const GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_label_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); + guint property_id, + GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_label_dispose (GObject *gobject); static void zak_form_gtk_form_element_label_finalize (GObject *gobject); -static gchar *zak_form_gtk_form_element_label_get_value (ZakFormGtkFormElementLabel *element); -static gboolean zak_form_gtk_form_element_label_set_value (ZakFormGtkFormElementLabel *element, const gchar *value); +static GValue *zak_form_gtk_form_element_label_get_value (ZakFormGtkFormElementLabel *element); +static gboolean zak_form_gtk_form_element_label_set_value (ZakFormGtkFormElementLabel *element, GValue *value); #define ZAK_FORM_GTK_FORM_ELEMENT_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_GTK_TYPE_FORM_ELEMENT_LABEL, ZakFormGtkFormElementLabelPrivate)) @@ -162,24 +164,24 @@ zak_form_gtk_form_element_label_finalize (GObject *gobject) parent_class->finalize (gobject); } -static gchar +static GValue *zak_form_gtk_form_element_label_get_value (ZakFormGtkFormElementLabel *element) { GtkWidget *w; w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); - return (gchar *)gtk_label_get_text (GTK_LABEL (w)); + return zak_utils_gvalue_new_string ((gchar *)gtk_label_get_text (GTK_LABEL (w))); } static gboolean -zak_form_gtk_form_element_label_set_value (ZakFormGtkFormElementLabel *element, const gchar *value) +zak_form_gtk_form_element_label_set_value (ZakFormGtkFormElementLabel *element, GValue *value) { GtkWidget *w; w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); - gtk_label_set_text (GTK_LABEL (w), value); + gtk_label_set_text (GTK_LABEL (w), g_value_get_string (value)); return TRUE; } diff --git a/src/formelementradio.c b/src/formelementradio.c index c0e6796..e6ddbdc 100644 --- a/src/formelementradio.c +++ b/src/formelementradio.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Andrea Zagli + * Copyright (C) 2015-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,8 @@ #include #endif +#include + #include "formelementradio.h" enum @@ -32,19 +34,19 @@ static void zak_form_gtk_form_element_radio_class_init (ZakFormGtkFormElementRad static void zak_form_gtk_form_element_radio_init (ZakFormGtkFormElementRadio *zak_form_gtk_form_element_radio); static void zak_form_gtk_form_element_radio_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); + guint property_id, + const GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_radio_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); + guint property_id, + GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_radio_dispose (GObject *gobject); static void zak_form_gtk_form_element_radio_finalize (GObject *gobject); -static gchar *zak_form_gtk_form_element_radio_get_value (ZakFormGtkFormElementRadio *element); -static gboolean zak_form_gtk_form_element_radio_set_value (ZakFormGtkFormElementRadio *element, const gchar *value); +static GValue *zak_form_gtk_form_element_radio_get_value (ZakFormGtkFormElementRadio *element); +static gboolean zak_form_gtk_form_element_radio_set_value (ZakFormGtkFormElementRadio *element, GValue *value); #define ZAK_FORM_GTK_FORM_ELEMENT_RADIO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_GTK_TYPE_FORM_ELEMENT_RADIO, ZakFormGtkFormElementRadioPrivate)) @@ -234,10 +236,10 @@ zak_form_gtk_form_element_radio_finalize (GObject *gobject) parent_class->finalize (gobject); } -static gchar +static GValue *zak_form_gtk_form_element_radio_get_value (ZakFormGtkFormElementRadio *element) { - gchar *ret; + GValue *ret; GtkWidget *w; @@ -245,16 +247,19 @@ static gchar w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); - ret = g_strdup (""); + ret = zak_utils_gvalue_new_string (""); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (w)); while (group != NULL) { if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (group->data))) { - ret = (gchar *)g_object_get_data (G_OBJECT (group->data), "return-value"); - if (ret == NULL) + if ((gchar *)g_object_get_data (G_OBJECT (group->data), "return-value") == NULL) + { + g_value_set_string (ret, (gchar *)g_object_get_data (G_OBJECT (group->data), "return-value")); + } + else { - ret = g_strdup (""); + g_value_set_string (ret, ""); } break; } @@ -266,7 +271,7 @@ static gchar } static gboolean -zak_form_gtk_form_element_radio_set_value (ZakFormGtkFormElementRadio *element, const gchar *value) +zak_form_gtk_form_element_radio_set_value (ZakFormGtkFormElementRadio *element, GValue *value) { GtkWidget *w; @@ -277,7 +282,7 @@ zak_form_gtk_form_element_radio_set_value (ZakFormGtkFormElementRadio *element, group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (w)); while (group != NULL) { - if (g_strcmp0 ((gchar *)g_object_get_data (G_OBJECT (group->data), "return-value"), value) == 0) + if (g_strcmp0 ((gchar *)g_object_get_data (G_OBJECT (group->data), "return-value"), g_value_get_string (value)) == 0) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (group->data), TRUE); break; diff --git a/src/formelementspin.c b/src/formelementspin.c index 2762eb0..5cbf3f9 100644 --- a/src/formelementspin.c +++ b/src/formelementspin.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Andrea Zagli + * Copyright (C) 2015-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,25 +20,27 @@ #include #endif +#include + #include "formelementspin.h" static void zak_form_gtk_form_element_spin_class_init (ZakFormGtkFormElementSpinClass *class); static void zak_form_gtk_form_element_spin_init (ZakFormGtkFormElementSpin *zak_form_gtk_form_element_spin); static void zak_form_gtk_form_element_spin_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); + guint property_id, + const GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_spin_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); + guint property_id, + GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_spin_dispose (GObject *gobject); static void zak_form_gtk_form_element_spin_finalize (GObject *gobject); -static gchar *zak_form_gtk_form_element_spin_get_value (ZakFormGtkFormElementSpin *element); -static gboolean zak_form_gtk_form_element_spin_set_value (ZakFormGtkFormElementSpin *element, const gchar *value); +static GValue *zak_form_gtk_form_element_spin_get_value (ZakFormGtkFormElementSpin *element); +static gboolean zak_form_gtk_form_element_spin_set_value (ZakFormGtkFormElementSpin *element, GValue *value); #define ZAK_FORM_GTK_FORM_ELEMENT_SPIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_GTK_TYPE_FORM_ELEMENT_SPIN, ZakFormGtkFormElementSpinPrivate)) @@ -162,28 +164,28 @@ zak_form_gtk_form_element_spin_finalize (GObject *gobject) parent_class->finalize (gobject); } -static gchar +static GValue *zak_form_gtk_form_element_spin_get_value (ZakFormGtkFormElementSpin *element) { - gchar *ret; + GValue *ret; GtkWidget *w; w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); - ret = g_strdup_printf ("%f", gtk_spin_button_get_value (GTK_SPIN_BUTTON (w))); + ret = zak_utils_gvalue_new_string (g_strdup_printf ("%f", gtk_spin_button_get_value (GTK_SPIN_BUTTON (w)))); return ret; } static gboolean -zak_form_gtk_form_element_spin_set_value (ZakFormGtkFormElementSpin *element, const gchar *value) +zak_form_gtk_form_element_spin_set_value (ZakFormGtkFormElementSpin *element, GValue *value) { GtkWidget *w; w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), g_strtod (value, NULL)); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (w), g_strtod (g_value_get_string (value), NULL)); return TRUE; } diff --git a/src/formelementtextview.c b/src/formelementtextview.c index 63b0172..42b05af 100644 --- a/src/formelementtextview.c +++ b/src/formelementtextview.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Andrea Zagli + * Copyright (C) 2015-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,25 +20,27 @@ #include #endif +#include + #include "formelementtextview.h" static void zak_form_gtk_form_element_textview_class_init (ZakFormGtkFormElementTextviewClass *class); static void zak_form_gtk_form_element_textview_init (ZakFormGtkFormElementTextview *zak_form_gtk_form_element_textview); static void zak_form_gtk_form_element_textview_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); + guint property_id, + const GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_textview_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); + guint property_id, + GValue *value, + GParamSpec *pspec); static void zak_form_gtk_form_element_textview_dispose (GObject *gobject); static void zak_form_gtk_form_element_textview_finalize (GObject *gobject); -static gchar *zak_form_gtk_form_element_textview_get_value (ZakFormGtkFormElementTextview *element); -static gboolean zak_form_gtk_form_element_textview_set_value (ZakFormGtkFormElementTextview *element, const gchar *value); +static GValue *zak_form_gtk_form_element_textview_get_value (ZakFormGtkFormElementTextview *element); +static gboolean zak_form_gtk_form_element_textview_set_value (ZakFormGtkFormElementTextview *element, GValue *value); #define ZAK_FORM_GTK_FORM_ELEMENT_TEXTVIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_GTK_TYPE_FORM_ELEMENT_TEXTVIEW, ZakFormGtkFormElementTextviewPrivate)) @@ -106,9 +108,9 @@ zak_form_gtk_form_element_textview_xml_parsing (ZakFormElement *element, xmlNode /* PRIVATE */ static void zak_form_gtk_form_element_textview_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) + guint property_id, + const GValue *value, + GParamSpec *pspec) { ZakFormGtkFormElementTextview *zak_form_gtk_form_element_textview = (ZakFormGtkFormElementTextview *)object; ZakFormGtkFormElementTextviewPrivate *priv = ZAK_FORM_GTK_FORM_ELEMENT_TEXTVIEW_GET_PRIVATE (zak_form_gtk_form_element_textview); @@ -123,9 +125,9 @@ zak_form_gtk_form_element_textview_set_property (GObject *object, static void zak_form_gtk_form_element_textview_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) + guint property_id, + GValue *value, + GParamSpec *pspec) { ZakFormGtkFormElementTextview *zak_form_gtk_form_element_textview = (ZakFormGtkFormElementTextview *)object; ZakFormGtkFormElementTextviewPrivate *priv = ZAK_FORM_GTK_FORM_ELEMENT_TEXTVIEW_GET_PRIVATE (zak_form_gtk_form_element_textview); @@ -162,10 +164,10 @@ zak_form_gtk_form_element_textview_finalize (GObject *gobject) parent_class->finalize (gobject); } -static gchar +static GValue *zak_form_gtk_form_element_textview_get_value (ZakFormGtkFormElementTextview *element) { - gchar *ret; + GValue *ret; GtkWidget *w; @@ -177,13 +179,13 @@ static gchar buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w)); gtk_text_buffer_get_bounds (buf, &start, &end); - ret = gtk_text_buffer_get_text (buf, &start, &end, FALSE); + ret = zak_utils_gvalue_new_string (gtk_text_buffer_get_text (buf, &start, &end, FALSE)); return ret; } static gboolean -zak_form_gtk_form_element_textview_set_value (ZakFormGtkFormElementTextview *element, const gchar *value) +zak_form_gtk_form_element_textview_set_value (ZakFormGtkFormElementTextview *element, GValue *value) { GtkWidget *w; @@ -192,7 +194,7 @@ zak_form_gtk_form_element_textview_set_value (ZakFormGtkFormElementTextview *ele w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w)); - gtk_text_buffer_set_text (buf, value, -1); + gtk_text_buffer_set_text (buf, g_value_get_string (value), -1); return TRUE; } -- 2.49.0