summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2017-08-28 21:40:05 +0200
committerBoris Faure <billiob@gmail.com>2017-08-28 21:41:21 +0200
commit496a5f178e10c92ee84711546203ecc36416c68b (patch)
tree1eae142d6d402a4c0d8b6bd176f8d3a88c6c2d50
parent38da9b2ded12f511025d8958d76570aa6845ad9c (diff)
have only one concept of title. Ref T5704
-rw-r--r--src/bin/termio.c11
-rw-r--r--src/bin/termio.h2
-rw-r--r--src/bin/termpty.c5
-rw-r--r--src/bin/termpty.h2
-rw-r--r--src/bin/termptyesc.c2
-rw-r--r--src/bin/win.c2
6 files changed, 9 insertions, 15 deletions
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 12d24dd..ca488b0 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -362,27 +362,24 @@ termio_title_get(const Evas_Object *obj)
362{ 362{
363 Termio *sd = evas_object_smart_data_get(obj); 363 Termio *sd = evas_object_smart_data_get(obj);
364 EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL); 364 EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL);
365 if (sd->pty->prop.user_title)
366 return sd->pty->prop.user_title;
367 return sd->pty->prop.title; 365 return sd->pty->prop.title;
368} 366}
369 367
370void 368void
371termio_user_title_set(Evas_Object *obj, const char *title) 369termio_title_set(Evas_Object *obj, const char *title)
372{ 370{
373 Termio *sd = evas_object_smart_data_get(obj); 371 Termio *sd = evas_object_smart_data_get(obj);
374 size_t len = 0; 372 size_t len = 0;
375 EINA_SAFETY_ON_NULL_RETURN(sd); 373 EINA_SAFETY_ON_NULL_RETURN(sd);
376 374
377 if (sd->pty->prop.user_title) 375 if (sd->pty->prop.title)
378 eina_stringshare_del(sd->pty->prop.user_title); 376 eina_stringshare_del(sd->pty->prop.title);
379 sd->pty->prop.user_title = NULL;
380 377
381 if (title) 378 if (title)
382 len = strlen(title); 379 len = strlen(title);
383 if (len) 380 if (len)
384 { 381 {
385 sd->pty->prop.user_title = eina_stringshare_add_length(title, len); 382 sd->pty->prop.title = eina_stringshare_add_length(title, len);
386 } 383 }
387 if (sd->pty->cb.set_title.func) 384 if (sd->pty->cb.set_title.func)
388 sd->pty->cb.set_title.func(sd->pty->cb.set_title.data); 385 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 ea142c0..32eb459 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);
39Evas_Object *termio_textgrid_get(const Evas_Object *obj); 39Evas_Object *termio_textgrid_get(const Evas_Object *obj);
40Evas_Object *termio_win_get(const Evas_Object *obj); 40Evas_Object *termio_win_get(const Evas_Object *obj);
41const char *termio_title_get(const Evas_Object *obj); 41const char *termio_title_get(const Evas_Object *obj);
42void termio_user_title_set(Evas_Object *obj, const char *title); 42void termio_title_set(Evas_Object *obj, const char *title);
43const char *termio_icon_name_get(const Evas_Object *obj); 43const char *termio_icon_name_get(const Evas_Object *obj);
44void termio_media_mute_set(Evas_Object *obj, Eina_Bool mute); 44void termio_media_mute_set(Evas_Object *obj, Eina_Bool mute);
45void termio_media_visualize_set(Evas_Object *obj, Eina_Bool visualize); 45void termio_media_visualize_set(Evas_Object *obj, Eina_Bool visualize);
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 501dca5..3c86546 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,
496 arg0 = strrchr(args[0], '/'); 496 arg0 = strrchr(args[0], '/');
497 if (!arg0) arg0 = args[0]; 497 if (!arg0) arg0 = args[0];
498 else arg0++; 498 else arg0++;
499 ty->prop.title = eina_stringshare_add(arg0); 499 ty->prop.title = eina_stringshare_add(title? title : arg0);
500 if (title)
501 ty->prop.user_title = eina_stringshare_add(title);
502 500
503 ty->fd = posix_openpt(O_RDWR | O_NOCTTY); 501 ty->fd = posix_openpt(O_RDWR | O_NOCTTY);
504 if (ty->fd < 0) 502 if (ty->fd < 0)
@@ -735,7 +733,6 @@ termpty_free(Termpty *ty)
735 if (ty->hand_exe_exit) ecore_event_handler_del(ty->hand_exe_exit); 733 if (ty->hand_exe_exit) ecore_event_handler_del(ty->hand_exe_exit);
736 if (ty->hand_fd) ecore_main_fd_handler_del(ty->hand_fd); 734 if (ty->hand_fd) ecore_main_fd_handler_del(ty->hand_fd);
737 if (ty->prop.title) eina_stringshare_del(ty->prop.title); 735 if (ty->prop.title) eina_stringshare_del(ty->prop.title);
738 if (ty->prop.user_title) eina_stringshare_del(ty->prop.user_title);
739 if (ty->prop.icon) eina_stringshare_del(ty->prop.icon); 736 if (ty->prop.icon) eina_stringshare_del(ty->prop.icon);
740 if (ty->back) 737 if (ty->back)
741 { 738 {
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index bcd7397..6de8d79 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -84,7 +84,7 @@ struct _Termpty
84 } change, set_title, set_icon, cancel_sel, exited, bell, command; 84 } change, set_title, set_icon, cancel_sel, exited, bell, command;
85 } cb; 85 } cb;
86 struct { 86 struct {
87 const char *title, *icon, *user_title; 87 const char *title, *icon;
88 } prop; 88 } prop;
89 const char *cur_cmd; 89 const char *cur_cmd;
90 Termcell *screen, *screen2; 90 Termcell *screen, *screen2;
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index c71a893..f147f63 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)
1627 ty->prop.title = NULL; 1627 ty->prop.title = NULL;
1628 ty->prop.icon = NULL; 1628 ty->prop.icon = NULL;
1629 } 1629 }
1630 if (ty->cb.set_title.func && !ty->prop.user_title) 1630 if (ty->cb.set_title.func)
1631 ty->cb.set_title.func(ty->cb.set_title.data); 1631 ty->cb.set_title.func(ty->cb.set_title.data);
1632 if (ty->cb.set_icon.func) ty->cb.set_icon.func(ty->cb.set_icon.data); 1632 if (ty->cb.set_icon.func) ty->cb.set_icon.func(ty->cb.set_icon.data);
1633 } 1633 }
diff --git a/src/bin/win.c b/src/bin/win.c
index dcfb82d..1b8315a 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -3560,7 +3560,7 @@ _set_title_ok_cb(void *data,
3560 if (!title || !strlen(title)) 3560 if (!title || !strlen(title))
3561 title = NULL; 3561 title = NULL;
3562 3562
3563 termio_user_title_set(term->termio, title); 3563 termio_title_set(term->termio, title);
3564 evas_object_del(popup); 3564 evas_object_del(popup);
3565 term_unref(term); 3565 term_unref(term);
3566} 3566}