Ephoto: Clean up menus, remove toolbars, work on focus, start search on type.

Screenshots:
http://www.enlightenment.org/ss/e-56feda88450023.78697698.jpg
http://www.enlightenment.org/ss/e-56fedac3d198f2.43263458.jpg
master
Stephen okra Houston 7 years ago
parent fbbf060059
commit 469ce75485
  1. 1
      src/bin/ephoto.h
  2. 3
      src/bin/ephoto_config.c
  3. 17
      src/bin/ephoto_main.c
  4. 216
      src/bin/ephoto_single_browser.c
  5. 239
      src/bin/ephoto_thumb_browser.c

@ -70,6 +70,7 @@ void ephoto_config_main(Ephoto *em);
Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_single_browser_entries_set(Evas_Object *obj, Eina_List *entries);
void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
void ephoto_single_browser_focus_set(Ephoto *ephoto);
void ephoto_single_browser_path_pending_set(Evas_Object *obj,
const char *path);
void ephoto_single_browser_path_pending_unset(Evas_Object *obj);

@ -82,8 +82,10 @@ static void
_config_close_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Evas_Object *popup = data;
Ephoto *ephoto = evas_object_data_get(popup, "ephoto");
evas_object_del(popup);
elm_object_focus_set(ephoto->pager, EINA_TRUE);
}
static void
@ -118,6 +120,7 @@ _config_save_cb(void *data, Evas_Object *obj EINA_UNUSED,
elm_object_text_get(ephoto->config->slide_trans));
evas_object_del(popup);
elm_object_focus_set(ephoto->pager, EINA_TRUE);
}
static void

