From ebc6664b661914aee41ed387fa7e11d269b10f97 Mon Sep 17 00:00:00 2001 From: Stephen okra Houston Date: Mon, 29 Aug 2016 13:56:29 -0500 Subject: [PATCH] Ephoto: Update thumb dir to be .cache/ephoto/thumbnails/ ... Config: Use XDG_CONFIG_HOME if available, else use HOME/.config --- src/bin/ephoto_config.c | 16 ++++++++++++---- src/bin/ephoto_single_browser.c | 2 +- src/bin/ephoto_thumbnailer.c | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/bin/ephoto_config.c b/src/bin/ephoto_config.c index 8d8c795..35a7da3 100644 --- a/src/bin/ephoto_config.c +++ b/src/bin/ephoto_config.c @@ -621,9 +621,13 @@ static int _ephoto_config_load(Ephoto *ephoto) { Eet_File *ef; - char buf[4096], buf2[4096]; + char buf[4096], buf2[4096], xdg[4096]; - snprintf(buf2, sizeof(buf2), "%s/.config/ephoto", getenv("HOME")); + snprintf(xdg, PATH_MAX, "%s", getenv("XDG_CONFIG_HOME")); + if (strlen(xdg)) + snprintf(buf2, sizeof(buf2), "%s/ephoto", xdg); + else + snprintf(buf2, sizeof(buf2), "%s/.config/ephoto", getenv("HOME")); ecore_file_mkpath(buf2); snprintf(buf, sizeof(buf), "%s/ephoto.cfg", buf2); @@ -660,9 +664,13 @@ _ephoto_on_config_save(void *data) { Ephoto *ephoto = data; Eet_File *ef; - char buf[4096], buf2[4096]; + char buf[4096], buf2[4096], xdg[4096]; - snprintf(buf, sizeof(buf), "%s/.config/ephoto/ephoto.cfg", getenv("HOME")); + snprintf(xdg, PATH_MAX, "%s", getenv("XDG_CONFIG_HOME")); + if (strlen(xdg)) + snprintf(buf, sizeof(buf), "%s/ephoto/ephoto.cfg", xdg); + else + snprintf(buf, sizeof(buf), "%s/.config/ephoto/ephoto.cfg", getenv("HOME")); snprintf(buf2, sizeof(buf2), "%s.tmp", buf); ef = eet_open(buf2, EET_FILE_MODE_WRITE); diff --git a/src/bin/ephoto_single_browser.c b/src/bin/ephoto_single_browser.c index 525bfcb..c160e16 100644 --- a/src/bin/ephoto_single_browser.c +++ b/src/bin/ephoto_single_browser.c @@ -1870,7 +1870,7 @@ _ephoto_main_edit_menu(Ephoto_Single_Browser *sb) Evas_Coord x, y; evas_pointer_canvas_xy_get(evas_object_evas_get(sb->main), &x, &y); - menu = elm_menu_add(sb->main); + menu = elm_menu_add(sb->ephoto->win); elm_menu_move(menu, x, y); _add_edit_menu_items(sb, menu); diff --git a/src/bin/ephoto_thumbnailer.c b/src/bin/ephoto_thumbnailer.c index 3ea8709..952eb41 100644 --- a/src/bin/ephoto_thumbnailer.c +++ b/src/bin/ephoto_thumbnailer.c @@ -88,7 +88,7 @@ main(int argc, ecore_file_init(); ecore_ipc_init(); - snprintf(_thumbdir, PATH_MAX, "%s/.thumbnails", getenv("HOME")); + snprintf(_thumbdir, PATH_MAX, "%s/cache/ephoto/.thumbnails", getenv("HOME")); ecore_file_mkpath(_thumbdir); if (_e_ipc_init()) ecore_main_loop_begin();