]> git.sesse.net Git - vlc/blobdiff - modules/gui/wince/dialogs.cpp
WinCE intf: use existing vlc functions
[vlc] / modules / gui / wince / dialogs.cpp
index f0bf00706ebbc00bb90879be17ad855d1aa0f7c3..5f9825d69320b2ed823e8a025b89dc95593fe1ec 100644 (file)
  * Preamble
  *****************************************************************************/
 
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
 #include <vlc_aout.h>
 #include <vlc_interface.h>
+#include <vlc_playlist.h>
 
 #include "wince.h"
 
@@ -114,11 +119,11 @@ DialogsProvider::DialogsProvider( intf_thread_t *p_intf,
 DialogsProvider::~DialogsProvider()
 {
     /* Clean up */
-    if( p_open_dialog )     delete p_open_dialog;
-    if( p_playlist_dialog ) delete p_playlist_dialog;
-    if( p_messages_dialog ) delete p_messages_dialog;
-    if( p_fileinfo_dialog ) delete p_fileinfo_dialog;
-    if( p_prefs_dialog )    delete p_prefs_dialog;
+    delete p_open_dialog;
+    delete p_playlist_dialog;
+    delete p_messages_dialog;
+    delete p_fileinfo_dialog;
+    delete p_prefs_dialog;
 
     if( h_gsgetfile_dll ) FreeLibrary( h_gsgetfile_dll );
 }
@@ -316,8 +321,8 @@ void DialogsProvider::OnOpenFileGeneric( intf_dialog_args_t *p_arg )
         }
         free( p_arg->psz_results );
     }
-    if( p_arg->psz_title ) free( p_arg->psz_title );
-    if( p_arg->psz_extensions ) free( p_arg->psz_extensions );
+    free( p_arg->psz_title );
+    free( p_arg->psz_extensions );
 
     free( p_arg );
 }
@@ -326,10 +331,9 @@ void DialogsProvider::OnOpenFileSimple( int i_arg )
 {
     OPENFILENAME ofn;
     TCHAR szFile[MAX_PATH] = _T("\0");
-    static TCHAR szFilter[] = _T("All (*.*)\0*.*\0");
+    static TCHAR szFilter[] = _T("wav (*.wav)\0*.wav\0mp3 (*.mp3 *.mpga)\0*.mp3;*.mpga\0All (*.*)\0*.*\0");
 
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Hold( p_intf );
     if( p_playlist == NULL ) return;
 
     memset( &ofn, 0, sizeof(OPENFILENAME) );
@@ -360,10 +364,11 @@ void DialogsProvider::OnOpenFileSimple( int i_arg )
     {
         char *psz_filename = _TOMB(ofn.lpstrFile);
         playlist_Add( p_playlist, psz_filename, psz_filename,
-                      PLAYLIST_APPEND | (i_arg?PLAYLIST_GO:0), PLAYLIST_END );
+                      PLAYLIST_APPEND | (i_arg?PLAYLIST_GO:0), PLAYLIST_END,
+                      TRUE, FALSE );
     }
 
-    vlc_object_release( p_playlist );
+    pl_Release( p_intf );
 }
 
 void DialogsProvider::OnOpenDirectory( int i_arg )
@@ -402,8 +407,7 @@ void DialogsProvider::OnOpenDirectory( int i_arg )
 
     if( !SUCCEEDED( SHGetMalloc(&p_malloc) ) ) goto error;
 
-    p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    p_playlist = pl_Hold( p_intf );
     if( !p_playlist ) goto error;
 
     memset( &bi, 0, sizeof(BROWSEINFO) );
@@ -421,7 +425,7 @@ void DialogsProvider::OnOpenDirectory( int i_arg )
             char *psz_filename = _TOMB(psz_result);
             playlist_Add( p_playlist, psz_filename, psz_filename,
                           PLAYLIST_APPEND | (i_arg ? PLAYLIST_GO : 0),
-                          PLAYLIST_END );
+                          PLAYLIST_END, TRUE, FALSE );
         }
         p_malloc->Free( pidl );
     }
@@ -429,7 +433,7 @@ void DialogsProvider::OnOpenDirectory( int i_arg )
  error:
 
     if( p_malloc) p_malloc->Release();
-    if( p_playlist ) vlc_object_release( p_playlist );
+    if( p_playlist ) pl_Release( p_intf );
 
 #ifdef UNDER_CE
     FreeLibrary( ceshell_dll );