Profiles: add a new profile window
Two profiles are possible: local and shell remote. Only local can work for the moment.
This commit is contained in:
parent
1b6255b4a2
commit
f1963435ba
|
@ -72,15 +72,18 @@ typedef struct
|
|||
|
||||
typedef enum
|
||||
{
|
||||
CLOUSEAU_PROFILE_LOCAL,
|
||||
CLOUSEAU_PROFILE_SDB
|
||||
CLOUSEAU_PROFILE_LOCAL = 1,
|
||||
CLOUSEAU_PROFILE_SHELL_REMOTE
|
||||
} Clouseau_Profile_Type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *file_name;
|
||||
const char *name;
|
||||
const char *command;
|
||||
const char *script;
|
||||
Clouseau_Profile_Type type;
|
||||
Elm_Object_Item *item;
|
||||
} Clouseau_Profile;
|
||||
|
||||
static Eina_List *_pending = NULL;
|
||||
|
@ -708,6 +711,7 @@ _config_load()
|
|||
sprintf(path, "%s/clouseau/profiles/%s", efreet_config_home_get(), filename);
|
||||
Eet_File *file = eet_open(path, EET_FILE_MODE_READ);
|
||||
Clouseau_Profile *p = eet_data_read(file, _profile_edd, _PROFILE_EET_ENTRY);
|
||||
p->file_name = eina_stringshare_add(filename);
|
||||
eet_close(file);
|
||||
_profiles = eina_list_append(_profiles, p);
|
||||
}
|
||||
|
@ -724,15 +728,16 @@ _profile_find(const char *name)
|
|||
}
|
||||
|
||||
static void
|
||||
_profile_save(const Clouseau_Profile *p, const char *filename)
|
||||
_profile_save(const Clouseau_Profile *p)
|
||||
{
|
||||
char path[1024];
|
||||
if (!p) return;
|
||||
sprintf(path, "%s/clouseau/profiles/%s", efreet_config_home_get(), filename);
|
||||
sprintf(path, "%s/clouseau/profiles/%s", efreet_config_home_get(), p->file_name);
|
||||
Eet_File *file = eet_open(path, EET_FILE_MODE_WRITE);
|
||||
_profile_eet_load();
|
||||
eet_data_write(file, _profile_edd, _PROFILE_EET_ENTRY, p, EINA_TRUE);
|
||||
eet_close(file);
|
||||
_profiles = eina_list_append(_profiles, p);
|
||||
}
|
||||
|
||||
static const Eina_Debug_Opcode ops[] =
|
||||
|
@ -751,6 +756,15 @@ static const Eina_Debug_Opcode ops[] =
|
|||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
static void
|
||||
_profile_sel_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Elm_Object_Item *glit = event_info;
|
||||
_selected_profile = glit ? elm_object_item_data_get(glit) : NULL;
|
||||
elm_object_disabled_set(_profiles_wdgs->profile_ok_button, !_selected_profile);
|
||||
elm_object_disabled_set(_profiles_wdgs->profile_delete_button, !_selected_profile);
|
||||
}
|
||||
|
||||
static void
|
||||
_profile_load()
|
||||
{
|
||||
|
@ -775,6 +789,71 @@ _profile_load()
|
|||
eina_debug_opcodes_register(_session, ops, _post_register_handle);
|
||||
}
|
||||
|
||||
static void _profile_type_selected_cb(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Gui_New_Profile_Win_Widgets *wdgs = NULL;
|
||||
eo_do(obj, wdgs = eo_key_data_get("_wdgs"));
|
||||
elm_object_text_set(obj, elm_object_item_text_get(event_info));
|
||||
Clouseau_Profile_Type type = (Clouseau_Profile_Type) data;
|
||||
if (type == CLOUSEAU_PROFILE_SHELL_REMOTE)
|
||||
{
|
||||
elm_object_disabled_set(wdgs->new_profile_command, EINA_FALSE);
|
||||
elm_object_disabled_set(wdgs->new_profile_script, EINA_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_object_text_set(wdgs->new_profile_command, NULL);
|
||||
elm_object_text_set(wdgs->new_profile_script, NULL);
|
||||
elm_object_disabled_set(wdgs->new_profile_command, EINA_TRUE);
|
||||
elm_object_disabled_set(wdgs->new_profile_script, EINA_TRUE);
|
||||
}
|
||||
eo_do(wdgs->new_profile_type_selector, eo_key_data_set("_current_type", data));
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
_new_profile_save_cb(void *data, Eo *save_bt, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Gui_New_Profile_Win_Widgets *wdgs = NULL;
|
||||
Clouseau_Profile *p = NULL;
|
||||
eo_do(save_bt, wdgs = eo_key_data_get("_wdgs"));
|
||||
data = NULL;
|
||||
eo_do(wdgs->new_profile_type_selector, data = eo_key_data_get("_current_type"));
|
||||
if (!data) return EINA_TRUE; /* No type selected yet -> nothing done */
|
||||
Clouseau_Profile_Type type = (Clouseau_Profile_Type) data;
|
||||
const char *name = elm_object_text_get(wdgs->new_profile_name);
|
||||
const char *cmd = elm_object_text_get(wdgs->new_profile_command);
|
||||
const char *script = elm_object_text_get(wdgs->new_profile_script);
|
||||
if (!name || !*name) return EINA_TRUE;
|
||||
if (type == CLOUSEAU_PROFILE_SHELL_REMOTE)
|
||||
{
|
||||
if (!cmd || !*cmd || !script || !*script) return EINA_TRUE;
|
||||
}
|
||||
p = calloc(1, sizeof(*p));
|
||||
p->file_name = eina_stringshare_add(name); /* FIXME: Have to format name to conform to file names convention */
|
||||
p->name = eina_stringshare_add(name);
|
||||
p->type = type;
|
||||
p->command = eina_stringshare_add(cmd);
|
||||
p->script = eina_stringshare_add(script);
|
||||
_profile_save(p);
|
||||
eo_del(wdgs->new_profile_win);
|
||||
p->item = elm_genlist_item_append(_profiles_wdgs->profiles_list, _profiles_itc, p,
|
||||
NULL, ELM_GENLIST_ITEM_NONE, _profile_sel_cb, NULL);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gui_new_profile_win_create_done(Gui_New_Profile_Win_Widgets *wdgs)
|
||||
{
|
||||
eo_do(wdgs->new_profile_type_selector,
|
||||
eo_key_data_set("_wdgs", wdgs),
|
||||
elm_obj_hoversel_hover_parent_set(wdgs->new_profile_win),
|
||||
elm_obj_hoversel_item_add("Local connection", NULL, ELM_ICON_NONE, _profile_type_selected_cb, (void *)CLOUSEAU_PROFILE_LOCAL),
|
||||
elm_obj_hoversel_item_add("Shell remote", NULL, ELM_ICON_NONE, _profile_type_selected_cb, (void *)CLOUSEAU_PROFILE_SHELL_REMOTE));
|
||||
|
||||
eo_do(wdgs->new_profile_save_button, eo_key_data_set("_wdgs", wdgs));
|
||||
eo_do(wdgs->new_profile_cancel_button, eo_key_data_set("_wdgs", wdgs));
|
||||
}
|
||||
|
||||
static char *_profile_item_label_get(void *data, Evas_Object *obj EINA_UNUSED,
|
||||
const char *part EINA_UNUSED)
|
||||
{
|
||||
|
@ -782,14 +861,6 @@ static char *_profile_item_label_get(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
return strdup(p->name);
|
||||
}
|
||||
|
||||
static void
|
||||
_profile_sel_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Elm_Object_Item *glit = event_info;
|
||||
_selected_profile = elm_object_item_data_get(glit);
|
||||
elm_object_disabled_set(_profiles_wdgs->profile_ok_button, EINA_FALSE);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
_profile_win_close_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
|
@ -799,6 +870,32 @@ _profile_win_close_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Even
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_profile_item_del(void *data, Evas_Object *obj EINA_UNUSED)
|
||||
{
|
||||
Clouseau_Profile *p = data;
|
||||
p->item = NULL;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
_profile_del_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
if (_selected_profile)
|
||||
{
|
||||
char path[1024];
|
||||
sprintf(path, "%s/clouseau/profiles/%s", efreet_config_home_get(), _selected_profile->file_name);
|
||||
remove(path);
|
||||
elm_object_item_del(_selected_profile->item);
|
||||
_profiles = eina_list_remove(_profiles, _selected_profile);
|
||||
eina_stringshare_del(_selected_profile->file_name);
|
||||
eina_stringshare_del(_selected_profile->name);
|
||||
free(_selected_profile);
|
||||
_selected_profile = NULL;
|
||||
}
|
||||
_profile_sel_cb(NULL, NULL, NULL);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI_MAIN int
|
||||
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
||||
{
|
||||
|
@ -809,9 +906,10 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
if (!_profile_find("Local connection"))
|
||||
{
|
||||
Clouseau_Profile *p = calloc(1, sizeof(*p));
|
||||
p->file_name = "local";
|
||||
p->name = eina_stringshare_add("Local connection");
|
||||
p->type = CLOUSEAU_PROFILE_LOCAL;
|
||||
_profile_save(p, "local");
|
||||
_profile_save(p);
|
||||
}
|
||||
|
||||
if (!_profiles_itc)
|
||||
|
@ -819,6 +917,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
_profiles_itc = elm_genlist_item_class_new();
|
||||
_profiles_itc->item_style = "default";
|
||||
_profiles_itc->func.text_get = _profile_item_label_get;
|
||||
_profiles_itc->func.del = _profile_item_del;
|
||||
}
|
||||
|
||||
eolian_directory_scan(EOLIAN_EO_DIR);
|
||||
|
@ -850,7 +949,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
_obj_info_itc->func.text_get = _obj_info_item_label_get;
|
||||
_obj_info_itc->func.content_get = NULL;
|
||||
_obj_info_itc->func.state_get = NULL;
|
||||
_obj_info_itc->func.del = _obj_info_item_del;
|
||||
_obj_info_itc->func.del = _obj_info_item_del;
|
||||
}
|
||||
eo_do(_main_widgets->object_infos_list,
|
||||
eo_event_callback_add(ELM_GENLIST_EVENT_EXPAND_REQUEST, _obj_info_expand_request_cb, NULL),
|
||||
|
@ -866,7 +965,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
Eina_List *itr;
|
||||
Clouseau_Profile *p;
|
||||
EINA_LIST_FOREACH(_profiles, itr, p)
|
||||
elm_genlist_item_append(_profiles_wdgs->profiles_list, _profiles_itc, p,
|
||||
p->item = elm_genlist_item_append(_profiles_wdgs->profiles_list, _profiles_itc, p,
|
||||
NULL, ELM_GENLIST_ITEM_NONE, _profile_sel_cb, NULL);
|
||||
}
|
||||
|
||||
|
|
306
src/bin/gui
306
src/bin/gui
|
@ -9,7 +9,10 @@
|
|||
{
|
||||
"Eo_Callbacks":
|
||||
{
|
||||
"profile_close":"_profile_win_close_cb"
|
||||
"profile_close":"_profile_win_close_cb",
|
||||
"new_profile_save":"_new_profile_save_cb",
|
||||
"new_profile_cancel":"_new_profile_cancel_cb",
|
||||
"profile_del":"_profile_del_cb"
|
||||
}
|
||||
},
|
||||
"Widgets":
|
||||
|
@ -80,8 +83,6 @@
|
|||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[1174, 643],
|
||||
"Efl.Gfx.Base.position":[-8, -2],
|
||||
"Elm.Hoversel.horizontal":[false],
|
||||
"Elm.Hoversel.auto_update":[true],
|
||||
"Elm.Widget.part_text":[null, "Select App"]
|
||||
}
|
||||
},
|
||||
|
@ -158,14 +159,6 @@
|
|||
},
|
||||
"Contains":["elm_bg2", "elm_box2"]
|
||||
},
|
||||
"elm_menu1":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"profiles_win",
|
||||
"class":"Elm.Menu"
|
||||
}
|
||||
},
|
||||
"elm_bg2":
|
||||
{
|
||||
"Desc":
|
||||
|
@ -212,7 +205,30 @@
|
|||
"Efl.Gfx.Base.position":[289, 742],
|
||||
"Evas.Object.size_hint_weight":[1, 0.20]
|
||||
},
|
||||
"Contains":["profile_ok_button", "profile_cancel_button"]
|
||||
"Contains":["profile_ok_button", "profile_cancel_button", "profile_new_button", "profile_delete_button"]
|
||||
},
|
||||
"profile_delete_button":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box3",
|
||||
"class":"Elm.Button",
|
||||
"public":true
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Elm.Widget.disabled":[true],
|
||||
"Elm.Widget.part_text":[null, "Delete profile"],
|
||||
"Efl.Gfx.Base.size":[115, 30],
|
||||
"Efl.Gfx.Base.position":[-42, 0],
|
||||
"Evas.Object.size_hint_align":[0.50, 0.50],
|
||||
"Evas.Object.size_hint_weight":[1, 1]
|
||||
},
|
||||
"Callbacks":
|
||||
{
|
||||
"clicked":["Invoke", "profile_del", null]
|
||||
}
|
||||
},
|
||||
"profile_ok_button":
|
||||
{
|
||||
|
@ -251,6 +267,26 @@
|
|||
"Elm.Widget.part_text":[null, "Cancel"]
|
||||
}
|
||||
},
|
||||
"profile_new_button":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box3",
|
||||
"class":"Elm.Button"
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[73, 30],
|
||||
"Elm.Widget.part_text":[null, "New profile"],
|
||||
"Evas.Object.size_hint_weight":[1, 1],
|
||||
"Evas.Object.size_hint_align":[0.50, 0.50]
|
||||
},
|
||||
"Callbacks":
|
||||
{
|
||||
"clicked":["Create", "new_profile_win", null]
|
||||
}
|
||||
},
|
||||
"profiles_list":
|
||||
{
|
||||
"Desc":
|
||||
|
@ -265,6 +301,252 @@
|
|||
"Efl.Gfx.Base.visible":[true],
|
||||
"Evas.Object.size_hint_align":[-1, -1]
|
||||
}
|
||||
},
|
||||
"new_profile_win":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":null,
|
||||
"class":"Elm.Win",
|
||||
"public":true
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Elm.Win.type":["ELM_WIN_BASIC"],
|
||||
"Elm.Win.autodel":[true],
|
||||
"Elm.Widget.part_text":[null, "Window"],
|
||||
"Evas.Object.size_hint_weight":[1, 1],
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[689, 390],
|
||||
"Elm.Win.title":["New profile..."],
|
||||
"Elm.Win.modal":[true]
|
||||
},
|
||||
"Contains":["elm_bg4", "elm_box5"]
|
||||
},
|
||||
"elm_bg4":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"new_profile_win",
|
||||
"class":"Elm.Bg"
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Evas.Object.size_hint_weight":[1, 1],
|
||||
"Efl.Gfx.Base.visible":[true]
|
||||
}
|
||||
},
|
||||
"elm_box5":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"new_profile_win",
|
||||
"class":"Elm.Box"
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Elm.Box.padding":[7, 0],
|
||||
"Evas.Object.size_hint_weight":[1, 1],
|
||||
"Evas.Object.size_hint_align":[-1, -1],
|
||||
"Efl.Gfx.Base.size":[200, 200],
|
||||
"Efl.Gfx.Base.visible":[true]
|
||||
},
|
||||
"Contains":["elm_box6", "elm_label1", "new_profile_command", "elm_label2", "new_profile_script", "elm_box4"]
|
||||
},
|
||||
"elm_box4":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box5",
|
||||
"class":"Elm.Box"
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Elm.Box.padding":[7, 0],
|
||||
"Evas.Object.size_hint_weight":[1, 1],
|
||||
"Evas.Object.size_hint_align":[-1, -1],
|
||||
"Efl.Gfx.Base.size":[200, 200],
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Elm.Box.horizontal":[true]
|
||||
},
|
||||
"Contains":["new_profile_save_button", "new_profile_cancel_button"]
|
||||
},
|
||||
"new_profile_cancel_button":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box4",
|
||||
"class":"Elm.Button",
|
||||
"public":true
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Evas.Object.size_hint_weight":[1, 1],
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[73, 30],
|
||||
"Elm.Widget.part_text":[null, "Cancel"]
|
||||
}
|
||||
},
|
||||
"new_profile_save_button":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box4",
|
||||
"class":"Elm.Button",
|
||||
"public":true
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Evas.Object.size_hint_weight":[1, 1],
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[73, 30],
|
||||
"Elm.Widget.part_text":[null, "Save"]
|
||||
},
|
||||
"Callbacks":
|
||||
{
|
||||
"clicked":["Invoke", "new_profile_save", null]
|
||||
}
|
||||
},
|
||||
"elm_box6":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box5",
|
||||
"class":"Elm.Box"
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Elm.Box.padding":[7, 0],
|
||||
"Evas.Object.size_hint_weight":[1, 1],
|
||||
"Evas.Object.size_hint_align":[-1, -1],
|
||||
"Efl.Gfx.Base.size":[200, 200],
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Elm.Box.horizontal":[true]
|
||||
},
|
||||
"Contains":["new_profile_type_selector", "elm_label3", "new_profile_name"]
|
||||
},
|
||||
"new_profile_type_selector":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box6",
|
||||
"class":"Elm.Hoversel",
|
||||
"public":true
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Evas.Object.size_hint_weight":[1, 1],
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[60, 40],
|
||||
"Evas.Object.size_hint_align":[0, 0.50],
|
||||
"Elm.Widget.part_text":[null, "Choose the profile type"]
|
||||
}
|
||||
},
|
||||
"elm_label3":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box6",
|
||||
"class":"Elm.Label"
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[60, 30],
|
||||
"Evas.Object.size_hint_align":[1, -1],
|
||||
"Elm.Widget.part_text":[null, "Name: "],
|
||||
"Evas.Object.size_hint_weight":[0, 1]
|
||||
}
|
||||
},
|
||||
"new_profile_name":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box6",
|
||||
"class":"Elm.Entry",
|
||||
"public":true
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Evas.Object.size_hint_align":[-1, -1],
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[65, 35],
|
||||
"Elm.Entry.scrollable":[true],
|
||||
"Elm.Entry.single_line":[true],
|
||||
"Evas.Object.size_hint_weight":[4, 1],
|
||||
"Elm.Entry.editable":[true],
|
||||
"Elm.Widget.part_text":[null, ""]
|
||||
}
|
||||
},
|
||||
"elm_label1":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box5",
|
||||
"class":"Elm.Label"
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Evas.Object.size_hint_weight":[1, 1],
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[115, 30],
|
||||
"Efl.Gfx.Base.position":[847, 0],
|
||||
"Elm.Widget.part_text":[null, "Command: "],
|
||||
"Evas.Object.size_hint_align":[0, 2]
|
||||
}
|
||||
},
|
||||
"new_profile_command":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box5",
|
||||
"class":"Elm.Entry",
|
||||
"public":true
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Elm.Entry.scrollable":[true],
|
||||
"Evas.Object.size_hint_align":[-1, -1],
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[65, 35],
|
||||
"Elm.Entry.single_line":[true],
|
||||
"Evas.Object.size_hint_weight":[1, 2],
|
||||
"Elm.Widget.disabled":[true]
|
||||
}
|
||||
},
|
||||
"elm_label2":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box5",
|
||||
"class":"Elm.Label"
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Evas.Object.size_hint_weight":[1, 1],
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[60, 30],
|
||||
"Evas.Object.size_hint_align":[0, 1],
|
||||
"Elm.Widget.part_text":[null, "Script: "]
|
||||
}
|
||||
},
|
||||
"new_profile_script":
|
||||
{
|
||||
"Desc":
|
||||
{
|
||||
"parent":"elm_box5",
|
||||
"class":"Elm.Entry",
|
||||
"public":true
|
||||
},
|
||||
"Properties":
|
||||
{
|
||||
"Elm.Entry.scrollable":[true],
|
||||
"Evas.Object.size_hint_align":[-1, -1],
|
||||
"Efl.Gfx.Base.visible":[true],
|
||||
"Efl.Gfx.Base.size":[65, 35],
|
||||
"Evas.Object.size_hint_weight":[1, 8],
|
||||
"Elm.Widget.disabled":[true]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
192
src/bin/gui.c
192
src/bin/gui.c
|
@ -15,8 +15,16 @@
|
|||
|
||||
static Gui_Widgets g_pub_widgets;
|
||||
|
||||
extern void gui_new_profile_win_create_done(Gui_New_Profile_Win_Widgets *wdgs);
|
||||
|
||||
extern Eina_Bool
|
||||
_profile_win_close_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
|
||||
extern Eina_Bool
|
||||
_new_profile_save_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
|
||||
extern Eina_Bool
|
||||
_new_profile_cancel_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
|
||||
extern Eina_Bool
|
||||
_profile_del_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
|
||||
|
||||
static Eina_Bool
|
||||
_pubs_free_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
|
@ -65,8 +73,6 @@ gui_main_win_create(Eo *__main_parent)
|
|||
eo_do(apps_selector, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(apps_selector, efl_gfx_size_set(1174, 643));
|
||||
eo_do(apps_selector, efl_gfx_position_set(-8, -2));
|
||||
eo_do(apps_selector, elm_obj_hoversel_horizontal_set(EINA_FALSE));
|
||||
eo_do(apps_selector, elm_obj_hoversel_auto_update_set(EINA_TRUE));
|
||||
eo_do(apps_selector, elm_obj_widget_part_text_set(NULL, "Select App"));
|
||||
elm_panes1 = eo_add(ELM_PANES_CLASS, elm_box1);
|
||||
eo_do(elm_panes1, elm_obj_panes_content_right_size_set(0.600000));
|
||||
|
@ -93,6 +99,21 @@ gui_main_win_create(Eo *__main_parent)
|
|||
return pub_widgets;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
profile_delete_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
_profile_del_cb(data, obj, desc, event_info);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
profile_new_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Gui_New_Profile_Win_Widgets *wdgs = gui_new_profile_win_create(NULL);
|
||||
gui_new_profile_win_create_done(wdgs);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
profile_ok_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
|
@ -106,12 +127,13 @@ gui_profiles_win_create(Eo *__main_parent)
|
|||
Gui_Profiles_Win_Widgets *pub_widgets = calloc(1, sizeof(*pub_widgets));
|
||||
|
||||
Eo *profiles_win;
|
||||
Eo *elm_menu1;
|
||||
Eo *elm_bg2;
|
||||
Eo *elm_box2;
|
||||
Eo *elm_box3;
|
||||
Eo *profile_delete_button;
|
||||
Eo *profile_ok_button;
|
||||
Eo *profile_cancel_button;
|
||||
Eo *profile_new_button;
|
||||
Eo *profiles_list;
|
||||
|
||||
|
||||
|
@ -125,7 +147,6 @@ elm_obj_win_type_set(ELM_WIN_BASIC));
|
|||
eo_do(profiles_win, evas_obj_freeze_events_set(EINA_FALSE));
|
||||
eo_do(profiles_win, evas_obj_repeat_events_set(EINA_FALSE));
|
||||
eo_do(profiles_win, elm_obj_win_title_set("Profiles"));
|
||||
elm_menu1 = eo_add(ELM_MENU_CLASS, profiles_win);
|
||||
elm_bg2 = eo_add(ELM_BG_CLASS, profiles_win);
|
||||
eo_do(elm_bg2, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(elm_bg2, efl_gfx_visible_set(EINA_TRUE));
|
||||
|
@ -144,6 +165,16 @@ elm_obj_win_type_set(ELM_WIN_BASIC));
|
|||
eo_do(elm_box3, efl_gfx_size_set(200, 139));
|
||||
eo_do(elm_box3, efl_gfx_position_set(289, 742));
|
||||
eo_do(elm_box3, evas_obj_size_hint_weight_set(1.000000, 0.200000));
|
||||
profile_delete_button = eo_add(ELM_BUTTON_CLASS, elm_box3);
|
||||
pub_widgets->profile_delete_button = profile_delete_button;
|
||||
eo_do(profile_delete_button, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(profile_delete_button, elm_obj_widget_disabled_set(EINA_TRUE));
|
||||
eo_do(profile_delete_button, elm_obj_widget_part_text_set(NULL, "Delete profile"));
|
||||
eo_do(profile_delete_button, efl_gfx_size_set(115, 30));
|
||||
eo_do(profile_delete_button, efl_gfx_position_set(-42, 0));
|
||||
eo_do(profile_delete_button, evas_obj_size_hint_align_set(0.500000, 0.500000));
|
||||
eo_do(profile_delete_button, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(profile_delete_button, eo_event_callback_add(EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, profile_delete_button_clicked, NULL));
|
||||
profile_ok_button = eo_add(ELM_BUTTON_CLASS, elm_box3);
|
||||
pub_widgets->profile_ok_button = profile_ok_button;
|
||||
eo_do(profile_ok_button, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
|
@ -158,8 +189,17 @@ elm_obj_win_type_set(ELM_WIN_BASIC));
|
|||
eo_do(profile_cancel_button, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(profile_cancel_button, efl_gfx_size_set(73, 30));
|
||||
eo_do(profile_cancel_button, elm_obj_widget_part_text_set(NULL, "Cancel"));
|
||||
profile_new_button = eo_add(ELM_BUTTON_CLASS, elm_box3);
|
||||
eo_do(profile_new_button, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(profile_new_button, efl_gfx_size_set(73, 30));
|
||||
eo_do(profile_new_button, elm_obj_widget_part_text_set(NULL, "New profile"));
|
||||
eo_do(profile_new_button, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(profile_new_button, evas_obj_size_hint_align_set(0.500000, 0.500000));
|
||||
eo_do(profile_new_button, eo_event_callback_add(EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, profile_new_button_clicked, NULL));
|
||||
eo_do(elm_box3, elm_obj_box_pack_end(profile_ok_button));
|
||||
eo_do(elm_box3, elm_obj_box_pack_end(profile_cancel_button));
|
||||
eo_do(elm_box3, elm_obj_box_pack_end(profile_new_button));
|
||||
eo_do(elm_box3, elm_obj_box_pack_end(profile_delete_button));
|
||||
profiles_list = eo_add(ELM_GENLIST_CLASS, elm_box2);
|
||||
pub_widgets->profiles_list = profiles_list;
|
||||
eo_do(profiles_list, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
|
@ -173,6 +213,150 @@ elm_obj_win_type_set(ELM_WIN_BASIC));
|
|||
return pub_widgets;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
new_profile_save_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
_new_profile_save_cb(data, obj, desc, event_info);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
Gui_New_Profile_Win_Widgets *
|
||||
gui_new_profile_win_create(Eo *__main_parent)
|
||||
{
|
||||
Gui_New_Profile_Win_Widgets *pub_widgets = calloc(1, sizeof(*pub_widgets));
|
||||
|
||||
Eo *new_profile_win;
|
||||
Eo *elm_bg4;
|
||||
Eo *elm_box5;
|
||||
Eo *elm_box4;
|
||||
Eo *new_profile_cancel_button;
|
||||
Eo *new_profile_save_button;
|
||||
Eo *elm_box6;
|
||||
Eo *new_profile_type_selector;
|
||||
Eo *elm_label3;
|
||||
Eo *new_profile_name;
|
||||
Eo *elm_label1;
|
||||
Eo *new_profile_command;
|
||||
Eo *elm_label2;
|
||||
Eo *new_profile_script;
|
||||
|
||||
|
||||
new_profile_win = eo_add(ELM_WIN_CLASS, __main_parent, elm_obj_win_type_set(ELM_WIN_BASIC));
|
||||
pub_widgets->new_profile_win = new_profile_win;
|
||||
eo_do(new_profile_win, elm_obj_win_autodel_set(EINA_TRUE));
|
||||
eo_do(new_profile_win, elm_obj_widget_part_text_set(NULL, "Window"));
|
||||
eo_do(new_profile_win, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(new_profile_win, efl_gfx_size_set(689, 390));
|
||||
eo_do(new_profile_win, elm_obj_win_title_set("New profile..."));
|
||||
eo_do(new_profile_win, elm_obj_win_modal_set(EINA_TRUE));
|
||||
elm_bg4 = eo_add(ELM_BG_CLASS, new_profile_win);
|
||||
eo_do(elm_bg4, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(elm_bg4, efl_gfx_visible_set(EINA_TRUE));
|
||||
elm_box5 = eo_add(ELM_BOX_CLASS, new_profile_win);
|
||||
eo_do(elm_box5, elm_obj_box_padding_set(7, 0));
|
||||
eo_do(elm_box5, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(elm_box5, evas_obj_size_hint_align_set(-1.000000, -1.000000));
|
||||
eo_do(elm_box5, efl_gfx_size_set(200, 200));
|
||||
eo_do(elm_box5, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(new_profile_win, elm_obj_win_resize_object_add(elm_bg4));
|
||||
eo_do(new_profile_win, elm_obj_win_resize_object_add(elm_box5));
|
||||
elm_box4 = eo_add(ELM_BOX_CLASS, elm_box5);
|
||||
eo_do(elm_box4, elm_obj_box_padding_set(7, 0));
|
||||
eo_do(elm_box4, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(elm_box4, evas_obj_size_hint_align_set(-1.000000, -1.000000));
|
||||
eo_do(elm_box4, efl_gfx_size_set(200, 200));
|
||||
eo_do(elm_box4, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(elm_box4, elm_obj_box_horizontal_set(EINA_TRUE));
|
||||
new_profile_cancel_button = eo_add(ELM_BUTTON_CLASS, elm_box4);
|
||||
pub_widgets->new_profile_cancel_button = new_profile_cancel_button;
|
||||
eo_do(new_profile_cancel_button, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(new_profile_cancel_button, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(new_profile_cancel_button, efl_gfx_size_set(73, 30));
|
||||
eo_do(new_profile_cancel_button, elm_obj_widget_part_text_set(NULL, "Cancel"));
|
||||
new_profile_save_button = eo_add(ELM_BUTTON_CLASS, elm_box4);
|
||||
pub_widgets->new_profile_save_button = new_profile_save_button;
|
||||
eo_do(new_profile_save_button, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(new_profile_save_button, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(new_profile_save_button, efl_gfx_size_set(73, 30));
|
||||
eo_do(new_profile_save_button, elm_obj_widget_part_text_set(NULL, "Save"));
|
||||
eo_do(new_profile_save_button, eo_event_callback_add(EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, new_profile_save_button_clicked, NULL));
|
||||
eo_do(elm_box4, elm_obj_box_pack_end(new_profile_save_button));
|
||||
eo_do(elm_box4, elm_obj_box_pack_end(new_profile_cancel_button));
|
||||
elm_box6 = eo_add(ELM_BOX_CLASS, elm_box5);
|
||||
eo_do(elm_box6, elm_obj_box_padding_set(7, 0));
|
||||
eo_do(elm_box6, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(elm_box6, evas_obj_size_hint_align_set(-1.000000, -1.000000));
|
||||
eo_do(elm_box6, efl_gfx_size_set(200, 200));
|
||||
eo_do(elm_box6, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(elm_box6, elm_obj_box_horizontal_set(EINA_TRUE));
|
||||
new_profile_type_selector = eo_add(ELM_HOVERSEL_CLASS, elm_box6);
|
||||
pub_widgets->new_profile_type_selector = new_profile_type_selector;
|
||||
eo_do(new_profile_type_selector, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(new_profile_type_selector, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(new_profile_type_selector, efl_gfx_size_set(60, 40));
|
||||
eo_do(new_profile_type_selector, evas_obj_size_hint_align_set(0.000000, 0.500000));
|
||||
eo_do(new_profile_type_selector, elm_obj_widget_part_text_set(NULL, "Choose the profile type"));
|
||||
elm_label3 = eo_add(ELM_LABEL_CLASS, elm_box6);
|
||||
eo_do(elm_label3, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(elm_label3, efl_gfx_size_set(60, 30));
|
||||
eo_do(elm_label3, evas_obj_size_hint_align_set(1.000000, -1.000000));
|
||||
eo_do(elm_label3, elm_obj_widget_part_text_set(NULL, "Name: "));
|
||||
eo_do(elm_label3, evas_obj_size_hint_weight_set(0.000000, 1.000000));
|
||||
new_profile_name = eo_add(ELM_ENTRY_CLASS, elm_box6);
|
||||
pub_widgets->new_profile_name = new_profile_name;
|
||||
eo_do(new_profile_name, evas_obj_size_hint_align_set(-1.000000, -1.000000));
|
||||
eo_do(new_profile_name, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(new_profile_name, efl_gfx_size_set(65, 35));
|
||||
eo_do(new_profile_name, elm_obj_entry_scrollable_set(EINA_TRUE));
|
||||
eo_do(new_profile_name, elm_obj_entry_single_line_set(EINA_TRUE));
|
||||
eo_do(new_profile_name, evas_obj_size_hint_weight_set(4.000000, 1.000000));
|
||||
eo_do(new_profile_name, elm_obj_entry_editable_set(EINA_TRUE));
|
||||
eo_do(new_profile_name, elm_obj_widget_part_text_set(NULL, ""));
|
||||
eo_do(elm_box6, elm_obj_box_pack_end(new_profile_type_selector));
|
||||
eo_do(elm_box6, elm_obj_box_pack_end(elm_label3));
|
||||
eo_do(elm_box6, elm_obj_box_pack_end(new_profile_name));
|
||||
elm_label1 = eo_add(ELM_LABEL_CLASS, elm_box5);
|
||||
eo_do(elm_label1, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(elm_label1, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(elm_label1, efl_gfx_size_set(115, 30));
|
||||
eo_do(elm_label1, efl_gfx_position_set(847, 0));
|
||||
eo_do(elm_label1, elm_obj_widget_part_text_set(NULL, "Command: "));
|
||||
eo_do(elm_label1, evas_obj_size_hint_align_set(0.000000, 2.000000));
|
||||
new_profile_command = eo_add(ELM_ENTRY_CLASS, elm_box5);
|
||||
pub_widgets->new_profile_command = new_profile_command;
|
||||
eo_do(new_profile_command, elm_obj_entry_scrollable_set(EINA_TRUE));
|
||||
eo_do(new_profile_command, evas_obj_size_hint_align_set(-1.000000, -1.000000));
|
||||
eo_do(new_profile_command, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(new_profile_command, efl_gfx_size_set(65, 35));
|
||||
eo_do(new_profile_command, elm_obj_entry_single_line_set(EINA_TRUE));
|
||||
eo_do(new_profile_command, evas_obj_size_hint_weight_set(1.000000, 2.000000));
|
||||
eo_do(new_profile_command, elm_obj_widget_disabled_set(EINA_TRUE));
|
||||
elm_label2 = eo_add(ELM_LABEL_CLASS, elm_box5);
|
||||
eo_do(elm_label2, evas_obj_size_hint_weight_set(1.000000, 1.000000));
|
||||
eo_do(elm_label2, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(elm_label2, efl_gfx_size_set(60, 30));
|
||||
eo_do(elm_label2, evas_obj_size_hint_align_set(0.000000, 1.000000));
|
||||
eo_do(elm_label2, elm_obj_widget_part_text_set(NULL, "Script: "));
|
||||
new_profile_script = eo_add(ELM_ENTRY_CLASS, elm_box5);
|
||||
pub_widgets->new_profile_script = new_profile_script;
|
||||
eo_do(new_profile_script, elm_obj_entry_scrollable_set(EINA_TRUE));
|
||||
eo_do(new_profile_script, evas_obj_size_hint_align_set(-1.000000, -1.000000));
|
||||
eo_do(new_profile_script, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(new_profile_script, efl_gfx_size_set(65, 35));
|
||||
eo_do(new_profile_script, evas_obj_size_hint_weight_set(1.000000, 8.000000));
|
||||
eo_do(new_profile_script, elm_obj_widget_disabled_set(EINA_TRUE));
|
||||
eo_do(elm_box5, elm_obj_box_pack_end(elm_box6));
|
||||
eo_do(elm_box5, elm_obj_box_pack_end(elm_label1));
|
||||
eo_do(elm_box5, elm_obj_box_pack_end(new_profile_command));
|
||||
eo_do(elm_box5, elm_obj_box_pack_end(elm_label2));
|
||||
eo_do(elm_box5, elm_obj_box_pack_end(new_profile_script));
|
||||
eo_do(elm_box5, elm_obj_box_pack_end(elm_box4));
|
||||
eo_do(new_profile_win, efl_gfx_visible_set(EINA_TRUE));
|
||||
eo_do(new_profile_win, eo_event_callback_add(EO_BASE_EVENT_DEL, _pubs_free_cb, pub_widgets));
|
||||
|
||||
return pub_widgets;
|
||||
}
|
||||
|
||||
Gui_Widgets *gui_gui_get()
|
||||
{
|
||||
static Eina_Bool initialized = EINA_FALSE;
|
||||
|
|
|
@ -15,12 +15,25 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
Eo *profiles_win;
|
||||
Eo *profile_delete_button;
|
||||
Eo *profile_ok_button;
|
||||
Eo *profile_cancel_button;
|
||||
Eo *profiles_list;
|
||||
} Gui_Profiles_Win_Widgets;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Eo *new_profile_win;
|
||||
Eo *new_profile_cancel_button;
|
||||
Eo *new_profile_save_button;
|
||||
Eo *new_profile_type_selector;
|
||||
Eo *new_profile_name;
|
||||
Eo *new_profile_command;
|
||||
Eo *new_profile_script;
|
||||
} Gui_New_Profile_Win_Widgets;
|
||||
|
||||
|
||||
typedef struct {
|
||||
Gui_Main_Win_Widgets *main_win;
|
||||
} Gui_Widgets;
|
||||
|
@ -29,5 +42,7 @@ Gui_Main_Win_Widgets *gui_main_win_create(Eo *parent);
|
|||
|
||||
Gui_Profiles_Win_Widgets *gui_profiles_win_create(Eo *parent);
|
||||
|
||||
Gui_New_Profile_Win_Widgets *gui_new_profile_win_create(Eo *parent);
|
||||
|
||||
Gui_Widgets *gui_gui_get();
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue