From: moon87.park Date: Tue, 29 Mar 2016 13:35:51 +0000 (+0900) Subject: [Widget-viewer-evas] return the default value when title is NULL X-Git-Tag: accepted/tizen/common/20160330.120703^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=991465586153ad56f54109a7e32c617b26a3f0c0;p=platform%2Fcore%2Fappfw%2Fwidget-viewer.git [Widget-viewer-evas] return the default value when title is NULL Change-Id: I49243543fe1b6920556db0fc5a03698d3fca1807 --- diff --git a/widget_viewer_evas/src/widget_viewer_evas.c b/widget_viewer_evas/src/widget_viewer_evas.c index 47ff328..22d9f11 100644 --- a/widget_viewer_evas/src/widget_viewer_evas.c +++ b/widget_viewer_evas/src/widget_viewer_evas.c @@ -572,69 +572,67 @@ EAPI int widget_viewer_evas_resume_widget(Evas_Object *widget) return WIDGET_ERROR_NONE; } -static int foreach_cb(widget_instance_h handle, void *data) +EAPI const char *widget_viewer_evas_get_content_info(Evas_Object *widget) { - struct widget_info *info = data; + struct widget_info *info; + widget_instance_h handle = NULL; bundle_raw *content_info = NULL; int content_len = 0; bundle *b = NULL; - char *id = NULL; - if (!handle) { - return 0; - } - if (widget_instance_get_id(handle, &id) < 0) { - return 0; + if (!is_widget_feature_enabled()) { + return NULL; } - if (!id && !info->instance_id) { - return 0; + if (!s_info.initialized) { + ErrPrint("widget viewer evas is not initialized\n"); + return NULL; } - if (strcmp(id, info->instance_id)) { - free(id); - return 0; + if (!widget) { + ErrPrint("widget object is invalid\n"); + return NULL; } - if (widget_instance_get_content(handle, &b) < 0 || b == NULL) { - return 0; + info = evas_object_data_get(widget, WIDGET_INFO_TAG); + if (!info) { + ErrPrint("widget(%p) don't have the info\n", widget); + return NULL; } - if (bundle_encode(b, &content_info, &content_len) < 0) { - return 0; + if (!info->widget_id && !info->instance_id) { + ErrPrint("widget id(%s) or instance id(%s) is invalid data\n", info->widget_id, info->instance_id); + return NULL; } - free(info->content_info); - info->content_info = (char *)content_info; - return 0; -} + handle = widget_instance_get_instance(info->widget_id, info->instance_id); -EAPI const char *widget_viewer_evas_get_content_info(Evas_Object *widget) -{ - struct widget_info *info; - - if (!is_widget_feature_enabled()) { + if (!handle) { + ErrPrint("instance handle of widget(%s) is invalid data\n", info->instance_id); return NULL; } - if (!s_info.initialized) { - ErrPrint("widget viewer evas is not initialized\n"); + if (widget_instance_get_content(handle, &b) < 0) { + ErrPrint("Failed to get content of widget(%s)\n", info->instance_id); return NULL; } - if (!widget) { - ErrPrint("widget object is invalid\n"); + if (b == NULL) { + ErrPrint("content of widget(%s) is invalid data\n", info->instance_id); return NULL; } - info = evas_object_data_get(widget, WIDGET_INFO_TAG); - if (!info) { - ErrPrint("widget(%p) don't have the info\n", widget); + if (bundle_encode(b, &content_info, &content_len) < 0) { + ErrPrint("Failed to encode (%s)\n", info->instance_id); return NULL; } - widget_instance_foreach(info->widget_id, foreach_cb, info); + if (info->content_info) { + free(info->content_info); + } + info->content_info = (char *)content_info; + return info->content_info; } @@ -665,7 +663,15 @@ EAPI const char *widget_viewer_evas_get_title_string(Evas_Object *widget) } title = pepper_efl_object_title_get(pepper_obj); - DbgPrint("%s : title is [%s]\n", __func__, title); + if (!title) { + struct widget_info *info; + info = evas_object_data_get(widget, WIDGET_INFO_TAG); + if (!info) { + ErrPrint("widget(%p) don't have the info\n", widget); + return NULL; + } + title = info->widget_id; + } return title; }