From 49b6a20c3f57bbeb501077c0876daef9e3e6c7e7 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Tue, 18 May 2010 07:52:26 +0000 Subject: [PATCH] - show thumbnails for edj wallpaper - added helper macros for action_free and new plugin instance SVN revision: 48967 --- src/modules/everything/evry.c | 15 ++++++++++----- src/modules/everything/evry_api.h | 13 ++++++++++--- src/modules/everything/evry_plug_view_thumb.c | 11 ++++++++++- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 2e7d38086..31b03a655 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -1090,7 +1090,8 @@ static int _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it) { Evas_Coord w, h; - + char *suffix = NULL; + if (sel->do_thumb) e_thumb_icon_end(sel->o_thumb); @@ -1107,21 +1108,25 @@ _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it) if (!(evry_file_path_get(file))) return 0; - - if (!strncmp(file->mime, "image/", 6)) + + if ((!strncmp(file->mime, "image/", 6)) || + ((suffix = strrchr(file->path, '.')) && (!strncmp(suffix, ".edj", 4)))) { sel->o_thumb = e_thumb_icon_add(win->popup->evas); evas_object_smart_callback_add(sel->o_thumb, "e_thumb_gen", _evry_selector_thumb_gen, sel); edje_object_part_geometry_get(sel->o_main, "e.swallow.thumb", NULL, NULL, &w, &h); - e_thumb_icon_file_set(sel->o_thumb, file->path, NULL); + if (suffix) + e_thumb_icon_file_set(sel->o_thumb, file->path, "e/desktop/background"); + else + e_thumb_icon_file_set(sel->o_thumb, file->path, NULL); e_thumb_icon_size_set(sel->o_thumb, w, h); e_thumb_icon_begin(sel->o_thumb); sel->do_thumb = EINA_TRUE; return 1; } - + return 0; } diff --git a/src/modules/everything/evry_api.h b/src/modules/everything/evry_api.h index 6c36acdfa..206a91089 100644 --- a/src/modules/everything/evry_api.h +++ b/src/modules/everything/evry_api.h @@ -213,9 +213,16 @@ struct _Evry_Event_Action_Performed /*** Evry_Plugin macros ***/ -#define EVRY_PLUGIN_NEW(_base, _name, _icon, _item_type, _begin, _cleanup, _fetch, _free) \ +#define EVRY_PLUGIN_NEW(_base, _name, _icon, _item_type, _begin, _finish, _fetch, _free) \ evry->plugin_new(EVRY_PLUGIN(E_NEW(_base, 1)), _name, _(_name), _icon, _item_type, \ - _begin, _cleanup, _fetch, _free) + _begin, _finish, _fetch, _free) + +#define EVRY_PLUGIN_FREE(_p) if (_p) evry->plugin_free(EVRY_PLUGIN(_p)) + +#define EVRY_PLUGIN_INST(_p, _type, _plugin) { \ + _p = E_NEW(_type, 1); \ + _p->base = (_type *)_plugin; \ + _p->base.items = NULL; \ #define EVRY_PLUGIN_ITEMS_CLEAR(_p) { \ Evry_Item *it; \ @@ -247,7 +254,7 @@ struct _Evry_Event_Action_Performed #define EVRY_ACTION_NEW(_name, _in1, _in2, _icon, _action, _check) \ evry->action_new(_name, _(_name), _in1, _in2, _icon, _action, _check) -#define EVRY_PLUGIN_FREE(_p) if (_p) evry->plugin_free(EVRY_PLUGIN(_p)) +#define EVRY_ACTION_FREE(_act) if (_act) evry->action_free(EVRY_ACTN(_act)) /*** handy macros ***/ diff --git a/src/modules/everything/evry_plug_view_thumb.c b/src/modules/everything/evry_plug_view_thumb.c index ee93a37aa..f6b29cf46 100644 --- a/src/modules/everything/evry_plug_view_thumb.c +++ b/src/modules/everything/evry_plug_view_thumb.c @@ -112,6 +112,8 @@ _thumb_gen(void *data, Evas_Object *obj, void *event_info) static int _check_item(const Evry_Item *it) { + char *suffix; + GET_FILE(file, it); if (!evry_file_path_get(file) || !file->mime) return 0; @@ -119,6 +121,10 @@ _check_item(const Evry_Item *it) if (!strncmp(file->mime, "image/", 6)) return 1; + if ((suffix = strrchr(it->label, '.'))) + if (!strncmp(suffix, ".edj", 4)) + return 1; + return 0; } @@ -128,7 +134,8 @@ _thumb_idler(void *data) Smart_Data *sd = data; Eina_List *l, *ll; Item *it; - + char *suffix; + if (!sd || sd->clearing) return 1; @@ -161,6 +168,8 @@ _thumb_idler(void *data) if (it->item->icon && it->item->icon[0]) e_thumb_icon_file_set(it->thumb, it->item->icon, NULL); + else if ((suffix = strrchr(file->path, '.')) && (!strncmp(suffix, ".edj", 4))) + e_thumb_icon_file_set(it->thumb, file->path, "e/desktop/background"); else e_thumb_icon_file_set(it->thumb, file->path, NULL);