Ephoto: Delete menus upon dismissal, and fix opening ephoto with an image path.

This commit is contained in:
Stephen okra Houston 2016-06-01 14:57:39 -05:00
parent a55e0d2097
commit 85dcb34cfc
4 changed files with 37 additions and 29 deletions

View File

@ -47,7 +47,7 @@ static void _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
Evas_Object *obj EINA_UNUSED, void *event_info); Evas_Object *obj EINA_UNUSED, void *event_info);
/*File Pane Callbacks*/ /*File Pane Callbacks*/
/*static void static void
_menu_dismissed_cb(void *data, Evas_Object *obj, _menu_dismissed_cb(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
@ -56,7 +56,7 @@ _menu_dismissed_cb(void *data, Evas_Object *obj,
db->ephoto->menu_blocking = EINA_FALSE; db->ephoto->menu_blocking = EINA_FALSE;
evas_object_del(obj); evas_object_del(obj);
elm_object_focus_set(db->main, EINA_TRUE); elm_object_focus_set(db->main, EINA_TRUE);
}*/ }
static void static void
_menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED, _menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED,
@ -648,8 +648,8 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
menu_it = elm_menu_item_add(menu, NULL, "user-trash", _("Trash"), menu_it = elm_menu_item_add(menu, NULL, "user-trash", _("Trash"),
_dir_go_trash, db); _dir_go_trash, db);
} }
/*evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb, evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb,
db);*/ db);
evas_object_show(menu); evas_object_show(menu);
} }

View File

@ -651,8 +651,7 @@ ephoto_window_add(const char *path)
eina_stringshare_replace(&ephoto->config->directory, eina_stringshare_replace(&ephoto->config->directory,
ecore_file_realpath(dir)); ecore_file_realpath(dir));
free(dir); free(dir);
ephoto_single_browser_path_pending_set(ephoto->single_browser, path); ephoto_single_browser_path_pending_set(ephoto->single_browser, path);
elm_naviframe_item_simple_promote(ephoto->pager, elm_naviframe_item_simple_promote(ephoto->pager,
ephoto->single_browser); ephoto->single_browser);
ephoto_single_browser_show_controls(ephoto); ephoto_single_browser_show_controls(ephoto);

View File

@ -150,7 +150,7 @@ _ephoto_get_file_size(const char *path)
return strdup(isize); return strdup(isize);
} }
/*static void static void
_menu_dismissed_cb(void *data, Evas_Object *obj, _menu_dismissed_cb(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
@ -158,7 +158,7 @@ _menu_dismissed_cb(void *data, Evas_Object *obj,
evas_object_del(obj); evas_object_del(obj);
elm_object_focus_set(sb->event, EINA_TRUE); elm_object_focus_set(sb->event, EINA_TRUE);
}*/ }
/*Image Viewer Callbacks*/ /*Image Viewer Callbacks*/
static Evas_Object * static Evas_Object *
@ -1273,9 +1273,15 @@ _entry_free(void *data, const Ephoto_Entry *entry)
} }
static Eina_Bool static Eina_Bool
_ephoto_single_populate_end(void *data EINA_UNUSED, int type EINA_UNUSED, _ephoto_single_populate_end(void *data, int type EINA_UNUSED,
void *event EINA_UNUSED) void *event EINA_UNUSED)
{ {
Ephoto_Single_Browser *sb = data;
if (!sb->entry)
ephoto_single_browser_entry_set(sb->main,
eina_list_nth(sb->ephoto->entries, 0));
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
@ -1442,8 +1448,8 @@ _ephoto_main_edit_menu(Ephoto_Single_Browser *sb)
_add_edit_menu_items(sb, menu); _add_edit_menu_items(sb, menu);
/*evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb, evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb,
sb);*/ sb);
evas_object_show(menu); evas_object_show(menu);
} }
@ -1664,15 +1670,23 @@ void
ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry) ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
{ {
Ephoto_Single_Browser *sb = evas_object_data_get(obj, "single_browser"); Ephoto_Single_Browser *sb = evas_object_data_get(obj, "single_browser");
char *dir;
if (sb->entry) if (sb->entry && !entry)
ephoto_entry_free_listener_del(sb->entry, _entry_free, sb); {
dir = ecore_file_dir_get(sb->entry->path);
sb->entry = entry; if (!eina_streq(sb->ephoto->config->directory, dir))
{
ephoto_entry_free_listener_del(sb->entry, _entry_free, sb);
sb->entry = entry;
}
free(dir);
}
if (entry) if (entry)
ephoto_entry_free_listener_add(entry, _entry_free, sb); {
sb->entry = entry;
ephoto_entry_free_listener_add(entry, _entry_free, sb);
}
_ephoto_single_browser_recalc(sb); _ephoto_single_browser_recalc(sb);
if (sb->edited_image_data) if (sb->edited_image_data)
{ {

View File

@ -79,7 +79,7 @@ static void _ephoto_thumb_search_start(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED); void *event_info EINA_UNUSED);
/*Common Callbacks*/ /*Common Callbacks*/
/*static void static void
_menu_dismissed_cb(void *data, Evas_Object *obj, _menu_dismissed_cb(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
@ -87,7 +87,7 @@ _menu_dismissed_cb(void *data, Evas_Object *obj,
evas_object_del(obj); evas_object_del(obj);
elm_object_focus_set(tb->main, EINA_TRUE); elm_object_focus_set(tb->main, EINA_TRUE);
}*/ }
static void static void
_menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED, _menu_empty_cb(void *data, Evas_Object *obj EINA_UNUSED,
@ -814,8 +814,8 @@ _grid_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
_grid_menu_delete_cb, tb); _grid_menu_delete_cb, tb);
} }
} }
/*evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb, evas_object_smart_callback_add(menu, "dismissed", _menu_dismissed_cb,
tb);*/ tb);
evas_object_show(menu); evas_object_show(menu);
} }
static void static void
@ -1373,19 +1373,14 @@ _ephoto_thumb_populate_end(void *data, int type EINA_UNUSED,
} }
else if (tb->ephoto->state == EPHOTO_STATE_SINGLE) else if (tb->ephoto->state == EPHOTO_STATE_SINGLE)
{ {
ephoto_single_browser_entry_set(tb->ephoto->single_browser, NULL);
if (tb->ephoto->entries) if (tb->ephoto->entries)
{ {
ephoto_single_browser_entry_set(tb->ephoto->single_browser, NULL);
ephoto_single_browser_entries_set(tb->ephoto->single_browser, ephoto_single_browser_entries_set(tb->ephoto->single_browser,
tb->ephoto->entries); tb->ephoto->entries);
ephoto_single_browser_entry_set(tb->ephoto->single_browser,
eina_list_nth(tb->ephoto->entries, 0));
} }
else else
{ ephoto_title_set(tb->ephoto, tb->ephoto->config->directory);
ephoto_single_browser_entry_set(tb->ephoto->single_browser, NULL);
ephoto_title_set(tb->ephoto, tb->ephoto->config->directory);
}
} }
tb->entries = tb->ephoto->entries; tb->entries = tb->ephoto->entries;
if (eina_list_count(tb->entries) < 1) if (eina_list_count(tb->entries) < 1)