From 90ba45222de9e056435066a33b49c9134986c776 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Mon, 12 Jun 2017 17:42:12 +0200 Subject: [PATCH] Make public ZakFormElement::xml_parsing. --- src/formelementcheck.c | 16 ++++------------ src/formelementcheck.h | 2 +- src/formelementemail.c | 18 +++++------------- src/formelementemail.h | 4 ++-- src/formelementfile.c | 15 +++------------ src/formelementfile.h | 2 +- src/formelementhidden.c | 19 +++++-------------- src/formelementhidden.h | 4 ++-- src/formelementpassword.c | 18 +++++------------- src/formelementpassword.h | 4 ++-- src/formelementradio.c | 16 ++++------------ src/formelementradio.h | 2 +- src/formelementselect.c | 16 ++++------------ src/formelementselect.h | 4 ++-- src/formelementstring.c | 16 +++++----------- src/formelementstring.h | 4 ++-- src/formelementsubmit.c | 18 +++++------------- src/formelementsubmit.h | 4 ++-- src/formelementtext.c | 18 +++++------------- src/formelementtext.h | 4 ++-- src/formelementtextarea.c | 18 +++++------------- src/formelementtextarea.h | 4 ++-- 22 files changed, 69 insertions(+), 157 deletions(-) diff --git a/src/formelementcheck.c b/src/formelementcheck.c index c8cb55c..157b23b 100644 --- a/src/formelementcheck.c +++ b/src/formelementcheck.c @@ -57,6 +57,7 @@ static void zak_form_cgi_form_element_check_class_init (ZakFormCgiFormElementCheckClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + ZakFormElementClass *form_elem_class = ZAK_FORM_ELEMENT_CLASS (klass); ZakFormCgiFormElementClass *elem_class = ZAK_FORM_CGI_FORM_ELEMENT_CLASS (klass); object_class->set_property = zak_form_cgi_form_element_check_set_property; @@ -64,6 +65,8 @@ zak_form_cgi_form_element_check_class_init (ZakFormCgiFormElementCheckClass *kla object_class->dispose = zak_form_cgi_form_element_check_dispose; object_class->finalize = zak_form_cgi_form_element_check_finalize; + form_elem_class->xml_parsing = zak_form_cgi_form_element_check_xml_parsing; + elem_class->render = zak_form_cgi_form_element_check_render; g_type_class_add_private (object_class, sizeof (ZakFormCgiFormElementCheckPrivate)); @@ -165,11 +168,9 @@ zak_form_cgi_form_element_check_set_in_line (ZakFormCgiFormElementCheck *element priv->in_line = in_line; } -gboolean +void zak_form_cgi_form_element_check_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode) { - gboolean ret; - gchar *id; GHashTable *ht_attrs; @@ -178,8 +179,6 @@ zak_form_cgi_form_element_check_xml_parsing (ZakFormElement *element, xmlNodePtr id = NULL; - ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_check_parent_class)->xml_parsing (element, xmlnode); - ht_attrs = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_replace (ht_attrs, "type", "checkbox"); @@ -220,14 +219,7 @@ zak_form_cgi_form_element_check_xml_parsing (ZakFormElement *element, xmlNodePtr ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_check_parent_class)->construct (ZAK_FORM_CGI_FORM_ELEMENT (element), id, ht_attrs); - ret = TRUE; } - else - { - ret = FALSE; - } - - return ret; } static gchar diff --git a/src/formelementcheck.h b/src/formelementcheck.h index 666a3c3..53ba533 100644 --- a/src/formelementcheck.h +++ b/src/formelementcheck.h @@ -62,7 +62,7 @@ void zak_form_cgi_form_element_check_set_text (ZakFormCgiFormElementCheck *eleme gboolean zak_form_cgi_form_element_check_get_in_line (ZakFormCgiFormElementCheck *element); void zak_form_cgi_form_element_check_set_in_line (ZakFormCgiFormElementCheck *element, gboolean in_line); -gboolean zak_form_cgi_form_element_check_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); +void zak_form_cgi_form_element_check_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); G_END_DECLS diff --git a/src/formelementemail.c b/src/formelementemail.c index efbbe48..96160e0 100644 --- a/src/formelementemail.c +++ b/src/formelementemail.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 @@ -54,6 +54,7 @@ static void zak_form_cgi_form_element_email_class_init (ZakFormCgiFormElementEmailClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + ZakFormElementClass *form_elem_class = ZAK_FORM_ELEMENT_CLASS (klass); ZakFormCgiFormElementClass *elem_class = ZAK_FORM_CGI_FORM_ELEMENT_CLASS (klass); object_class->set_property = zak_form_cgi_form_element_email_set_property; @@ -61,6 +62,8 @@ zak_form_cgi_form_element_email_class_init (ZakFormCgiFormElementEmailClass *kla object_class->dispose = zak_form_cgi_form_element_email_dispose; object_class->finalize = zak_form_cgi_form_element_email_finalize; + form_elem_class->xml_parsing = zak_form_cgi_form_element_email_xml_parsing; + elem_class->render = zak_form_cgi_form_element_email_render; g_type_class_add_private (object_class, sizeof (ZakFormCgiFormElementEmailPrivate)); @@ -119,11 +122,9 @@ ZakFormCgiFormElement return zak_form_cgi_form_element_email; } -gboolean +void zak_form_cgi_form_element_email_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode) { - gboolean ret; - gchar *id; GHashTable *ht_attrs; @@ -132,8 +133,6 @@ zak_form_cgi_form_element_email_xml_parsing (ZakFormElement *element, xmlNodePtr id = NULL; - ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_email_parent_class)->xml_parsing (element, xmlnode); - ht_attrs = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_replace (ht_attrs, "type", "email"); @@ -164,14 +163,7 @@ zak_form_cgi_form_element_email_xml_parsing (ZakFormElement *element, xmlNodePtr ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_email_parent_class)->construct (ZAK_FORM_CGI_FORM_ELEMENT (element), id, ht_attrs); - ret = TRUE; } - else - { - ret = FALSE; - } - - return ret; } static gchar diff --git a/src/formelementemail.h b/src/formelementemail.h index 5a9b9fa..d09d82c 100644 --- a/src/formelementemail.h +++ b/src/formelementemail.h @@ -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 @@ -56,7 +56,7 @@ GType zak_form_cgi_form_element_email_get_type (void); ZakFormCgiFormElement *zak_form_cgi_form_element_email_new (); ZakFormCgiFormElement *zak_form_cgi_form_element_email_new_attrs (const gchar *id, ...); -gboolean zak_form_cgi_form_element_email_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); +void zak_form_cgi_form_element_email_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); G_END_DECLS diff --git a/src/formelementfile.c b/src/formelementfile.c index af4a1fb..caa1d4f 100644 --- a/src/formelementfile.c +++ b/src/formelementfile.c @@ -69,6 +69,8 @@ zak_form_cgi_form_element_file_class_init (ZakFormCgiFormElementFileClass *klass object_class->dispose = zak_form_cgi_form_element_file_dispose; object_class->finalize = zak_form_cgi_form_element_file_finalize; + elem_class->xml_parsing = zak_form_cgi_form_element_file_xml_parsing; + cgi_elem_class->render = zak_form_cgi_form_element_file_render; g_type_class_add_private (object_class, sizeof (ZakFormCgiFormElementFilePrivate)); @@ -129,11 +131,9 @@ ZakFormCgiFormElement return zak_form_cgi_form_element_file; } -gboolean +void zak_form_cgi_form_element_file_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode) { - gboolean ret; - gchar *id; GHashTable *ht_attrs; @@ -142,8 +142,6 @@ zak_form_cgi_form_element_file_xml_parsing (ZakFormElement *element, xmlNodePtr id = NULL; - ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_file_parent_class)->xml_parsing (element, xmlnode); - ht_attrs = g_hash_table_new (g_str_hash, g_str_equal); cur = xmlnode->children; @@ -186,14 +184,7 @@ zak_form_cgi_form_element_file_xml_parsing (ZakFormElement *element, xmlNodePtr ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_file_parent_class)->construct (ZAK_FORM_CGI_FORM_ELEMENT (element), id, ht_attrs); - ret = TRUE; } - else - { - ret = FALSE; - } - - return ret; } void diff --git a/src/formelementfile.h b/src/formelementfile.h index 2a16a25..0d245c6 100644 --- a/src/formelementfile.h +++ b/src/formelementfile.h @@ -56,7 +56,7 @@ GType zak_form_cgi_form_element_file_get_type (void); ZakFormCgiFormElement *zak_form_cgi_form_element_file_new (void); ZakFormCgiFormElement *zak_form_cgi_form_element_file_new_attrs (const gchar *id, ...); -gboolean zak_form_cgi_form_element_file_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); +void zak_form_cgi_form_element_file_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); void zak_form_cgi_form_element_file_set_size_min (ZakFormElement *element, guint min); guint zak_form_cgi_form_element_file_get_size_min (ZakFormElement *element); diff --git a/src/formelementhidden.c b/src/formelementhidden.c index a5d763c..1e1b728 100644 --- a/src/formelementhidden.c +++ b/src/formelementhidden.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2016 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 @@ -54,6 +54,7 @@ static void zak_form_cgi_form_element_hidden_class_init (ZakFormCgiFormElementHiddenClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + ZakFormElementClass *form_elem_class = ZAK_FORM_ELEMENT_CLASS (klass); ZakFormCgiFormElementClass *elem_class = ZAK_FORM_CGI_FORM_ELEMENT_CLASS (klass); object_class->set_property = zak_form_cgi_form_element_hidden_set_property; @@ -61,6 +62,8 @@ zak_form_cgi_form_element_hidden_class_init (ZakFormCgiFormElementHiddenClass *k object_class->dispose = zak_form_cgi_form_element_hidden_dispose; object_class->finalize = zak_form_cgi_form_element_hidden_finalize; + form_elem_class->xml_parsing = zak_form_cgi_form_element_hidden_xml_parsing; + elem_class->render = zak_form_cgi_form_element_hidden_render; g_type_class_add_private (object_class, sizeof (ZakFormCgiFormElementHiddenPrivate)); @@ -119,12 +122,9 @@ ZakFormCgiFormElement return zak_form_cgi_form_element_hidden; } - -gboolean +void zak_form_cgi_form_element_hidden_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode) { - gboolean ret; - gchar *id; GHashTable *ht_attrs; @@ -133,8 +133,6 @@ zak_form_cgi_form_element_hidden_xml_parsing (ZakFormElement *element, xmlNodePt id = NULL; - ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_hidden_parent_class)->xml_parsing (element, xmlnode); - ht_attrs = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_replace (ht_attrs, "type", "hidden"); @@ -161,14 +159,7 @@ zak_form_cgi_form_element_hidden_xml_parsing (ZakFormElement *element, xmlNodePt ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_hidden_parent_class)->construct (ZAK_FORM_CGI_FORM_ELEMENT (element), id, ht_attrs); - ret = TRUE; } - else - { - ret = FALSE; - } - - return ret; } static gchar diff --git a/src/formelementhidden.h b/src/formelementhidden.h index 0060225..7c02ba9 100644 --- a/src/formelementhidden.h +++ b/src/formelementhidden.h @@ -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 @@ -56,7 +56,7 @@ GType zak_form_cgi_form_element_hidden_get_type (void); ZakFormCgiFormElement *zak_form_cgi_form_element_hidden_new (void); ZakFormCgiFormElement *zak_form_cgi_form_element_hidden_new_attrs (const gchar *id, ...); -gboolean zak_form_cgi_form_element_hidden_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); +void zak_form_cgi_form_element_hidden_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); G_END_DECLS diff --git a/src/formelementpassword.c b/src/formelementpassword.c index 994f459..8a21d2d 100644 --- a/src/formelementpassword.c +++ b/src/formelementpassword.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2016 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 @@ -54,6 +54,7 @@ static void zak_form_cgi_form_element_password_class_init (ZakFormCgiFormElementPasswordClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + ZakFormElementClass *form_elem_class = ZAK_FORM_ELEMENT_CLASS (klass); ZakFormCgiFormElementClass *elem_class = ZAK_FORM_CGI_FORM_ELEMENT_CLASS (klass); object_class->set_property = zak_form_cgi_form_element_password_set_property; @@ -61,6 +62,8 @@ zak_form_cgi_form_element_password_class_init (ZakFormCgiFormElementPasswordClas object_class->dispose = zak_form_cgi_form_element_password_dispose; object_class->finalize = zak_form_cgi_form_element_password_finalize; + form_elem_class->xml_parsing = zak_form_cgi_form_element_password_xml_parsing; + elem_class->render = zak_form_cgi_form_element_password_render; g_type_class_add_private (object_class, sizeof (ZakFormCgiFormElementPasswordPrivate)); @@ -119,11 +122,9 @@ ZakFormCgiFormElement return zak_form_cgi_form_element_password; } -gboolean +void zak_form_cgi_form_element_password_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode) { - gboolean ret; - gchar *id; GHashTable *ht_attrs; @@ -132,8 +133,6 @@ zak_form_cgi_form_element_password_xml_parsing (ZakFormElement *element, xmlNode id = NULL; - ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_password_parent_class)->xml_parsing (element, xmlnode); - ht_attrs = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_replace (ht_attrs, "type", "password"); @@ -164,14 +163,7 @@ zak_form_cgi_form_element_password_xml_parsing (ZakFormElement *element, xmlNode ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_password_parent_class)->construct (ZAK_FORM_CGI_FORM_ELEMENT (element), id, ht_attrs); - ret = TRUE; } - else - { - ret = FALSE; - } - - return ret; } static gchar diff --git a/src/formelementpassword.h b/src/formelementpassword.h index 3bd2f87..d10cace 100644 --- a/src/formelementpassword.h +++ b/src/formelementpassword.h @@ -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 @@ -56,7 +56,7 @@ GType zak_form_cgi_form_element_password_get_type (void); ZakFormCgiFormElement *zak_form_cgi_form_element_password_new (); ZakFormCgiFormElement *zak_form_cgi_form_element_password_new_attrs (const gchar *id, ...); -gboolean zak_form_cgi_form_element_password_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); +void zak_form_cgi_form_element_password_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); G_END_DECLS diff --git a/src/formelementradio.c b/src/formelementradio.c index ed7df41..49c18ce 100644 --- a/src/formelementradio.c +++ b/src/formelementradio.c @@ -63,6 +63,7 @@ static void zak_form_cgi_form_element_radio_class_init (ZakFormCgiFormElementRadioClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + ZakFormElementClass *form_elem_class = ZAK_FORM_ELEMENT_CLASS (klass); ZakFormCgiFormElementClass *elem_class = ZAK_FORM_CGI_FORM_ELEMENT_CLASS (klass); object_class->set_property = zak_form_cgi_form_element_radio_set_property; @@ -70,6 +71,8 @@ zak_form_cgi_form_element_radio_class_init (ZakFormCgiFormElementRadioClass *kla object_class->dispose = zak_form_cgi_form_element_radio_dispose; object_class->finalize = zak_form_cgi_form_element_radio_finalize; + form_elem_class->xml_parsing = zak_form_cgi_form_element_radio_xml_parsing; + elem_class->render = zak_form_cgi_form_element_radio_render; g_type_class_add_private (object_class, sizeof (ZakFormCgiFormElementRadioPrivate)); @@ -146,11 +149,9 @@ zak_form_cgi_form_element_radio_set_in_line (ZakFormCgiFormElementRadio *element priv->in_line = in_line; } -gboolean +void zak_form_cgi_form_element_radio_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode) { - gboolean ret; - gchar *id; GHashTable *ht_attrs; @@ -161,8 +162,6 @@ zak_form_cgi_form_element_radio_xml_parsing (ZakFormElement *element, xmlNodePtr id = NULL; - ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_radio_parent_class)->xml_parsing (element, xmlnode); - ht_attrs = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_replace (ht_attrs, "type", "radio"); @@ -218,14 +217,7 @@ zak_form_cgi_form_element_radio_xml_parsing (ZakFormElement *element, xmlNodePtr ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_radio_parent_class)->construct (ZAK_FORM_CGI_FORM_ELEMENT (element), id, ht_attrs); - ret = TRUE; } - else - { - ret = FALSE; - } - - return ret; } static gchar diff --git a/src/formelementradio.h b/src/formelementradio.h index aad6fd2..945f398 100644 --- a/src/formelementradio.h +++ b/src/formelementradio.h @@ -59,7 +59,7 @@ ZakFormCgiFormElement *zak_form_cgi_form_element_radio_new_attrs (const gchar *i gboolean zak_form_cgi_form_element_radio_get_in_line (ZakFormCgiFormElementRadio *element); void zak_form_cgi_form_element_radio_set_in_line (ZakFormCgiFormElementRadio *element, gboolean in_line); -gboolean zak_form_cgi_form_element_radio_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); +void zak_form_cgi_form_element_radio_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); G_END_DECLS diff --git a/src/formelementselect.c b/src/formelementselect.c index ccce41c..1a4dd74 100644 --- a/src/formelementselect.c +++ b/src/formelementselect.c @@ -54,6 +54,7 @@ static void zak_form_cgi_form_element_select_class_init (ZakFormCgiFormElementSelectClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + ZakFormElementClass *form_elem_class = ZAK_FORM_ELEMENT_CLASS (klass); ZakFormCgiFormElementClass *elem_class = ZAK_FORM_CGI_FORM_ELEMENT_CLASS (klass); object_class->set_property = zak_form_cgi_form_element_select_set_property; @@ -61,6 +62,8 @@ zak_form_cgi_form_element_select_class_init (ZakFormCgiFormElementSelectClass *k object_class->dispose = zak_form_cgi_form_element_select_dispose; object_class->finalize = zak_form_cgi_form_element_select_finalize; + form_elem_class->xml_parsing = zak_form_cgi_form_element_select_xml_parsing; + elem_class->render = zak_form_cgi_form_element_select_render; g_type_class_add_private (object_class, sizeof (ZakFormCgiFormElementSelectPrivate)); @@ -145,11 +148,9 @@ zak_form_cgi_form_element_select_add_option (ZakFormCgiFormElementSelect *elemen g_hash_table_replace (priv->ht_options, g_strdup (value), ht_attrs); } -gboolean +void zak_form_cgi_form_element_select_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode) { - gboolean ret; - gchar *id; GHashTable *ht_attrs; @@ -158,8 +159,6 @@ zak_form_cgi_form_element_select_xml_parsing (ZakFormElement *element, xmlNodePt id = NULL; - ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_select_parent_class)->xml_parsing (element, xmlnode); - ht_attrs = g_hash_table_new (g_str_hash, g_str_equal); cur = xmlnode->children; @@ -193,14 +192,7 @@ zak_form_cgi_form_element_select_xml_parsing (ZakFormElement *element, xmlNodePt ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_select_parent_class)->construct (ZAK_FORM_CGI_FORM_ELEMENT (element), id, ht_attrs); - ret = TRUE; } - else - { - ret = FALSE; - } - - return ret; } static gchar diff --git a/src/formelementselect.h b/src/formelementselect.h index 1c5e4a0..452003e 100644 --- a/src/formelementselect.h +++ b/src/formelementselect.h @@ -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 @@ -58,7 +58,7 @@ ZakFormCgiFormElement *zak_form_cgi_form_element_select_new_attrs (const gchar * void zak_form_cgi_form_element_select_add_option (ZakFormCgiFormElementSelect *element, const gchar *value, const gchar *content, ...); -gboolean zak_form_cgi_form_element_select_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); +void zak_form_cgi_form_element_select_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); G_END_DECLS diff --git a/src/formelementstring.c b/src/formelementstring.c index a76aa44..26732ee 100644 --- a/src/formelementstring.c +++ b/src/formelementstring.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2016 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 @@ -56,6 +56,7 @@ static void zak_form_cgi_form_element_string_class_init (ZakFormCgiFormElementStringClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + ZakFormElementClass *form_elem_class = ZAK_FORM_ELEMENT_CLASS (klass); ZakFormCgiFormElementClass *elem_class = ZAK_FORM_CGI_FORM_ELEMENT_CLASS (klass); object_class->set_property = zak_form_cgi_form_element_string_set_property; @@ -63,6 +64,8 @@ zak_form_cgi_form_element_string_class_init (ZakFormCgiFormElementStringClass *k object_class->dispose = zak_form_cgi_form_element_string_dispose; object_class->finalize = zak_form_cgi_form_element_string_finalize; + form_elem_class->xml_parsing = zak_form_cgi_form_element_string_xml_parsing; + elem_class->render = zak_form_cgi_form_element_string_render; //elem_class->is_valid = zak_form_cgi_form_element_string_is_valid; @@ -112,19 +115,13 @@ ZakFormCgiFormElement return zak_form_cgi_form_element_string; } -gboolean +void zak_form_cgi_form_element_string_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode) { - gboolean ret; - xmlNode *cur; ZakFormCgiFormElementStringPrivate *priv; - ret = FALSE; - - ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_string_parent_class)->xml_parsing (element, xmlnode); - cur = xmlnode->children; while (cur != NULL) { @@ -132,14 +129,11 @@ zak_form_cgi_form_element_string_xml_parsing (ZakFormElement *element, xmlNodePt { priv = ZAK_FORM_CGI_FORM_ELEMENT_STRING_GET_PRIVATE (ZAK_FORM_CGI_FORM_ELEMENT_STRING (element)); priv->str = g_strdup ((gchar *)xmlNodeGetContent (cur)); - ret = TRUE; break; } cur = cur->next; } - - return ret; } static gchar diff --git a/src/formelementstring.h b/src/formelementstring.h index 9b39fde..5783e97 100644 --- a/src/formelementstring.h +++ b/src/formelementstring.h @@ -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 @@ -56,7 +56,7 @@ GType zak_form_cgi_form_element_string_get_type (void); ZakFormCgiFormElement *zak_form_cgi_form_element_string_new (void); ZakFormCgiFormElement *zak_form_cgi_form_element_string_new_attrs (const gchar *str); -gboolean zak_form_cgi_form_element_string_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); +void zak_form_cgi_form_element_string_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); G_END_DECLS diff --git a/src/formelementsubmit.c b/src/formelementsubmit.c index 7f547d9..67f091d 100644 --- a/src/formelementsubmit.c +++ b/src/formelementsubmit.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2016 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 @@ -54,6 +54,7 @@ static void zak_form_cgi_form_element_submit_class_init (ZakFormCgiFormElementSubmitClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + ZakFormElementClass *form_elem_class = ZAK_FORM_ELEMENT_CLASS (klass); ZakFormCgiFormElementClass *elem_class = ZAK_FORM_CGI_FORM_ELEMENT_CLASS (klass); object_class->set_property = zak_form_cgi_form_element_submit_set_property; @@ -61,6 +62,8 @@ zak_form_cgi_form_element_submit_class_init (ZakFormCgiFormElementSubmitClass *k object_class->dispose = zak_form_cgi_form_element_submit_dispose; object_class->finalize = zak_form_cgi_form_element_submit_finalize; + form_elem_class->xml_parsing = zak_form_cgi_form_element_submit_xml_parsing; + elem_class->render = zak_form_cgi_form_element_submit_render; g_type_class_add_private (object_class, sizeof (ZakFormCgiFormElementSubmitPrivate)); @@ -114,11 +117,9 @@ ZakFormCgiFormElement return zak_form_cgi_form_element_submit; } -gboolean +void zak_form_cgi_form_element_submit_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode) { - gboolean ret; - gchar *id; GHashTable *ht_attrs; @@ -127,8 +128,6 @@ zak_form_cgi_form_element_submit_xml_parsing (ZakFormElement *element, xmlNodePt id = NULL; - ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_submit_parent_class)->xml_parsing (element, xmlnode); - ht_attrs = g_hash_table_new (g_str_hash, g_str_equal); cur = xmlnode->children; @@ -158,14 +157,7 @@ zak_form_cgi_form_element_submit_xml_parsing (ZakFormElement *element, xmlNodePt ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_submit_parent_class)->construct (ZAK_FORM_CGI_FORM_ELEMENT (element), id, ht_attrs); - ret = TRUE; - } - else - { - ret = FALSE; } - - return ret; } static gchar diff --git a/src/formelementsubmit.h b/src/formelementsubmit.h index 077730f..e1f0846 100644 --- a/src/formelementsubmit.h +++ b/src/formelementsubmit.h @@ -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 @@ -56,7 +56,7 @@ GType zak_form_cgi_form_element_submit_get_type (void); ZakFormCgiFormElement *zak_form_cgi_form_element_submit_new (void); ZakFormCgiFormElement *zak_form_cgi_form_element_submit_new_attrs (const gchar *id, ...); -gboolean zak_form_cgi_form_element_submit_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); +void zak_form_cgi_form_element_submit_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); G_END_DECLS diff --git a/src/formelementtext.c b/src/formelementtext.c index c1d45d3..abb7712 100644 --- a/src/formelementtext.c +++ b/src/formelementtext.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2016 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 @@ -54,6 +54,7 @@ static void zak_form_cgi_form_element_text_class_init (ZakFormCgiFormElementTextClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + ZakFormElementClass *form_elem_class = ZAK_FORM_ELEMENT_CLASS (klass); ZakFormCgiFormElementClass *elem_class = ZAK_FORM_CGI_FORM_ELEMENT_CLASS (klass); object_class->set_property = zak_form_cgi_form_element_text_set_property; @@ -61,6 +62,8 @@ zak_form_cgi_form_element_text_class_init (ZakFormCgiFormElementTextClass *klass object_class->dispose = zak_form_cgi_form_element_text_dispose; object_class->finalize = zak_form_cgi_form_element_text_finalize; + form_elem_class->xml_parsing = zak_form_cgi_form_element_text_xml_parsing; + elem_class->render = zak_form_cgi_form_element_text_render; g_type_class_add_private (object_class, sizeof (ZakFormCgiFormElementTextPrivate)); @@ -114,11 +117,9 @@ ZakFormCgiFormElement return zak_form_cgi_form_element_text; } -gboolean +void zak_form_cgi_form_element_text_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode) { - gboolean ret; - gchar *id; GHashTable *ht_attrs; @@ -127,8 +128,6 @@ zak_form_cgi_form_element_text_xml_parsing (ZakFormElement *element, xmlNodePtr id = NULL; - ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_text_parent_class)->xml_parsing (element, xmlnode); - ht_attrs = g_hash_table_new (g_str_hash, g_str_equal); cur = xmlnode->children; @@ -158,14 +157,7 @@ zak_form_cgi_form_element_text_xml_parsing (ZakFormElement *element, xmlNodePtr ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_text_parent_class)->construct (ZAK_FORM_CGI_FORM_ELEMENT (element), id, ht_attrs); - ret = TRUE; } - else - { - ret = FALSE; - } - - return ret; } static gchar diff --git a/src/formelementtext.h b/src/formelementtext.h index b716fa2..a61885a 100644 --- a/src/formelementtext.h +++ b/src/formelementtext.h @@ -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 @@ -56,7 +56,7 @@ GType zak_form_cgi_form_element_text_get_type (void); ZakFormCgiFormElement *zak_form_cgi_form_element_text_new (void); ZakFormCgiFormElement *zak_form_cgi_form_element_text_new_attrs (const gchar *id, ...); -gboolean zak_form_cgi_form_element_text_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); +void zak_form_cgi_form_element_text_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); G_END_DECLS diff --git a/src/formelementtextarea.c b/src/formelementtextarea.c index 13368ca..a41efcd 100644 --- a/src/formelementtextarea.c +++ b/src/formelementtextarea.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2016 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 @@ -54,6 +54,7 @@ static void zak_form_cgi_form_element_text_area_class_init (ZakFormCgiFormElementTextAreaClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + ZakFormElementClass *form_elem_class = ZAK_FORM_ELEMENT_CLASS (klass); ZakFormCgiFormElementClass *elem_class = ZAK_FORM_CGI_FORM_ELEMENT_CLASS (klass); object_class->set_property = zak_form_cgi_form_element_text_area_set_property; @@ -61,6 +62,8 @@ zak_form_cgi_form_element_text_area_class_init (ZakFormCgiFormElementTextAreaCla object_class->dispose = zak_form_cgi_form_element_text_area_dispose; object_class->finalize = zak_form_cgi_form_element_text_area_finalize; + form_elem_class->xml_parsing = zak_form_cgi_form_element_text_area_xml_parsing; + elem_class->render = zak_form_cgi_form_element_text_area_render; g_type_class_add_private (object_class, sizeof (ZakFormCgiFormElementTextAreaPrivate)); @@ -114,11 +117,9 @@ ZakFormCgiFormElement return zak_form_cgi_form_element_text_area; } -gboolean +void zak_form_cgi_form_element_text_area_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode) { - gboolean ret; - gchar *id; GHashTable *ht_attrs; @@ -127,8 +128,6 @@ zak_form_cgi_form_element_text_area_xml_parsing (ZakFormElement *element, xmlNod id = NULL; - ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_text_area_parent_class)->xml_parsing (element, xmlnode); - ht_attrs = g_hash_table_new (g_str_hash, g_str_equal); cur = xmlnode->children; @@ -158,14 +157,7 @@ zak_form_cgi_form_element_text_area_xml_parsing (ZakFormElement *element, xmlNod ZAK_FORM_CGI_FORM_ELEMENT_CLASS (zak_form_cgi_form_element_text_area_parent_class)->construct (ZAK_FORM_CGI_FORM_ELEMENT (element), id, ht_attrs); - ret = TRUE; } - else - { - ret = FALSE; - } - - return ret; } static gchar diff --git a/src/formelementtextarea.h b/src/formelementtextarea.h index 560792a..1698e35 100644 --- a/src/formelementtextarea.h +++ b/src/formelementtextarea.h @@ -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 @@ -56,7 +56,7 @@ GType zak_form_cgi_form_element_text_area_get_type (void); ZakFormCgiFormElement *zak_form_cgi_form_element_text_area_new (void); ZakFormCgiFormElement *zak_form_cgi_form_element_text_area_new_attrs (const gchar *id, ...); -gboolean zak_form_cgi_form_element_text_area_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); +void zak_form_cgi_form_element_text_area_xml_parsing (ZakFormElement *element, xmlNodePtr xmlnode); G_END_DECLS -- 2.49.0