From dd9a8ed7ce999eae6662f26a111806606af4ac28 Mon Sep 17 00:00:00 2001 From: Stephen Houston Date: Sun, 7 Aug 2016 22:54:08 -0500 Subject: [PATCH] Ephoto: Add configure option to not show the folders on app startup. --- data/themes/ephoto.edc | 7 +++++++ src/bin/ephoto.h | 2 ++ src/bin/ephoto_config.c | 27 ++++++++++++++++++++------- src/bin/ephoto_main.c | 16 ++++++++++++++-- src/bin/ephoto_thumb_browser.c | 2 +- 5 files changed, 44 insertions(+), 10 deletions(-) diff --git a/data/themes/ephoto.edc b/data/themes/ephoto.edc index d1f8edb..4651256 100644 --- a/data/themes/ephoto.edc +++ b/data/themes/ephoto.edc @@ -365,6 +365,13 @@ collections { source: "ephoto.swallow.folders"; action: SIGNAL_EMIT "ephoto,unblock" "ephoto"; } + program { signal: "ephoto,folders,hide,start"; + source: "ephoto"; + action: STATE_SET "hidden" 0.0; + target: "ephoto.swallow.folders"; + target: "folders_shadow"; + target: "ephoto,folders"; + } program { signal: "ephoto,folders,hide"; source: "ephoto"; script { diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h index 626f83f..75d3a15 100644 --- a/src/bin/ephoto.h +++ b/src/bin/ephoto.h @@ -227,6 +227,7 @@ struct _Ephoto_Config Eina_Bool movess; Eina_Bool smooth; Eina_Bool firstrun; + Eina_Bool folders; Evas_Object *slide_time; Evas_Object *slide_trans; Evas_Object *open_dir; @@ -235,6 +236,7 @@ struct _Ephoto_Config Evas_Object *move_drop; Evas_Object *smooth_scale; Evas_Object *slide_move; + Evas_Object *show_folders; }; struct _Ephoto diff --git a/src/bin/ephoto_config.c b/src/bin/ephoto_config.c index 944a040..a495cb5 100644 --- a/src/bin/ephoto_config.c +++ b/src/bin/ephoto_config.c @@ -1,6 +1,6 @@ #include "ephoto.h" -#define CONFIG_VERSION 19 +#define CONFIG_VERSION 20 static int _ephoto_config_load(Ephoto *ephoto); static Eina_Bool _ephoto_on_config_save(void *data); @@ -51,6 +51,7 @@ _config_save_cb(void *data, Evas_Object *obj EINA_UNUSED, ephoto->config->drop = elm_check_state_get(ephoto->config->move_drop); ephoto->config->movess = elm_check_state_get(ephoto->config->slide_move); ephoto->config->smooth = elm_check_state_get(ephoto->config->smooth_scale); + ephoto->config->folders = elm_check_state_get(ephoto->config->show_folders); if (elm_spinner_value_get(ephoto->config->slide_time) > 0) ephoto->config->slideshow_timeout = elm_spinner_value_get(ephoto->config->slide_time); @@ -93,11 +94,19 @@ _config_general(Ephoto *ephoto, Evas_Object *parent) elm_object_content_set(frame, table); evas_object_show(table); + check = elm_check_add(table); + elm_object_text_set(check, _("Show Folders On Start")); + evas_object_size_hint_align_set(check, 0.0, EVAS_HINT_FILL); + elm_check_state_set(check, ephoto->config->folders); + elm_table_pack(table, check, 0, 1, 1, 1); + evas_object_show(check); + ephoto->config->show_folders = check; + check = elm_check_add(table); elm_object_text_set(check, _("Prompt Before Changing The Filesystem")); evas_object_size_hint_align_set(check, 0.0, EVAS_HINT_FILL); elm_check_state_set(check, ephoto->config->prompts); - elm_table_pack(table, check, 0, 1, 1, 1); + elm_table_pack(table, check, 0, 2, 1, 1); evas_object_show(check); ephoto->config->show_prompts = check; @@ -105,7 +114,7 @@ _config_general(Ephoto *ephoto, Evas_Object *parent) elm_object_text_set(check, _("Move Files When Dropped")); evas_object_size_hint_align_set(check, 0.0, EVAS_HINT_FILL); elm_check_state_set(check, ephoto->config->drop); - elm_table_pack(table, check, 0, 2, 1, 1); + elm_table_pack(table, check, 0, 3, 1, 1); evas_object_show(check); ephoto->config->move_drop = check; @@ -113,14 +122,14 @@ _config_general(Ephoto *ephoto, Evas_Object *parent) elm_object_text_set(check, _("Smooth Scale Images")); evas_object_size_hint_align_set(check, 0.0, EVAS_HINT_FILL); elm_check_state_set(check, ephoto->config->smooth); - elm_table_pack(table, check, 0, 3, 1, 1); + elm_table_pack(table, check, 0, 4, 1, 1); evas_object_show(check); ephoto->config->smooth_scale = check; label = elm_label_add(table); elm_object_text_set(label, _("Directory To Open Ephoto In:")); evas_object_size_hint_align_set(label, 0.5, 0.5); - elm_table_pack(table, label, 0, 4, 1, 1); + elm_table_pack(table, label, 0, 5, 1, 1); evas_object_show(label); hoversel = elm_hoversel_add(table); @@ -138,7 +147,7 @@ _config_general(Ephoto *ephoto, Evas_Object *parent) evas_object_size_hint_weight_set(hoversel, EVAS_HINT_EXPAND, EVAS_HINT_FILL); evas_object_size_hint_align_set(hoversel, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_table_pack(table, hoversel, 0, 5, 1, 1); + elm_table_pack(table, hoversel, 0, 6, 1, 1); evas_object_show(hoversel); ephoto->config->open_dir = hoversel; @@ -151,7 +160,7 @@ _config_general(Ephoto *ephoto, Evas_Object *parent) ELM_SCROLLER_POLICY_OFF); evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_table_pack(table, entry, 0, 6, 1, 1); + elm_table_pack(table, entry, 0, 7, 1, 1); evas_object_show(entry); ephoto->config->open_dir_custom = entry; } @@ -800,6 +809,9 @@ ephoto_config_init(Ephoto *ephoto) C_VAL(D, T, prompts, EET_T_INT); C_VAL(D, T, drop, EET_T_INT); C_VAL(D, T, movess, EET_T_INT); + C_VAL(D, T, smooth, EET_T_INT); + C_VAL(D, T, firstrun, EET_T_INT); + C_VAL(D, T, folders, EET_T_INT); switch (_ephoto_config_load(ephoto)) { case 0: @@ -817,6 +829,7 @@ ephoto_config_init(Ephoto *ephoto) ephoto->config->movess = 1; ephoto->config->smooth = 1; ephoto->config->firstrun = 1; + ephoto->config->folders = 1; break; default: diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index b90ac08..8c08ed8 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -47,6 +47,8 @@ _ephoto_thumb_browser_show(Ephoto *ephoto, Ephoto_Entry *entry) ephoto->menu_blocking = EINA_FALSE; ephoto->hover_blocking = EINA_FALSE; ephoto->editor_blocking = EINA_FALSE; + ephoto->folders_toggle = EINA_TRUE; + ephoto_show_folders(ephoto, EINA_TRUE); ephoto_thumb_browser_show_controls(ephoto); evas_object_freeze_events_set(ephoto->single_browser, EINA_TRUE); evas_object_freeze_events_set(ephoto->slideshow, EINA_TRUE); @@ -395,7 +397,7 @@ Evas_Object * ephoto_window_add(const char *path) { Ephoto *ephoto = calloc(1, sizeof(Ephoto)); - Evas_Object *ic, *but; + Evas_Object *ic, *but, *fold; char buf[PATH_MAX]; int ret; @@ -538,6 +540,7 @@ ephoto_window_add(const char *path) elm_object_tooltip_orient_set(but, ELM_TOOLTIP_ORIENT_RIGHT); elm_box_pack_end(ephoto->statusbar, but); evas_object_show(but); + fold = but; evas_object_data_set(ephoto->layout, "folder_button", but); ephoto->controls_left = elm_box_add(ephoto->statusbar); @@ -650,8 +653,17 @@ ephoto_window_add(const char *path) ephoto->config->window_height); evas_object_show(ephoto->win); + if (!ephoto->config->folders) + { + edje_object_signal_emit(elm_layout_edje_get(ephoto->layout), + "ephoto,folders,hide,start", "ephoto"); + evas_object_hide(ephoto->dir_browser); + ephoto->folders_toggle = EINA_FALSE; + elm_object_tooltip_text_set(fold, _("Show Folders")); + } + else + elm_layout_signal_emit(ephoto->layout, "ephoto,folders,show", "ephoto"); elm_layout_signal_emit(ephoto->layout, "ephoto,controls,show", "ephoto"); - elm_layout_signal_emit(ephoto->layout, "ephoto,folders,show", "ephoto"); ephoto->overlay_timer = ecore_timer_add(5.0, _timer_cb, ephoto); if (ephoto->config->firstrun) diff --git a/src/bin/ephoto_thumb_browser.c b/src/bin/ephoto_thumb_browser.c index 14c748f..1b8684c 100644 --- a/src/bin/ephoto_thumb_browser.c +++ b/src/bin/ephoto_thumb_browser.c @@ -1387,7 +1387,7 @@ _ephoto_thumb_populate_end(void *data, int type EINA_UNUSED, } } tb->entries = tb->ephoto->entries; - if (eina_list_count(tb->entries) < 1) + if (eina_list_count(tb->entries) < 1 && tb->ephoto->config->folders) { ephoto_show_folders(tb->ephoto, EINA_FALSE); }