jaehwan pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=220c58eb8f650cada6dc45f10f152265add2c411

commit 220c58eb8f650cada6dc45f10f152265add2c411
Author: Jaehwan Kim <jae.hwan....@samsung.com>
Date:   Sat Dec 3 10:52:54 2016 +0900

    project_navigator: add the option to open the first group automatically.
    
    The user want to the widget more quickly. So they can use --open-group
    option to open the first group automatically. If the user open only
    one group, this option is more useful.
---
 src/bin/eflete.h               |  1 +
 src/bin/main.c                 |  5 ++++-
 src/bin/ui/project_navigator.c | 16 ++++++++++++++--
 src/bin/ui/tabs.c              |  2 +-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/bin/eflete.h b/src/bin/eflete.h
index 768eb33..f39bbce 100644
--- a/src/bin/eflete.h
+++ b/src/bin/eflete.h
@@ -145,6 +145,7 @@ struct _App_Data
                                        This is needed to continue closing 
application after
                                        clicking in save/don't save buttons in 
project close
                                        popup */
+   Eina_Bool open_group : 1;
 #ifdef HAVE_ENVENTOR
    Evas_Object *enventor;
    Eina_Bool enventor_mode : 1;
diff --git a/src/bin/main.c b/src/bin/main.c
index b100aaa..539a1fe 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -71,6 +71,7 @@ static const Ecore_Getopt options = {
       ECORE_GETOPT_APPEND_METAVAR('d', "dd", "Add data directory for edc 
compilation", "DIR_NAME", ECORE_GETOPT_TYPE_STR),
       ECORE_GETOPT_APPEND_METAVAR('w', "widget", "Add widget to new project or 
import edj-file. Add its styles if the style names are added. Copy its styles 
if the copy style names are added. **rule = 
WIDGET:STYLE[COPY_STYLE,..]{ITEM_STYLE,..[COPY_ITEM_STYLE,..]},..", "(Follow 
the below rule)", ECORE_GETOPT_TYPE_STR),
       ECORE_GETOPT_STORE_TRUE('r', "reopen", "reopen last project"),
+      ECORE_GETOPT_STORE_TRUE('o', "open-group", "open the first group 
automatically"),
       ECORE_GETOPT_VERSION  ('v', "version"),
       ECORE_GETOPT_COPYRIGHT('c', "copyright"),
       ECORE_GETOPT_LICENSE  ('l', "license"),
@@ -185,7 +186,7 @@ _new_project(void *data __UNUSED__)
 EAPI_MAIN int
 elm_main(int argc, char **argv)
 {
-   Eina_Bool info_only = false, reopen = false;
+   Eina_Bool info_only = false, reopen = false, open_group = false;
    Config *config;
    Recent *r;
    int pos;
@@ -201,6 +202,7 @@ elm_main(int argc, char **argv)
      ECORE_GETOPT_VALUE_LIST(data_dirs),
      ECORE_GETOPT_VALUE_LIST(widgets),
      ECORE_GETOPT_VALUE_BOOL(reopen),
+     ECORE_GETOPT_VALUE_BOOL(open_group),
      ECORE_GETOPT_VALUE_BOOL(info_only),
      ECORE_GETOPT_VALUE_BOOL(info_only),
      ECORE_GETOPT_VALUE_BOOL(info_only),
@@ -359,6 +361,7 @@ run:
              ecore_file_mkpath(export_edc);
              ap.path.export_edc = eina_stringshare_add(export_edc);
           }
+        ap.open_group = open_group;
         evas_object_show(ap.win);
         elm_run();
 exit:
diff --git a/src/bin/ui/project_navigator.c b/src/bin/ui/project_navigator.c
index dc89760..fcfb8a1 100644
--- a/src/bin/ui/project_navigator.c
+++ b/src/bin/ui/project_navigator.c
@@ -57,6 +57,7 @@ typedef struct
 static Project_Navigator project_navigator;
 static Layout_Popup layout_p;
 static Resource_Name_Validator *validator = NULL;
+static Eina_Bool first_group_open = EINA_FALSE;
 
 static char *
 _group_item_label_get(void *data,
@@ -196,6 +197,7 @@ _expanded_cb(void *data __UNUSED__,
    Eina_List *folders = NULL, *groups = NULL;
    Elm_Object_Item *glit = event_info;
    Eina_Stringshare *prefix = elm_object_item_data_get(glit);
+   Elm_Object_Item *it;
 
    if (glit == project_navigator.item_top)
      widget_tree_items_get(ap.project->RM.groups, "", &folders, &groups);
@@ -204,23 +206,33 @@ _expanded_cb(void *data __UNUSED__,
 
    EINA_LIST_FREE(folders, prefix)
      {
-        elm_genlist_item_append(project_navigator.genlist,
+        it = elm_genlist_item_append(project_navigator.genlist,
                                 project_navigator.itc_folder,
                                 prefix,
                                 glit,
                                 ELM_GENLIST_ITEM_TREE,
                                 NULL,
                                 NULL);
+        if (ap.open_group && !first_group_open)
+          elm_genlist_item_expanded_set(it, true);
      }
    EINA_LIST_FREE(groups, group)
      {
-        elm_genlist_item_append(project_navigator.genlist,
+        it = elm_genlist_item_append(project_navigator.genlist,
                                 project_navigator.itc_group,
                                 group,
                                 glit,
                                 ELM_GENLIST_ITEM_NONE,
                                 NULL,
                                 NULL);
+        if (ap.open_group && !first_group_open)
+          {
+             elm_genlist_item_selected_set(it, true);
+
+             Group2 *group = (Group2 *)elm_object_item_data_get(it);
+             evas_object_smart_callback_call(project_navigator.layout, 
SIGNAL_GROUP_OPEN, group);
+             first_group_open = EINA_TRUE;
+          }
      }
 }
 
diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c
index 95b75d9..1d3c804 100644
--- a/src/bin/ui/tabs.c
+++ b/src/bin/ui/tabs.c
@@ -1255,7 +1255,7 @@ subtab_select:
    button = elm_object_part_content_get(content, "elm.swallow.btn_create");
    evas_object_smart_callback_call(button, signals.elm.button.clicked, NULL);
 #endif /* HAVE_TIZEN */
-   elm_toolbar_item_selected_set(item->toolbar_item, true);
+   if (!ap.open_group) elm_toolbar_item_selected_set(item->toolbar_item, true);
 }
 
 void

-- 


Reply via email to