jaehwan pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=4c00f9c64e95c50209f8e315b31fb81177fa1491
commit 4c00f9c64e95c50209f8e315b31fb81177fa1491 Author: Jaehwan Kim <jae.hwan....@samsung.com> Date: Mon Apr 25 17:18:52 2016 +0900 main: use widget option when the file is edj --- src/bin/main.c | 8 ++++---- src/bin/ui/tab_home_import_edj.c | 42 +++++++++++++++++++++++++++++++++++++++- src/bin/ui/tabs.c | 4 ++-- src/bin/ui/tabs.h | 2 +- src/bin/ui/tabs_private.h | 2 +- 5 files changed, 49 insertions(+), 9 deletions(-) diff --git a/src/bin/main.c b/src/bin/main.c index 2bc4713..7fcf98b 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -120,13 +120,13 @@ _import_edj(void *data __UNUSED__) Eina_Tmpstr *proj_name; if (pro_name) { - tabs_menu_import_edj_data_set(pro_name, pro_path, file); + tabs_menu_import_edj_data_set(pro_name, pro_path, file, widgets); } else { name = ecore_file_file_get(file); proj_name = eina_tmpstr_add_length(name, strlen(name) - 4); - tabs_menu_import_edj_data_set(proj_name, pro_path, file); + tabs_menu_import_edj_data_set(proj_name, pro_path, file, widgets); eina_tmpstr_del(proj_name); } tabs_menu_tab_open(TAB_HOME_IMPORT_EDJ); @@ -255,8 +255,6 @@ elm_main(int argc, char **argv) _ERR_EXIT(_("File '%s' doesn't exists."), file); if (ecore_file_is_dir(file)) _ERR_EXIT(_("'%s' is a directory."), file); - if (widgets) - _ERR_EXIT(_("widgets can be added only to new project.")); if (eina_str_has_suffix(file, ".pro")) { @@ -272,6 +270,8 @@ elm_main(int argc, char **argv) _ERR_EXIT(_("*.pro file is given but --fd specified.")); if (data_dirs) _ERR_EXIT(_("*.pro file is given but --dd specified.")); + if (widgets) + _ERR_EXIT(_("widgets can be added only to new project.")); ecore_job_add(_open_project, NULL); goto run; diff --git a/src/bin/ui/tab_home_import_edj.c b/src/bin/ui/tab_home_import_edj.c index 68a1e73..4a07d5a 100644 --- a/src/bin/ui/tab_home_import_edj.c +++ b/src/bin/ui/tab_home_import_edj.c @@ -467,9 +467,23 @@ _tab_import_edj_add(void) return tab_edj.layout; } +static void +_delayed_popup(void *data) +{ + char *msg = data; + popup_want_action(_("Import edj-file"), msg, NULL, NULL, BTN_OK, NULL, NULL); + free(msg); +} + void -_tab_import_edj_data_set(const char *name, const char *path, const char *edj) +_tab_import_edj_data_set(const char *name, const char *path, const char *edj, const Eina_List *widgets) { + const Eina_List *l; + const char *str; + Widget_Item_Data *widget_item_data_iterator; + Eina_Strbuf *buf = eina_strbuf_new(); + Eina_Bool first_not_found = true; + assert(tab_edj.layout != NULL); elm_entry_entry_set(tab_edj.name, name); @@ -478,4 +492,30 @@ _tab_import_edj_data_set(const char *name, const char *path, const char *edj) else elm_entry_entry_set(tab_edj.path, profile_get()->general.projects_folder); elm_entry_entry_set(tab_edj.edj, edj); + + EINA_LIST_FOREACH(widgets, l, str) + { + widget_item_data_iterator = widget_item_data; + while (widget_item_data_iterator->name) + { + if (!strcasecmp(str, widget_item_data_iterator->name)) + break; + widget_item_data_iterator++; + } + if (widget_item_data_iterator->name) + widget_item_data_iterator->check = true; + else + { + eina_strbuf_append_printf(buf, first_not_found ? "%s" : ", %s", str); + first_not_found = false; + } + } + elm_genlist_realized_items_update(tab_edj.genlist); + if (eina_strbuf_length_get(buf)) + { + eina_strbuf_prepend(buf, _("Following widgets were not found and ignored: ")); + ERR("%s", eina_strbuf_string_get(buf)); + ecore_job_add(_delayed_popup, eina_strbuf_string_steal(buf)); + } + eina_strbuf_free(buf); } diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c index 23d2e55..7ab4dfb 100644 --- a/src/bin/ui/tabs.c +++ b/src/bin/ui/tabs.c @@ -1112,9 +1112,9 @@ tabs_menu_tab_open(Tabs_Menu view) } void -tabs_menu_import_edj_data_set(const char *name, const char *path, const char *edj) +tabs_menu_import_edj_data_set(const char *name, const char *path, const char *edj, const Eina_List *widgets) { - _tab_import_edj_data_set(name, path, edj); + _tab_import_edj_data_set(name, path, edj, widgets); } void diff --git a/src/bin/ui/tabs.h b/src/bin/ui/tabs.h index a6ad43a..bfe9dd9 100644 --- a/src/bin/ui/tabs.h +++ b/src/bin/ui/tabs.h @@ -66,7 +66,7 @@ tabs_menu_tab_open(Tabs_Menu view); * @ingroup Tabs */ void -tabs_menu_import_edj_data_set(const char *name, const char *path, const char *edj); +tabs_menu_import_edj_data_set(const char *name, const char *path, const char *edj, const Eina_List *widgets); /** * Fill the import edc tab fields diff --git a/src/bin/ui/tabs_private.h b/src/bin/ui/tabs_private.h index f5670bb..e0f771c 100644 --- a/src/bin/ui/tabs_private.h +++ b/src/bin/ui/tabs_private.h @@ -52,7 +52,7 @@ Evas_Object * _tab_import_edj_add(void); void -_tab_import_edj_data_set(const char *name, const char *path, const char *edj); +_tab_import_edj_data_set(const char *name, const char *path, const char *edj, const Eina_List *widgets); void _tab_import_edc_data_set(const char *name, const char *path, const char *edc, --