Add Create Project menu item

Also provide command line argument to load the create
screen on launch.
This commit is contained in:
Andy Williams 2016-08-26 15:13:54 +01:00
parent 100d68a30d
commit 7f6fdac376
4 changed files with 40 additions and 4 deletions

View File

@ -450,7 +450,7 @@ _edi_project_config_load()
_edi_project_config->gui.bottomopen = EINA_FALSE;
_edi_project_config->gui.bottomtab = 0;
_edi_project_config->gui.width_marker = 80;
_edi_project_config->gui.width_marker = 81;
_edi_project_config->gui.tabstop = 8;
_edi_project_config->gui.toolbar_hidden = EINA_FALSE;

View File

@ -682,6 +682,16 @@ _tb_settings_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *even
edi_settings_show(_edi_main_win);
}
static void
_edi_menu_project_new_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
char path[PATH_MAX];
eina_file_path_join(path, sizeof(path), elm_app_bin_dir_get(), "edi -c");
ecore_exe_run(path, NULL);
}
static void
_edi_menu_new_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
@ -831,6 +841,8 @@ _edi_menu_setup(Evas_Object *win)
menu = elm_win_main_menu_get(win);
menu_it = elm_menu_item_add(menu, NULL, NULL, "File", NULL, NULL);
elm_menu_item_add(menu, menu_it, "folder-new", "New Project ...", _edi_menu_project_new_cb, NULL);
elm_menu_item_separator_add(menu, menu_it);
elm_menu_item_add(menu, menu_it, "document-new", "New ...", _edi_menu_new_cb, NULL);
elm_menu_item_add(menu, menu_it, "document-save", "Save", _edi_menu_save_cb, NULL);
elm_menu_item_add(menu, menu_it, "window-new", "New window", _edi_menu_open_window_cb, NULL);
@ -1143,6 +1155,7 @@ static const Ecore_Getopt optdesc = {
"The Enlightened IDE",
EINA_TRUE,
{
ECORE_GETOPT_STORE_TRUE('c', "create", "Create a new project"),
ECORE_GETOPT_LICENSE('L', "license"),
ECORE_GETOPT_COPYRIGHT('C', "copyright"),
ECORE_GETOPT_VERSION('V', "version"),
@ -1155,10 +1168,11 @@ EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
int args;
Eina_Bool quit_option = EINA_FALSE;
Eina_Bool create = EINA_FALSE, quit_option = EINA_FALSE;
const char *project_path = NULL;
Ecore_Getopt_Value values[] = {
ECORE_GETOPT_VALUE_BOOL(create),
ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option),
@ -1205,7 +1219,9 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
if (!project_path)
{
if (!edi_welcome_show())
if (create)
edi_welcome_create_show();
else if (!edi_welcome_show())
goto end;
}
else if (!ecore_file_is_dir(project_path))

View File

@ -31,6 +31,14 @@ extern "C" {
*/
Evas_Object *edi_welcome_show();
/**
* Initialise a new Edi welcome screen and open it on the create project panel.
*
* @return The welcome screen window that is created
*
* @ingroup UI
*/
Evas_Object *edi_welcome_create_show();
/**
* Initialize a new Edi about window and display it.

View File

@ -14,7 +14,7 @@
#define _EDI_WELCOME_PROJECT_NEW_TABLE_WIDTH 4
static Evas_Object *_welcome_window;
static Evas_Object *_welcome_window, *_welcome_naviframe;
static Evas_Object *_edi_new_popup;
static Evas_Object *_edi_welcome_list;
static Evas_Object *_edi_project_box;
@ -398,6 +398,7 @@ Evas_Object *edi_welcome_show()
evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, naviframe);
evas_object_show(naviframe);
_welcome_naviframe = naviframe;
hbx = elm_box_add(naviframe);
elm_box_horizontal_set(hbx, EINA_TRUE);
@ -465,3 +466,14 @@ Evas_Object *edi_welcome_show()
return win;
}
Evas_Object *
edi_welcome_create_show()
{
Evas_Object *win;
win = edi_welcome_show();
_edi_welcome_project_new_cb(_welcome_naviframe, NULL, NULL);
return win;
}