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;
}
}
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;
}