forked from enlightenment/enlightenment
'everything' module:
- thumnails for selector - cleanups SVN revision: 41982
This commit is contained in:
parent
2438e6acde
commit
1a807b6a60
|
@ -60,6 +60,9 @@ struct _Evry_Selector
|
||||||
Eina_List *plugins;
|
Eina_List *plugins;
|
||||||
|
|
||||||
Evry_View *view;
|
Evry_View *view;
|
||||||
|
|
||||||
|
Evas_Object *o_thumb;
|
||||||
|
Eina_Bool do_thumb;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Tab_View
|
struct _Tab_View
|
||||||
|
|
|
@ -58,6 +58,7 @@ static void _evry_selector_icon_set(Evry_Selector *sel);
|
||||||
static int _evry_selector_subjects_get(const char *plugin_name);
|
static int _evry_selector_subjects_get(const char *plugin_name);
|
||||||
static int _evry_selector_actions_get(Evry_Item *it);
|
static int _evry_selector_actions_get(Evry_Item *it);
|
||||||
static int _evry_selector_objects_get(Evry_Action *act);
|
static int _evry_selector_objects_get(Evry_Action *act);
|
||||||
|
static void _evry_selector_thumb_gen(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
|
||||||
static int _evry_browse_item(Evry_Selector *sel);
|
static int _evry_browse_item(Evry_Selector *sel);
|
||||||
static void _evry_browse_back(Evry_Selector *sel);
|
static void _evry_browse_back(Evry_Selector *sel);
|
||||||
|
@ -92,6 +93,7 @@ static Eina_List *handlers = NULL;
|
||||||
static Ecore_Timer *update_timer = NULL;
|
static Ecore_Timer *update_timer = NULL;
|
||||||
static Evry_Plugin *action_selector = NULL;
|
static Evry_Plugin *action_selector = NULL;
|
||||||
static Evry_Selector *selector = NULL;
|
static Evry_Selector *selector = NULL;
|
||||||
|
static const char *thumb_types = NULL;
|
||||||
|
|
||||||
Evry_Selector **selectors;
|
Evry_Selector **selectors;
|
||||||
|
|
||||||
|
@ -100,6 +102,7 @@ int
|
||||||
evry_init(void)
|
evry_init(void)
|
||||||
{
|
{
|
||||||
action_selector = evry_plug_actions_new();
|
action_selector = evry_plug_actions_new();
|
||||||
|
thumb_types = eina_stringshare_add("FILE");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +112,7 @@ evry_shutdown(void)
|
||||||
evry_hide();
|
evry_hide();
|
||||||
|
|
||||||
evry_plug_actions_free(action_selector);
|
evry_plug_actions_free(action_selector);
|
||||||
|
eina_stringshare_del(thumb_types);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,6 +741,7 @@ _evry_window_free(Evry_Window *win)
|
||||||
e_object_del(E_OBJECT(win->popup));
|
e_object_del(E_OBJECT(win->popup));
|
||||||
E_FREE(win);
|
E_FREE(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evry_Selector *
|
static Evry_Selector *
|
||||||
_evry_selector_new(int type)
|
_evry_selector_new(int type)
|
||||||
{
|
{
|
||||||
|
@ -775,8 +779,13 @@ _evry_selector_new(int type)
|
||||||
static void
|
static void
|
||||||
_evry_selector_free(Evry_Selector *sel)
|
_evry_selector_free(Evry_Selector *sel)
|
||||||
{
|
{
|
||||||
|
if (sel->do_thumb)
|
||||||
|
e_thumb_icon_end(sel->o_thumb);
|
||||||
|
if (sel->o_thumb)
|
||||||
|
evas_object_del(sel->o_thumb);
|
||||||
if (sel->o_icon)
|
if (sel->o_icon)
|
||||||
evas_object_del(sel->o_icon);
|
evas_object_del(sel->o_icon);
|
||||||
|
if (sel->o_main)
|
||||||
evas_object_del(sel->o_main);
|
evas_object_del(sel->o_main);
|
||||||
|
|
||||||
if (list->visible && (sel == selector))
|
if (list->visible && (sel == selector))
|
||||||
|
@ -788,6 +797,7 @@ _evry_selector_free(Evry_Selector *sel)
|
||||||
evry_plug_aggregator_free(sel->aggregator);
|
evry_plug_aggregator_free(sel->aggregator);
|
||||||
|
|
||||||
if (sel->plugins) eina_list_free(sel->plugins);
|
if (sel->plugins) eina_list_free(sel->plugins);
|
||||||
|
|
||||||
E_FREE(sel);
|
E_FREE(sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,6 +840,56 @@ _evry_selector_activate(Evry_Selector *sel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_evry_selector_thumb_gen(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
Evas_Coord w, h;
|
||||||
|
Evry_Selector *sel = data;
|
||||||
|
|
||||||
|
if (sel->o_icon)
|
||||||
|
evas_object_del(sel->o_icon);
|
||||||
|
sel->o_icon = NULL;
|
||||||
|
|
||||||
|
e_icon_size_get(sel->o_thumb, &w, &h);
|
||||||
|
edje_extern_object_aspect_set(sel->o_thumb, EDJE_ASPECT_CONTROL_BOTH, w, h);
|
||||||
|
edje_object_part_swallow(sel->o_main, "e.swallow.thumb", sel->o_thumb);
|
||||||
|
evas_object_show(sel->o_thumb);
|
||||||
|
edje_object_signal_emit(sel->o_main, "e,action,thumb,show", "e");
|
||||||
|
sel->do_thumb = EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it)
|
||||||
|
{
|
||||||
|
Evas_Coord w, h;
|
||||||
|
|
||||||
|
if (sel->do_thumb)
|
||||||
|
e_thumb_icon_end(sel->o_thumb);
|
||||||
|
|
||||||
|
if (sel->o_thumb)
|
||||||
|
evas_object_del(sel->o_thumb);
|
||||||
|
|
||||||
|
if (it->plugin->type_out != thumb_types) return 0;
|
||||||
|
|
||||||
|
ITEM_FILE(file, it);
|
||||||
|
|
||||||
|
if (!file->uri || !file->mime) return 0;
|
||||||
|
|
||||||
|
if (!strncmp(file->mime, "image/", 6))
|
||||||
|
{
|
||||||
|
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->uri, 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;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_evry_selector_icon_set(Evry_Selector *sel)
|
_evry_selector_icon_set(Evry_Selector *sel)
|
||||||
{
|
{
|
||||||
|
@ -850,6 +910,8 @@ _evry_selector_icon_set(Evry_Selector *sel)
|
||||||
it = s->sel_item;
|
it = s->sel_item;
|
||||||
|
|
||||||
if (it && it->plugin && it->plugin->icon_get)
|
if (it && it->plugin && it->plugin->icon_get)
|
||||||
|
{
|
||||||
|
if (!_evry_selector_thumb(sel, it))
|
||||||
{
|
{
|
||||||
o = it->plugin->icon_get(it->plugin, it, win->popup->evas);
|
o = it->plugin->icon_get(it->plugin, it, win->popup->evas);
|
||||||
if (o)
|
if (o)
|
||||||
|
@ -858,8 +920,11 @@ _evry_selector_icon_set(Evry_Selector *sel)
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
sel->o_icon = o;
|
sel->o_icon = o;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
sel->o_icon = NULL;
|
}
|
||||||
|
else if (it)
|
||||||
|
{
|
||||||
|
_evry_selector_thumb(sel, it);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sel->o_icon && s->plugin && s->plugin->icon)
|
if (!sel->o_icon && s->plugin && s->plugin->icon)
|
||||||
|
|
|
@ -735,7 +735,7 @@ _exec_border_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it)
|
||||||
static int
|
static int
|
||||||
_exec_border_action(Evry_Action *act)
|
_exec_border_action(Evry_Action *act)
|
||||||
{
|
{
|
||||||
ITEM_APP(app, act->item1);
|
/* ITEM_APP(app, act->item1); */
|
||||||
|
|
||||||
return _app_action(act->item1, act->item2);
|
return _app_action(act->item1, act->item2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue