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
=== modified file 'src/View/Window.vala'
--- src/View/Window.vala 2013-10-31 10:01:00 +0000
+++ src/View/Window.vala 2013-12-15 15:14:42 +0000
@@ -229,31 +229,32 @@
229 return false;229 return false;
230 });230 });
231231
232 tabs.tab_added.connect ((tab) => {232 tabs.new_tab_requested.connect (() => {
233 make_new_tab (tab);233 make_new_tab ();
234 });234 });
235235
236 tabs.tab_removed.connect ((tab) => {236 tabs.close_tab_requested.connect ((tab) => {
237 if (tabs.n_tabs == 1) {
238 make_new_tab ();
239 }
240
241 tab.restore_data =237 tab.restore_data =
242 (tab.page as ViewContainer).slot.location.get_uri ();238 (tab.page as ViewContainer).slot.location.get_uri ();
243239
244 return true;240 return true;
245 });241 });
246242
243 tabs.tab_removed.connect ((tab) => {
244 if (tabs.n_tabs == 0)
245 make_new_tab ();
246 });
247
247 tabs.tab_switched.connect ((old_tab, new_tab) => {248 tabs.tab_switched.connect ((old_tab, new_tab) => {
248 change_tab (tabs.get_tab_position (new_tab));249 change_tab (tabs.get_tab_position (new_tab));
249 });250 });
250251
251 tabs.tab_restored.connect ((tab) => {252 tabs.tab_restored.connect ((label, restore_data, icon) => {
252 make_new_tab (tab, File.new_for_uri (tab.restore_data));253 make_new_tab (File.new_for_uri (restore_data));
253 });254 });
254255
255 tabs.tab_duplicated.connect ((tab) => {256 tabs.tab_duplicated.connect ((tab) => {
256 make_new_tab (null, File.new_for_uri (((tab.page as ViewContainer).get_active_slot ()).location.get_uri ()));257 make_new_tab (File.new_for_uri (((tab.page as ViewContainer).get_active_slot ()).location.get_uri ()));
257 });258 });
258259
259 Gtk.Allocation win_alloc;260 Gtk.Allocation win_alloc;
@@ -334,31 +335,24 @@
334 }335 }
335 }336 }
336337
337 private void make_new_tab (Granite.Widgets.Tab? tab = null,338 private void make_new_tab (File location = File.new_for_commandline_arg (Environment.get_home_dir ())) {
338 File location = File.new_for_commandline_arg (Environment.get_home_dir ())) {
339 if (tab == null) {
340 var new_tab = new Granite.Widgets.Tab ();
341 tabs.insert_tab (new_tab, -1);
342 make_new_tab (new_tab, location);
343 return;
344 }
345
346 var content = new View.ViewContainer (this, location,339 var content = new View.ViewContainer (this, location,
347 current_tab != null ? current_tab.view_mode : Preferences.settings.get_enum("default-viewmode"));340 current_tab != null ? current_tab.view_mode : Preferences.settings.get_enum("default-viewmode"));
348341
349 tab.label = "";342 var tab = new Granite.Widgets.Tab ("", null, content);
350 tab.page = content;
351343
352 content.tab_name_changed.connect ((tab_name) => {344 content.tab_name_changed.connect ((tab_name) => {
353 tab.label = tab_name;345 tab.label = tab_name;
354 });346 });
355347
348 tabs.insert_tab (tab, -1);
349
356 tabs.current = tab;350 tabs.current = tab;
357 change_tab (tabs.get_tab_position (tab));351 change_tab (tabs.get_tab_position (tab));
358 }352 }
359353
360 public void add_tab (File location) {354 public void add_tab (File location) {
361 make_new_tab (null, location);355 make_new_tab (location);
362356
363 /* The following fixes a bug where upon first opening357 /* The following fixes a bug where upon first opening
364 Files, the overlay status bar is shown empty. */358 Files, the overlay status bar is shown empty. */
@@ -371,8 +365,7 @@
371365
372 public void remove_tab (ViewContainer view_container) {366 public void remove_tab (ViewContainer view_container) {
373 var tab = tabs.get_tab_by_widget (view_container as Gtk.Widget);367 var tab = tabs.get_tab_by_widget (view_container as Gtk.Widget);
374 if (tab != null)368 tab.close ();
375 tabs.remove_tab (tab);
376 }369 }
377370
378 public void add_window(File location){371 public void add_window(File location){

Subscribers

People subscribed via source and target branches

to all changes: