From edd37bbae7acc36abb36a2da5b9adc10ac9172e5 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 20 Mar 2013 13:47:56 +0900 Subject: [PATCH] track term titles properly and put them in tab sel views. done for the moment. --- data/themes/default.edc | 25 +++++++++++++++++++++++++ src/bin/main.c | 19 +++++++++++++++++++ src/bin/sel.c | 11 +++++++++++ src/bin/termio.c | 22 ++++++++++++++++++++-- src/bin/termio.h | 2 ++ 5 files changed, 77 insertions(+), 2 deletions(-) diff --git a/data/themes/default.edc b/data/themes/default.edc index f5925622..cba8427b 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -2411,6 +2411,7 @@ target: "4.bottom" action: STATE_SET "selected" 0.0; transition: DECELERATE 0.2 CURRENT; target: "terminology.content"; + target: "terminology.label"; target: "shadow"; target: "clip"; target: "glow"; @@ -2419,6 +2420,7 @@ target: "4.bottom" signal: "selected,start"; source: "terminology"; action: STATE_SET "selected" 0.0; target: "terminology.content"; + target: "terminology.label"; target: "shadow"; target: "clip"; target: "glow"; @@ -2428,6 +2430,7 @@ target: "4.bottom" action: STATE_SET "default" 0.0; transition: DECELERATE 0.4 CURRENT; target: "terminology.content"; + target: "terminology.label"; target: "shadow"; target: "clip"; target: "glow"; @@ -2455,6 +2458,28 @@ target: "4.bottom" fill.smooth: 0; } } + part { name: "terminology.label"; type: TEXT; mouse_events: 0; + effect: GLOW; + scale: 1; + description { state: "default" 0.0; + rel1.to: "terminology.content"; + rel2.to: "terminology.content"; + color: 51 153 255 255; + color2: 51 153 255 24; + color3: 51 153 255 18; + align: 0.5 1.0; + text { font: "Sans"; size: 10; + align: 0.5 1.0; + min: 0 1; + } + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + color2: 51 153 255 128; + color3: 51 153 255 20; + } + } part { name: "clip2"; type: RECT; description { state: "default" 0.0; rel1.to: "terminology.content"; diff --git a/src/bin/main.c b/src/bin/main.c index c02b0adb..95622de5 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -471,6 +471,7 @@ _term_focus(Term *term) edje_object_signal_emit(term->bg, "focus,in", "terminology"); if (term->wn->cmdbox) elm_object_focus_set(term->wn->cmdbox, EINA_FALSE); elm_object_focus_set(term->term, EINA_TRUE); + elm_win_title_set(term->wn->win, termio_title_get(term->term)); } void @@ -1263,6 +1264,22 @@ _cb_split_v(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__) main_split_v(term->wn->win, term->term); } +static void +_cb_title(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +{ + Term *term = data; + if (term->focused) + elm_win_title_set(term->wn->win, termio_title_get(term->term)); +} + +static void +_cb_icon(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +{ + Term *term = data; + if (term->focused) + elm_win_icon_name_set(term->wn->win, termio_icon_name_get(term->term)); +} + static Eina_Bool _cb_cmd_focus(void *data) { @@ -1841,6 +1858,8 @@ main_term_new(Win *wn, Config *config, const char *cmd, evas_object_smart_callback_add(o, "select", _cb_select, term); evas_object_smart_callback_add(o, "split,h", _cb_split_h, term); evas_object_smart_callback_add(o, "split,v", _cb_split_v, term); + evas_object_smart_callback_add(o, "title,change", _cb_title, term); + evas_object_smart_callback_add(o, "icon,change", _cb_icon, term); evas_object_show(o); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, diff --git a/src/bin/sel.c b/src/bin/sel.c index 1439ba8e..79934064 100644 --- a/src/bin/sel.c +++ b/src/bin/sel.c @@ -441,6 +441,7 @@ void sel_entry_add(Evas_Object *obj, Evas_Object *entry, Eina_Bool selected, Config *config) { Sel *sd = evas_object_smart_data_get(obj); + Evas_Object *o; Entry *en = calloc(1, sizeof(Entry)); if (!en) return; sd->items = eina_list_append(sd->items, en); @@ -458,6 +459,16 @@ sel_entry_add(Evas_Object *obj, Evas_Object *entry, Eina_Bool selected, Config * if (en->selected) edje_object_signal_emit(en->bg, "selected,start", "terminology"); sd->interp = 1.0; + + o = evas_object_data_get(en->obj, "termio"); + if (o) + { + const char *s; + + s = termio_title_get(o); + if (!s) s = termio_icon_name_get(o); + if (s) edje_object_part_text_set(en->bg, "terminology.label", s); + } } void diff --git a/src/bin/termio.c b/src/bin/termio.c index 21939136..4d012e9e 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -2885,7 +2885,8 @@ _smart_pty_title(void *data) sd = evas_object_smart_data_get(obj); if (!sd) return; if (!sd->win) return; - elm_win_title_set(sd->win, sd->pty->prop.title); + evas_object_smart_callback_call(obj, "title,change", NULL); +// elm_win_title_set(sd->win, sd->pty->prop.title); } static void @@ -2896,7 +2897,8 @@ _smart_pty_icon(void *data) sd = evas_object_smart_data_get(obj); if (!sd) return; if (!sd->win) return; - elm_win_icon_name_set(sd->win, sd->pty->prop.icon); + evas_object_smart_callback_call(obj, "icon,change", NULL); +// elm_win_icon_name_set(sd->win, sd->pty->prop.icon); } static void @@ -3520,3 +3522,19 @@ termio_mirror_add(Evas_Object *obj) _smart_mirror_del, obj); return img; } + +const char * +termio_title_get(Evas_Object *obj) +{ + Termio *sd = evas_object_smart_data_get(obj); + if (!sd) return NULL; + return sd->pty->prop.title; +} + +const char * +termio_icon_name_get(Evas_Object *obj) +{ + Termio *sd = evas_object_smart_data_get(obj); + if (!sd) return NULL; + return sd->pty->prop.icon; +} diff --git a/src/bin/termio.h b/src/bin/termio.h index de4015be..1dc07d3a 100644 --- a/src/bin/termio.h +++ b/src/bin/termio.h @@ -23,5 +23,7 @@ pid_t termio_pid_get(const Evas_Object *obj); Eina_Bool termio_cwd_get(const Evas_Object *obj, char *buf, size_t size); Evas_Object *termio_textgrid_get(Evas_Object *obj); Evas_Object *termio_mirror_add(Evas_Object *obj); +const char *termio_title_get(Evas_Object *obj); +const char *termio_icon_name_get(Evas_Object *obj); #endif