Merge remote-tracking branch 'mjtorn/login_shell'

Conflicts:
	src/bin/config.c
This commit is contained in:
Boris Faure 2014-01-15 22:03:26 +01:00
commit 2706eef099
4 changed files with 55 additions and 26 deletions

View File

@ -26,7 +26,7 @@ config_init(void)
elm_need_efreet(); elm_need_efreet();
efreet_init(); efreet_init();
eet_eina_stream_data_descriptor_class_set eet_eina_stream_data_descriptor_class_set
(&eddc, sizeof(eddc), "Config", sizeof(Config)); (&eddc, sizeof(eddc), "Config", sizeof(Config));
edd_base = eet_data_descriptor_stream_new(&eddc); edd_base = eet_data_descriptor_stream_new(&eddc);
@ -43,7 +43,7 @@ config_init(void)
(edd_color, Config_Color, "b", b, EET_T_UCHAR); (edd_color, Config_Color, "b", b, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_color, Config_Color, "a", a, EET_T_UCHAR); (edd_color, Config_Color, "a", a, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "version", version, EET_T_INT); (edd_base, Config, "version", version, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC EET_DATA_DESCRIPTOR_ADD_BASIC
@ -112,6 +112,8 @@ config_init(void)
(edd_base, Config, "cg_height", cg_height, EET_T_INT); (edd_base, Config, "cg_height", cg_height, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "drag_links", drag_links, EET_T_UCHAR); (edd_base, Config, "drag_links", drag_links, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "login_shell", login_shell, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "application_server", application_server, EET_T_UCHAR); (edd_base, Config, "application_server", application_server, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC EET_DATA_DESCRIPTOR_ADD_BASIC
@ -160,7 +162,7 @@ config_save(Config *config, const char *key)
config->font.orig_name = NULL; config->font.orig_name = NULL;
if (config->font.name) config->font.orig_name = eina_stringshare_add(config->font.name); if (config->font.name) config->font.orig_name = eina_stringshare_add(config->font.name);
config->font.orig_bitmap = config->font.bitmap; config->font.orig_bitmap = config->font.bitmap;
cfgdir = _config_home_get(); cfgdir = _config_home_get();
snprintf(buf, sizeof(buf), "%s/terminology/config/standard", cfgdir); snprintf(buf, sizeof(buf), "%s/terminology/config/standard", cfgdir);
ecore_file_mkpath(buf); ecore_file_mkpath(buf);
@ -221,6 +223,7 @@ config_sync(const Config *config_src, Config *config)
config->erase_is_del = config_src->erase_is_del; config->erase_is_del = config_src->erase_is_del;
config->temporary = config_src->temporary; config->temporary = config_src->temporary;
config->custom_geometry = config_src->custom_geometry; config->custom_geometry = config_src->custom_geometry;
config->login_shell = config_src->login_shell;
config->cg_width = config_src->cg_width; config->cg_width = config_src->cg_width;
config->cg_height = config_src->cg_height; config->cg_height = config_src->cg_height;
config->colors_use = config_src->colors_use; config->colors_use = config_src->colors_use;
@ -465,18 +468,18 @@ config_load(const char *key)
0x1367, 0x1367,
0xa60f, 0xa60f,
0x2cfa, 0x2cfa,
'`', '`',
0 0
}; };
char *s; char *s;
int slen = 0; int slen = 0;
config = calloc(1, sizeof(Config)); config = calloc(1, sizeof(Config));
if (config) if (config)
{ {
int i, j; int i, j;
config->version = CONF_VER; config->version = CONF_VER;
config->font.bitmap = EINA_TRUE; config->font.bitmap = EINA_TRUE;
config->font.name = eina_stringshare_add("nexus.pcf"); config->font.name = eina_stringshare_add("nexus.pcf");
@ -515,6 +518,7 @@ config_load(const char *key)
config->xterm_256color = EINA_FALSE; config->xterm_256color = EINA_FALSE;
config->erase_is_del = EINA_FALSE; config->erase_is_del = EINA_FALSE;
config->custom_geometry = EINA_FALSE; config->custom_geometry = EINA_FALSE;
config->login_shell = EINA_FALSE;
config->cg_width = 80; config->cg_width = 80;
config->cg_height = 24; config->cg_height = 24;
config->colors_use = EINA_FALSE; config->colors_use = EINA_FALSE;
@ -523,7 +527,7 @@ config_load(const char *key)
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
{ {
unsigned char rr = 0, gg = 0, bb = 0, aa = 0; unsigned char rr = 0, gg = 0, bb = 0, aa = 0;
colors_standard_get(j, i, &rr, &gg, &bb, &aa); colors_standard_get(j, i, &rr, &gg, &bb, &aa);
config->colors[(j * 12) + i].r = rr; config->colors[(j * 12) + i].r = rr;
config->colors[(j * 12) + i].g = gg; config->colors[(j * 12) + i].g = gg;
@ -547,7 +551,7 @@ config_fork(Config *config)
config2 = calloc(1, sizeof(Config)); config2 = calloc(1, sizeof(Config));
if (!config2) return NULL; if (!config2) return NULL;
#define CPY(fld) config2->fld = config->fld; #define CPY(fld) config2->fld = config->fld;
#define SCPY(fld) if (config->fld) config2->fld = eina_stringshare_add(config->fld) #define SCPY(fld) if (config->fld) config2->fld = eina_stringshare_add(config->fld)
#define SLSTCPY(fld) \ #define SLSTCPY(fld) \
do { Eina_List *__l; const char *__s; \ do { Eina_List *__l; const char *__s; \
@ -556,10 +560,10 @@ config_fork(Config *config)
(config2->fld, eina_stringshare_add(__s)); } while (0) (config2->fld, eina_stringshare_add(__s)); } while (0)
CPY(version); CPY(version);
SCPY(font.name); SCPY(font.name);
CPY(font.size); CPY(font.size);
CPY(font.bitmap); CPY(font.bitmap);
SCPY(helper.email); SCPY(helper.email);
SCPY(helper.url.general); SCPY(helper.url.general);
SCPY(helper.url.video); SCPY(helper.url.video);
SCPY(helper.url.image); SCPY(helper.url.image);
@ -588,11 +592,12 @@ config_fork(Config *config)
CPY(xterm_256color); CPY(xterm_256color);
CPY(erase_is_del); CPY(erase_is_del);
CPY(custom_geometry); CPY(custom_geometry);
CPY(login_shell);
CPY(cg_width); CPY(cg_width);
CPY(cg_height); CPY(cg_height);
CPY(colors_use); CPY(colors_use);
memcpy(config2->colors, config->colors, sizeof(config->colors)); memcpy(config2->colors, config->colors, sizeof(config->colors));
CPY(temporary); CPY(temporary);
SCPY(config_key); SCPY(config_key);
return config2; return config2;

View File

@ -53,6 +53,7 @@ struct _Config
Eina_Bool erase_is_del; Eina_Bool erase_is_del;
Eina_Bool custom_geometry; Eina_Bool custom_geometry;
Eina_Bool drag_links; Eina_Bool drag_links;
Eina_Bool login_shell;
int cg_width; int cg_width;
int cg_height; int cg_height;
Eina_Bool colors_use; Eina_Bool colors_use;

View File

@ -293,7 +293,7 @@ _split_split(Split *sp, Eina_Bool horizontal)
config = config_fork(sp->term->config); config = config_fork(sp->term->config);
if (termio_cwd_get(sp->term->term, buf, sizeof(buf))) wdir = buf; if (termio_cwd_get(sp->term->term, buf, sizeof(buf))) wdir = buf;
sp2->term = main_term_new(sp->wn, config, sp2->term = main_term_new(sp->wn, config,
NULL, EINA_FALSE, wdir, NULL, config->login_shell, wdir,
80, 24, EINA_FALSE); 80, 24, EINA_FALSE);
sp2->terms = eina_list_append(sp2->terms, sp2->term); sp2->terms = eina_list_append(sp2->terms, sp2->term);
_term_resize_track_start(sp2); _term_resize_track_start(sp2);
@ -367,7 +367,7 @@ main_new_with_dir(Evas_Object *win, Evas_Object *term, const char *wdir)
config = config_fork(sp->term->config); config = config_fork(sp->term->config);
termio_size_get(sp->term->term, &w, &h); termio_size_get(sp->term->term, &w, &h);
sp->term = main_term_new(sp->wn, config, sp->term = main_term_new(sp->wn, config,
NULL, EINA_FALSE, wdir, NULL, config->login_shell, wdir,
w, h, EINA_FALSE); w, h, EINA_FALSE);
sp->terms = eina_list_append(sp->terms, sp->term); sp->terms = eina_list_append(sp->terms, sp->term);
_term_resize_track_start(sp); _term_resize_track_start(sp);
@ -2924,9 +2924,13 @@ elm_main(int argc, char **argv)
size_h = 24; size_h = 24;
} }
} }
// for now if not set - dont do login shell - later from config if (login_shell != 0xff)
if (login_shell == 0xff) login_shell = EINA_FALSE; {
config->login_shell = login_shell;
config->temporary = EINA_TRUE;
}
login_shell = config->login_shell;
remote: remote:
if ((!single) && (config->multi_instance)) if ((!single) && (config->multi_instance))

