Merge lp:~gangsterveggies/granite/fix-bug-1214933 into lp:~elementary-pantheon/granite/granite

Proposed by Pedro Paredes
Status: Rejected
Rejected by: Cody Garver
Proposed branch: lp:~gangsterveggies/granite/fix-bug-1214933
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 61 lines (+21/-7)
1 file modified
lib/Widgets/DynamicNotebook.vala (+21/-7)
To merge this branch: bzr merge lp:~gangsterveggies/granite/fix-bug-1214933
Reviewer Review Type Date Requested Status
David Gomes Pending
Review via email: mp+181627@code.launchpad.net

Description of the change

Fixes bug #1214933, of having smart tabs on the DynamicNotebook.

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

This doesn't appear to work as intended, if I understand the bug report correctly. When I close a tab, the next tab's close button is not underneath my cursor.

Revision history for this message
Danielle Foré (danrabbit) wrote :
Revision history for this message
Pedro Paredes (gangsterveggies) wrote :

> http://videobin.org/+6ts/8b3.html

I've been investigating it and apparently (as you suggested in the IRC) the problem is when the tab overflow makes the arrows for changing tabs... I'll try to correct it, thanks for the heads up.

Revision history for this message
Pedro Paredes (gangsterveggies) wrote :

> > http://videobin.org/+6ts/8b3.html
>
> I've been investigating it and apparently (as you suggested in the IRC) the
> problem is when the tab overflow makes the arrows for changing tabs... I'll
> try to correct it, thanks for the heads up.

The actual problem is when you remove a tab and the arrow disappears. The arrows change the margins of the tabs... I think it would be a good idea to remove the arrows by setting it to not scrollable (since this is a feature from the Gtk.Notebook) and add our own arrows so that we have more control over the thing.

Revision history for this message
David Gomes (davidgomes) wrote :

The more independent DynamicNotebook is, the better, if you can do that, it'll be great.

Revision history for this message
Pedro Paredes (gangsterveggies) wrote :

> The more independent DynamicNotebook is, the better, if you can do that, it'll
> be great.

I can do it but it should be on a different branch. I think we should merge or discard this one and then after the arrows thing I would fix or redo it.

Unmerged revisions

614. By Pedro Paredes

Fixed bug #1214933

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/Widgets/DynamicNotebook.vala'
2--- lib/Widgets/DynamicNotebook.vala 2013-08-19 22:05:17 +0000
3+++ lib/Widgets/DynamicNotebook.vala 2013-08-22 18:12:05 +0000
4@@ -39,10 +39,10 @@
5 }
6
7 /**
8- * Data which will be kept once the tab is deleted, and which will be used by
9- * the application to restore the data into the restored tab. Let it empty if
10- * the tab should not be restored.
11- **/
12+ * Data which will be kept once the tab is deleted, and which will be used by
13+ * the application to restore the data into the restored tab. Let it empty if
14+ * the tab should not be restored.
15+ **/
16 public string restore_data { get; set; }
17
18 internal Gtk.EventBox page_container;
19@@ -446,6 +446,10 @@
20 private int tab_width = 150;
21 private int max_tab_width = 150;
22
23+ private uint tab_closing = -1;
24+
25+ private int smart_tab_time = 2;
26+
27 public signal void tab_added (Tab tab);
28 public signal bool tab_removed (Tab tab);
29 Tab? old_tab; //stores a reference for tab_switched
30@@ -679,7 +683,7 @@
31 }
32
33 private void recalc_size () {
34- if (n_tabs == 0)
35+ if (n_tabs == 0 || tab_closing != -1)
36 return;
37
38 var offset = 130;
39@@ -728,10 +732,20 @@
40 restore_button.sensitive = !closed_tabs.empty;
41 restore_tab_m.sensitive = !closed_tabs.empty;
42 }
43+
44+ if (tab_closing != -1) {
45+ GLib.Source.remove (tab_closing);
46+ }
47+
48+ tab_closing = Timeout.add_seconds (smart_tab_time, () => {
49+ tab_closing = -1;
50+ recalc_size ();
51+ return false;
52+ });
53 }
54
55- [Deprecated (since=0.2)]
56- public void remove_tab_force (Tab tab) {
57+ [Deprecated (since=0.2)]
58+ public void remove_tab_force (Tab tab) {
59 var pos = get_tab_position (tab);
60 if (pos != -1)
61 notebook.remove_page (pos);

Subscribers

People subscribed via source and target branches