Bring back the user title per tab
Summary: T6719 Reviewers: billiob Reviewed By: billiob Differential Revision: https://phab.enlightenment.org/D5852
This commit is contained in:
parent
4a30c10ed9
commit
3569f18cc8
|
@ -369,25 +369,38 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
termio_user_title_get(const Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Termio *sd = evas_object_smart_data_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL);
|
||||||
|
return sd->pty->prop.user_title;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
termio_title_set(Evas_Object *obj, const char *title)
|
termio_user_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.title)
|
if (sd->pty->prop.user_title)
|
||||||
eina_stringshare_del(sd->pty->prop.title);
|
{
|
||||||
|
eina_stringshare_del(sd->pty->prop.user_title);
|
||||||
|
sd->pty->prop.user_title = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (title)
|
if (title)
|
||||||
len = strlen(title);
|
|
||||||
if (len)
|
|
||||||
{
|
{
|
||||||
sd->pty->prop.title = eina_stringshare_add_length(title, len);
|
len = strlen(title);
|
||||||
}
|
}
|
||||||
|
if (len)
|
||||||
|
sd->pty->prop.user_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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,8 @@ 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_title_set(Evas_Object *obj, const char *title);
|
const char *termio_user_title_get(const Evas_Object *obj);
|
||||||
|
void termio_user_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);
|
||||||
|
|
|
@ -800,6 +800,7 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,7 +87,13 @@ 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;
|
const char *icon;
|
||||||
|
/* dynamic title set by xterm, keep it in case user don't want a
|
||||||
|
* title any more by setting a empty title
|
||||||
|
*/
|
||||||
|
const char *title;
|
||||||
|
/* set by user */
|
||||||
|
const char *user_title;
|
||||||
} prop;
|
} prop;
|
||||||
const char *cur_cmd;
|
const char *cur_cmd;
|
||||||
Termcell *screen, *screen2;
|
Termcell *screen, *screen2;
|
||||||
|
|
|
@ -4278,7 +4278,7 @@ _set_title_ok_cb(void *data,
|
||||||
if (!title || !strlen(title))
|
if (!title || !strlen(title))
|
||||||
title = NULL;
|
title = NULL;
|
||||||
|
|
||||||
termio_title_set(term->termio, title);
|
termio_user_title_set(term->termio, title);
|
||||||
elm_object_focus_set(entry, EINA_FALSE);
|
elm_object_focus_set(entry, EINA_FALSE);
|
||||||
elm_popup_dismiss(popup);
|
elm_popup_dismiss(popup);
|
||||||
}
|
}
|
||||||
|
@ -4315,6 +4315,7 @@ term_set_title(Term *term)
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
Evas_Object *popup;
|
Evas_Object *popup;
|
||||||
Term_Container *tc = term->container;
|
Term_Container *tc = term->container;
|
||||||
|
const char *prev_title;
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(term);
|
EINA_SAFETY_ON_NULL_RETURN(term);
|
||||||
term->wn->on_popover++;
|
term->wn->on_popover++;
|
||||||
|
@ -4341,6 +4342,13 @@ term_set_title(Term *term)
|
||||||
|
|
||||||
o = elm_entry_add(popup);
|
o = elm_entry_add(popup);
|
||||||
elm_entry_single_line_set(o, EINA_TRUE);
|
elm_entry_single_line_set(o, EINA_TRUE);
|
||||||
|
elm_entry_editable_set(o, EINA_TRUE);
|
||||||
|
prev_title = termio_user_title_get(term->termio);
|
||||||
|
if (prev_title)
|
||||||
|
{
|
||||||
|
elm_entry_entry_set(o, prev_title);
|
||||||
|
elm_entry_cursor_pos_set(o, strlen(prev_title));
|
||||||
|
}
|
||||||
evas_object_smart_callback_add(o, "activated", _set_title_ok_cb, popup);
|
evas_object_smart_callback_add(o, "activated", _set_title_ok_cb, popup);
|
||||||
evas_object_smart_callback_add(o, "aborted", _set_title_cancel_cb, popup);
|
evas_object_smart_callback_add(o, "aborted", _set_title_cancel_cb, popup);
|
||||||
elm_object_content_set(popup, o);
|
elm_object_content_set(popup, o);
|
||||||
|
|
Loading…
Reference in New Issue