rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=3bb55494fe1a822d5a6ea57102c933f649c387fd

commit 3bb55494fe1a822d5a6ea57102c933f649c387fd
Author: Vyacheslav Reutskiy <v.reuts...@samsung.com>
Date:   Wed Feb 10 11:49:44 2016 +0200

    eflete: fill the import edj tab fiels on import from command liane
    
    Eflete it's a graphical application and do hiden import from command
    line it's wrong way. So if edj file imported from the command line
    Eflete show the necessary tab and fill the filds accourdingly to
    used options. In this way user can correct the entered data and
    can see the splash animation.
    
    Change-Id: I6ad334423267835e7fe8043a3b257a3588c7d19e
---
 src/bin/main.c | 79 +++-------------------------------------------------------
 1 file changed, 3 insertions(+), 76 deletions(-)

diff --git a/src/bin/main.c b/src/bin/main.c
index c8d006e..6148554 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -23,6 +23,7 @@
 #include "project_navigator.h"
 #include "project_manager.h"
 #include "project_common.h"
+#include "tabs.h"
 /* it's really bad idia, but need haven't time to make it correctly */
 #include "tabs_private.h"
 #include "config.h"
@@ -57,35 +58,6 @@ static const Ecore_Getopt options = {
    }
 };
 
-static void
-_import_end(void *data __UNUSED__, PM_Project_Result result)
-{
-   Project *pro;
-
-   if (result == PM_PROJECT_SUCCESS)
-     {
-        pro = pm_project_thread_project_get();
-        ap.project = pro;
-
-        ui_menu_items_list_disable_set(ap.menu, MENU_ITEMS_LIST_MAIN, false);
-        ui_menu_disable_set(ap.menu, MENU_FILE_CLOSE_PROJECT, false);
-        project_navigator_project_set();
-
-        STATUSBAR_PROJECT_PATH(ap.project->pro_path);
-        STATUSBAR_PROJECT_SAVE_TIME_UPDATE();
-
-        evas_object_smart_callback_call(ap.win, SIGNAL_PROJECT_OPENED, NULL);
-     }
-   evas_object_show(ap.win);
-}
-
-static Eina_Bool
-_message_print(void *data __UNUSED__, Eina_Stringshare *progress_string)
-{
-   fprintf(stdout, "%s\n", progress_string);
-   return true;
-}
-
 static Eina_Bool
 _setup_open_splash(void *data, Splash_Status status __UNUSED__)
 {
@@ -127,22 +99,14 @@ _open_project(void *data __UNUSED__)
 static void
 _import_edj(void *data __UNUSED__)
 {
-   /* Ugly hack, but we need to do this.
-    * When we try to import edj file while ecore main loop not fully started
-    * we get a freeze. So for use the ecore and eina threads in the project
-    * manager need to itarate the main loop for initialize it.
-    * DO NOT DELETE: whith out iterate import from command line not worked! */
-   ecore_main_loop_iterate();
-
-   pm_project_import_edj(pro_name, pro_path, import_edj,
-                         _message_print, _import_end, NULL);
+   tabs_menu_import_edj_data_set(pro_name, pro_path, import_edj);
+   tabs_menu_tab_open(TAB_HOME_IMPORT_EDJ);
 }
 
 EAPI_MAIN int
 elm_main(int argc, char **argv)
 {
    Eina_Bool info_only = false, reopen = false;
-   Eina_Stringshare *pro_folder;
    Config *config;
    Recent *r;
 
@@ -212,44 +176,7 @@ elm_main(int argc, char **argv)
           }
         if (import_edj)
           {
-            if (!ecore_file_exists(import_edj))
-              {
-                 fprintf(stderr, N_("ERROR: cann't find file: '%s'.\n"), 
import_edj);
-                 return -1;
-              }
-            if (!pro_name)
-              {
-                 fprintf(stderr, N_("ERROR: missing name for imported 
project.\n"));
-                 fprintf(stderr, N_("ERROR: invalid options found. See 
--help.\n"));
-                 return -1;
-              }
-            else
-              {
-                 regex_t regex;
-                 regcomp(&regex, NAME_REGEX, REG_EXTENDED | REG_NOSUB);
-                 if (regexec(&regex, pro_name, (size_t)0, NULL, 0))
-                   {
-                      fprintf(stderr, N_("ERROR: invalid name. Name can 
contain only next characters: a-zA-z0-9_.\n"));
-                      return -1;
-                   }
-                 regfree(&regex);
-              }
-            if (!pro_path) pro_path = eina_file_path_sanitize(".");
-            pro_folder = eina_stringshare_printf("%s/%s", pro_path, pro_name);
-            if (ecore_file_exists(pro_folder))
-              {
-                 if (!pro_replace)
-                   {
-                      fprintf(stderr, N_("ERROR: can't import file '%s'. 
Project '%s' exist.\n"),
-                              import_edj, pro_folder);
-                      fprintf(stderr, N_("ERROR: to replace existing project 
use option '--replace'.\n"));
-                      fprintf(stderr, N_("ERROR: invalid options found. See 
--help.\n"));
-                      return -1;
-                   }
-                 else  ecore_file_recursive_rm(pro_folder);
-              }
             ecore_job_add(_import_edj, NULL);
-            eina_stringshare_del(pro_folder); pro_folder = NULL;
             goto run;
           }
 

-- 


Reply via email to