have only one concept of title. Ref T5704

This commit is contained in:
Boris Faure 2017-08-28 21:40:05 +02:00
parent 38da9b2ded
commit 496a5f178e
6 changed files with 9 additions and 15 deletions

View File

@ -362,27 +362,24 @@ termio_title_get(const Evas_Object *obj)
{ {
Termio *sd = evas_object_smart_data_get(obj); Termio *sd = evas_object_smart_data_get(obj);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL);
if (sd->pty->prop.user_title)
return sd->pty->prop.user_title;
return sd->pty->prop.title; return sd->pty->prop.title;
} }
void void
termio_user_title_set(Evas_Object *obj, const char *title) termio_title_set(Evas_Object *obj, const char *title)
{ {
Termio *sd = evas_object_smart_data_get(obj); Termio *sd = evas_object_smart_data_get(obj);
size_t len = 0; size_t len = 0;
EINA_SAFETY_ON_NULL_RETURN(sd); EINA_SAFETY_ON_NULL_RETURN(sd);
if (sd->pty->prop.user_title) if (sd->pty->prop.title)
eina_stringshare_del(sd->pty->prop.user_title); eina_stringshare_del(sd->pty->prop.title);
sd->pty->prop.user_title = NULL;
if (title) if (title)
len = strlen(title); len = strlen(title);
if (len) if (len)
{ {
sd->pty->prop.user_title = eina_stringshare_add_length(title, len); sd->pty->prop.title = eina_stringshare_add_length(title, len);
} }
if (sd->pty->cb.set_title.func) if (sd->pty->cb.set_title.func)
sd->pty->cb.set_title.func(sd->pty->cb.set_title.data); sd->pty->cb.set_title.func(sd->pty->cb.set_title.data);

View File

@ -39,7 +39,7 @@ Eina_Bool termio_cwd_get(const Evas_Object *obj, char *buf, size_t size);
Evas_Object *termio_textgrid_get(const Evas_Object *obj); Evas_Object *termio_textgrid_get(const Evas_Object *obj);
Evas_Object *termio_win_get(const Evas_Object *obj); Evas_Object *termio_win_get(const Evas_Object *obj);
const char *termio_title_get(const Evas_Object *obj); const char *termio_title_get(const Evas_Object *obj);
void termio_user_title_set(Evas_Object *obj, const char *title); void termio_title_set(Evas_Object *obj, const char *title);
const char *termio_icon_name_get(const Evas_Object *obj); const char *termio_icon_name_get(const Evas_Object *obj);
void termio_media_mute_set(Evas_Object *obj, Eina_Bool mute); void termio_media_mute_set(Evas_Object *obj, Eina_Bool mute);
void termio_media_visualize_set(Evas_Object *obj, Eina_Bool visualize); void termio_media_visualize_set(Evas_Object *obj, Eina_Bool visualize);

View File

@ -496,9 +496,7 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
arg0 = strrchr(args[0], '/'); arg0 = strrchr(args[0], '/');
if (!arg0) arg0 = args[0]; if (!arg0) arg0 = args[0];
else arg0++; else arg0++;
ty->prop.title = eina_stringshare_add(arg0); ty->prop.title = eina_stringshare_add(title? title : arg0);
if (title)
ty->prop.user_title = eina_stringshare_add(title);
ty->fd = posix_openpt(O_RDWR | O_NOCTTY); ty->fd = posix_openpt(O_RDWR | O_NOCTTY);
if (ty->fd < 0) if (ty->fd < 0)
@ -735,7 +733,6 @@ termpty_free(Termpty *ty)
if (ty->hand_exe_exit) ecore_event_handler_del(ty->hand_exe_exit); if (ty->hand_exe_exit) ecore_event_handler_del(ty->hand_exe_exit);
if (ty->hand_fd) ecore_main_fd_handler_del(ty->hand_fd); if (ty->hand_fd) ecore_main_fd_handler_del(ty->hand_fd);
if (ty->prop.title) eina_stringshare_del(ty->prop.title); if (ty->prop.title) eina_stringshare_del(ty->prop.title);
if (ty->prop.user_title) eina_stringshare_del(ty->prop.user_title);
if (ty->prop.icon) eina_stringshare_del(ty->prop.icon); if (ty->prop.icon) eina_stringshare_del(ty->prop.icon);
if (ty->back) if (ty->back)
{ {

View File

@ -84,7 +84,7 @@ struct _Termpty
} change, set_title, set_icon, cancel_sel, exited, bell, command; } change, set_title, set_icon, cancel_sel, exited, bell, command;
} cb; } cb;
struct { struct {
const char *title, *icon, *user_title; const char *title, *icon;
} prop; } prop;
const char *cur_cmd; const char *cur_cmd;
Termcell *screen, *screen2; Termcell *screen, *screen2;

View File

@ -1627,7 +1627,7 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
ty->prop.title = NULL; ty->prop.title = NULL;
ty->prop.icon = NULL; ty->prop.icon = NULL;
} }
if (ty->cb.set_title.func && !ty->prop.user_title) if (ty->cb.set_title.func)
ty->cb.set_title.func(ty->cb.set_title.data); ty->cb.set_title.func(ty->cb.set_title.data);
if (ty->cb.set_icon.func) ty->cb.set_icon.func(ty->cb.set_icon.data); if (ty->cb.set_icon.func) ty->cb.set_icon.func(ty->cb.set_icon.data);
} }

View File

@ -3560,7 +3560,7 @@ _set_title_ok_cb(void *data,
if (!title || !strlen(title)) if (!title || !strlen(title))
title = NULL; title = NULL;
termio_user_title_set(term->termio, title); termio_title_set(term->termio, title);
evas_object_del(popup); evas_object_del(popup);
term_unref(term); term_unref(term);
} }