From 9f5fa563cf836815bdd2fec6c691161a8e9d0bd0 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 13 Mar 2016 15:38:37 +0100 Subject: [PATCH] Adjustmnets to objects definition. --- src/instance.c | 2 +- src/model.c | 46 +++++++++++++++++----------------------------- src/model.h | 4 ++-- 3 files changed, 20 insertions(+), 32 deletions(-) diff --git a/src/instance.c b/src/instance.c index 744622d..80bea80 100644 --- a/src/instance.c +++ b/src/instance.c @@ -50,7 +50,7 @@ typedef struct { } ZakGFlowInstancePrivate; -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ZakGFlowInstance, zak_gflow_instance, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (ZakGFlowInstance, zak_gflow_instance, G_TYPE_OBJECT) static void zak_gflow_instance_class_init (ZakGFlowInstanceClass *class) diff --git a/src/model.c b/src/model.c index f895434..e8cff4a 100644 --- a/src/model.c +++ b/src/model.c @@ -50,7 +50,7 @@ typedef struct { } ZakGFlowModelPrivate; -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ZakGFlowModel, zak_gflow_model, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (ZakGFlowModel, zak_gflow_model, G_TYPE_OBJECT) #ifdef G_OS_WIN32 static HMODULE backend_dll = NULL; @@ -127,58 +127,46 @@ zak_gflow_model_init (ZakGFlowModel *zak_gflow_model) } /** - * zak_gflow_model_load_from_xml: - * @zakmodel: + * zak_gflow_model_new_from_xml: * @xmldoc: * */ -gboolean -zak_gflow_model_load_from_xml (ZakGFlowModel *zakmodel, xmlDoc *xmldoc) +ZakGFlowModel +*zak_gflow_model_new_from_xml (xmlDoc *xmldoc) { + ZakGFlowModel *model; ZakGFlowModelPrivate *priv; - xmlNode *cur; - xmlNode *cur_clean; - gboolean ret; + g_return_val_if_fail (xmldoc != NULL, NULL); - g_return_val_if_fail (ZAK_GFLOW_IS_MODEL (zakmodel), FALSE); - g_return_val_if_fail (xmldoc != NULL, FALSE); + model = ZAK_GFLOW_MODEL (g_object_new (zak_gflow_model_get_type (), NULL)); - ret = FALSE; + priv = zak_gflow_model_get_instance_private (model); - cur = xmlDocGetRootElement (xmldoc); - if (cur != NULL) - { - } - - return ret; + return model; } /** - * zak_gflow_model_load_from_file: - * @zakmodel: + * zak_gflow_model_new_from_file: * @filename: * */ -gboolean -zak_gflow_model_load_from_file (ZakGFlowModel *zakmodel, const gchar *filename) +ZakGFlowModel +*zak_gflow_model_load_from_file (const gchar *filename) { - xmlDoc *xdoc; - - gboolean ret; + ZakGFlowModel *model; - g_return_val_if_fail (ZAK_GFLOW_IS_MODEL (zakmodel), FALSE); - g_return_val_if_fail (filename != NULL, FALSE); + xmlDoc *xdoc; - ret = FALSE; + g_return_val_if_fail (filename != NULL, NULL); xdoc = xmlParseFile (filename); if (xdoc != NULL) { - ret = zak_gflow_model_load_from_xml (zakmodel, xdoc); + model = zak_gflow_model_new_from_xml (xdoc); } - return ret; + return model; } /* PRIVATE */ diff --git a/src/model.h b/src/model.h index aa6f1e8..7bf009d 100644 --- a/src/model.h +++ b/src/model.h @@ -40,8 +40,8 @@ struct _ZakGFlowModelClass }; -gboolean zak_gflow_model_load_from_xml (ZakGFlowModel *model, xmlDoc *xmldoc); -gboolean zak_gflow_model_load_from_file (ZakGFlowModel *model, const gchar *filename); +ZakGFlowModel *zak_gflow_model_new_from_xml (xmlDoc *xmldoc); +ZakGFlowModel *zak_gflow_model_new_from_file (const gchar *filename); ZakGFlowInstance *zak_gflow_model_start (ZakGFlowModel *model, const gchar *model_id); -- 2.49.0