From cd01fb813b5a7eeac6e36f8e9b12d3b591079a8f Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Wed, 26 Aug 2009 05:14:08 +0000 Subject: [PATCH] 'everything' module: enabled thumbs for selector again .. ok the bug was on my side SVN revision: 42004 --- src/modules/everything/evry.c | 122 +++++++++--------- .../everything/views/evry_plug_view_thumb.c | 40 +++--- 2 files changed, 82 insertions(+), 80 deletions(-) diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index e8bc77b4e..7b493db5d 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -786,10 +786,10 @@ _evry_selector_new(int type) static void _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->do_thumb) + e_thumb_icon_end(sel->o_thumb); + if (sel->o_thumb) + evas_object_del(sel->o_thumb); if (sel->o_icon) evas_object_del(sel->o_icon); if (sel->o_main) @@ -847,55 +847,61 @@ _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 +_evry_selector_thumb_gen(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Coord w, h; + Evry_Selector *sel = data; + + /* if (!(selector[0] == data) && + * !(selector[1] == data) && + * !(selector[2] == data)) + * return; */ + + 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); + sel->o_thumb = NULL; + + 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 _evry_selector_icon_set(Evry_Selector *sel) @@ -918,7 +924,7 @@ _evry_selector_icon_set(Evry_Selector *sel) if (it && it->plugin && it->plugin->icon_get) { - if (1) //!_evry_selector_thumb(sel, it)) + if (!_evry_selector_thumb(sel, it)) { o = it->plugin->icon_get(it->plugin, it, win->popup->evas); if (o) @@ -929,10 +935,10 @@ _evry_selector_icon_set(Evry_Selector *sel) } } } - /* else if (it) - * { - * _evry_selector_thumb(sel, it); - * } */ + else if (it) + { + _evry_selector_thumb(sel, it); + } if (!sel->o_icon && s->plugin && s->plugin->icon) { diff --git a/src/modules/everything/views/evry_plug_view_thumb.c b/src/modules/everything/views/evry_plug_view_thumb.c index 8e1365ed7..698eb5895 100644 --- a/src/modules/everything/views/evry_plug_view_thumb.c +++ b/src/modules/everything/views/evry_plug_view_thumb.c @@ -333,29 +333,26 @@ _e_smart_reconfigure_do(void *data) evas_object_show(it->frame); - if (it->selected && sd->zoom < 2) - edje_object_signal_emit(it->frame, "e,state,selected", "e"); - if (sd->update && !it->visible) edje_object_signal_emit(it->frame, "e,action,thumb,show_delayed", "e"); else if (!it->visible) edje_object_signal_emit(it->frame, "e,action,thumb,show", "e"); - if (it->get_thumb) - { - it->thumb = e_thumb_icon_add(sd->view->evas); - - if (!sd->thumb_idler) - sd->thumb_idler = ecore_idle_enterer_before_add(_thumb_idler, sd); - } it->visible = EINA_TRUE; } - if (it->visible) + if (it->selected && sd->zoom < 2) + edje_object_signal_emit(it->frame, "e,state,selected", "e"); + + evas_object_move(it->frame, xx + dx, yy + dy); + evas_object_resize(it->frame, it->w, it->h); + + if (it->get_thumb && !it->thumb) { - evas_object_move(it->frame, xx + dx, yy + dy); - evas_object_resize(it->frame, it->w, it->h); - + it->thumb = e_thumb_icon_add(sd->view->evas); + + if (!sd->thumb_idler) + sd->thumb_idler = ecore_idle_enterer_before_add(_thumb_idler, sd); } } else if (it->visible) @@ -741,15 +738,14 @@ _view_update(Evry_View *view) added = 1; v_it = _pan_item_add(v->span, p_it); - if (v_it) - { - v_it->pos = pos; + if (!v_it) continue; - if (p_it == v->state->sel_item) - { - sd->sel_item = v_it; - v_it->selected = EINA_TRUE; - } + v_it->pos = pos; + + if (p_it == v->state->sel_item) + { + sd->sel_item = v_it; + v_it->selected = EINA_TRUE; } } pos++;