forked from enlightenment/enlightenment
- show thumbnails for edj wallpaper
- added helper macros for action_free and new plugin instance SVN revision: 48967
This commit is contained in:
parent
25cb393e47
commit
49b6a20c3f
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ***/
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue