rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=41f0e771e0bdeffbc998ffbbb6fcb15fcb03f22c

commit 41f0e771e0bdeffbc998ffbbb6fcb15fcb03f22c
Author: Vyacheslav Reutskiy <v.reuts...@samsung.com>
Date:   Tue Mar 14 14:07:46 2017 +0200

    fileselector: add mode switcher between list and grid
    
    Fixes T4590
    
    @feature
---
 data/themes/default/images/icon_grid.png     | Bin 0 -> 266 bytes
 data/themes/default/images/icon_list.png     | Bin 0 -> 208 bytes
 data/themes/default/widgets/fileselector.edc | 213 +++++++++++++++++++++++++++
 data/themes/default/widgets/radio.edc        | 208 ++++++++++++++++++++++++++
 src/bin/ui/popup.c                           |  34 +++++
 src/bin/ui/tab_home_open.c                   |  34 +++++
 6 files changed, 489 insertions(+)

diff --git a/data/themes/default/images/icon_grid.png 
b/data/themes/default/images/icon_grid.png
new file mode 100644
index 0000000..65575ea
Binary files /dev/null and b/data/themes/default/images/icon_grid.png differ
diff --git a/data/themes/default/images/icon_list.png 
b/data/themes/default/images/icon_list.png
new file mode 100644
index 0000000..4ecd332
Binary files /dev/null and b/data/themes/default/images/icon_list.png differ
diff --git a/data/themes/default/widgets/fileselector.edc 
b/data/themes/default/widgets/fileselector.edc
index fad4d2c..a9b4447 100644
--- a/data/themes/default/widgets/fileselector.edc
+++ b/data/themes/default/widgets/fileselector.edc
@@ -188,6 +188,219 @@ group { name: "elm/fileselector/base/default";
             }
          }
       }
+      programs {
+         program { name: "program_0x1e19fa0";
+            signal: "elm,action,spinner,show";
+            source: "elm";
+            action: STATE_SET "visible" 0.00;
+            transition: LINEAR 0.20000;
+            target: "elm.spinner.clip";
+         }
+         program { name: "program_0x1e1a2d0";
+            signal: "elm,action,spinner,hide";
+            source: "elm";
+            action: STATE_SET "default" 0.00;
+            transition: LINEAR 0.50000 CURRENT;
+            target: "elm.spinner.clip";
+         }
+      }
+   }
+}
+
+group { name: "elm/fileselector/base/extended";
+   data {
+      item: "path_separator" "<item relsize=15x15 vsize=full 
href=path/separator></item>";
+   }
+   parts {
+      part { name: "elm.swallow.up";
+         type: SWALLOW;
+         description { state: "default" 0.00;
+            align: 0.00 0.00;
+            fixed: 1 1;
+            min: 5 5;
+            rel2.relative: 0.00 0.00;
+         }
+      }
+      part { name: "elm.swallow.home";
+         type: SWALLOW;
+         description { state: "default" 0.00;
+            align: 0.00 0.00;
+            fixed: 1 1;
+            min: 5 5;
+            rel1 {
+               relative: 1.00 0.00;
+               offset: 6 0;
+               to: "elm.swallow.up";
+            }
+            rel2 {
+               offset: 3 -1;
+               to: "elm.swallow.up";
+            }
+         }
+      }
+      part { name: "elm.swallow.search";
+         type: SWALLOW;
+         description { state: "default" 0.00;
+            align: 0.00 0.50;
+            fixed: 1 1;
+            max: 350 -1;
+            rel1 {
+               relative: 1.00 0.00;
+               offset: 6 0;
+               to: "elm.swallow.home";
+            }
+            rel2 {
+               relative: 0.00 1.00;
+               offset: -7 -1;
+               to_x: "elm.swallow.btn_list";
+               to_y: "elm.swallow.home";
+            }
+         }
+      }
+      part { name: "elm.spinner.clip";
+         type: RECT;
+         description { state: "default" 0.00;
+            color: 255 255 255 0;
+            rel1.to: "elm.swallow.spinner";
+            rel2.to: "elm.swallow.spinner";
+         }
+         description { state: "visible" 0.00;
+            inherit: "default" 0.00;
+            color: 255 255 255 255;
+         }
+      }
+      part { name: "elm.swallow.files";
+         type: SWALLOW;
+         description { state: "default" 0.00;
+            align: 1.00 0.00;
+            min: 10 10;
+            rel1 {
+               relative: 0.00 1.00;
+               offset: 0 6;
+               to_y: "elm.swallow.home";
+            }
+            rel2 {
+               relative: 1.00 0.00;
+               offset: -1 -7;
+               to_y: "elm.swallow.path";
+            }
+         }
+      }
+      part { name: "elm.swallow.path";
+         type: SWALLOW;
+         description { state: "default" 0.00;
+            align: 0.50 1.00;
+            fixed: 1 1;
+            rel1 {
+               offset: 0 -4;
+               to_y: "elm.swallow.filename";
+            }
+            rel2 {
+               relative: 1.00 0.00;
+               offset: -1 -4;
+               to_y: "elm.swallow.filename";
+            }
+         }
+      }
+      part { name: "elm.swallow.filename";
+         type: SWALLOW;
+         description { state: "default" 0.00;
+            align: 0.50 1.00;
+            fixed: 1 1;
+            rel1 {
+               offset: 0 -7;
+               to_y: "separator";
+            }
+            rel2 {
+               relative: 1.00 0.00;
+               offset: -1 -7;
+               to_y: "separator";
+            }
+         }
+      }
+      part { name: "separator";
+         type: IMAGE;
+         description { state: "default" 0.00;
+            align: 0.50 1.00;
+            min: 0 2;
+            max: -1 2;
+            image.normal: "separator-horizontal.png";
+            rel2 {
+               relative: 1.00 0.00;
+               offset: -1 -7;
+               to_y: "elm.swallow.ok";
+            }
+         }
+      }
+      part { name: "elm.swallow.filters";
+         type: SWALLOW;
+         description { state: "default" 0.00;
+            align: 1.00 1.00;
+            fixed: 1 1;
+            min: 74 0;
+            rel1.to: "elm.swallow.cancel";
+            rel2 {
+               relative: 0.00 1.00;
+               offset: -32 -1;
+               to: "elm.swallow.cancel";
+            }
+         }
+      }
+      part { name: "elm.swallow.cancel";
+         type: SWALLOW;
+         description { state: "default" 0.00;
+            align: 1.00 1.00;
+            fixed: 1 1;
+            min: 63 0;
+            rel1.to: "elm.swallow.ok";
+            rel2 {
+               relative: 0.00 1.00;
+               offset: -7 -1;
+               to: "elm.swallow.ok";
+            }
+         }
+      }
+      part { name: "elm.swallow.ok";
+         type: SWALLOW;
+         description { state: "default" 0.00;
+            align: 1.00 1.00;
+            fixed: 1 1;
+            min: 42 0;
+            rel1.relative: 1.00 1.00;
+         }
+      }
+      part { name: "elm.swallow.spinner";
+         type: SWALLOW;
+         clip_to: "elm.spinner.clip";
+         description { state: "default" 0.00;
+            rel1.to: "elm.swallow.files";
+            rel2.to: "elm.swallow.files";
+         }
+      }
+      part { name: "elm.swallow.btn_list";
+         type: SWALLOW;
+         description { state: "default" 0.00;
+            align: 1.00 0.00;
+            fixed: 1 1;
+            min: 20 19;
+            rel1.to_x: "elm.swallow.btn_grid";
+            rel2 {
+               relative: 0.00 0.00;
+               offset: -7 -1;
+               to_x: "elm.swallow.btn_grid";
+            }
+         }
+      }
+      part { name: "elm.swallow.btn_grid";
+         type: SWALLOW;
+         description { state: "default" 0.00;
+            align: 1.00 0.00;
+            fixed: 1 1;
+            min: 20 19;
+            rel1.relative: 1.00 0.00;
+            rel2.relative: 1.00 0.00;
+         }
+      }
    }
    programs {
       program { name: "program_0x1e19fa0";
diff --git a/data/themes/default/widgets/radio.edc 
b/data/themes/default/widgets/radio.edc
index aa8c703..33e5194 100644
--- a/data/themes/default/widgets/radio.edc
+++ b/data/themes/default/widgets/radio.edc
@@ -700,3 +700,211 @@ WORKSPACE_RADIO("separate", "separate.png")
 WORKSPACE_RADIO("animator", "animator.png")
 WORKSPACE_RADIO("code", "code.png")
 WORKSPACE_RADIO("demo", "demo.png")
+
+group { name: "elm/radio/base/fs_list";
+   images {
+      image: "icon_list.png" COMP;
+   }
+   parts {
+      part { name: "radio";
+         type: IMAGE;
+         mouse_events: 0;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            min: 20 19;
+            max: 20 19;
+            image {
+               normal: "button_bg.png";
+               border: 4 4 9 9;
+            }
+         }
+         description { state: "visible" 0.0;
+            min: 20 19;
+            max: 20 19;
+            image {
+               normal: "button_click_bg.png";
+               border: 4 4 9 9;
+            }
+         }
+      }
+      part { name: "picture";
+         type: IMAGE;
+         mouse_events: 0;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 12 12;
+            max: 12 12;
+            rel1 {
+               to: "radio";
+               offset: 0 1;
+            }
+            rel2.to: "radio";
+            image {
+               normal: "icon_list.png";
+               middle: DEFAULT;
+            }
+         }
+      }
+      part { name: "events";
+         type: RECT;
+         ignore_flags: "ON_HOLD";
+         description { state: "default" 0.0;
+            color: 0 0 0 0;
+            rel1 {
+               to: "radio";
+            }
+            rel2 {
+               to: "radio";
+            }
+         }
+      }
+      part { name: "disabler";
+         type: RECT;
+         description { state: "default" 0.0;
+            visible: 0;
+            color: 0 0 0 0;
+         }
+         description { state: "disabled" 0.0;
+            color: 0 0 0 0;
+         }
+      }
+   }
+   programs {
+      program { name: "click";
+         signal: "mouse,up,1";
+         source: "events";
+         action: SIGNAL_EMIT "elm,action,radio,toggle" "";
+      }
+      program { name: "radio_on";
+         signal: "elm,state,radio,on";
+         source: "elm";
+         action: STATE_SET "visible" 0.00;
+         transition: LINEAR 0.08000;
+         target: "radio";
+      }
+      program { name: "radio_off";
+         signal: "elm,state,radio,off";
+         source: "elm";
+         action: STATE_SET "default" 0.00;
+         transition: LINEAR 0.08000;
+         target: "radio";
+      }
+      program { name: "disable";
+         signal: "elm,state,disabled";
+         source: "elm";
+         action: STATE_SET "disabled" 0.00;
+         target: "disabler";
+      }
+      program { name: "enable";
+         signal: "elm,state,enabled";
+         source: "elm";
+         action: STATE_SET "default" 0.00;
+         target: "disabler";
+      }
+   }
+}
+
+group { name: "elm/radio/base/fs_grid";
+   images {
+      image: "icon_grid.png" COMP;
+   }
+   parts {
+      part { name: "radio";
+         type: IMAGE;
+         mouse_events: 0;
+         scale: 1;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            min: 20 19;
+            max: 20 19;
+            image {
+               normal: "button_bg.png";
+               border: 4 4 9 9;
+            }
+         }
+         description { state: "visible" 0.0;
+            min: 20 19;
+            max: 20 19;
+            image {
+               normal: "button_click_bg.png";
+               border: 4 4 9 9;
+            }
+         }
+      }
+      part { name: "picture";
+         type: IMAGE;
+         mouse_events: 0;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 12 12;
+            max: 12 12;
+            rel1 {
+               to: "radio";
+               offset: 0 1;
+            }
+            rel2.to: "radio";
+            image {
+               normal: "icon_grid.png";
+               middle: DEFAULT;
+            }
+         }
+      }
+      part { name: "events";
+         type: RECT;
+         ignore_flags: "ON_HOLD";
+         description { state: "default" 0.0;
+            color: 0 0 0 0;
+            rel1 {
+               to: "radio";
+            }
+            rel2 {
+               to: "radio";
+            }
+         }
+      }
+      part { name: "disabler";
+         type: RECT;
+         description { state: "default" 0.0;
+            visible: 0;
+            color: 0 0 0 0;
+         }
+         description { state: "disabled" 0.0;
+            color: 0 0 0 0;
+         }
+      }
+   }
+   programs {
+      program { name: "click";
+         signal: "mouse,up,1";
+         source: "events";
+         action: SIGNAL_EMIT "elm,action,radio,toggle" "";
+      }
+      program { name: "radio_on";
+         signal: "elm,state,radio,on";
+         source: "elm";
+         action: STATE_SET "visible" 0.00;
+         transition: LINEAR 0.08000;
+         target: "radio";
+      }
+      program { name: "radio_off";
+         signal: "elm,state,radio,off";
+         source: "elm";
+         action: STATE_SET "default" 0.00;
+         transition: LINEAR 0.08000;
+         target: "radio";
+      }
+      program { name: "disable";
+         signal: "elm,state,disabled";
+         source: "elm";
+         action: STATE_SET "disabled" 0.00;
+         target: "disabler";
+      }
+      program { name: "enable";
+         signal: "elm,state,enabled";
+         source: "elm";
+         action: STATE_SET "default" 0.00;
+         target: "disabler";
+      }
+   }
+}
diff --git a/src/bin/ui/popup.c b/src/bin/ui/popup.c
index f18b7bd..d814f48 100644
--- a/src/bin/ui/popup.c
+++ b/src/bin/ui/popup.c
@@ -471,6 +471,25 @@ _done(void *data __UNUSED__,
 }
 
 static void
+_fs_mode_cb(void *data __UNUSED__,
+            Evas_Object *obj,
+            void *event_info __UNUSED__)
+{
+   int mode = elm_radio_value_get(obj);
+
+   if (mode == 0)
+     {
+        elm_fileselector_mode_set(fs, ELM_FILESELECTOR_LIST);
+        elm_fileselector_thumbnail_size_set(fs, 14, 14);
+     }
+   else if (mode == 1)
+     {
+        elm_fileselector_mode_set(fs, ELM_FILESELECTOR_GRID);
+        elm_fileselector_thumbnail_size_set(fs, 64, 64);
+     }
+}
+
+static void
 _fileselector_helper(const char *title,
                      Evas_Object *follow_up,
                      const char *path,
@@ -481,6 +500,7 @@ _fileselector_helper(const char *title,
                      Elm_Fileselector_Filter_Func filter_cb)
 {
    Evas_Object *scroller;
+   Evas_Object *r_list, *r_grid;
 
    dismiss_func = func;
    func_data = data;
@@ -490,6 +510,7 @@ _fileselector_helper(const char *title,
    elm_layout_signal_callback_add(helper, "hint,dismiss", "eflete", 
_helper_dismiss, follow_up);
 
    fs = elm_fileselector_add(ap.win);
+   elm_object_style_set(fs, "extended");
 #if HAVE_TIZEN
    /* Dirty Hack */
    Evas_Object *files_list;
@@ -514,6 +535,19 @@ _fileselector_helper(const char *title,
    evas_object_size_hint_min_set(helper, FS_W, FS_H);
    evas_object_resize(helper, FS_W, FS_H);
 
+   r_list = elm_radio_add(fs);
+   elm_object_style_set(r_list, "fs_list");
+   elm_radio_state_value_set(r_list, 0);
+   elm_layout_content_set(fs, "elm.swallow.btn_list", r_list);
+   evas_object_smart_callback_add(r_list, signals.elm.radio.changed, 
_fs_mode_cb, fs);
+
+   r_grid = elm_radio_add(fs);
+   elm_object_style_set(r_grid, "fs_grid");
+   elm_radio_state_value_set(r_grid, 1);
+   elm_layout_content_set(fs, "elm.swallow.btn_grid", r_grid);
+   elm_radio_group_add(r_list, r_grid);
+   evas_object_smart_callback_add(r_grid, signals.elm.radio.changed, 
_fs_mode_cb, fs);
+
    /* scroller is necessary to fix issues with fileselector size */
    SCROLLER_ADD(ap.win, scroller);
    elm_object_content_set(scroller, fs);
diff --git a/src/bin/ui/tab_home_open.c b/src/bin/ui/tab_home_open.c
index d28b931..6fcfcd0 100644
--- a/src/bin/ui/tab_home_open.c
+++ b/src/bin/ui/tab_home_open.c
@@ -192,9 +192,29 @@ _recent_clear(void *data __UNUSED__,
    evas_object_smart_callback_add(popup, POPUP_CLOSE_CB, 
_recent_clear_popup_close_cb, NULL);
 }
 
+static void
+_fs_mode_cb(void *data __UNUSED__,
+            Evas_Object *obj,
+            void *event_info __UNUSED__)
+{
+   int mode = elm_radio_value_get(obj);
+
+   if (mode == 0)
+     {
+        elm_fileselector_mode_set(tab.fs, ELM_FILESELECTOR_LIST);
+        elm_fileselector_thumbnail_size_set(tab.fs, 14, 14);
+     }
+   else if (mode == 1)
+     {
+        elm_fileselector_mode_set(tab.fs, ELM_FILESELECTOR_GRID);
+        elm_fileselector_thumbnail_size_set(tab.fs, 64, 64);
+     }
+}
+
 Evas_Object *
 _tab_open_project_add(void)
 {
+   Evas_Object *r_list, *r_grid;
    tab.layout = elm_layout_add(ap.win);
    elm_layout_theme_set(tab.layout, "layout", "tab_home", "open_project");
    elm_layout_text_set(tab.layout, "elm.text.recent", _("Open recent"));
@@ -205,6 +225,7 @@ _tab_open_project_add(void)
    evas_object_smart_callback_add(tab.btn_clear, signals.elm.button.clicked, 
_recent_clear, NULL);
 
    tab.fs = elm_fileselector_add(ap.win);
+   elm_object_style_set(tab.fs, "extended");
    elm_fileselector_expandable_set(tab.fs, false);
    elm_fileselector_path_set(tab.fs, profile_get()->general.projects_folder);
    elm_fileselector_custom_filter_append(tab.fs, _eflete_filter, NULL, "Eflete 
Files");
@@ -221,6 +242,19 @@ _tab_open_project_add(void)
    elm_object_text_set(elm_layout_content_get(tab.fs, "elm.swallow.ok"), 
_("Open"));
    elm_object_disabled_set(elm_layout_content_get(tab.fs, "elm.swallow.ok"), 
true);
 
+   r_list = elm_radio_add(tab.fs);
+   elm_object_style_set(r_list, "fs_list");
+   elm_radio_state_value_set(r_list, 0);
+   elm_layout_content_set(tab.fs, "elm.swallow.btn_list", r_list);
+   evas_object_smart_callback_add(r_list, signals.elm.radio.changed, 
_fs_mode_cb, NULL);
+
+   r_grid = elm_radio_add(tab.fs);
+   elm_object_style_set(r_grid, "fs_grid");
+   elm_radio_state_value_set(r_grid, 1);
+   elm_layout_content_set(tab.fs, "elm.swallow.btn_grid", r_grid);
+   elm_radio_group_add(r_list, r_grid);
+   evas_object_smart_callback_add(r_grid, signals.elm.radio.changed, 
_fs_mode_cb, NULL);
+
    elm_layout_content_set(tab.layout, "elm.swallow.fileselector", tab.fs);
 
    _tab_open_project_recents_update();

-- 


Reply via email to