@@ -116,10 +116,25 @@ define(function (require, exports, module) {
116116 }
117117
118118 /**
119- * Update state of splitview button icon and menu checkmarks
119+ * Update state of working set
120120 * @private
121121 */
122- function _updateSplitViewButtonState ( ) {
122+ function _updateWorkingSetState ( ) {
123+ if ( MainViewManager . getPaneCount ( ) === 1 &&
124+ MainViewManager . getWorkingSetSize ( MainViewManager . ACTIVE_PANE ) === 0 ) {
125+ $workingSetViewsContainer . hide ( ) ;
126+ $gearMenu . hide ( ) ;
127+ } else {
128+ $workingSetViewsContainer . show ( ) ;
129+ $gearMenu . show ( ) ;
130+ }
131+ }
132+
133+ /**
134+ * Update state of splitview and option elements
135+ * @private
136+ */
137+ function _updateUIStates ( ) {
123138 var ypos , spriteIndex ,
124139 layoutScheme = MainViewManager . getLayoutScheme ( ) ;
125140
@@ -131,14 +146,17 @@ define(function (require, exports, module) {
131146 spriteIndex = 0 ;
132147 }
133148
134- // Icon
149+ // SplitView Icon
135150 ypos = SPRITE_BASE - ( spriteIndex * SPRITE_OFFSET ) ;
136151 $splitViewMenu . css ( "background-position-y" , ypos ) ;
137152
138- // Menu
153+ // SplitView Menu
139154 _cmdSplitNone . setChecked ( spriteIndex === 0 ) ;
140155 _cmdSplitVertical . setChecked ( spriteIndex === 1 ) ;
141156 _cmdSplitHorizontal . setChecked ( spriteIndex === 2 ) ;
157+
158+ // Options icon
159+ _updateWorkingSetState ( ) ;
142160 }
143161
144162 /**
@@ -226,15 +244,19 @@ define(function (require, exports, module) {
226244 } ) ;
227245
228246 $ ( MainViewManager ) . on ( "paneLayoutChange" , function ( ) {
229- _updateSplitViewButtonState ( ) ;
247+ _updateUIStates ( ) ;
248+ } ) ;
249+
250+ $ ( MainViewManager ) . on ( "workingSetAdd workingSetAddList workingSetRemove workingSetRemoveList workingSetUpdate" , function ( ) {
251+ _updateWorkingSetState ( ) ;
230252 } ) ;
231253
232254 // create WorkingSetViews for each pane already created
233255 _ . forEach ( MainViewManager . getPaneIdList ( ) , function ( paneId ) {
234256 WorkingSetView . createWorkingSetViewForPane ( $workingSetViewsContainer , paneId ) ;
235257 } ) ;
236258
237- _updateSplitViewButtonState ( ) ;
259+ _updateUIStates ( ) ;
238260
239261 // Tooltips
240262 $gearMenu . attr ( "title" , Strings . GEAR_MENU_TOOLTIP ) ;
0 commit comments