okra pushed a commit to branch master.

http://git.enlightenment.org/apps/ephoto.git/commit/?id=dc89de84e98cc3749ed8dae1ca5335e8b0cff78a

commit dc89de84e98cc3749ed8dae1ca5335e8b0cff78a
Author: Stephen 'Okra' Houston <[email protected]>
Date:   Mon May 1 18:44:56 2017 -0500

    Ephoto: Move root/home shortcuts into the context menu and remove min size 
restrictions that affect window resizing.
---
 src/bin/ephoto_directory_browser.c | 118 +++++++++++--------------------------
 src/bin/ephoto_editor.c            |   1 -
 src/bin/ephoto_main.c              |  12 +++-
 src/bin/ephoto_single_browser.c    |   4 +-
 src/bin/ephoto_slideshow.c         |   4 +-
 src/bin/ephoto_thumb.c             |   2 +-
 src/bin/ephoto_thumb_browser.c     |   2 +-
 src/bin/ephoto_thumbnailer.c       |   4 +-
 8 files changed, 53 insertions(+), 94 deletions(-)

diff --git a/src/bin/ephoto_directory_browser.c 
b/src/bin/ephoto_directory_browser.c
index eb57e62..17b63cf 100644
--- a/src/bin/ephoto_directory_browser.c
+++ b/src/bin/ephoto_directory_browser.c
@@ -16,7 +16,6 @@ struct _Ephoto_Directory_Browser
    Evas_Object *fsel;
    Evas_Object *fsel_back;
    Evas_Object *leftbox;
-   Evas_Object *butbox;
    Elm_Object_Item *dir_current;
    Elm_Object_Item *last_sel;
    Eio_File *ls;
