Skip to content

Commit

Permalink
workspace: Save window default layout fixes #1769
Browse files Browse the repository at this point in the history
rn=
     (integrated from master branch change cd705ac by Carey Hoffman (cgchoffman@gmail.com>)
  • Loading branch information
th3coop committed Jul 26, 2016
1 parent b2c5d85 commit ee2f184
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/chrome/komodo/content/library/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,13 @@ if (typeof(ko.widgets)=='undefined') {
}
};

/**
* Save the UI state as JSON string in PrefPath
*
* @argument {Array} prefpath array of string prefIds, where to save state
* in prefs.xml. Empty list saves globaly UI. ie.
* all new windows will load this state.
*/
this.unload = function koWidgetManager_onunload(prefpath) {
// Note that this doesn't use this._persist_state; that's for restoring
// only, we want to record the state as it is now
Expand Down
7 changes: 6 additions & 1 deletion src/chrome/komodo/content/workspace.p.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,12 @@ this.saveWorkspace = function view_saveWorkspace(saveNow)
windowWorkspace, saveCoordinates);
}
// Use the current window's layout as the default for new windows
mainWindow.ko.widgets.unload(require("ko/prefs"),[]);
// Use the last window to close to save the default window state
// Don't run this everytime saveWorkspace is run (eg. on every file
// open)
if(ko.windowManager.lastWindow()){
ko.widgets.unload([]);
}
var prefSvc = Components.classes["@activestate.com/koPrefService;1"].getService(Components.interfaces.koIPrefService);
if (saveNow) {
prefSvc.saveState();
Expand Down

0 comments on commit ee2f184

Please sign in to comment.