Permalink
Browse files

Remember the sidebar view's width

  • Loading branch information...
1 parent b1edfc3 commit d6080644f42af9efa0880a27d469018a1c28af69 Josh Hatwich committed May 15, 2012
Showing with 12 additions and 1 deletion.
  1. +12 −1 src/project/SidebarView.js
View
@@ -32,6 +32,7 @@ define(function (require, exports, module) {
WorkingSetView = require("project/WorkingSetView"),
CommandManager = require("command/CommandManager"),
Commands = require("command/Commands"),
+ PreferencesManager = require("preferences/PreferencesManager"),
EditorManager = require("editor/EditorManager");
var $sidebar = $("#sidebar"),
@@ -42,6 +43,10 @@ define(function (require, exports, module) {
$projectFilesContainer = $("#project-files-container"),
isSidebarClosed = false;
+ var PREFERENCES_CLIENT_ID = "com.adobe.brackets.SidebarView",
+ defaultPrefs = { 'sidebarWidth': '200' };
+
+
/**
* @private
* Update project title when the project root changes
@@ -88,6 +93,9 @@ define(function (require, exports, module) {
$sidebarMenuText.first().text(text);
}
+ var prefs = PreferencesManager.getPreferenceStorage(PREFERENCES_CLIENT_ID, defaultPrefs);
+ prefs.setValue("sidebarWidth", String(width));
+
EditorManager.resizeEditor();
}
@@ -112,9 +120,12 @@ define(function (require, exports, module) {
*/
function _initSidebarResizer() {
var $mainView = $(".main-view"),
- sidebarWidth = $sidebar.width(),
+ prefs = PreferencesManager.getPreferenceStorage(PREFERENCES_CLIENT_ID, defaultPrefs),
+ sidebarWidth = prefs.getValue("sidebarWidth"),
startingSidebarPosition = sidebarWidth;
+ _setWidth(sidebarWidth, true, true);
+
$sidebarResizer.css("left", sidebarWidth - 1);
$sidebarResizer.on("dblclick", function () {
if ($sidebar.width() === 1) {

0 comments on commit d608064

Please sign in to comment.