[vlc-devel] [PATCH 2/2] macosx: fix and cleanup quit-after-playback main menu item

david.fuhrmann at gmail.com david.fuhrmann at gmail.com
Mon Feb 3 11:05:38 CET 2014


From: David Fuhrmann <david.fuhrmann at googlemail.com>

close #6073
---
 .../macosx/Resources/English.lproj/MainMenu.xib    | 38 +++++++++++-----------
 modules/gui/macosx/MainMenu.h                      |  1 +
 modules/gui/macosx/MainMenu.m                      | 12 +++++--
 modules/gui/macosx/controls.h                      |  1 -
 modules/gui/macosx/controls.m                      |  7 ----
 5 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/extras/package/macosx/Resources/English.lproj/MainMenu.xib b/extras/package/macosx/Resources/English.lproj/MainMenu.xib
index f764cd0..c59e503 100644
--- a/extras/package/macosx/Resources/English.lproj/MainMenu.xib
+++ b/extras/package/macosx/Resources/English.lproj/MainMenu.xib
@@ -12,10 +12,10 @@
     </object>
     <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
       <bool key="EncodedWithXMLCoder">YES</bool>
+      <integer value="5132"/>
       <integer value="2730"/>
-      <integer value="24"/>
-      <integer value="5547"/>
       <integer value="2461"/>
+      <integer value="5547"/>
     </object>
     <object class="NSArray" key="IBDocument.PluginDependencies">
       <bool key="EncodedWithXMLCoder">YES</bool>
@@ -3654,14 +3654,6 @@
         </object>
         <object class="IBConnectionRecord">
           <object class="IBActionConnection" key="connection">
-            <string key="label">quitAfterPlayback:</string>
-            <reference key="source" ref="113811151"/>
-            <reference key="destination" ref="872694174"/>
-          </object>
-          <int key="connectionID">5172</int>
-        </object>
-        <object class="IBConnectionRecord">
-          <object class="IBActionConnection" key="connection">
             <string key="label">next:</string>
             <reference key="source" ref="113811151"/>
             <reference key="destination" ref="232322819"/>
@@ -4464,6 +4456,14 @@
           </object>
           <int key="connectionID">5611</int>
         </object>
+        <object class="IBConnectionRecord">
+          <object class="IBActionConnection" key="connection">
+            <string key="label">quitAfterPlayback:</string>
+            <reference key="source" ref="651263286"/>
+            <reference key="destination" ref="872694174"/>
+          </object>
+          <int key="connectionID">5612</int>
+        </object>
       </object>
       <object class="IBMutableOrderedSet" key="objectRecords">
         <object class="NSArray" key="orderedObjects">
@@ -7010,7 +7010,7 @@
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
-          <string>{{592, 420}, {222, 383}}</string>
+          <string>{{567, 353}, {222, 383}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -7181,7 +7181,7 @@
         </object>
       </object>
       <nil key="sourceID"/>
-      <int key="maxID">5611</int>
+      <int key="maxID">5612</int>
     </object>
     <object class="IBClassDescriber" key="IBDocument.Classes">
       <object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -7259,7 +7259,6 @@
               <string>next:</string>
               <string>play:</string>
               <string>prev:</string>
-              <string>quitAfterPlayback:</string>
               <string>random:</string>
               <string>repeat:</string>
               <string>showPosition:</string>
@@ -7286,7 +7285,6 @@
               <string>id</string>
               <string>id</string>
               <string>id</string>
-              <string>id</string>
             </object>
           </object>
           <object class="NSMutableDictionary" key="actionInfosByName">
@@ -7302,7 +7300,6 @@
               <string>next:</string>
               <string>play:</string>
               <string>prev:</string>
-              <string>quitAfterPlayback:</string>
               <string>random:</string>
               <string>repeat:</string>
               <string>showPosition:</string>
@@ -7350,10 +7347,6 @@
                 <string key="candidateClassName">id</string>
               </object>
               <object class="IBActionInfo">
-                <string key="name">quitAfterPlayback:</string>
-                <string key="candidateClassName">id</string>
-              </object>
-              <object class="IBActionInfo">
                 <string key="name">random:</string>
                 <string key="candidateClassName">id</string>
               </object>
@@ -7766,6 +7759,7 @@
               <string>openForum:</string>
               <string>openReadMe:</string>
               <string>openWebsite:</string>
+              <string>quitAfterPlayback:</string>
               <string>resizeVideoWindow:</string>
               <string>savePlaylist:</string>
               <string>setPlaybackRate:</string>
@@ -7848,6 +7842,7 @@
               <string>id</string>
               <string>id</string>
               <string>id</string>
+              <string>id</string>
             </object>
           </object>
           <object class="NSMutableDictionary" key="actionInfosByName">
@@ -7867,6 +7862,7 @@
               <string>openForum:</string>
               <string>openReadMe:</string>
               <string>openWebsite:</string>
+              <string>quitAfterPlayback:</string>
               <string>resizeVideoWindow:</string>
               <string>savePlaylist:</string>
               <string>setPlaybackRate:</string>
@@ -7956,6 +7952,10 @@
                 <string key="candidateClassName">id</string>
               </object>
               <object class="IBActionInfo">
+                <string key="name">quitAfterPlayback:</string>
+                <string key="candidateClassName">id</string>
+              </object>
+              <object class="IBActionInfo">
                 <string key="name">resizeVideoWindow:</string>
                 <string key="candidateClassName">id</string>
               </object>
diff --git a/modules/gui/macosx/MainMenu.h b/modules/gui/macosx/MainMenu.h
index 60de535..55e548f 100644
--- a/modules/gui/macosx/MainMenu.h
+++ b/modules/gui/macosx/MainMenu.h
@@ -252,6 +252,7 @@
 - (void)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)o_column;
 - (NSMenu *)setupPlaylistTableColumnsMenu;
 
