Merge lp:~niclasl/pantheon-files/new-dn-api into lp:~elementary-apps/pantheon-files/trunk

Proposed by Niclas Lockner
Status: Merged
Approved by: David Gomes
Approved revision: 1387
Merged at revision: 1399
Proposed branch: lp:~niclasl/pantheon-files/new-dn-api
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 93 lines (+17/-24)
1 file modified
src/View/Window.vala (+17/-24)
To merge this branch: bzr merge lp:~niclasl/pantheon-files/new-dn-api
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Review via email: mp+199045@code.launchpad.net

Commit message

Made compatible with DynamicNotebook's new API

Description of the change

Made compatible with DynamicNotebook's new API

To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) wrote :

Works pretty well, also good code.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/View/Window.vala'
2--- src/View/Window.vala 2013-10-31 10:01:00 +0000
3+++ src/View/Window.vala 2013-12-15 15:14:42 +0000
4@@ -229,31 +229,32 @@
5 return false;
6 });
7
8- tabs.tab_added.connect ((tab) => {
9- make_new_tab (tab);
10+ tabs.new_tab_requested.connect (() => {
11+ make_new_tab ();
12 });
13
14- tabs.tab_removed.connect ((tab) => {
15- if (tabs.n_tabs == 1) {
16- make_new_tab ();
17- }
18-
19+ tabs.close_tab_requested.connect ((tab) => {
20 tab.restore_data =
21 (tab.page as ViewContainer).slot.location.get_uri ();
22
23 return true;
24 });
25
26+ tabs.tab_removed.connect ((tab) => {
27+ if (tabs.n_tabs == 0)
28+ make_new_tab ();
29+ });
30+
31 tabs.tab_switched.connect ((old_tab, new_tab) => {
32 change_tab (tabs.get_tab_position (new_tab));
33 });
34
35- tabs.tab_restored.connect ((tab) => {
36- make_new_tab (tab, File.new_for_uri (tab.restore_data));
37+ tabs.tab_restored.connect ((label, restore_data, icon) => {
38+ make_new_tab (File.new_for_uri (restore_data));
39 });
40
41 tabs.tab_duplicated.connect ((tab) => {
42- make_new_tab (null, File.new_for_uri (((tab.page as ViewContainer).get_active_slot ()).location.get_uri ()));
43+ make_new_tab (File.new_for_uri (((tab.page as ViewContainer).get_active_slot ()).location.get_uri ()));
44 });
45
46 Gtk.Allocation win_alloc;
47@@ -334,31 +335,24 @@
48 }
49 }
50
51- private void make_new_tab (Granite.Widgets.Tab? tab = null,
52- File location = File.new_for_commandline_arg (Environment.get_home_dir ())) {
53- if (tab == null) {
54- var new_tab = new Granite.Widgets.Tab ();
55- tabs.insert_tab (new_tab, -1);
56- make_new_tab (new_tab, location);
57- return;
58- }
59-
60+ private void make_new_tab (File location = File.new_for_commandline_arg (Environment.get_home_dir ())) {
61 var content = new View.ViewContainer (this, location,
62 current_tab != null ? current_tab.view_mode : Preferences.settings.get_enum("default-viewmode"));
63
64- tab.label = "";
65- tab.page = content;
66+ var tab = new Granite.Widgets.Tab ("", null, content);
67
68 content.tab_name_changed.connect ((tab_name) => {
69 tab.label = tab_name;
70 });
71
72+ tabs.insert_tab (tab, -1);
73+
74 tabs.current = tab;
75 change_tab (tabs.get_tab_position (tab));
76 }
77
78 public void add_tab (File location) {
79- make_new_tab (null, location);
80+ make_new_tab (location);
81
82 /* The following fixes a bug where upon first opening
83 Files, the overlay status bar is shown empty. */
84@@ -371,8 +365,7 @@
85
86 public void remove_tab (ViewContainer view_container) {
87 var tab = tabs.get_tab_by_widget (view_container as Gtk.Widget);
88- if (tab != null)
89- tabs.remove_tab (tab);
90+ tab.close ();
91 }
92
93 public void add_window(File location){

Subscribers

People subscribed via source and target branches

to all changes: