]> git.sesse.net Git - vlc/blobdiff - modules/gui/beos/InterfaceWindow.cpp
Merge commit 'origin/base'
[vlc] / modules / gui / beos / InterfaceWindow.cpp
index affd8016471d47a9093124daa889c9f89c44b8af..79873d589765e21f995f9ac42bed5ccf72237500 100644 (file)
 #include <scsi.h>
 #include <scsiprobe_driver.h>
 #include <fs_info.h>
-#include <string.h>
 
 /* VLC headers */
-#include <vlc/vlc.h>
-#include <vlc/aout.h>
-#include <vlc/intf.h>
-#include <vlc/input.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_aout.h>
+#include <vlc_interface.h>
 
 /* BeOS interface headers */
 #include "MsgVals.h"
@@ -201,14 +203,13 @@ InterfaceWindow::InterfaceWindow( intf_thread_t * _p_intf, BRect frame,
       fLastUpdateTime( system_time() ),
       fSettings( new BMessage( 'sett' ) )
 {
-    p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    p_playlist = pl_Hold( p_intf );
 
     var_AddCallback( p_playlist, "intf-change", PlaylistChanged, this );
     var_AddCallback( p_playlist, "item-change", PlaylistChanged, this );
-    var_AddCallback( p_playlist, "item-append", PlaylistChanged, this );
-    var_AddCallback( p_playlist, "item-deleted", PlaylistChanged, this );
-    var_AddCallback( p_playlist, "playlist-current", PlaylistChanged, this );
+    var_AddCallback( p_playlist, "playlist-item-append", PlaylistChanged, this );
+    var_AddCallback( p_playlist, "playlist-item-deleted", PlaylistChanged, this );
+    var_AddCallback( p_playlist, "item-current", PlaylistChanged, this );
 
     char psz_tmp[1024];
 #define ADD_ELLIPSIS( a ) \
@@ -321,7 +322,7 @@ InterfaceWindow::InterfaceWindow( intf_thread_t * _p_intf, BRect frame,
 
     /* Add the Show menu */
     fShowMenu = new BMenu( _("Window") );
-#if 0    
+#if 0
     ADD_ELLIPSIS( _("Playlist") );
     fShowMenu->AddItem( new BMenuItem( psz_tmp, new BMessage( OPEN_PLAYLIST ), 'P') );
 #endif
@@ -436,8 +437,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
                     char psz_uri[1024];
                     memset( psz_uri, 0, 1024 );
                     snprintf( psz_uri, 1024, "dvdnav:%s", psz_device );
-                    playlist_PlaylistAdd( p_playlist, psz_uri, psz_device,
-                                  PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
+                    playlist_Add( p_playlist, psz_uri, psz_device,
+                        PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, true );
                 }
                 UpdatePlaylist();
             }
@@ -661,38 +662,26 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
         case NAVIGATE_NEXT:
             if( p_input )
             {
-                vlc_value_t val, val_list;
-
                 /* First try to go to next chapter */
                 if( !var_Get( p_input, "chapter", &val ) )
                 {
-                    var_Change( p_input, "chapter", VLC_VAR_GETCHOICES,
-                                &val_list, NULL );
-                    if( val_list.p_list->i_count > val.i_int )
+                    int i_chapter_count = var_CountChoices( p_input, "chapter" );
+                    if( i_chapter_count > val.i_int )
                     {
-                        var_Change( p_input, "chapter", VLC_VAR_FREELIST,
-                                    &val_list, NULL );
                         var_SetVoid( p_input, "next-chapter" );
                         break;
                     }
-                    var_Change( p_input, "chapter", VLC_VAR_FREELIST,
-                                &val_list, NULL );
                 }
 
                 /* Try to go to next title */
                 if( !var_Get( p_input, "title", &val ) )
                 {
-                    var_Change( p_input, "title", VLC_VAR_GETCHOICES,
-                                &val_list, NULL );
-                    if( val_list.p_list->i_count > val.i_int )
+                    int i_title_count = var_CountChoices( p_input, "title" );
+                    if( i_title_count > val.i_int )
                     {
-                        var_Change( p_input, "title", VLC_VAR_FREELIST,
-                                    &val_list, NULL );
                         var_SetVoid( p_input, "next-title" );
                         break;
                     }
-                    var_Change( p_input, "title", VLC_VAR_FREELIST,
-                                &val_list, NULL );
                 }
 
                 /* Try to go to next file */
@@ -732,12 +721,12 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
                 break;
             }
 
-            vlc_bool_t b_remove = ( p_message->WasDropped() &&
+            bool b_remove = ( p_message->WasDropped() &&
                                     !( modifiers() & B_SHIFT_KEY ) );
 
             if( b_remove && p_playlist )
             {
-                playlist_Clear( p_playlist );
+                playlist_Clear( p_playlist, true );
             }
 
             entry_ref ref;
@@ -749,8 +738,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
 
                 if( p_playlist )
                 {
-                    playlist_PlaylistAdd( p_playlist, path.Path(), NULL,
-                                  PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
+                    playlist_Add( p_playlist, path.Path(), NULL,
+                       PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, true );
                 }
             }
 
@@ -805,7 +794,7 @@ bool InterfaceWindow::QuitRequested()
 
      _StoreSettings();
 
-    p_intf->b_die = 1;
+    vlc_object_kill( p_intf );
 
     return( true );
 }
@@ -1072,10 +1061,10 @@ InterfaceWindow::_RestoreSettings()
         BRect frame;
         if ( fSettings->FindRect( "main frame", &frame ) == B_OK )
             set_window_pos( this, frame );
-#if 0            
+#if 0
         if (fSettings->FindRect( "playlist frame", &frame ) == B_OK )
             set_window_pos( fPlaylistWindow, frame );
-#endif 
+#endif
         if (fSettings->FindRect( "messages frame", &frame ) == B_OK )
             set_window_pos( fMessagesWindow, frame );
         if (fSettings->FindRect( "settings frame", &frame ) == B_OK )
@@ -1090,7 +1079,7 @@ InterfaceWindow::_RestoreSettings()
 #if 0
         if ( fSettings->FindBool( "playlist showing", &showing ) == B_OK )
             launch_window( fPlaylistWindow, showing );
-#endif    
+#endif
         if ( fSettings->FindBool( "messages showing", &showing ) == B_OK )
             launch_window( fMessagesWindow, showing );
         if ( fSettings->FindBool( "settings showing", &showing ) == B_OK )
@@ -1111,7 +1100,6 @@ InterfaceWindow::_StoreSettings()
 {
     /* Save the volume */
     config_PutInt( p_intf, "volume", p_mediaControl->GetVolume() );
-    config_SaveConfigFile( p_intf, "main" );
 
     /* Save the windows positions */
     if ( fSettings->ReplaceRect( "main frame", Frame() ) != B_OK )
@@ -1264,7 +1252,7 @@ void LanguageMenu::AttachedToWindow()
         }
         AddItem( item );
     }
-    var_Change( p_input, psz_variable, VLC_VAR_FREELIST, &val_list, &text_list );
+    var_FreeList( &val_list, &text_list );
 
     vlc_object_release( p_input );
 
@@ -1327,8 +1315,7 @@ void TitleMenu::AttachedToWindow()
             AddItem( item );
         }
 
-        var_Change( p_input, "title", VLC_VAR_FREELIST,
-                    &val_list, &text_list );
+        var_FreeList( &val_list, &text_list );
     }
     vlc_object_release( p_input );
     BMenu::AttachedToWindow();
@@ -1391,8 +1378,7 @@ void ChapterMenu::AttachedToWindow()
             AddItem( item );
         }
 
-        var_Change( p_input, "chapter", VLC_VAR_FREELIST,
-                    &val_list, &text_list );
+        var_FreeList( &val_list, &text_list );
     }
     vlc_object_release( p_input );
     BMenu::AttachedToWindow();