+- (IBAction)quitAfterPlayback:(id)sender;
 - (IBAction)toggleRecord:(id)sender;
 - (void)updateRecordState:(BOOL)b_value;
 - (IBAction)setPlaybackRate:(id)sender;
diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m
index 0f4b0fa..7733de7 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -754,6 +754,14 @@ static VLCMainMenu *_o_sharedInstance = nil;
 
 #pragma mark -
 #pragma mark Playback
+
+- (IBAction)quitAfterPlayback:(id)sender
+{
+    playlist_t *p_playlist = pl_Get(VLCIntf);
+    bool b_value = var_CreateGetBool(p_playlist, "play-and-exit");
+    var_SetBool(p_playlist, "play-and-exit", !b_value);
+}
+
 - (IBAction)toggleRecord:(id)sender
 {
     [[VLCCoreInteraction sharedInstance] toggleRecord];
@@ -1500,8 +1508,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
         [o_mi setState: i_state];
     } else if ([o_title isEqualToString: _NS("Quit after Playback")]) {
         int i_state;
-        var_Get(p_playlist, "play-and-exit", &val);
-        i_state = val.b_bool ? NSOnState : NSOffState;
+        bool b_value = var_InheritBool(p_playlist, "play-and-exit");
+        i_state = b_value ? NSOnState : NSOffState;
         [o_mi setState: i_state];
     } else if ([o_title isEqualToString: _NS("Step Forward")] ||
                [o_title isEqualToString: _NS("Step Backward")] ||
diff --git a/modules/gui/macosx/controls.h b/modules/gui/macosx/controls.h
index 8df133c..90985ee 100644
--- a/modules/gui/macosx/controls.h
+++ b/modules/gui/macosx/controls.h
@@ -50,7 +50,6 @@
 - (IBAction)random:(id)sender;
 - (IBAction)repeat:(id)sender;
 - (IBAction)loop:(id)sender;
-- (IBAction)quitAfterPlayback:(id)sender;
 
 - (IBAction)forward:(id)sender;
 - (IBAction)backward:(id)sender;
diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m
index 943cf85..a806d75 100644
--- a/modules/gui/macosx/controls.m
+++ b/modules/gui/macosx/controls.m
@@ -117,13 +117,6 @@
         [[VLCCoreInteraction sharedInstance] repeatOff];
 }
 
-- (IBAction)quitAfterPlayback:(id)sender
-{
-    vlc_value_t val;
-    playlist_t * p_playlist = pl_Get(VLCIntf);
-    var_ToggleBool(p_playlist, "play-and-exit");
-}
-
 - (IBAction)forward:(id)sender
 {
     [[VLCCoreInteraction sharedInstance] forward];
-- 
1.8.3.4 (Apple Git-47)




More information about the vlc-devel mailing list