From c421929c547e98fcd9b925cb42c85a7ecd38c8c0 Mon Sep 17 00:00:00 2001 From: Stephen okra Houston Date: Wed, 20 Jan 2016 16:46:49 -0600 Subject: [PATCH] Ephoto: Use ecore_file_dir_get consistently instead of dirname and ecore_file_dir_get inconsistently. --- src/bin/ephoto_main.c | 6 +++--- src/bin/ephoto_single_browser.c | 37 +++++++++++++++++++-------------- src/bin/ephoto_thumb_browser.c | 20 +++++++++--------- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index a7ff653..163eefe 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -469,7 +469,7 @@ _monitor_created(void *data, int type EINA_UNUSED, void *event) char file[PATH_MAX], dir[PATH_MAX]; snprintf(file, PATH_MAX, "%s", ev->filename); - snprintf(dir, PATH_MAX, "%s", dirname(file)); + snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file)); if (strcmp(ephoto->config->directory, dir)) return ECORE_CALLBACK_PASS_ON; @@ -521,7 +521,7 @@ _monitor_deleted(void *data, int type EINA_UNUSED, void *event) char file[PATH_MAX], dir[PATH_MAX]; snprintf(file, PATH_MAX, "%s", ev->filename); - snprintf(dir, PATH_MAX, "%s", dirname(file)); + snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file)); if (strcmp(ephoto->config->directory, dir)) return ECORE_CALLBACK_PASS_ON; @@ -552,7 +552,7 @@ _monitor_modified(void *data, int type EINA_UNUSED, void *event) char file[PATH_MAX], dir[PATH_MAX]; snprintf(file, PATH_MAX, "%s", ev->filename); - snprintf(dir, PATH_MAX, "%s", dirname(file)); + snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file)); if (strcmp(ephoto->config->directory, dir)) return ECORE_CALLBACK_PASS_ON; diff --git a/src/bin/ephoto_single_browser.c b/src/bin/ephoto_single_browser.c index 9c913e0..23fc22b 100644 --- a/src/bin/ephoto_single_browser.c +++ b/src/bin/ephoto_single_browser.c @@ -1200,15 +1200,17 @@ _save_image_as_overwrite(void *data, Evas_Object *obj EINA_UNUSED, { char *dir = ecore_file_dir_get(file); - ephoto_thumb_browser_fsel_clear(sb->ephoto); - ephoto_directory_set(sb->ephoto, dir, NULL, EINA_FALSE, EINA_FALSE); - ephoto_thumb_browser_top_dir_set(sb->ephoto, - sb->ephoto->config->directory); - free(dir); - ephoto_single_browser_path_pending_set(sb->ephoto->single_browser, - file); + if (strcmp(dir, sb->ephoto->config->directory)) + { + ephoto_thumb_browser_fsel_clear(sb->ephoto); + ephoto_directory_set(sb->ephoto, dir, NULL, EINA_FALSE, EINA_FALSE); + ephoto_thumb_browser_top_dir_set(sb->ephoto, + sb->ephoto->config->directory); + free(dir); + ephoto_single_browser_path_pending_set(sb->ephoto->single_browser, + file); + } } - ephoto_single_browser_entry_set(sb->main, sb->entry); evas_object_del(popup); if (sb->event) { @@ -1309,14 +1311,17 @@ _save_image_as_done(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) { char *dir = ecore_file_dir_get(buf); - ephoto_thumb_browser_fsel_clear(sb->ephoto); - ephoto_directory_set(sb->ephoto, dir, NULL, - EINA_FALSE, EINA_FALSE); - ephoto_thumb_browser_top_dir_set(sb->ephoto, - sb->ephoto->config->directory); - free(dir); - ephoto_single_browser_path_pending_set(sb->ephoto-> - single_browser, buf); + if (!strcmp(dir, sb->ephoto->config->directory)) + { + ephoto_thumb_browser_fsel_clear(sb->ephoto); + ephoto_directory_set(sb->ephoto, dir, NULL, + EINA_FALSE, EINA_FALSE); + ephoto_thumb_browser_top_dir_set(sb->ephoto, + sb->ephoto->config->directory); + free(dir); + ephoto_single_browser_path_pending_set(sb->ephoto-> + single_browser, buf); + } } } } diff --git a/src/bin/ephoto_thumb_browser.c b/src/bin/ephoto_thumb_browser.c index f0f5cfe..230386c 100644 --- a/src/bin/ephoto_thumb_browser.c +++ b/src/bin/ephoto_thumb_browser.c @@ -448,7 +448,7 @@ _monitor_created(void *data, int type EINA_UNUSED, void *event) return ECORE_CALLBACK_PASS_ON; snprintf(file, PATH_MAX, "%s", ev->filename); - snprintf(dir, PATH_MAX, "%s", dirname(file)); + snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file)); if (strcmp(entry->path, dir)) return ECORE_CALLBACK_PASS_ON; @@ -533,7 +533,7 @@ _monitor_deleted(void *data, int type EINA_UNUSED, void *event) return ECORE_CALLBACK_PASS_ON; snprintf(file, PATH_MAX, "%s", ev->filename); - snprintf(dir, PATH_MAX, "%s", dirname(file)); + snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file)); if (strcmp(entry->path, dir)) return ECORE_CALLBACK_PASS_ON; @@ -582,7 +582,7 @@ _monitor_modified(void *data, int type EINA_UNUSED, void *event) return ECORE_CALLBACK_PASS_ON; snprintf(file, PATH_MAX, "%s", ev->filename); - snprintf(dir, PATH_MAX, "%s", dirname(file)); + snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file)); if (strcmp(entry->path, dir)) return ECORE_CALLBACK_PASS_ON; @@ -730,7 +730,7 @@ _ephoto_dir_go_up(void *data, Evas_Object *obj EINA_UNUSED, elm_genlist_clear(tb->fsel); tb->thumbs_only = 0; tb->dirs_only = 0; - ephoto_directory_set(tb->ephoto, dirname(path), NULL, + ephoto_directory_set(tb->ephoto, ecore_file_dir_get(path), NULL, tb->dirs_only, tb->thumbs_only); ephoto_title_set(tb->ephoto, tb->ephoto->config->directory); ephoto_thumb_browser_top_dir_set(tb->ephoto, @@ -1687,9 +1687,9 @@ _rename_confirm(void *data, Evas_Object *obj EINA_UNUSED, } snprintf(dir, PATH_MAX, "%s", file); if (ecore_file_is_dir(file)) - snprintf(new_file_name, PATH_MAX, "%s/%s", dirname(dir), text); + snprintf(new_file_name, PATH_MAX, "%s/%s", ecore_file_dir_get(dir), text); else - snprintf(new_file_name, PATH_MAX, "%s/%s.%s", dirname(dir), escaped, + snprintf(new_file_name, PATH_MAX, "%s/%s.%s", ecore_file_dir_get(dir), escaped, strrchr(dir, '.')+1); ret = ecore_file_mv(file, new_file_name); if (!ret) @@ -3708,7 +3708,7 @@ _top_monitor_created(void *data, int type EINA_UNUSED, void *event) return ECORE_CALLBACK_PASS_ON; snprintf(file, PATH_MAX, "%s", ev->filename); - snprintf(dir, PATH_MAX, "%s", dirname(file)); + snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file)); if (strcmp(tb->ephoto->top_directory, dir)) return ECORE_CALLBACK_PASS_ON; @@ -3758,7 +3758,7 @@ _top_monitor_deleted(void *data, int type EINA_UNUSED, void *event) return ECORE_CALLBACK_PASS_ON; snprintf(file, PATH_MAX, "%s", ev->filename); - snprintf(dir, PATH_MAX, "%s", dirname(file)); + snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file)); if (strcmp(tb->ephoto->top_directory, dir)) return ECORE_CALLBACK_PASS_ON; @@ -3790,7 +3790,7 @@ _top_monitor_modified(void *data, int type EINA_UNUSED, void *event) return ECORE_CALLBACK_PASS_ON; snprintf(file, PATH_MAX, "%s", ev->filename); - snprintf(dir, PATH_MAX, "%s", dirname(file)); + snprintf(dir, PATH_MAX, "%s", ecore_file_dir_get(file)); if (strcmp(tb->ephoto->top_directory, dir)) return ECORE_CALLBACK_PASS_ON; @@ -3987,7 +3987,7 @@ ephoto_thumb_browser_remove(Ephoto *ephoto, Ephoto_Entry *entry) } } } - snprintf(image_info, PATH_MAX, "%s: %d %s " + snprintf(image_info, PATH_MAX, "%s: %d %s " "%s: %s", _("Total"), tb->totimages, ngettext("image", "images", tb->totimages), _("Size"), isize); elm_object_text_set(tb->infolabel, image_info);