View File

@ -252,6 +252,15 @@ _cb_op_behavior_cg_height(void *data, Evas_Object *obj, void *event EINA_UNUSED)
} }
} }
static void
_cb_op_behavior_login_shell_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
Evas_Object *term = data;
Config *config = termio_config_get(term);
config->login_shell = elm_check_state_get(obj);
config_save(config, NULL);
}
void void
options_behavior(Evas_Object *opbox, Evas_Object *term) options_behavior(Evas_Object *opbox, Evas_Object *term)
{ {
@ -268,20 +277,20 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
elm_object_text_set(o, "Behavior"); elm_object_text_set(o, "Behavior");
elm_box_pack_end(opbox, o); elm_box_pack_end(opbox, o);
evas_object_show(o); evas_object_show(o);
sc = o = elm_scroller_add(opbox); sc = o = elm_scroller_add(opbox);
elm_scroller_content_min_limit(sc, EINA_TRUE, EINA_FALSE); elm_scroller_content_min_limit(sc, EINA_TRUE, EINA_FALSE);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_content_set(fr, o); elm_object_content_set(fr, o);
evas_object_show(o); evas_object_show(o);
bx = o = elm_box_add(opbox); bx = o = elm_box_add(opbox);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
elm_object_content_set(sc, o); elm_object_content_set(sc, o);
evas_object_show(o); evas_object_show(o);
o = elm_check_add(bx); o = elm_check_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
@ -321,7 +330,7 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
evas_object_show(o); evas_object_show(o);
evas_object_smart_callback_add(o, "changed", evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_cursor_blink_chg, term); _cb_op_behavior_cursor_blink_chg, term);
o = elm_check_add(bx); o = elm_check_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
@ -331,7 +340,7 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
evas_object_show(o); evas_object_show(o);
evas_object_smart_callback_add(o, "changed", evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_visual_bell_chg, term); _cb_op_behavior_visual_bell_chg, term);
o = elm_check_add(bx); o = elm_check_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
@ -341,7 +350,7 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
evas_object_show(o); evas_object_show(o);
evas_object_smart_callback_add(o, "changed", evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_urg_bell_chg, term); _cb_op_behavior_urg_bell_chg, term);
o = elm_check_add(bx); o = elm_check_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
@ -396,6 +405,16 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
evas_object_smart_callback_add(o, "changed", evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_drag_links_chg, term); _cb_op_behavior_drag_links_chg, term);
o = elm_check_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_object_text_set(o, "Start as login shell");
elm_check_state_set(o, config->login_shell);
elm_box_pack_end(bx, o);
evas_object_show(o);
evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_login_shell_chg, term);
o = elm_check_add(bx); o = elm_check_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
@ -450,7 +469,7 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
elm_separator_horizontal_set(o, EINA_TRUE); elm_separator_horizontal_set(o, EINA_TRUE);
elm_box_pack_end(bx, o); elm_box_pack_end(bx, o);
evas_object_show(o); evas_object_show(o);
o = elm_label_add(bx); o = elm_label_add(bx);
evas_object_size_hint_weight_set(o, 0.0, 0.0); evas_object_size_hint_weight_set(o, 0.0, 0.0);
evas_object_size_hint_align_set(o, 0.0, 0.5); evas_object_size_hint_align_set(o, 0.0, 0.5);
@ -481,14 +500,14 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
elm_separator_horizontal_set(o, EINA_TRUE); elm_separator_horizontal_set(o, EINA_TRUE);
elm_box_pack_end(bx, o); elm_box_pack_end(bx, o);
evas_object_show(o); evas_object_show(o);
o = elm_label_add(bx); o = elm_label_add(bx);
evas_object_size_hint_weight_set(o, 0.0, 0.0); evas_object_size_hint_weight_set(o, 0.0, 0.0);
evas_object_size_hint_align_set(o, 0.0, 0.5); evas_object_size_hint_align_set(o, 0.0, 0.5);
elm_object_text_set(o, "Scrollback:"); elm_object_text_set(o, "Scrollback:");
elm_box_pack_end(bx, o); elm_box_pack_end(bx, o);
evas_object_show(o); evas_object_show(o);
o = elm_slider_add(bx); o = elm_slider_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
@ -521,7 +540,7 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
evas_object_show(o); evas_object_show(o);
evas_object_smart_callback_add(o, "delay,changed", evas_object_smart_callback_add(o, "delay,changed",
_cb_op_behavior_tab_zoom_slider_chg, term); _cb_op_behavior_tab_zoom_slider_chg, term);
evas_object_size_hint_weight_set(opbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(opbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(o); evas_object_show(o);