← Back to team overview

elementaryart team mailing list archive

[Merge] lp:~mefrio-g/granite/fix-974995 into lp:granite

 

Mario Guerriero has proposed merging lp:~mefrio-g/granite/fix-974995 into lp:granite.

Requested reviews:
  elementary Pantheon team (elementary-pantheon)
Related bugs:
  Bug #974995 in Granite: "Add a public function to remove a Tab"
  https://bugs.launchpad.net/granite/+bug/974995

For more details, see:
https://code.launchpad.net/~mefrio-g/granite/fix-974995/+merge/101077
-- 
https://code.launchpad.net/~mefrio-g/granite/fix-974995/+merge/101077
Your team elementaryart (old) is subscribed to branch lp:granite.
=== modified file 'lib/Widgets/DynamicNotebook.vala'
--- lib/Widgets/DynamicNotebook.vala	2012-04-06 04:51:00 +0000
+++ lib/Widgets/DynamicNotebook.vala	2012-04-06 09:51:19 +0000
@@ -19,12 +19,12 @@
     internal Cairo.Surface surface;
 
     public Gtk.Widget widget;
-
+    
+    public signal bool close_button_clicked ();
     public signal void need_redraw ();
     public signal void need_recache ();
 
     public bool is_animated () {
-
         bool return_value =  (!removed && initial_offset != 1.0) ||
                              (drag_origin == 0.0 && initial_draw_offset != 0.0) ||
                              (removed && initial_offset != 0.0);
@@ -625,7 +625,8 @@
                 /* Let's see of it is on the close button */
                 double offset = event.x - n_tab * (width - overlap) - overlap;
                 if (0 < offset < close_margin*2 + close_size) { /* then it is a click on the close_button */
-                    remove_tab_internal (n_tab);
+                    if (tabs[n_tab].close_button_clicked ())
+                        remove_tab_internal (n_tab);
                 }
                 else {
                     page = n_tab;
@@ -685,7 +686,7 @@
         });
     }
 
-    void remove_tab (Tab tab) {
+    public void remove_tab (Tab tab) {
         int n_tab = tabs.index_of (tab);
         tabs.remove (tab);
         if (_page >= n_tab)
@@ -840,7 +841,11 @@
         page_added (widget, tabs.tabs.size - 1);
         return tab;
     }
-
+    
+    public void remove_tab (Tab tab) {
+        tabs.remove_tab (tab);
+    }
+    
     public void set_scrollable (bool scrollable) {
     }
 


Follow ups