]> git.sesse.net Git - vlc/commitdiff
modules/gui/wxwidgets/*: bunch of fixes.
authorGildas Bazin <gbazin@videolan.org>
Mon, 28 May 2007 14:56:09 +0000 (14:56 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 28 May 2007 14:56:09 +0000 (14:56 +0000)
modules/gui/wxwidgets/dialogs.cpp
modules/gui/wxwidgets/dialogs/playlist.cpp
modules/gui/wxwidgets/playlist_manager.cpp

index 4efb9d3b73fc5fb58e0bfe0f673e142b36590b64..8cc88e69806c66a372195efd73b967107b0428ef 100644 (file)
@@ -382,8 +382,8 @@ void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
     {
         p_file_generic_dialog->SetMessage( wxU(p_arg->psz_title) );
         p_file_generic_dialog->SetWildcard( wxU(p_arg->psz_extensions) );
-        p_file_generic_dialog->SetStyle( (p_arg->b_save ? wxSAVE : wxOPEN) |
-                                         (p_arg->b_multiple ? wxMULTIPLE:0) );
+        p_file_generic_dialog->SetWindowStyle( (p_arg->b_save ? wxSAVE : wxOPEN) |
+                                               (p_arg->b_multiple ? wxMULTIPLE:0) );
     }
 
     if( p_file_generic_dialog &&
index 70b08897755370ddabc6d16a02bb26c009854cbb..337a68674900026772aa0a296ed8ad65dbf1e0c0 100644 (file)
@@ -227,7 +227,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
     p_sd_menu = SDMenu();
 
     p_current_viewroot = p_playlist->p_root_category;
-    p_current_treeroot = p_playlist->p_local_category;
+    p_current_treeroot = NULL;
 
     i_title_sorted = 0;
     i_group_sorted = 0;
@@ -366,8 +366,6 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
     p_images->Add( wxIcon( type_node_xpm ) );
     treectrl->AssignImageList( p_images );
 
-    treectrl->AddRoot( wxU(_("root" )), -1, -1, NULL );
-
     /* Reduce font size */
     wxFont font= treectrl->GetFont();
     font.SetPointSize(9);
@@ -407,8 +405,8 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
     var_AddCallback( p_playlist, "item-deleted", ItemDeleted, this );
 
     /* Update the playlist */
+    p_current_treeroot = p_playlist->p_local_category;
     Rebuild( VLC_TRUE );
-
 }
 
 Playlist::~Playlist()
@@ -798,19 +796,8 @@ void Playlist::Rebuild( vlc_bool_t b_root )
 {
     i_items_to_append = 0;
 
-    /* We can remove the callbacks before locking, anyway, we won't
-     * miss anything */
-    if( b_root )
-    {
-        var_DelCallback( p_playlist, "item-change", ItemChanged, this );
-        var_DelCallback( p_playlist, "playlist-current", PlaylistNext, this );
-        var_DelCallback( p_playlist, "intf-change", PlaylistChanged, this );
-        var_DelCallback( p_playlist, "item-append", ItemAppended, this );
-        var_DelCallback( p_playlist, "item-deleted", ItemDeleted, this );
+    LockPlaylist( p_intf->p_sys, p_playlist );
 
-        /* ...and rebuild it */
-        LockPlaylist( p_intf->p_sys, p_playlist );
-    }
     /* Invalidate cache */
     i_saved_id = -1;
     i_saved_input_id = -1;
@@ -833,8 +820,6 @@ void Playlist::Rebuild( vlc_bool_t b_root )
                          new PlaylistItem( p_current_treeroot ) );
 
     wxTreeItemId root = treectrl->GetRootItem();
-    //UpdateNode( p_current_treeroot, root );
-    //CreateNode( p_current_treeroot, root );
     UpdateNodeChildren( p_current_treeroot, root );
 
     int i_count = CountItems( treectrl->GetRootItem() );
@@ -842,17 +827,7 @@ void Playlist::Rebuild( vlc_bool_t b_root )
     statusbar->SetStatusText( wxString::Format( wxU(_(
                               "%i items in playlist")), i_count ), 0 );
 
-    if( b_root )
-    {
-        /* Put callbacks back online */
-        var_AddCallback( p_playlist, "intf-change", PlaylistChanged, this );
-        var_AddCallback( p_playlist, "playlist-current", PlaylistNext, this );
-        var_AddCallback( p_playlist, "item-change", ItemChanged, this );
-        var_AddCallback( p_playlist, "item-append", ItemAppended, this );
-        var_AddCallback( p_playlist, "item-deleted", ItemDeleted, this );
-
-        UnlockPlaylist( p_intf->p_sys, p_playlist );
-    }
+    UnlockPlaylist( p_intf->p_sys, p_playlist );
 }
 
 void Playlist::ShowPlaylist( bool show )
@@ -1647,7 +1622,7 @@ void Playlist::OnSourceSelected( wxListEvent &event )
 {
    int i_id = event.GetData();
 
-   if( p_current_treeroot && i_id != p_current_treeroot->i_id )
+   if( !p_current_treeroot || i_id != p_current_treeroot->i_id )
    {
        playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id,
                                                        VLC_TRUE );
index 528e5e304523346654bf559bab851ce08bb5381e..bf091b156c9138397a6471fa89e5a23bac2564d9 100644 (file)
@@ -87,8 +87,15 @@ END_EVENT_TABLE()
 class PlaylistItem : public wxTreeItemData
 {
 public:
-    PlaylistItem( playlist_item_t *p_item ) : i_id(p_item->p_input->i_id) {}
+    PlaylistItem( playlist_item_t *p_item ) : wxTreeItemData()
+    {
+        i_id = p_item->i_id;
+        i_input_id = p_item->p_input->i_id;
+    }
+protected:
+    int i_input_id;
     int i_id;
+friend class PlaylistManager;
 };
 
 /*****************************************************************************
@@ -291,9 +298,15 @@ void PlaylistManager::UpdateTreeItem( wxTreeItemId item )
 
     wxString msg;
     wxString duration = wxU( "" );
-    char *psz_artist = p_item->p_input->p_meta->psz_artist ?
-                        strdup( p_item->p_input->p_meta->psz_artist ) :
-                        strdup( "" );
+
+    char *psz_artist;
+    if( p_item->p_input->p_meta &&
+        p_item->p_input->p_meta->psz_artist )
+    {
+        psz_artist = strdup( p_item->p_input->p_meta->psz_artist );
+    }
+    else psz_artist = strdup( "" );
+
     if( !psz_artist )
     {
         UnlockPlaylist( p_intf->p_sys, p_playlist );