]> git.sesse.net Git - vlc/commitdiff
Look for "Title" entry in title 0, instead of always using entry 3
authorLaurent Aimar <fenrir@videolan.org>
Sat, 2 Aug 2008 15:38:50 +0000 (17:38 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sat, 2 Aug 2008 15:38:50 +0000 (17:38 +0200)
for going to the DVD menu.

modules/gui/qt4/input_manager.cpp

index defd89d1100e05736a75fc656977127e35a40f95..955c8630f383ff15bf420bf2846746fdc896db2d 100644 (file)
@@ -414,9 +414,22 @@ void InputManager::sectionMenu()
 {
     if( hasInput() )
     {
-        // FIXME we should not assume that but probably find the entry named "Root" in "title 0"
-        vlc_value_t val; val.i_int = 2;
-        var_Set( p_input, "title  0", val );
+        vlc_value_t val, text;
+        vlc_value_t root;
+
+        if( var_Change( p_input, "title  0", VLC_VAR_GETLIST, &val, &text ) < 0 )
+            return;
+
+        /* XXX is it "Root" or "Title" we want here ?" (set 0 by default) */
+        root.i_int = 0;
+        for( int i = 0; i < val.p_list->i_count; i++ )
+        {
+            if( !strcmp( text.p_list->p_values[i].psz_string, "Title" ) )
+                root.i_int = i;
+        }
+        var_Change( p_input, "title  0", VLC_VAR_FREELIST, &val, &text );
+
+        var_Set( p_input, "title  0", root );
     }
 }