From 496a5f178e10c92ee84711546203ecc36416c68b Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Mon, 28 Aug 2017 21:40:05 +0200 Subject: [PATCH] have only one concept of title. Ref T5704 --- src/bin/termio.c | 11 ++++------- src/bin/termio.h | 2 +- src/bin/termpty.c | 5 +---- src/bin/termpty.h | 2 +- src/bin/termptyesc.c | 2 +- src/bin/win.c | 2 +- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/bin/termio.c b/src/bin/termio.c index 12d24dd1..ca488b09 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -362,27 +362,24 @@ termio_title_get(const Evas_Object *obj) { Termio *sd = evas_object_smart_data_get(obj); 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; } 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); size_t len = 0; EINA_SAFETY_ON_NULL_RETURN(sd); - if (sd->pty->prop.user_title) - eina_stringshare_del(sd->pty->prop.user_title); - sd->pty->prop.user_title = NULL; + if (sd->pty->prop.title) + eina_stringshare_del(sd->pty->prop.title); if (title) len = strlen(title); 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) sd->pty->cb.set_title.func(sd->pty->cb.set_title.data); diff --git a/src/bin/termio.h b/src/bin/termio.h index ea142c0e..32eb4593 100644 --- a/src/bin/termio.h +++ b/src/bin/termio.h @@ -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_win_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); void termio_media_mute_set(Evas_Object *obj, Eina_Bool mute); void termio_media_visualize_set(Evas_Object *obj, Eina_Bool visualize); diff --git a/src/bin/termpty.c b/src/bin/termpty.c index 501dca5c..3c86546c 100644 --- a/src/bin/termpty.c +++ b/src/bin/termpty.c @@ -496,9 +496,7 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd, arg0 = strrchr(args[0], '/'); if (!arg0) arg0 = args[0]; else arg0++; - ty->prop.title = eina_stringshare_add(arg0); - if (title) - ty->prop.user_title = eina_stringshare_add(title); + ty->prop.title = eina_stringshare_add(title? title : arg0); ty->fd = posix_openpt(O_RDWR | O_NOCTTY); 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_fd) ecore_main_fd_handler_del(ty->hand_fd); 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->back) { diff --git a/src/bin/termpty.h b/src/bin/termpty.h index bcd7397c..6de8d79a 100644 --- a/src/bin/termpty.h +++ b/src/bin/termpty.h @@ -84,7 +84,7 @@ struct _Termpty } change, set_title, set_icon, cancel_sel, exited, bell, command; } cb; struct { - const char *title, *icon, *user_title; + const char *title, *icon; } prop; const char *cur_cmd; Termcell *screen, *screen2; diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c index c71a8939..f147f635 100644 --- a/src/bin/termptyesc.c +++ b/src/bin/termptyesc.c @@ -1627,7 +1627,7 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce) ty->prop.title = 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); if (ty->cb.set_icon.func) ty->cb.set_icon.func(ty->cb.set_icon.data); } diff --git a/src/bin/win.c b/src/bin/win.c index dcfb82d8..1b8315aa 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -3560,7 +3560,7 @@ _set_title_ok_cb(void *data, if (!title || !strlen(title)) title = NULL; - termio_user_title_set(term->termio, title); + termio_title_set(term->termio, title); evas_object_del(popup); term_unref(term); }