diff --git a/data/images/show-screenshot.png b/data/images/show-screenshot.png new file mode 100644 index 0000000..6f118cd Binary files /dev/null and b/data/images/show-screenshot.png differ diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt index 7e6f61b..fb44d48 100644 --- a/src/bin/CMakeLists.txt +++ b/src/bin/CMakeLists.txt @@ -4,7 +4,8 @@ LIST(APPEND SOURCES clouseau_client.c gui.c) STRING(REGEX REPLACE "\n" "" EOLIAN_EO_DIR ${EOLIAN_EO_DIR}) STRING(REGEX REPLACE " " "" EOLIAN_EO_DIR ${EOLIAN_EO_DIR}) -add_definitions(${CLI_COMMON_DEFINITIONS} -DEFL_EO_API_SUPPORT -DEOLIAN_EO_DIR="${EOLIAN_EO_DIR}") +add_definitions(${CLI_COMMON_DEFINITIONS} -DEFL_EO_API_SUPPORT + -DEOLIAN_EO_DIR="${EOLIAN_EO_DIR}" -DPACKAGE_DATA_DIR="${CMAKE_HOME_DIRECTORY}/data") link_directories (${PC_LIBELEMENTARY_LIBRARY_DIRS}) diff --git a/src/bin/clouseau_client.c b/src/bin/clouseau_client.c index ae0a2c0..75a457e 100644 --- a/src/bin/clouseau_client.c +++ b/src/bin/clouseau_client.c @@ -16,6 +16,8 @@ #include +#define SHOW_SCREENSHOT "/images/show-screenshot.png" + #define EXTRACT(_buf, pval, sz) \ { \ memcpy(pval, _buf, sz); \ @@ -449,6 +451,45 @@ _objs_item_label_get(void *data, Evas_Object *obj EINA_UNUSED, return strdup(buf); } +static void +_set_button(Evas_Object *w, Evas_Object *bt, + char *ic_name, char *tip, Eina_Bool en) +{ /* Update button icon and tooltip */ + char buf[1024]; + Evas_Object *ic = elm_icon_add(w); + snprintf(buf, sizeof(buf), "%s%s", PACKAGE_DATA_DIR, ic_name); + elm_image_file_set(ic, buf, NULL); + elm_object_part_content_set(bt, "icon", ic); + elm_object_tooltip_text_set(bt, tip); + elm_object_disabled_set(bt, en); +} + +static void +_show_app_window(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + _Obj_list_node *info_node = data; + + printf("show screenshot of obj %s %p\n", info_node->info->kl_name, info_node->info->ptr); +} + +static Evas_Object * +_objs_item_content_get(void *data, Evas_Object *obj, const char *part) +{ + Evas_Object *bt = NULL; + + if(!strcmp(part, "elm.swallow.end")) + { + bt = elm_button_add(obj); + _set_button(obj, bt, + SHOW_SCREENSHOT, + "Show App Screenshot", EINA_FALSE); + + evas_object_smart_callback_add(bt, "clicked", + _show_app_window, data); + } + return bt; +} + static void _objs_nodes_free(Eina_List *parents) { @@ -790,7 +831,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) _objs_itc = elm_genlist_item_class_new(); _objs_itc->item_style = "default"; _objs_itc->func.text_get = _objs_item_label_get; - _objs_itc->func.content_get = NULL; + _objs_itc->func.content_get = _objs_item_content_get; _objs_itc->func.state_get = NULL; _objs_itc->func.del = NULL; }