]> git.sesse.net Git - vlc/commitdiff
Fix item selection in WX wizard (Closes:#402)
authorClément Stenac <zorglub@videolan.org>
Mon, 21 Nov 2005 10:09:22 +0000 (10:09 +0000)
committerClément Stenac <zorglub@videolan.org>
Mon, 21 Nov 2005 10:09:22 +0000 (10:09 +0000)
modules/gui/wxwidgets/dialogs/wizard.cpp

index c83e5ae6429a15df18ee76dfacd7bfebb7b1ac97..dbce5ad74b2cfaf03995198fa066603ed91a6468 100644 (file)
@@ -591,6 +591,8 @@ wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t
                 listview->InsertItem( i, filename );
                 listview->SetItem( i, 1, wxL2U( p_playlist->pp_items[i]->
                                                             input.psz_uri) );
+                listview->SetItemData( i,
+                                  (long)p_playlist->pp_items[i]->input.i_id );
             }
             listview->Select( p_playlist->i_index , TRUE);
             mainSizer->Add( listview, 1, wxALL|wxEXPAND, 5 );
@@ -715,14 +717,25 @@ void wizInputPage::OnWizardPageChanging(wxWizardEvent& event)
     else
     {
         int i = -1;
-        wxListItem listitem;
         i = listview->GetNextItem( i , wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
         if( i != -1 )
         {
-            listitem.SetId( i );
-            listitem.SetColumn( 1 );
-            listview->GetItem( listitem );
-            p_parent->SetMrl( (const char*) listitem.GetText().mb_str() );
+            long data = listview->GetItemData( i );            
+            playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
+                                      VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);
+            if( p_playlist )
+            {
+                playlist_item_t * p_item = playlist_LockItemGetById(
+                                                   p_playlist, (int)data );
+                if( p_item )
+                {
+                    p_parent->SetMrl( (const char*)p_item->input.psz_uri );
+                }
+                else
+                    event.Veto();
+            }
+            else
+                event.Veto();
         }
     }
     if( enable_checkbox->IsChecked() )