From 88c4ce46b04459a0fb849b8123fc844010d5aad5 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Sat, 10 Oct 2015 19:39:16 +0200 Subject: [PATCH] add (ugly) cross to close tabs --- ChangeLog.theme | 11 +++++++ data/themes/default.edc | 53 ++++++++++++++++++++++++++++++- data/themes/images/tab_close.png | Bin 0 -> 214 bytes src/bin/win.c | 15 +++++++++ 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 ChangeLog.theme create mode 100644 data/themes/images/tab_close.png diff --git a/ChangeLog.theme b/ChangeLog.theme new file mode 100644 index 00000000..1791a2f5 --- /dev/null +++ b/ChangeLog.theme @@ -0,0 +1,11 @@ +================= +Terminology 0.9.1 +================= + +Changes since 0.9.1: +-------------------- + + * In group "terminology/background", add signal "tab,close" with emitter set + to "terminology" to close the current tab + * In group "terminology/tabbar_back", add signal "tab,close" with emitter + set to "terminology" to close a tab in the background diff --git a/data/themes/default.edc b/data/themes/default.edc index a675c9a4..bd073058 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -226,6 +226,7 @@ collections { image: "tab_shad_r1.png" COMP; image: "media_busy_knob.png" COMP; image: "media_busy_spinner.png" COMP; + image: "tab_close.png" COMP; } set { name: "bg_shadow"; image { image: "bg_shadow.png" COMP; size: 0 0 200 150; } @@ -1016,6 +1017,7 @@ collections { target: "tab_bevel_shad3"; target: "tab_bevel_shad4"; target: "tabtitle"; + target: "tabclose"; } program { signal: "tabbar,off"; source: "terminology"; @@ -1041,6 +1043,7 @@ collections { target: "tab_bevel_shad3"; target: "tab_bevel_shad4"; target: "tabtitle"; + target: "tabclose"; } part { name: "terminology.tab"; type: SWALLOW; @@ -1055,7 +1058,7 @@ collections { fixed: 1 1; } } - // some slot for dragable parts to stayt in along top edge of bg + // some slot for dragable parts to stay in along top edge of bg part { name: "tabdrag"; type: SPACER; description { state: "default" 0.0; rel2.relative: 1.0 0.0; @@ -1185,6 +1188,32 @@ collections { visible: 1; } } + part { name: "tabclose"; type: IMAGE; + description { state: "default" 0.0; + image { + normal: "tab_close.png"; + }; + rel1 { + to: "tabmiddle"; + relative: 1.0 0.5; + offset: -20 -8; + } + rel2 { + to: "tabmiddle"; + relative: 1.0 0.5; + offset: -2 8; + } + visible: 0; + } + description { state: "tab" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + program { + signal: "mouse,clicked,1"; source: "tabclose"; + action: SIGNAL_EMIT "tab,close" "terminology"; + } //////////////////////////////////////////////////////////////////// // visual bell - spinning red siren light @@ -1709,6 +1738,7 @@ collections { image: "tab_other_r.png" COMP; image: "tab_shad_l2.png" COMP; image: "tab_shad_r2.png" COMP; + image: "tab_close.png" COMP; } parts { part { name: "tab_bevel_shad1"; @@ -1822,6 +1852,27 @@ collections { rel2.to: "tab_bevel_top2"; } } + part { name: "tabclose"; type: IMAGE; + description { state: "default" 0.0; + image { + normal: "tab_close.png"; + }; + rel1 { + to: "tab_bevel_top2"; + relative: 1.0 0.5; + offset: -20 -8; + } + rel2 { + to: "tab_bevel_top2"; + relative: 1.0 0.5; + offset: -2 8; + } + } + } + program { + signal: "mouse,clicked,1"; source: "tabclose"; + action: SIGNAL_EMIT "tab,close" "terminology"; + } part { name: "clip"; type: RECT; description { state: "default" 0.0; rel2.offset: -1 -2; diff --git a/data/themes/images/tab_close.png b/data/themes/images/tab_close.png new file mode 100644 index 0000000000000000000000000000000000000000..4872dc4b1f8e7d8ddfb0c574826439f40590c9e8 GIT binary patch literal 214 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt`Lo-U3d z7N_4{+Q@szK!Ejv`T`eC$4?AX8U&)3r1kS0k($|HCd8V0tzq7?2|cVvys>q~yXv36 zf3I(x_^&Z~v2(NG4zcAg-kUb^ajWQTJZM-}zT*nZEDN2iQ)$=FTn%qD%=2TlU!Xrd z{XfUXUi0Y{sYcgia=33hUwdC)Sa4X8>GfuxFpI~AfB%)+FjoB)`m+14iYw4r44$rj JF6*2Ung9jyQ#Akp literal 0 HcmV?d00001 diff --git a/src/bin/win.c b/src/bin/win.c index 26429611..6bae0196 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -1648,6 +1648,17 @@ _cb_tab_activate(void *data, Evas_Object *obj EINA_UNUSED, _term_focus(term); } +static void +_cb_tab_close(void *data, Evas_Object *obj EINA_UNUSED, + const char *sig EINA_UNUSED, const char *src EINA_UNUSED) +{ + Term *term = data; + Win *wn = term->wn; + Evas_Object *win = win_evas_object_get(wn); + + main_close(win, term->termio); +} + static void _tabbar_fill(Tabs *tabs) { @@ -1718,6 +1729,8 @@ _tabbar_fill(Tabs *tabs) evas_object_show(o); edje_object_signal_callback_add(o, "tab,activate", "terminology", _cb_tab_activate, tab_item); + edje_object_signal_callback_add(o, "tab,close", "terminology", + _cb_tab_close, term); } j++; } @@ -3776,6 +3789,8 @@ _term_bg_config(Term *term) _cb_tabcount_prev, term); edje_object_signal_callback_add(term->bg, "tabcount,next", "terminology", _cb_tabcount_next, term); + edje_object_signal_callback_add(term->bg, "tab,close", "terminology", + _cb_tab_close, term); edje_object_part_swallow(term->base, "terminology.content", term->termio); edje_object_part_swallow(term->bg, "terminology.content", term->base); edje_object_part_swallow(term->bg, "terminology.miniview", term->miniview);