]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/applescript.m
First and probably only attempt at fixing os x interface :)
[vlc] / modules / gui / macosx / applescript.m
index 8cc131d257ae76d73dc0dad4e1410618551bebaf..11b2c505c8dd5eb53c36d3c793716f2d06b44852 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * applescript.m: MacOS X AppleScript support
  *****************************************************************************
- * Copyright (C) 2002-2003 VideoLAN
- * $Id: applescript.m,v 1.3 2003/06/15 15:20:21 hartman Exp $
+ * Copyright (C) 2002-2003 the VideoLAN team
+ * $Id$
  *
  * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
  *
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -29,7 +29,6 @@
 #include "controls.h"
 #include "open.h"
 
-
 /*****************************************************************************
  * VLGetURLScriptCommand implementation 
  *****************************************************************************/
@@ -41,7 +40,7 @@
 
     if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] )
     {
-        intf_thread_t * p_intf = [NSApp getIntf];
+        intf_thread_t * p_intf = VLCIntf;
         playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                         FIND_ANYWHERE );
         if( p_playlist == NULL )
         if ( o_urlString )
         {
             NSURL * o_url;
-    
-            int i_mode = PLAYLIST_INSERT | PLAYLIST_GO;
-            
-            playlist_Add( p_playlist, [o_urlString fileSystemRepresentation],
-                                                    i_mode, PLAYLIST_END );
+            input_item_t *p_input;
+
+            p_input = input_ItemNew( p_playlist,
+                                    [o_urlString fileSystemRepresentation],
+                                    [[[NSFileManager defaultManager]
+                                    displayNameAtPath: o_urlString] UTF8String] );
+            playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT,
+                               PLAYLIST_END, VLC_TRUE );
+
 
             o_url = [NSURL fileURLWithPath: o_urlString];
             if( o_url != nil )
-            { 
+            {
                 [[NSDocumentController sharedDocumentController]
-                    noteNewRecentDocumentURL: o_url]; 
+                    noteNewRecentDocumentURL: o_url];
             }
         }
         vlc_object_release( p_playlist );
@@ -85,7 +88,7 @@
 - (id)performDefaultImplementation {
     NSString *o_command = [[self commandDescription] commandName];
 
-    intf_thread_t * p_intf = [NSApp getIntf];
+    intf_thread_t * p_intf = VLCIntf;
     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                     FIND_ANYWHERE );
     if( p_playlist == NULL )
     return nil;
 }
 
-@end
\ No newline at end of file
+@end