From c02621026f74d8828949a77f3cafdb7405f66273 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 30 Jan 2013 17:18:05 +0000 Subject: [PATCH] Clouseau: Added legacy<->eina value conversion functions. SVN revision: 83488 --- src/bin/clouseau.c | 2 + src/lib/clouseau_object_information.c | 57 ++++++++++++++++++++++----- src/lib/clouseau_private.h | 3 ++ 3 files changed, 52 insertions(+), 10 deletions(-) diff --git a/src/bin/clouseau.c b/src/bin/clouseau.c index 2aa18ca..21966e6 100644 --- a/src/bin/clouseau.c +++ b/src/bin/clouseau.c @@ -969,6 +969,8 @@ _tree_data_cb(EINA_UNUSED void *data, EINA_UNUSED Ecore_Con_Reply *reply, _free_app_tree_data(st->td); st->td = value; + /* FIXME-TOM: Convert to the new type */ + if (selected->ptr == td->app) { /* Update GUI only if TREE_DATA is from SELECTED app */ elm_genlist_clear(gui->gl); diff --git a/src/lib/clouseau_object_information.c b/src/lib/clouseau_object_information.c index 07355d4..d812bf0 100644 --- a/src/lib/clouseau_object_information.c +++ b/src/lib/clouseau_object_information.c @@ -49,13 +49,50 @@ clouseau_object_information_free(Clouseau_Object *oinfo) free(oinfo); } -static Eina_List * -_clouseau_eo_list_convert(Eo_Dbg_Info *root) -{ /* This function converts a list of Eo_Dbg_Info - * to a list of Clouseau_Eo_Dbg_Info. - * This is required because we would like to keep the def of - * Eo_Dbg_Info in EO code. Thus, avoiding API/ABI error if user - * does not do a full update of Clouseau and EO */ +static void +_clouseau_eo_from_legacy_convert_helper(Eo_Dbg_Info *new_root, Clouseau_Eo_Dbg_Info *root) +{ + if (root->type != EINA_VALUE_TYPE_LIST) + { + EO_DBG_INFO_APPEND(new_root, root->name, root->type, root->un_dbg_info); + } + else + { + Eina_List *l; + Clouseau_Eo_Dbg_Info *eo; + + new_root = EO_DBG_INFO_LIST_APPEND(new_root, root->name); + EINA_LIST_FOREACH(root->un_dbg_info.dbg.list, l, eo) + { + _clouseau_eo_from_legacy_convert_helper(new_root, eo); + } + } +} + +Eo_Dbg_Info * +clouseau_eo_from_legacy_convert(Eina_List *root) +{ + Eo_Dbg_Info *new_root = NULL; + Eina_List *l; + Clouseau_Eo_Dbg_Info *eo; + + new_root = EO_DBG_INFO_LIST_APPEND(NULL, ""); + EINA_LIST_FOREACH(root, l, eo) + { + _clouseau_eo_from_legacy_convert_helper(new_root, eo); + } + + return new_root; +} + +/* This function converts a list of Eo_Dbg_Info + * to a list of Clouseau_Eo_Dbg_Info. + * This is required because we would like to keep the def of + * Eo_Dbg_Info in EO code. Thus, avoiding API/ABI error if user + * does not do a full update of Clouseau and EO */ +Eina_List * +clouseau_eo_to_legacy_convert(Eo_Dbg_Info *root) +{ Eina_List *l; Eina_List *new_list = NULL; Eo_Dbg_Info *eo; @@ -98,7 +135,7 @@ _clouseau_eo_list_convert(Eo_Dbg_Info *root) else if (info->type == EINA_VALUE_TYPE_LIST) { info->un_dbg_info.dbg.list = - _clouseau_eo_list_convert(eo); + clouseau_eo_to_legacy_convert(eo); } else { @@ -122,7 +159,7 @@ clouseau_object_information_get(Clouseau_Tree_Item *treeit) return NULL; eo_do(obj, eo_dbg_info_get(eo_dbg_info)); - treeit->eo_info = _clouseau_eo_list_convert(eo_dbg_info); + treeit->eo_info = clouseau_eo_to_legacy_convert(eo_dbg_info); eo_dbg_info_free(eo_dbg_info); /* Free original list */ @@ -320,7 +357,7 @@ clouseau_object_information_list_populate(Clouseau_Tree_Item *treeit, Evas_Objec elm_object_text_set(lb, NULL); /* Convert Old format to Clouseau_eo */ - treeit->eo_info = _clouseau_eo_list_convert(root); + treeit->eo_info = clouseau_eo_to_legacy_convert(root); eo_dbg_info_free(root); } } diff --git a/src/lib/clouseau_private.h b/src/lib/clouseau_private.h index d7846ae..ab92eb6 100644 --- a/src/lib/clouseau_private.h +++ b/src/lib/clouseau_private.h @@ -198,6 +198,9 @@ struct _Clouseau_Eo_Dbg_Info }; /* END - EO - debug structs */ +Eo_Dbg_Info *clouseau_eo_from_legacy_convert(Eina_List *root); +Eina_List *clouseau_eo_to_legacy_convert(Eo_Dbg_Info *root); + /* Exported From Object information */ EAPI void clouseau_object_information_free(Clouseau_Object *oinfo); EAPI Clouseau_Object * clouseau_object_information_get(Clouseau_Tree_Item *treeit);