billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=88c4ce46b04459a0fb849b8123fc844010d5aad5

commit 88c4ce46b04459a0fb849b8123fc844010d5aad5
Author: Boris Faure <bill...@gmail.com>
Date:   Sat Oct 10 19:39:16 2015 +0200

    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(-)

diff --git a/ChangeLog.theme b/ChangeLog.theme
new file mode 100644
index 0000000..1791a2f
--- /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 a675c9a..bd07305 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 0000000..4872dc4
Binary files /dev/null and b/data/themes/images/tab_close.png differ
diff --git a/src/bin/win.c b/src/bin/win.c
index 2642961..6bae019 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -1649,6 +1649,17 @@ _cb_tab_activate(void *data, Evas_Object *obj 
EINA_UNUSED,
 }
 
 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)
 {
    Eina_List *l;
@@ -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);

-- 


Reply via email to