vlc/vlc-3.0 | branch: master | David Fuhrmann <dfuhrm...@videolan.org> | Mon 
Feb 19 21:49:51 2018 +0100| [e88bc95fd6cb25c374c66340acf9daa799f80469] | 
committer: David Fuhrmann

macosx: Correctly save and restore collapsed state of split view

This state is saved already with the automatic macOS mechanisms
using the assigned autosave name. Therefore, remove the additional
setting which was interfering with the already correct state.

fixes #19649

(cherry picked from commit b62b868c75b54ccca3a7e7271878abce5253f69b)
Signed-off-by: David Fuhrmann <dfuhrm...@videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=e88bc95fd6cb25c374c66340acf9daa799f80469
---

 modules/gui/macosx/VLCMainMenu.h   |  2 +-
 modules/gui/macosx/VLCMainMenu.m   |  5 ++---
 modules/gui/macosx/VLCMainWindow.m | 11 ++++-------
 modules/gui/macosx/macosx.m        |  5 +----
 4 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/modules/gui/macosx/VLCMainMenu.h b/modules/gui/macosx/VLCMainMenu.h
index 777f681448..926604d474 100644
--- a/modules/gui/macosx/VLCMainMenu.h
+++ b/modules/gui/macosx/VLCMainMenu.h
@@ -214,7 +214,7 @@
 - (void)setupMenus;
 - (void)setSubmenusEnabled:(BOOL)b_enabled;
 - (void)setRateControlsEnabled:(BOOL)b_enabled;
-- (void)updateSidebarMenuItem;
+- (void)updateSidebarMenuItem:(BOOL)show;
 
 - (IBAction)openAddonManager:(id)sender;
 
diff --git a/modules/gui/macosx/VLCMainMenu.m b/modules/gui/macosx/VLCMainMenu.m
index ea6ebe5813..bf2509f01a 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -379,7 +379,6 @@
     [_toggleEffectsButton setTitle: _NS("Show Audio Effects Button")];
     [_toggleEffectsButton setState: var_InheritBool(getIntf(), 
"macosx-show-effects-button")];
     [_toggleSidebar setTitle: _NS("Show Sidebar")];
-    [_toggleSidebar setState: var_InheritBool(getIntf(), 
"macosx-show-sidebar")];
     [_playlistTableColumns setTitle: _NS("Playlist Table Columns")];
 
     [_controlsMenu setTitle: _NS("Playback")];
@@ -704,9 +703,9 @@
     [[[VLCMain sharedInstance] mainWindow] toggleLeftSubSplitView];
 }
 
-- (void)updateSidebarMenuItem
+- (void)updateSidebarMenuItem:(BOOL)show;
 {
-    [_toggleSidebar setState: var_InheritBool(getIntf(), 
"macosx-show-sidebar")];
+    [_toggleSidebar setState:show];
 }
 
 #pragma mark - Playback
diff --git a/modules/gui/macosx/VLCMainWindow.m 
b/modules/gui/macosx/VLCMainWindow.m
index 93f230394d..57dc4d4d5f 100644
--- a/modules/gui/macosx/VLCMainWindow.m
+++ b/modules/gui/macosx/VLCMainWindow.m
@@ -277,9 +277,7 @@ static const float f_min_window_height = 307.;
 
     /* restore split view */
     f_lastLeftSplitViewWidth = 200;
-    /* trick NSSplitView implementation, which pretends to know better than us 
*/
-    if (!var_InheritBool(getIntf(), "macosx-show-sidebar"))
-        [self performSelector:@selector(toggleLeftSubSplitView) withObject:nil 
afterDelay:0.05];
+    [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem: ![_splitView 
isSubviewCollapsed:_splitViewLeft]];
 }
 
 #pragma mark -
@@ -516,7 +514,6 @@ static const float f_min_window_height = 307.;
 
 - (void)applicationWillTerminate:(NSNotification *)notification
 {
-    config_PutInt(getIntf(), "macosx-show-sidebar", ![_splitView 
isSubviewCollapsed:_splitViewLeft]);
     [self saveFrameUsingName:[self frameAutosaveName]];
 }
 
@@ -833,8 +830,7 @@ static const float f_min_window_height = 307.;
 - (void)mainSplitViewDidResizeSubviews:(id)object
 {
     f_lastLeftSplitViewWidth = [_splitViewLeft frame].size.width;
-    config_PutInt(getIntf(), "macosx-show-sidebar", ![_splitView 
isSubviewCollapsed:_splitViewLeft]);
-    [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
+    [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem: ![_splitView 
isSubviewCollapsed:_splitViewLeft]];
 }
 
 - (void)toggleLeftSubSplitView
@@ -844,7 +840,8 @@ static const float f_min_window_height = 307.;
         [_splitView setPosition:f_lastLeftSplitViewWidth ofDividerAtIndex:0];
     else
         [_splitView setPosition:[_splitView 
minPossiblePositionOfDividerAtIndex:0] ofDividerAtIndex:0];
-    [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
+
+    [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem: ![_splitView 
isSubviewCollapsed:_splitViewLeft]];
 }
 
 #pragma mark -
diff --git a/modules/gui/macosx/macosx.m b/modules/gui/macosx/macosx.m
index 9adcc2a205..3c93acfcfb 100644
--- a/modules/gui/macosx/macosx.m
+++ b/modules/gui/macosx/macosx.m
@@ -122,9 +122,6 @@ void WindowClose  (vout_window_t *);
 #define EFFECTSBUTTON_TEXT N_("Show Audio Effects Button")
 #define EFFECTSBUTTON_LONGTEXT N_("Shows the audio effects button in the main 
window.")
 
-#define SIDEBAR_TEXT N_("Show Sidebar")
-#define SIDEBAR_LONGTEXT N_("Shows a sidebar in the main window listing media 
sources.")
-
 #define ITUNES_TEXT N_("Control external music players")
 #define ITUNES_LONGTEXT N_("VLC will pause and resume supported music players 
on playback.")
 
@@ -164,7 +161,6 @@ vlc_module_begin()
         add_bool("macosx-show-playback-buttons", false, JUMPBUTTONS_TEXT, 
JUMPBUTTONS_LONGTEXT, false)
         add_bool("macosx-show-playmode-buttons", false, PLAYMODEBUTTONS_TEXT, 
PLAYMODEBUTTONS_LONGTEXT, false)
         add_bool("macosx-show-effects-button", false, EFFECTSBUTTON_TEXT, 
EFFECTSBUTTON_LONGTEXT, false)
-        add_bool("macosx-show-sidebar", true, SIDEBAR_TEXT, SIDEBAR_LONGTEXT, 
false)
         add_integer_with_range("macosx-max-volume", 125, 60, 200, 
VOLUME_MAX_TEXT, VOLUME_MAX_TEXT, true)
         add_bool("macosx-large-text", false, LARGE_LISTFONT_TEXT, 
LARGE_LISTFONT_TEXT, false)
 
@@ -190,6 +186,7 @@ vlc_module_begin()
     add_obsolete_bool("macosx-stretch") /* since 2.0.0 */
     add_obsolete_bool("macosx-eq-keep") /* since 2.0.0 */
     add_obsolete_bool("macosx-autosave-volume") /* since 2.1.0 */
+    add_obsolete_bool("macosx-show-sidebar") /* since 3.0.1 */
 
     add_submodule()
         set_description("Mac OS X Video Output Provider")

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to