@ -203,6 +203,20 @@ _resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
}
}
static void
_pager_focused(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Ephoto *ephoto = data;
if (ephoto->state == EPHOTO_STATE_THUMB)
elm_object_focus_set(ephoto->tb, EINA_TRUE);
else if (ephoto->state == EPHOTO_STATE_SINGLE)
ephoto_single_browser_focus_set(ephoto);
else
elm_object_focus_set(ephoto->sl, EINA_TRUE);
}
Evas_Object *
ephoto_window_add(const char *path)
{
@ -245,11 +259,14 @@ ephoto_window_add(const char *path)
ephoto_thumb_size_set(ephoto, ephoto->config->thumb_size);
ephoto->pager = elm_naviframe_add(ephoto->win);
elm_object_focus_allow_set(ephoto->pager, EINA_FALSE);
elm_naviframe_prev_btn_auto_pushed_set(ephoto->pager, EINA_FALSE);
evas_object_size_hint_weight_set(ephoto->pager, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set(ephoto->pager, EVAS_HINT_FILL,
EVAS_HINT_FILL);
evas_object_event_callback_add(ephoto->pager, EVAS_CALLBACK_FOCUS_IN,
_pager_focused, ephoto);
elm_win_resize_object_add(ephoto->win, ephoto->pager);
evas_object_show(ephoto->pager);

@ -51,6 +51,8 @@ static void _key_down(void *data, Evas *e EINA_UNUSED,
static void _edit_menu(Ephoto_Single_Browser *sb);
static void _back(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED);
static char *_ephoto_get_file_size(const char *path);
static void _update_bottom_bar(Ephoto_Single_Browser *sb);
static void
_viewer_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
@ -140,7 +142,7 @@ _image_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
}
static void
_scroller_mouse_up(void *data, Evas *e EINA_UNUSED,
_scroller_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
Evas_Object *obj EINA_UNUSED, void *event_info)
{
Ephoto_Single_Browser *sb = data;
@ -149,6 +151,7 @@ _scroller_mouse_up(void *data, Evas *e EINA_UNUSED,
if (ev->button == 3)
{
_edit_menu(sb);
_update_bottom_bar(sb);
}
}
@ -227,8 +230,8 @@ _viewer_add(Evas_Object *parent, const char *path, Ephoto_Single_Browser *sb)
evas_object_size_hint_align_set(v->scroller,
EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_data_set(v->scroller, "viewer", v);
evas_object_event_callback_add(v->scroller, EVAS_CALLBACK_MOUSE_UP, _scroller_mouse_up,
sb);
evas_object_event_callback_add(v->scroller, EVAS_CALLBACK_MOUSE_UP,
_scroller_mouse_up_cb, sb);
evas_object_event_callback_add(v->scroller, EVAS_CALLBACK_DEL, _viewer_del,
v);
evas_object_show(v->scroller);
@ -380,44 +383,33 @@ _viewer_zoom_fit(Evas_Object *obj)
}
static void
_create_bottom_bar(Ephoto_Single_Browser *sb)
_update_bottom_bar(Ephoto_Single_Browser *sb)
{
Evas_Object *button, *ic;
sb->botbox = elm_box_add(sb->table);
elm_box_horizontal_set(sb->botbox, EINA_TRUE);
evas_object_size_hint_weight_set(sb->botbox, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_fill_set(sb->botbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(sb->table, sb->botbox, 0, 2, 4, 1);
evas_object_show(sb->botbox);
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
char image_info[PATH_MAX], *tmp;
Evas_Coord w, h;
ic = elm_icon_add(sb->botbox);
elm_icon_order_lookup_set(ic, ELM_ICON_LOOKUP_FDO_THEME);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_icon_standard_set(ic, "go-previous");
if (sb->editing)
return;
button = elm_button_add(sb->botbox);
elm_object_text_set(button, _("Back"));
elm_object_part_content_set(button, "icon", ic);
evas_object_smart_callback_add(button, "clicked", _back, sb);
elm_box_pack_end(sb->botbox, button);
evas_object_show(button);
evas_object_image_size_get(elm_image_object_get(v->image),
&w, &h);
tmp = _ephoto_get_file_size(sb->entry->path);
snprintf(image_info, PATH_MAX,
"<b>%s:</b> %s <b>%s:</b> %dx%d <b>%s:</b> %s",
_("Type"), efreet_mime_type_get(sb->entry->path),
_("Resolution"), w, h, _("File Size"), tmp);
free(tmp);
sb->infolabel = elm_label_add(sb->botbox);
elm_label_line_wrap_set(sb->infolabel, ELM_WRAP_NONE);
evas_object_size_hint_weight_set(sb->infolabel, EVAS_HINT_EXPAND,
EVAS_HINT_FILL);
evas_object_size_hint_align_set(sb->infolabel, EVAS_HINT_FILL,
EVAS_HINT_FILL);
elm_box_pack_end(sb->botbox, sb->infolabel);
evas_object_show(sb->infolabel);
elm_object_text_set(sb->infolabel, image_info);
elm_notify_timeout_set(sb->botbox, 5);
evas_object_show(sb->botbox);
}
static void
_orient_apply(Ephoto_Single_Browser *sb)
{
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
char image_info[PATH_MAX];
int w, h;
switch (sb->orient)
@ -468,16 +460,7 @@ _orient_apply(Ephoto_Single_Browser *sb)
evas_object_size_hint_max_set(v->image, w, h);
elm_table_pack(v->table, v->image, 0, 0, 1, 1);
elm_object_content_set(v->scroller, v->table);
evas_object_del(sb->infolabel);
evas_object_del(sb->botbox);
_create_bottom_bar(sb);
snprintf(image_info, PATH_MAX,
"<b>%s:</b> %s <b>%s:</b> %dx%d <b>%s:</b> %s", _("Type"),
efreet_mime_type_get(sb->entry->path), _("Resolution"), w, h,
_("File Size"), _("N/A"));
elm_object_text_set(sb->infolabel, image_info);
if (v->fit)
_viewer_zoom_fit_apply(v);
else
@ -738,10 +721,6 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb)
{
evas_object_del(sb->viewer);
sb->viewer = NULL;
evas_object_del(sb->infolabel);
sb->infolabel = NULL;
evas_object_del(sb->botbox);
sb->botbox = NULL;
}
if (sb->nolabel)
{
@ -752,32 +731,14 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb)
{
const char *bname = ecore_file_file_get(sb->entry->path);
elm_table_clear(sb->table, EINA_FALSE);
sb->viewer = _viewer_add(sb->main, sb->entry->path, sb);
if (sb->viewer)
{
char image_info[PATH_MAX], *tmp;
Evas_Coord w, h;
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
elm_table_pack(sb->table, sb->viewer, 0, 1, 4, 1);
elm_box_pack_start(sb->mhbox, sb->viewer);
evas_object_show(sb->viewer);
evas_object_event_callback_add(sb->viewer,
EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel, sb);
evas_object_image_size_get(elm_image_object_get(v->image),
&w, &h);
tmp = _ephoto_get_file_size(sb->entry->path);
snprintf(image_info, PATH_MAX,
"<b>%s:</b> %s <b>%s:</b> %dx%d <b>%s:</b> %s",
_("Type"), efreet_mime_type_get(sb->entry->path),
_("Resolution"), w, h, _("File Size"), tmp);
free(tmp);
_create_bottom_bar(sb);
elm_object_text_set(sb->infolabel, image_info);
_update_bottom_bar(sb);
ephoto_title_set(sb->ephoto, bname);
if (!_ephoto_file_image_can_save(strrchr(bname, '.')+1))
@ -787,7 +748,7 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb)
}
else
{
sb->nolabel = elm_label_add(sb->table);
sb->nolabel = elm_label_add(sb->mhbox);
elm_label_line_wrap_set(sb->nolabel, ELM_WRAP_WORD);
elm_object_text_set(sb->nolabel,
_("This image does not exist or is corrupted!"));
@ -795,7 +756,7 @@ _ephoto_single_browser_recalc(Ephoto_Single_Browser *sb)
EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(sb->nolabel, EVAS_HINT_FILL,
EVAS_HINT_FILL);
elm_table_pack(sb->table, sb->nolabel, 0, 1, 4, 1);
elm_box_pack_start(sb->mhbox, sb->nolabel);
evas_object_show(sb->nolabel);
ephoto_title_set(sb->ephoto, _("Bad Image"));
}
@ -1153,6 +1114,8 @@ _crop_image(void *data, Evas_Object *obj EINA_UNUSED,
if (sb->viewer)
{
sb->editing = EINA_TRUE;
if (sb->botbox)
evas_object_hide(sb->botbox);
sb->cropping = EINA_TRUE;
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
@ -1169,7 +1132,9 @@ _go_bcg(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
if (sb->viewer)
{
sb->editing = EINA_TRUE;
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
if (sb->botbox)
evas_object_hide(sb->botbox);
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
ephoto_bcg_add(sb->main, sb->mhbox, v->image);
}
@ -1183,6 +1148,8 @@ _go_hsv(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
if (sb->viewer)
{
sb->editing = EINA_TRUE;
if (sb->botbox)
evas_object_hide(sb->botbox);
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
ephoto_hsv_add(sb->main, sb->mhbox, v->image);
@ -1198,6 +1165,8 @@ _go_color(void *data, Evas_Object *obj EINA_UNUSED,
if (sb->viewer)
{
sb->editing = EINA_TRUE;
if (sb->botbox)
evas_object_hide(sb->botbox);
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
ephoto_color_add(sb->main, sb->mhbox, v->image);
@ -1213,6 +1182,8 @@ _go_auto_eq(void *data, Evas_Object *obj EINA_UNUSED,
if (sb->viewer)
{
sb->editing = EINA_TRUE;
if (sb->botbox)
evas_object_hide(sb->botbox);
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
ephoto_filter_histogram_eq(sb->main, v->image);
@ -1228,6 +1199,8 @@ _go_blur(void *data, Evas_Object *obj EINA_UNUSED,
if (sb->viewer)
{
sb->editing = EINA_TRUE;
if (sb->botbox)
evas_object_hide(sb->botbox);
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
ephoto_filter_blur(sb->main, v->image);
@ -1243,6 +1216,8 @@ _go_sharpen(void *data, Evas_Object *obj EINA_UNUSED,
if (sb->viewer)
{
sb->editing = EINA_TRUE;
if (sb->botbox)
evas_object_hide(sb->botbox);
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
ephoto_filter_sharpen(sb->main, v->image);
@ -1258,7 +1233,9 @@ _go_black_and_white(void *data, Evas_Object *obj EINA_UNUSED,
if (sb->viewer)
{
sb->editing = EINA_TRUE;
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
if (sb->botbox)
evas_object_hide(sb->botbox);
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
ephoto_filter_black_and_white(sb->main, v->image);
}
@ -1273,6 +1250,8 @@ _go_old_photo(void *data, Evas_Object *obj EINA_UNUSED,
if (sb->viewer)
{
sb->editing = EINA_TRUE;
if (sb->botbox)
evas_object_hide(sb->botbox);
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
ephoto_filter_old_photo(sb->main, v->image);
@ -1292,6 +1271,8 @@ _slideshow(void *data, Evas_Object *obj EINA_UNUSED,
evas_object_del(sb->event);
sb->event = NULL;
}
if (sb->botbox)
evas_object_hide(sb->botbox);
evas_object_smart_callback_call(sb->main, "slideshow", sb->entry);
}
}
@ -1306,6 +1287,8 @@ _back(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
evas_object_del(sb->event);
sb->event = NULL;
}
if (sb->botbox)
evas_object_hide(sb->botbox);
evas_object_smart_callback_call(sb->main, "back", sb->entry);
}
@ -1334,6 +1317,9 @@ _add_edit_menu_items(Ephoto_Single_Browser *sb, Evas_Object *menu)
{
Evas_Object *menu_it, *menu_itt;
elm_menu_item_add(menu, NULL, "go-previous", _("Back"), _back, sb);
elm_menu_item_separator_add(menu, NULL);
menu_it =
elm_menu_item_add(menu, NULL, "system-file-manager", _("File"), NULL, NULL);
elm_menu_item_add(menu, menu_it, "edit-undo", _("Reset"), _reset_image, sb);
@ -1344,8 +1330,6 @@ _add_edit_menu_items(Ephoto_Single_Browser *sb, Evas_Object *menu)
sb);
elm_menu_item_add(menu, menu_it, "edit-delete", _("Delete"),
_delete_image, sb);
elm_menu_item_separator_add(menu, NULL);
menu_it =
elm_menu_item_add(menu, NULL, "document-properties", _("Edit"), NULL, NULL);
@ -1353,7 +1337,7 @@ _add_edit_menu_items(Ephoto_Single_Browser *sb, Evas_Object *menu)
elm_menu_item_add(menu, menu_it, "document-properties", _("Transform"),
NULL, NULL);
elm_menu_item_add(menu, menu_itt, "edit-cut", _("Crop"), _crop_image, sb);
elm_menu_item_separator_add(menu, menu_it);
elm_menu_item_separator_add(menu, menu_itt);
elm_menu_item_add(menu, menu_itt, "object-rotate-left", _("Rotate Left"),
_go_rotate_counterclock, sb);
elm_menu_item_add(menu, menu_itt, "object-rotate-right", _("Rotate Right"),
@ -1407,6 +1391,7 @@ _add_edit_menu_items(Ephoto_Single_Browser *sb, Evas_Object *menu)
_zoom_fit_cb, sb);
elm_menu_item_add(menu, menu_itt, "zoom-original", _("Zoom 1:1"),
_zoom_1_cb, sb);
elm_menu_item_separator_add(menu, menu_it);
elm_menu_item_add(menu, menu_it, "media-playback-start", _("Slideshow"),
_slideshow, sb);
@ -1494,6 +1479,7 @@ _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
evas_object_del(sb->event);
sb->event = NULL;
}
evas_object_hide(sb->botbox);
evas_object_smart_callback_call(sb->main, "back", sb->entry);
}
else if (!strcmp(k, "Left") && !sb->editing)
@ -1517,6 +1503,7 @@ _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
evas_object_del(sb->event);
sb->event = NULL;
}
evas_object_hide(sb->botbox);
evas_object_smart_callback_call(sb->main, "slideshow", sb->entry);
}
}
@ -1524,22 +1511,6 @@ _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
{
Evas_Object *win = sb->ephoto->win;
if (!elm_win_fullscreen_get(sb->ephoto->win))
{
if (sb->ephoto->config->tool_hide)
{
evas_object_hide(sb->botbox);
elm_table_unpack(sb->table, sb->botbox);
}
}
else
{
if (!evas_object_visible_get(sb->botbox))
{
elm_table_pack(sb->table, sb->botbox, 0, 2, 4, 1);
evas_object_show(sb->botbox);
}
}
elm_win_fullscreen_set(win, !elm_win_fullscreen_get(win));
}
}
@ -1620,7 +1591,10 @@ _main_focused(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
if (sb->ephoto->state == EPHOTO_STATE_SINGLE)
{
if (sb->event)
elm_object_focus_set(sb->event, EINA_TRUE);
{
elm_object_focus_set(sb->event, EINA_TRUE);
evas_object_raise(sb->event);
}
}
}
@ -1643,6 +1617,8 @@ ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent)
elm_box_horizontal_set(sb->main, EINA_FALSE);
elm_object_tree_focus_allow_set(sb->main, EINA_FALSE);
evas_object_event_callback_add(sb->main, EVAS_CALLBACK_DEL, _main_del, sb);
evas_object_event_callback_add(sb->main, EVAS_CALLBACK_KEY_DOWN, _key_down,
sb);
evas_object_event_callback_add(sb->ephoto->win, EVAS_CALLBACK_FOCUS_IN,
_main_focused, sb);
evas_object_size_hint_weight_set(sb->main, EVAS_HINT_EXPAND,
@ -1658,12 +1634,20 @@ ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent)
elm_box_pack_end(sb->main, sb->mhbox);
evas_object_show(sb->mhbox);
sb->table = elm_table_add(sb->mhbox);
evas_object_size_hint_weight_set(sb->table, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(sb->table, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(sb->mhbox, sb->table);
evas_object_show(sb->table);
sb->botbox = elm_notify_add(sb->ephoto->win);
elm_notify_align_set(sb->botbox, 0.5, 1.0);
elm_notify_timeout_set(sb->botbox, 5);
evas_object_size_hint_weight_set(sb->botbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set(sb->botbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
sb->infolabel = elm_label_add(sb->botbox);
elm_label_line_wrap_set(sb->infolabel, ELM_WRAP_NONE);
evas_object_size_hint_weight_set(sb->infolabel, EVAS_HINT_EXPAND,
EVAS_HINT_FILL);
evas_object_size_hint_align_set(sb->infolabel, EVAS_HINT_FILL,
EVAS_HINT_FILL);
elm_object_content_set(sb->botbox, sb->infolabel);
evas_object_show(sb->infolabel);
sb->handlers =
eina_list_append(sb->handlers,
@ -1715,22 +1699,6 @@ ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
}
if (sb->viewer)
_zoom_fit(sb);
if (elm_win_fullscreen_get(sb->ephoto->win))
{
if (sb->ephoto->config->tool_hide)
{
evas_object_hide(sb->botbox);
elm_table_unpack(sb->table, sb->botbox);
}
}
else
{
if (!evas_object_visible_get(sb->botbox))
{
elm_table_pack(sb->table, sb->botbox, 0, 2, 4, 1);
evas_object_show(sb->botbox);
}
}
if (sb->event)
{
evas_object_del(sb->event);
@ -1747,6 +1715,19 @@ ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
elm_object_focus_set(sb->event, EINA_TRUE);
}
void
ephoto_single_browser_focus_set(Ephoto *ephoto)
{
Ephoto_Single_Browser *sb = evas_object_data_get
(ephoto->single_browser, "single_browser");
if (sb->event)
{
evas_object_raise(sb->event);
elm_object_focus_set(sb->event, EINA_TRUE);
}
}
void
ephoto_single_browser_path_pending_set(Evas_Object *obj, const char *path)
{
@ -1800,18 +1781,7 @@ ephoto_single_browser_image_data_update(Evas_Object *main, Evas_Object *image,
if (finished)
{
char image_info[PATH_MAX];
evas_object_del(sb->infolabel);
evas_object_del(sb->botbox);
snprintf(image_info, PATH_MAX,
"<b>%s:</b> %s <b>%s:</b> %dx%d <b>%s:</b> %s",
_("Type"), efreet_mime_type_get(sb->entry->path),
_("Resolution"), w, h, _("File Size"), _("N/A"));
_create_bottom_bar(sb);
elm_object_text_set(sb->infolabel, image_info);
_update_bottom_bar(sb);
sb->edited_image_data = image_data;
sb->ew = w;
sb->eh = h;

@ -32,7 +32,6 @@ struct _Ephoto_Thumb_Browser
Evas_Object *direntry;
Evas_Object *search;
Evas_Object *hover;
Evas_Object *progress;
Elm_Object_Item *dir_current;
Elm_Object_Item *last_sel;
Ephoto_Sort sort;
@ -425,7 +424,6 @@ _sort_alpha_asc(void *data, Evas_Object *obj EINA_UNUSED,
tb->sort = EPHOTO_SORT_ALPHABETICAL_ASCENDING;
tb->thumbs_only = 1;
tb->dirs_only = 0;
elm_object_text_set(tb->hover, _("Alphabetical Ascending"));
ic = elm_icon_add(tb->hover);
elm_icon_standard_set(ic, "view-sort-ascending");
elm_object_part_content_set(tb->hover, "icon", ic);
@ -444,7 +442,6 @@ _sort_alpha_desc(void *data, Evas_Object *obj EINA_UNUSED,
tb->sort = EPHOTO_SORT_ALPHABETICAL_DESCENDING;
tb->thumbs_only = 1;
tb->dirs_only = 0;
elm_object_text_set(tb->hover, _("Alphabetical Descending"));
ic = elm_icon_add(tb->hover);
elm_icon_standard_set(ic, "view-sort-descending");
elm_object_part_content_set(tb->hover, "icon", ic);
@ -463,7 +460,6 @@ _sort_mod_asc(void *data, Evas_Object *obj EINA_UNUSED,
tb->sort = EPHOTO_SORT_MODTIME_ASCENDING;
tb->thumbs_only = 1;
tb->dirs_only = 0;
elm_object_text_set(tb->hover, _("Modification Time Ascending"));
ic = elm_icon_add(tb->hover);
elm_icon_standard_set(ic, "view-sort-ascending");
elm_object_part_content_set(tb->hover, "icon", ic);
@ -482,7 +478,6 @@ _sort_mod_desc(void *data, Evas_Object *obj EINA_UNUSED,
tb->sort = EPHOTO_SORT_MODTIME_DESCENDING;
tb->thumbs_only = 1;
tb->dirs_only = 0;
elm_object_text_set(tb->hover, _("Modification Time Descending"));
ic = elm_icon_add(tb->hover);
elm_icon_standard_set(ic, "view-sort-descending");
elm_object_part_content_set(tb->hover, "icon", ic);
@ -640,8 +635,6 @@ _todo_items_process(void *data)
return EINA_TRUE;
tb->animator.todo_items = NULL;
tb->processing = 0;
elm_progressbar_pulse(tb->progress, EINA_FALSE);
evas_object_hide(tb->progress);
return EINA_FALSE;
}
if ((tb->ls) && (eina_list_count(tb->todo_items) < TODO_ITEM_MIN_BATCH))
@ -1049,7 +1042,7 @@ _search(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Ephoto_Thumb_Browser *tb = data;
Evas_Object *hbox, *search, *ic, *but;
Evas_Object *hbox, *search;
if (tb->processing)
return;
@ -1085,34 +1078,6 @@ _search(void *data, Evas_Object *obj EINA_UNUSED,
evas_object_show(search);
tb->search = search;
ic = elm_icon_add(hbox);
elm_icon_order_lookup_set(ic, ELM_ICON_LOOKUP_FDO_THEME);
elm_icon_standard_set(ic, "system-search");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
but = elm_button_add(hbox);
elm_object_part_content_set(but, "icon", ic);
elm_object_text_set(but, _("Search"));
evas_object_size_hint_weight_set(but, 0.0, 0.0);
evas_object_size_hint_align_set(but, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(but, "clicked", _ephoto_search_go, search);
elm_box_pack_end(hbox, but);
evas_object_show(but);
ic = elm_icon_add(hbox);
elm_icon_order_lookup_set(ic, ELM_ICON_LOOKUP_FDO_THEME);
elm_icon_standard_set(ic, "window-close");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
but = elm_button_add(hbox);
elm_object_part_content_set(but, "icon", ic);
elm_object_text_set(but, _("Cancel"));
evas_object_size_hint_weight_set(but, 0.0, 0.0);
evas_object_size_hint_align_set(but, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(but, "clicked",
_ephoto_search_cancel, search);
elm_box_pack_end(hbox, but);
evas_object_show(but);
elm_object_focus_set(search, EINA_TRUE);
}
@ -1174,7 +1139,7 @@ _settings(void *data, Evas_Object *obj EINA_UNUSED,
}
static void
_ephoto_dir_show_folders(void *data, Evas_Object *obj EINA_UNUSED,
_ephoto_dir_show_folders(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED)
{
Ephoto_Thumb_Browser *tb = data;
@ -1186,10 +1151,12 @@ _ephoto_dir_show_folders(void *data, Evas_Object *obj EINA_UNUSED,
elm_table_unpack(tb->table, tb->gridbox);
elm_table_pack(tb->table, tb->gridbox, 1, 0, 4, 1);
tb->ephoto->config->fsel_hide = 0;
evas_object_smart_callback_del(obj, "changed", _ephoto_dir_show_folders);
evas_object_smart_callback_add(obj, "changed", _ephoto_dir_hide_folders, tb);
}
static void
_ephoto_dir_hide_folders(void *data, Evas_Object *obj EINA_UNUSED,
_ephoto_dir_hide_folders(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED)
{
Ephoto_Thumb_Browser *tb = data;
@ -1202,6 +1169,8 @@ _ephoto_dir_hide_folders(void *data, Evas_Object *obj EINA_UNUSED,
elm_table_pack(tb->table, tb->gridbox, 0, 0, 5, 1);
elm_object_focus_set(tb->main, EINA_TRUE);
tb->ephoto->config->fsel_hide = 1;
evas_object_smart_callback_del(obj, "changed", _ephoto_dir_hide_folders);
evas_object_smart_callback_add(obj, "changed", _ephoto_dir_show_folders, tb);
}
static char *
@ -1836,16 +1805,9 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
elm_genlist_item_selected_set(item, EINA_TRUE);
menu = elm_menu_add(tb->ephoto->win);
elm_menu_move(menu, x, y);
menu_it = elm_menu_item_add(menu, NULL, "system-file-manager", _("File"),
NULL, NULL);
if (!tb->ephoto->config->fsel_hide)
elm_menu_item_add(menu, menu_it, "system-file-manager", _("Hide Folders"),
_ephoto_dir_hide_folders, tb);
else
elm_menu_item_add(menu, menu_it, "system-file-manager", _("Show Folders"),
_ephoto_dir_show_folders, tb);
menu_it = elm_menu_item_add(menu, NULL, "document-properties", _("Edit"),
NULL, NULL);
elm_menu_item_separator_add(menu, NULL);
if (strcmp(tb->ephoto->config->directory, trash))
{
elm_menu_item_add(menu, menu_it, "folder-new", _("New Folder"),
@ -1868,16 +1830,23 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
elm_menu_item_add(menu, menu_it, "edit-delete", _("Empty Trash"),
_grid_menu_empty_cb, tb);
}
else if (!strcmp(tb->ephoto->config->directory, trash) &&
elm_genlist_first_item_get(tb->fsel))
{
elm_menu_item_add(menu, menu_it, "edit-delete", _("Empty Trash"),
_grid_menu_empty_cb, tb);
}
if (strcmp(tb->ephoto->config->directory, trash) && item)
{
elm_menu_item_add(menu, menu_it, "edit-delete", _("Delete"),
_fsel_menu_delete_cb, tb);
}
menu_it = elm_menu_item_add(menu, NULL, "document-properties", _("View"),
NULL, NULL);
elm_menu_item_add(menu, menu_it, "media-playback-start", _("Slideshow"),
_slideshow, tb);
elm_menu_item_separator_add(menu, NULL);
if (strcmp(tb->ephoto->config->directory, trash) &&
elm_gengrid_first_item_get(tb->grid))
{
elm_menu_item_add(menu, NULL, "media-playback-start", _("Slideshow"),
_slideshow, tb);
}
elm_menu_item_add(menu, NULL, "preferences-system", _("Settings"),
_settings, tb);
evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb,
@ -1980,18 +1949,11 @@ _grid_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
elm_gengrid_item_selected_set(item, EINA_TRUE);
menu = elm_menu_add(tb->ephoto->win);
elm_menu_move(menu, x, y);
menu_it = elm_menu_item_add(menu, NULL, "system-file-manager", _("File"),
NULL, NULL);
if (!tb->ephoto->config->fsel_hide)
elm_menu_item_add(menu, menu_it, "system-file-manager", _("Hide Folders"),
_ephoto_dir_hide_folders, tb);
else
elm_menu_item_add(menu, menu_it, "system-file-manager", _("Show Folders"),
_ephoto_dir_show_folders, tb);
if (elm_gengrid_first_item_get(tb->grid))
{
menu_it = elm_menu_item_add(menu, NULL, "document-properties", _("Edit"),
NULL, NULL);
elm_menu_item_separator_add(menu, NULL);
elm_menu_item_add(menu, menu_it, "system-search", _("Search"),
_search, tb);
elm_menu_item_add(menu, menu_it, "edit-select-all", _("Select All"),
@ -2030,19 +1992,13 @@ _grid_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
else
{
if (elm_gengrid_first_item_get(tb->grid))
elm_menu_item_add(menu, menu_it, "edit-delete", _("Delete"),
{
elm_menu_item_add(menu, menu_it, "edit-delete", _("Delete"),
_grid_menu_delete_cb, tb);
elm_menu_item_add(menu, NULL, "media-playback-start",
_("Slideshow"), _slideshow, tb);
}
}
menu_it = elm_menu_item_add(menu, NULL, "document-properties", _("View"),
NULL, NULL);
elm_menu_item_add(menu, menu_it, "zoom-in", _("Zoom In"),
_zoom_in, tb);
elm_menu_item_add(menu, menu_it, "zoom-out", _("Zoom Out"),
_zoom_out, tb);
elm_menu_item_add(menu, menu_it, "media-playback-start", _("Slideshow"),
_slideshow, tb);
elm_menu_item_separator_add(menu, NULL);
elm_menu_item_add(menu, NULL, "preferences-system", _("Settings"),
_settings, tb);
evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb,
@ -2143,7 +2099,9 @@ _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
tb->ephoto->searchentries = NULL;
}
if (entry)
evas_object_smart_callback_call(tb->main, "view", entry);
{
evas_object_smart_callback_call(tb->main, "view", entry);
}
}
else if (!strcmp(k, "c"))
{
@ -2253,7 +2211,27 @@ _key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
}
else if (!strcmp(k, "Escape"))
{
_grid_menu_clear_cb(tb, NULL, NULL);
if (tb->searching)
_ephoto_search_cancel(tb->search, NULL, NULL);
else
_grid_menu_clear_cb(tb, NULL, NULL);
}
else if (ev->compose && (((ev->compose[0] != '\\')
&& (ev->compose[0] >= ' ')) || ev->compose[1]))
{
if (!tb->searching)
{
_search(tb, NULL, NULL);
elm_entry_entry_append(tb->search, ev->compose);
elm_entry_cursor_end_set(tb->search);
}
else if (!elm_object_focus_get(tb->search))
{
elm_object_focus_set(tb->search, EINA_TRUE);
elm_entry_entry_append(tb->search, ev->compose);
elm_entry_cursor_end_set(tb->search);
}
_ephoto_search_go(tb->search, NULL, NULL);
}
if (selected)
eina_list_free(selected);
@ -2302,8 +2280,6 @@ _ephoto_thumb_populate_start(void *data, int type EINA_UNUSED,
evas_object_smart_callback_call(tb->main, "changed,directory", NULL);
evas_object_show(tb->progress);
elm_progressbar_pulse(tb->progress, EINA_TRUE);
tb->animator.processed = 0;
tb->animator.count = 0;
if (tb->ephoto->selentries)
@ -2339,11 +2315,6 @@ _ephoto_thumb_populate_end(void *data, int type EINA_UNUSED,
tb->totimages = 0;
tb->totsize = 0;
}
if (tb->animator.processed == tb->animator.count)
{
elm_progressbar_pulse(tb->progress, EINA_FALSE);
evas_object_hide(tb->progress);
}
_update_info_label(tb);
tb->dirs_only = 0;
tb->thumbs_only = 0;
@ -2586,8 +2557,9 @@ Evas_Object *
ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
{
Evas_Object *box = elm_box_add(parent);
Evas_Object *icon, *hbox, *but, *ic, *tab;
Evas_Object *hbox, *but, *ic;
Ephoto_Thumb_Browser *tb;
int ret;
EINA_SAFETY_ON_NULL_RETURN_VAL(box, NULL);
@ -2636,7 +2608,7 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
evas_object_show(tb->table);
tb->leftbox = elm_box_add(tb->table);
evas_object_size_hint_weight_set(tb->leftbox, 0.1, EVAS_HINT_EXPAND);
evas_object_size_hint_weight_set(tb->leftbox, 0.2, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(tb->leftbox,
EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -2783,48 +2755,93 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
_zoom_set(tb, tb->ephoto->config->thumb_size);
tab = elm_table_add(tb->table);
evas_object_size_hint_weight_set(tab, EVAS_HINT_EXPAND,
EVAS_HINT_FILL);
evas_object_size_hint_align_set(tab, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(tb->table, tab, 0, 1, 4, 1);
evas_object_show(tab);
tb->progress = elm_progressbar_add(tb->table);
elm_progressbar_pulse_set(tb->progress, EINA_TRUE);
elm_object_text_set(tb->progress, _("Loading: "));
evas_object_size_hint_weight_set(tb->progress, 0.1, 0.0);
evas_object_size_hint_align_set(tb->progress, EVAS_HINT_FILL, 0.5);
elm_table_pack(tab, tb->progress, 0, 0, 1, 1);
evas_object_hide(tb->progress);
tb->infolabel = elm_label_add(tb->table);
hbox = elm_box_add(tb->main);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(tb->main, hbox);
evas_object_show(hbox);
but = elm_check_add(hbox);
elm_object_style_set(but, "toggle");
elm_object_part_text_set(but, "on", _("Show Folders"));
elm_object_part_text_set(but, "off", _("Hide Folders"));
if (!tb->ephoto->config->fsel_hide)
{
elm_check_state_set(but, EINA_FALSE);
evas_object_smart_callback_add(but, "changed", _ephoto_dir_hide_folders, tb);
}
else
{
elm_check_state_set(but, EINA_TRUE);
evas_object_smart_callback_add(but, "changed", _ephoto_dir_show_folders, tb);
}
elm_box_pack_end(hbox, but);
evas_object_show(but);
tb->infolabel = elm_label_add(hbox);
elm_label_line_wrap_set(tb->infolabel, ELM_WRAP_WORD);
elm_object_text_set(tb->infolabel, "Info Label");
evas_object_size_hint_weight_set(tb->infolabel, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(tb->infolabel, EVAS_HINT_FILL,
EVAS_HINT_FILL);
evas_object_size_hint_aspect_set(tb->infolabel,
EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_table_pack(tab, tb->infolabel, 1, 0, 3, 1);
evas_object_size_hint_aspect_set(tb->infolabel, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
elm_box_pack_end(hbox, tb->infolabel);
evas_object_show(tb->infolabel);
tb->hover = elm_hoversel_add(tb->table);
ic = elm_icon_add(hbox);
evas_object_size_hint_min_set(ic, 20, 20);
elm_icon_order_lookup_set(ic, ELM_ICON_LOOKUP_FDO_THEME);
ret = elm_icon_standard_set(ic, "zoom-in");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
but = elm_button_add(hbox);
if (!ret)
elm_object_text_set(but, _("Zoom In"));
else
{
elm_object_part_content_set(but, "icon", ic);
elm_object_tooltip_text_set(but, _("Zoom In"));
elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_CENTER);
}
evas_object_smart_callback_add(but, "clicked", _zoom_in, tb);
elm_box_pack_end(hbox, but);
evas_object_show(but);
ic = elm_icon_add(hbox);
evas_object_size_hint_min_set(ic, 20, 20);
elm_icon_order_lookup_set(ic, ELM_ICON_LOOKUP_FDO_THEME);
elm_icon_standard_set(ic, "zoom-out");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
but = elm_button_add(hbox);
if (!ret)
elm_object_text_set(but, _("Zoom Out"));
else
{
elm_object_part_content_set(but, "icon", ic);
elm_object_tooltip_text_set(but, _("Zoom Out"));
elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_CENTER);
}
evas_object_smart_callback_add(but, "clicked", _zoom_out, tb);
elm_box_pack_end(hbox, but);
evas_object_show(but);
tb->hover = elm_hoversel_add(hbox);
elm_hoversel_hover_parent_set(tb->hover, tb->ephoto->win);
elm_hoversel_item_add(tb->hover, _("Alphabetical Ascending"),
elm_hoversel_item_add(tb->hover, _("Alphabetical Ascending"),
"view-sort-ascending", ELM_ICON_STANDARD, _sort_alpha_asc, tb);
elm_hoversel_item_add(tb->hover, _("Alphabetical Descending"),
elm_hoversel_item_add(tb->hover, _("Alphabetical Descending"),
"view-sort-descending", ELM_ICON_STANDARD, _sort_alpha_desc, tb);
elm_hoversel_item_add(tb->hover, _("Modification Time Ascending"),
elm_hoversel_item_add(tb->hover, _("Modification Time Ascending"),
"view-sort-ascending", ELM_ICON_STANDARD, _sort_mod_asc, tb);
elm_hoversel_item_add(tb->hover, _("Modification Time Descending"),
elm_hoversel_item_add(tb->hover, _("Modification Time Descending"),
"view-sort-descending", ELM_ICON_STANDARD, _sort_mod_desc, tb);
elm_object_text_set(tb->hover, _("Alphabetical Ascending"));
icon = elm_icon_add(tb->hover);
elm_icon_standard_set(icon, "view-sort-ascending");
elm_object_part_content_set(tb->hover, "icon", icon);
evas_object_show(icon);
elm_table_pack(tb->table, tb->hover, 4, 1, 1, 1);
elm_object_text_set(tb->hover, _("Sort"));
ic = elm_icon_add(tb->hover);
evas_object_size_hint_min_set(ic, 20, 20);
elm_icon_standard_set(ic, "view-sort-ascending");
elm_object_part_content_set(tb->hover, "icon", ic);
evas_object_show(ic);
elm_box_pack_end(hbox, tb->hover);
evas_object_show(tb->hover);
tb->handlers =

Loading…
Cancel
Save