@@ -415,9 +414,7 @@ _trash_back(void *data, Evas_Object *obj EINA_UNUSED,
 
    elm_box_clear(db->leftbox);
    db->fsel = db->fsel_back;
-   elm_box_pack_end(db->leftbox, db->butbox);
    elm_box_pack_end(db->leftbox, db->fsel);\
-   evas_object_show(db->butbox);
    evas_object_show(db->fsel);
    db->fsel_back = NULL;
 
@@ -436,14 +433,10 @@ _dir_go_trash(void *data, Evas_Object *obj EINA_UNUSED,
    Evas_Object *ic, *but;
 
    db->fsel_back = db->fsel;
-   evas_object_hide(db->butbox);
    evas_object_hide(db->fsel_back);
-   elm_box_unpack(db->leftbox, db->butbox);
    elm_box_unpack(db->leftbox, db->fsel_back);
 
    ic = elm_icon_add(db->leftbox);
-   evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(),
-       20*elm_config_scale_get());
    elm_icon_standard_set(ic, "go-previous");
    evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
 
@@ -471,7 +464,6 @@ _dir_go_trash(void *data, Evas_Object *obj EINA_UNUSED,
    evas_object_event_callback_add(db->fsel, EVAS_CALLBACK_MOUSE_UP,
        _fsel_mouse_up_cb, db);
    evas_object_data_set(db->fsel, "directory_browser", db);
-   evas_object_size_hint_min_set(db->fsel, (int)round(195 * 
elm_config_scale_get()), 0);
    elm_box_pack_end(db->leftbox, db->fsel);
    evas_object_show(db->fsel);
 
@@ -500,6 +492,36 @@ _click_timer_cb(void *data)
 }
 
 static void
+_fsel_menu_go_root(void *data, Evas_Object *obj EINA_UNUSED, void *event_data 
EINA_UNUSED)
+{
+   Ephoto *ephoto = data;
+   const char *path = "/";
+   char *realpath = ecore_file_realpath(path);
+
+   ephoto_directory_browser_clear(ephoto);
+   ephoto_thumb_browser_clear(ephoto);
+   eina_stringshare_replace(&ephoto->config->directory, realpath);
+   ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
+   ephoto_directory_browser_initialize_structure(ephoto);
+   free(realpath);
+}
+
+static void
+_fsel_menu_go_home(void *data, Evas_Object *obj EINA_UNUSED, void *event_data 
EINA_UNUSED)
+{
+   Ephoto *ephoto = data;
+   const char *path = eina_environment_home_get();
+   char *realpath = ecore_file_realpath(path);
+
+   ephoto_directory_browser_clear(ephoto);
+   ephoto_thumb_browser_clear(ephoto);
+   eina_stringshare_replace(&ephoto->config->directory, realpath);
+   ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
+   ephoto_directory_browser_initialize_structure(ephoto);
+   free(realpath);
+}
+
+static void
 _fsel_menu_new_dir_cb(void *data, Evas_Object *obj EINA_UNUSED,
     void *event_info EINA_UNUSED)
 {
@@ -601,7 +623,7 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
              evas_object_data_del(db->fsel, "current_item");
              evas_object_data_set(db->fsel, "current_item", item);
              if (elm_genlist_item_type_get(item) == ELM_GENLIST_ITEM_TREE)
-               db->click_timer = ecore_timer_add(.3, _click_timer_cb, db);
+               db->click_timer = ecore_timer_loop_add(.3, _click_timer_cb, db);
              else
                _on_list_selected(db, NULL, item);
           }
@@ -615,7 +637,10 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
 
    menu = elm_menu_add(db->ephoto->win);
    elm_menu_move(menu, x, y);
-
+   elm_menu_item_add(menu, NULL, "computer", _("Root"),
+       _fsel_menu_go_root, db->ephoto);
+   elm_menu_item_add(menu, NULL, "user-home", _("Home"),
+       _fsel_menu_go_home, db->ephoto);
    if (strcmp(db->ephoto->config->directory, db->ephoto->trash_path))
      {
         elm_menu_item_add(menu, NULL, "folder-new", _("New Folder"),
@@ -647,40 +672,8 @@ _fsel_mouse_up_cb(void *data, Evas *e EINA_UNUSED,
 }
 
 static void
-_go_root(void *data, Evas_Object *obj EINA_UNUSED, void *event_data 
EINA_UNUSED)
-{
-   Ephoto *ephoto = data;
-   const char *path = "/";
-   char *realpath = ecore_file_realpath(path);
-
-   ephoto_directory_browser_clear(ephoto);
-   ephoto_thumb_browser_clear(ephoto);
-   eina_stringshare_replace(&ephoto->config->directory, realpath);
-   ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
-   ephoto_directory_browser_initialize_structure(ephoto);
-   free(realpath);
-}
-
-static void
-_go_home(void *data, Evas_Object *obj EINA_UNUSED, void *event_data 
EINA_UNUSED)
-{
-   Ephoto *ephoto = data;
-   const char *path = eina_environment_home_get();
-   char *realpath = ecore_file_realpath(path);
-
-   ephoto_directory_browser_clear(ephoto);
-   ephoto_thumb_browser_clear(ephoto);
-   eina_stringshare_replace(&ephoto->config->directory, realpath);
-   ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
-   ephoto_directory_browser_initialize_structure(ephoto);
-   free(realpath);
-}
-
-static void
 _ephoto_directory_view_add(Ephoto_Directory_Browser *db)
 {
-   Evas_Object *ic, *but;
-
    db->leftbox = elm_box_add(db->main);
    elm_box_horizontal_set(db->leftbox, EINA_FALSE);
    elm_box_homogeneous_set(db->leftbox, EINA_FALSE);
@@ -689,44 +682,6 @@ _ephoto_directory_view_add(Ephoto_Directory_Browser *db)
    elm_box_pack_end(db->main, db->leftbox);
    evas_object_show(db->leftbox);
 
-   db->butbox = elm_box_add(db->leftbox);
-   elm_box_horizontal_set(db->butbox, EINA_TRUE);
-   elm_box_homogeneous_set(db->butbox, EINA_TRUE);
-   EPHOTO_WEIGHT(db->butbox, EVAS_HINT_EXPAND, 0.0);
-   EPHOTO_FILL(db->butbox);
-   elm_box_pack_end(db->leftbox, db->butbox);
-   evas_object_show(db->butbox);
-
-   ic = elm_icon_add(db->butbox);
-   evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(),
-       20*elm_config_scale_get());
-   elm_icon_standard_set(ic, "computer");
-   evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
-
-   but = elm_button_add(db->butbox);
-   elm_object_text_set(but, _("Root"));
-   elm_object_part_content_set(but, "icon", ic);
-   EPHOTO_WEIGHT(but, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
-   EPHOTO_FILL(but);
-   evas_object_smart_callback_add(but, "clicked", _go_root, db->ephoto);
-   elm_box_pack_end(db->butbox, but);
-   evas_object_show(but);
-
-   ic = elm_icon_add(db->butbox);
-   evas_object_size_hint_min_set(ic, 20*elm_config_scale_get(),
-       20*elm_config_scale_get());
-   elm_icon_standard_set(ic, "user-home");
-   evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
-
-   but = elm_button_add(db->butbox);
-   elm_object_text_set(but, _("Home"));
-   elm_object_part_content_set(but, "icon", ic);
-   EPHOTO_WEIGHT(but, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
-   EPHOTO_FILL(but);
-   evas_object_smart_callback_add(but, "clicked", _go_home, db->ephoto);
-   elm_box_pack_end(db->butbox, but);
-   evas_object_show(but);
-
    db->fsel = elm_genlist_add(db->leftbox);
    elm_genlist_select_mode_set(db->fsel, ELM_OBJECT_SELECT_MODE_ALWAYS);
    elm_genlist_highlight_mode_set(db->fsel, EINA_TRUE);
@@ -742,7 +697,6 @@ _ephoto_directory_view_add(Ephoto_Directory_Browser *db)
    evas_object_event_callback_add(db->fsel, EVAS_CALLBACK_MOUSE_UP,
        _fsel_mouse_up_cb, db);
    evas_object_data_set(db->fsel, "directory_browser", db);
-   evas_object_size_hint_min_set(db->fsel, (int)round(195 * 
elm_config_scale_get()), 0);
    elm_box_pack_end(db->leftbox, db->fsel);
    evas_object_show(db->fsel);
 
@@ -1396,8 +1350,6 @@ ephoto_directory_browser_add(Ephoto *ephoto, Evas_Object 
*parent)
    elm_box_horizontal_set(db->main, EINA_FALSE);
    evas_object_event_callback_add(db->main, EVAS_CALLBACK_DEL,
        _ephoto_main_del, db);
-   evas_object_size_hint_min_set(db->main, (int)round(195 * 
elm_config_scale_get()), 0);
-   evas_object_size_hint_max_set(db->main, (int)round(195 * 
elm_config_scale_get()), 99999);
    evas_object_data_set(db->main, "directory_browser", db);
 
    _ephoto_directory_view_add(db);
diff --git a/src/bin/ephoto_editor.c b/src/bin/ephoto_editor.c
index ee67ea7..4a0c253 100644
--- a/src/bin/ephoto_editor.c
+++ b/src/bin/ephoto_editor.c
@@ -31,7 +31,6 @@ ephoto_editor_add(Ephoto *ephoto, Evas_Object *parent, const 
char *title, const
    elm_object_text_set(frame, title);
    EPHOTO_WEIGHT(frame, 0.3, EVAS_HINT_EXPAND);
    EPHOTO_FILL(frame);
-   evas_object_size_hint_min_set(frame, (int)round(195 * 
elm_config_scale_get()), 0);
    evas_object_data_set(frame, data_name, data);
    elm_object_part_content_set(parent, "right", frame);
    elm_panes_content_right_size_set(parent, ephoto->config->right_size);
diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c
index 8aed810..09fa417 100644
--- a/src/bin/ephoto_main.c
+++ b/src/bin/ephoto_main.c
@@ -111,6 +111,7 @@ _ephoto_slideshow_show(Ephoto *ephoto, Ephoto_Entry *entry)
    evas_object_hide(ephoto->single_browser);
    evas_object_hide(ephoto->thumb_browser);
    elm_object_focus_set(ephoto->slideshow, EINA_TRUE);
+   elm_panes_content_left_min_size_set(ephoto->layout, 0);
    elm_panes_content_left_size_set(ephoto->layout, 0.0);
    elm_table_unpack(ephoto->main, ephoto->statusbar);
    evas_object_hide(ephoto->dir_browser);
@@ -155,6 +156,7 @@ _ephoto_slideshow_back(void *data, Evas_Object *obj 
EINA_UNUSED,
      }
    if (ephoto->folders_toggle)
      {
+        elm_panes_content_left_min_size_set(ephoto->layout, 0);
         elm_panes_content_left_size_set(ephoto->layout, 
ephoto->config->left_size);
         evas_object_show(ephoto->dir_browser);
      }
@@ -252,7 +254,6 @@ _resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object 
*obj EINA_UNUSED,
 
    if (elm_win_fullscreen_get(ephoto->win))
      return;
-
    evas_object_geometry_get(ephoto->win, 0, 0, &w, &h);
    if (w && h)
      {
@@ -269,6 +270,7 @@ _folder_icon_clicked(void *data, Evas_Object *obj,
 
    if (!ephoto->folders_toggle)
      {
+        elm_panes_content_left_min_size_set(ephoto->layout, 0);
         elm_panes_content_left_size_set(ephoto->layout, 
ephoto->config->left_size);
         ephoto->folders_toggle = EINA_TRUE;
         if (elm_object_text_get(obj))
@@ -277,6 +279,7 @@ _folder_icon_clicked(void *data, Evas_Object *obj,
      }
    else
      {
+        elm_panes_content_left_min_size_set(ephoto->layout, 0);
         elm_panes_content_left_size_set(ephoto->layout, 0.0);
         ephoto->folders_toggle = EINA_FALSE;
         if (elm_object_text_get(obj))
@@ -332,6 +335,7 @@ ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle)
 {
    if (!ephoto->folders_toggle || !toggle)
      {
+        elm_panes_content_left_min_size_set(ephoto->layout, 0);
         elm_panes_content_left_size_set(ephoto->layout, 
ephoto->config->left_size);
         evas_object_show(ephoto->dir_browser);
         ephoto->folders_toggle = EINA_TRUE;
@@ -339,6 +343,7 @@ ephoto_show_folders(Ephoto *ephoto, Eina_Bool toggle)
      }
    else if (ephoto->folders_toggle)
      {
+        elm_panes_content_left_min_size_set(ephoto->layout, 0);
         elm_panes_content_left_size_set(ephoto->layout, 0.0);
         evas_object_hide(ephoto->dir_browser);
         ephoto->folders_toggle = EINA_FALSE;
@@ -452,6 +457,7 @@ ephoto_window_add(const char *path)
    ephoto->dir_browser = ephoto_directory_browser_add(ephoto, ephoto->layout);
    EPHOTO_WEIGHT(ephoto->dir_browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    EPHOTO_FILL(ephoto->dir_browser);
+   elm_panes_content_left_min_size_set(ephoto->layout, 0);
    elm_panes_content_left_size_set(ephoto->layout, ephoto->config->left_size);
    elm_object_part_content_set(ephoto->layout, "left", ephoto->dir_browser);
    evas_object_show(ephoto->dir_browser);
@@ -614,6 +620,7 @@ ephoto_window_add(const char *path)
    if (!ephoto->config->folders)
      {
         evas_object_hide(ephoto->dir_browser);
+        elm_panes_content_left_min_size_set(ephoto->layout, 0);
         elm_panes_content_left_size_set(ephoto->layout, 0.0);
         ephoto->folders_toggle = EINA_FALSE;
         elm_object_tooltip_text_set(ephoto->folders_button, _("Show Folders"));
@@ -621,6 +628,7 @@ ephoto_window_add(const char *path)
    else
      {
         ephoto->folders_toggle = EINA_TRUE;
+        elm_panes_content_left_min_size_set(ephoto->layout, 0);
         elm_panes_content_left_size_set(ephoto->layout, 
ephoto->config->left_size);
         elm_object_tooltip_text_set(ephoto->folders_button, _("Hide Folders"));
      }
@@ -1004,7 +1012,7 @@ ephoto_thumb_size_set(Ephoto *ephoto, int size)
    if (ephoto->timer.thumb_regen)
       ecore_timer_del(ephoto->timer.thumb_regen);
    ephoto->timer.thumb_regen =
-       ecore_timer_add(0.1, _thumb_gen_size_changed_timer_cb, ephoto);
+       ecore_timer_loop_add(0.1, _thumb_gen_size_changed_timer_cb, ephoto);
 }
 
 static void
diff --git a/src/bin/ephoto_single_browser.c b/src/bin/ephoto_single_browser.c
index f47798b..f8dc3b1 100644
--- a/src/bin/ephoto_single_browser.c
+++ b/src/bin/ephoto_single_browser.c
@@ -238,7 +238,7 @@ _image_mouse_down_cb(void *data EINA_UNUSED, Evas *e 
EINA_UNUSED,
      }
    else if (ev->button == 1)
      {
-        _1s_hold = ecore_timer_add(0.5, _1s_hold_time, io);
+        _1s_hold = ecore_timer_loop_add(0.5, _1s_hold_time, io);
      }
 }
 
@@ -1528,7 +1528,7 @@ _viewer_add(Evas_Object *parent, const char *path, 
Ephoto_Single_Browser *sb)
         evas_object_image_animated_frame_set(v->image, v->cur_frame);
         v->duration = evas_object_image_animated_frame_duration_get(v->image,
             v->cur_frame, 0);
-        v->anim_timer = ecore_timer_add(v->duration, _animate_cb, v);
+        v->anim_timer = ecore_timer_loop_add(v->duration, _animate_cb, v);
      }
 
    v->monitor = eio_monitor_add(path);
diff --git a/src/bin/ephoto_slideshow.c b/src/bin/ephoto_slideshow.c
index 8b54b69..a4b6e58 100644
--- a/src/bin/ephoto_slideshow.c
+++ b/src/bin/ephoto_slideshow.c
@@ -314,7 +314,7 @@ _on_transition_end(void *data, Evas_Object *obj EINA_UNUSED,
      ecore_timer_del(ss->timer);
    ss->timer = NULL;
    if (ss->playing)
-     ss->timer = ecore_timer_add(ss->timeout, _slideshow_transition, ss);
+     ss->timer = ecore_timer_loop_add(ss->timeout, _slideshow_transition, ss);
 }
 
 static Evas_Object *
@@ -446,7 +446,7 @@ _slideshow_play(Ephoto_Slideshow *ss)
 
    if (ss->timer)
      ecore_timer_del(ss->timer);
-   ss->timer = ecore_timer_add(ss->timeout, _slideshow_transition, ss);
+   ss->timer = ecore_timer_loop_add(ss->timeout, _slideshow_transition, ss);
 }
 
 static void
diff --git a/src/bin/ephoto_thumb.c b/src/bin/ephoto_thumb.c
index 0f97158..0c4e7b8 100644
--- a/src/bin/ephoto_thumb.c
+++ b/src/bin/ephoto_thumb.c
@@ -384,7 +384,7 @@ static void
 _e_thumb_thumbnailers_kill(void)
 {
    if (_kill_timer) ecore_timer_del(_kill_timer);
-   _kill_timer = ecore_timer_add(1.0, _e_thumb_cb_kill, NULL);
+   _kill_timer = ecore_timer_loop_add(1.0, _e_thumb_cb_kill, NULL);
 }
 
 static void
diff --git a/src/bin/ephoto_thumb_browser.c b/src/bin/ephoto_thumb_browser.c
index 93028db..97269aa 100644
--- a/src/bin/ephoto_thumb_browser.c
+++ b/src/bin/ephoto_thumb_browser.c
@@ -257,7 +257,7 @@ _dnd_drag_start(void *data EINA_UNUSED, Evas_Object *obj)
         return;
      }
    if (_5s_cancel)
-      _5s_timeout = ecore_timer_add(5.0, _5s_timeout_gone, obj);
+      _5s_timeout = ecore_timer_loop_add(5.0, _5s_timeout_gone, obj);
    elm_object_cursor_set(tb->main, ELM_CURSOR_HAND2);
 
    ephoto_show_folders(tb->ephoto, EINA_FALSE);
diff --git a/src/bin/ephoto_thumbnailer.c b/src/bin/ephoto_thumbnailer.c
index acc7243..7d4ca39 100644
--- a/src/bin/ephoto_thumbnailer.c
+++ b/src/bin/ephoto_thumbnailer.c
@@ -196,7 +196,7 @@ _e_ipc_cb_server_data(void *data EINA_UNUSED,
                   eth->file = strdup(file);
                   if (key) eth->key = strdup(key);
                   _thumblist = eina_list_append(_thumblist, eth);
-                  if (!_timer) _timer = ecore_timer_add(0.001, _e_cb_timer, 
NULL);
+                  if (!_timer) _timer = ecore_timer_loop_add(0.001, 
_e_cb_timer, NULL);
                }
           }
         break;
@@ -245,7 +245,7 @@ _e_cb_timer(void *data EINA_UNUSED)
         free(eth->key);
         free(eth);
 
-        if (_thumblist) _timer = ecore_timer_add(0.01, _e_cb_timer, NULL);
+        if (_thumblist) _timer = ecore_timer_loop_add(0.01, _e_cb_timer, NULL);
         else _timer = NULL;
      }
    else

-- 


Reply via email to