]> saetta.ns0.it Git - zakform/gtkdecoder/commitdiff
Migration to GValue.
authorAndrea Zagli <azagli@libero.it>
Sat, 3 Jun 2017 09:24:41 +0000 (11:24 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 3 Jun 2017 09:24:41 +0000 (11:24 +0200)
configure.ac
src/Makefile.am
src/formelementdecoder.c
src/libzakformgtkdecoder.h

index 7d9a720bea64bc9782605e167af8be0c186038ea..4bacf6be8125d6f96cb146fb0922b68de0b7e1b5 100644 (file)
@@ -39,8 +39,9 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
 AM_GLIB_GNU_GETTEXT
 
 # Checks for libraries.
-PKG_CHECK_MODULES(ZAKFORMGTKDECODER, [libzakformgtk
-                               libzakgtkdecoder])
+PKG_CHECK_MODULES(ZAKFORMGTKDECODER, [libzakutils
+                                      libzakformgtk
+                                      libzakgtkdecoder])
 
 AC_SUBST(ZAKFORMGTKDECODER_CFLAGS)
 AC_SUBST(ZAKFORMGTKDECODER_LIBS)
index fa2ff1fed58df8504100f25c6c4f03d4fa904513..46bd740e546f62ba2a6fce8ea8891977f0722a93 100644 (file)
@@ -17,13 +17,13 @@ AM_CPPFLAGS = $(ZAKFORMGTKDECODER_CFLAGS) \
 lib_LTLIBRARIES = libzakformgtkdecoder.la
 
 libzakformgtkdecoder_la_SOURCES = \
-                        formelementdecoder.c
+                                  formelementdecoder.c
 
 libzakformgtkdecoder_la_LDFLAGS = -no-undefined
 
 libzakformgtkdecoder_include_HEADERS = \
-                             libzakformgtkdecoder.h \
-                             formelementdecoder.h
+                                       libzakformgtkdecoder.h \
+                                       formelementdecoder.h
 
 libzakformgtkdecoder_includedir = $(includedir)/libzakformgtkdecoder
 
index c3c703afca052329f5fb5b87ebfef2ead6a76e9e..7b9a2d73be77779eef41188cf5bbbf178dab4954 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2015-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
@@ -20,6 +20,8 @@
        #include <config.h>
 #endif
 
+#include <libzakutils/libzakutils.h>
+
 #include <libzakgtkdecoder/libzakgtkdecoder.h>
 
 #include "formelementdecoder.h"
@@ -28,19 +30,19 @@ static void zak_form_gtk_form_element_decoder_class_init (ZakFormGtkFormElementD
 static void zak_form_gtk_form_element_decoder_init (ZakFormGtkFormElementDecoder *zak_form_gtk_form_element_decoder);
 
 static void zak_form_gtk_form_element_decoder_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_decoder_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_decoder_dispose (GObject *gobject);
 static void zak_form_gtk_form_element_decoder_finalize (GObject *gobject);
 
-static gchar *zak_form_gtk_form_element_decoder_get_value (ZakFormGtkFormElementDecoder *element);
-static gboolean zak_form_gtk_form_element_decoder_set_value (ZakFormGtkFormElementDecoder *element, const gchar *value);
+static GValue *zak_form_gtk_form_element_decoder_get_value (ZakFormGtkFormElementDecoder *element);
+static gboolean zak_form_gtk_form_element_decoder_set_value (ZakFormGtkFormElementDecoder *element, GValue *value);
 
 #define ZAK_FORM_GTK_FORM_ELEMENT_DECODER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_GTK_TYPE_FORM_ELEMENT_DECODER, ZakFormGtkFormElementDecoderPrivate))
 
@@ -108,9 +110,9 @@ zak_form_gtk_form_element_decoder_xml_parsing (ZakFormElement *element, xmlNodeP
 /* PRIVATE */
 static void
 zak_form_gtk_form_element_decoder_set_property (GObject *object,
-                   guint property_id,
-                   const GValue *value,
-                   GParamSpec *pspec)
+                                                guint property_id,
+                                                const GValue *value,
+                                                GParamSpec *pspec)
 {
        ZakFormGtkFormElementDecoder *zak_form_gtk_form_element_decoder = (ZakFormGtkFormElementDecoder *)object;
        ZakFormGtkFormElementDecoderPrivate *priv = ZAK_FORM_GTK_FORM_ELEMENT_DECODER_GET_PRIVATE (zak_form_gtk_form_element_decoder);
@@ -125,9 +127,9 @@ zak_form_gtk_form_element_decoder_set_property (GObject *object,
 
 static void
 zak_form_gtk_form_element_decoder_get_property (GObject *object,
-                   guint property_id,
-                   GValue *value,
-                   GParamSpec *pspec)
+                                                guint property_id,
+                                                GValue *value,
+                                                GParamSpec *pspec)
 {
        ZakFormGtkFormElementDecoder *zak_form_gtk_form_element_decoder = (ZakFormGtkFormElementDecoder *)object;
        ZakFormGtkFormElementDecoderPrivate *priv = ZAK_FORM_GTK_FORM_ELEMENT_DECODER_GET_PRIVATE (zak_form_gtk_form_element_decoder);
@@ -164,28 +166,28 @@ zak_form_gtk_form_element_decoder_finalize (GObject *gobject)
        parent_class->finalize (gobject);
 }
 
-static gchar
+static GValue
 *zak_form_gtk_form_element_decoder_get_value (ZakFormGtkFormElementDecoder *element)
 {
-       gchar *ret;
+       GValue *ret;
 
        GtkWidget *w;
 
        w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element));
 
-       ret = (gchar *)zak_gtk_decoder_get_key (ZAK_GTK_DECODER (w));
+       ret = zak_utils_gvalue_new_string ((gchar *)zak_gtk_decoder_get_key (ZAK_GTK_DECODER (w)));
 
        return ret;
 }
 
 static gboolean
-zak_form_gtk_form_element_decoder_set_value (ZakFormGtkFormElementDecoder *element, const gchar *value)
+zak_form_gtk_form_element_decoder_set_value (ZakFormGtkFormElementDecoder *element, GValue *value)
 {
        GtkWidget *w;
 
        w = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element));
 
-       zak_gtk_decoder_set_key (ZAK_GTK_DECODER (w), value);
+       zak_gtk_decoder_set_key (ZAK_GTK_DECODER (w), g_value_get_string (value));
 
        return TRUE;
 }
index 76b657bfb8650475760e99b420047cca29891bbe..e8ff1e68b9e488d8a04ceae82bdfb763bb598272 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2015-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
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBZAKFORMGTK_H__
-#define __LIBZAKFORMGTK_H__
+#ifndef __LIBZAKFORMGTKDECODER_H__
+#define __LIBZAKFORMGTKDECODER_H__
 
 
-#include <libzakformgtk/form.h>
+#include <libzakformgtkdecoder/formelementdecoder.h>
 
-#include <libzakformgtk/formelement.h>
-#include <libzakformgtk/formelementcheck.h>
-#include <libzakformgtk/formelemententry.h>
-#include <libzakformgtk/formelementlabel.h>
-#include <libzakformgtk/formelementradio.h>
-#include <libzakformgtk/formelementspin.h>
-#include <libzakformgtk/formelementtextview.h>
 
-
-#endif /* __LIBZAKFORMGTK_H__ */
+#endif /* __LIBZAKFORMGTKDECODER_H__ */