Merge lp:~xapantu/granite/fix-1157350tab-crash into lp:~elementary-pantheon/granite/granite

Proposed by xapantu
Status: Merged
Approved by: Mario Guerriero
Approved revision: 585
Merged at revision: 583
Proposed branch: lp:~xapantu/granite/fix-1157350tab-crash
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 52 lines (+4/-10)
1 file modified
lib/Widgets/DynamicNotebook.vala (+4/-10)
To merge this branch: bzr merge lp:~xapantu/granite/fix-1157350tab-crash
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+169688@code.launchpad.net
To post a comment you must log in.
584. By xapantu

New API to force tab deletion (useful for drag and drop things, when the tab is not really deleted)
Code simplification (which avoids some weird bugs)

585. By xapantu

Removed commented code

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-06-02 12:40:05 +0000
3+++ lib/Widgets/DynamicNotebook.vala 2013-06-16 16:41:27 +0000
4@@ -116,7 +116,7 @@
5 this.pack_start (this._working, false);
6
7 page_container = new Gtk.EventBox ();
8- page_container.add (page ?? new Gtk.Label (""));
9+ this.page = page ?? new Gtk.Label("");
10 page_container.show_all ();
11
12 this.show_all ();
13@@ -483,9 +483,6 @@
14
15 unowned Gtk.Notebook on_create_window (Gtk.Widget page, int x, int y) {
16 var tab = notebook.get_tab_label (page) as Tab;
17- notebook.remove_page (notebook.page_num (tab.page_container));
18- tab.page_container.destroy ();
19-
20 tab_moved (tab, 0, true, x, y);
21 return null;
22 }
23@@ -507,8 +504,8 @@
24 }
25 }
26
27- public void remove_tab (Tab tab) {
28- if (Signal.has_handler_pending (this, Signal.lookup ("tab-removed", typeof (DynamicNotebook)), 0, true)) {
29+ public void remove_tab (Tab tab, bool force = false) {
30+ if (!force && Signal.has_handler_pending (this, Signal.lookup ("tab-removed", typeof (DynamicNotebook)), 0, true)) {
31 var sure = tab_removed (tab);
32 if (!sure)
33 return;
34@@ -517,7 +514,6 @@
35 var pos = get_tab_position (tab);
36 if (pos != -1)
37 notebook.remove_page (pos);
38- tab.page_container.destroy ();
39 }
40
41 public void next_page () {
42@@ -610,9 +606,7 @@
43 });
44
45 tab.new_window.connect (() => {
46- notebook.remove_page (notebook.page_num (tab.page_container));
47- tab.page_container.destroy ();
48- tab_moved (tab, 0, true, 0, 0);
49+ notebook.create_window(tab.page_container, 0, 0);
50 });
51
52 tab.duplicate.connect (() => {

Subscribers

People subscribed via source and target branches