]> git.sesse.net Git - vlc/commitdiff
Forward-port and adapt [15500]
authorClément Stenac <zorglub@videolan.org>
Sun, 7 May 2006 08:51:34 +0000 (08:51 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 7 May 2006 08:51:34 +0000 (08:51 +0000)
modules/gui/wxwidgets/menus.cpp
src/interface/interface.c

index d51c0706a9bf9fd9a7e58e5fd529974920eb2f30..28a0a350159993b35078c6fa5c037f8ad6d85339 100644 (file)
@@ -59,7 +59,7 @@ public:
 
 private:
     wxMenu *CreateDummyMenu();
-    void   CreateMenuItem( wxMenu *, char *, vlc_object_t * );
+    void   CreateMenuItem( wxMenu *, const char *, vlc_object_t * );
     wxMenu *CreateChoicesMenu( char *, vlc_object_t *, bool );
 
     DECLARE_EVENT_TABLE();
@@ -192,7 +192,8 @@ int AudioAutoMenuBuilder( vlc_object_t *p_object,
 }
 
 int IntfAutoMenuBuilder( intf_thread_t *p_intf,
-                         vector<int> &ri_objects, vector<string> &rs_varnames )
+                         vector<int> &ri_objects, vector<string> &rs_varnames,
+                         bool is_popup)
 {
     /* vlc_object_find is needed because of the dialogs provider case */
     vlc_object_t *p_object;
@@ -200,6 +201,14 @@ int IntfAutoMenuBuilder( intf_thread_t *p_intf,
                                                 FIND_PARENT );
     if( p_object != NULL )
     {
+        if( is_popup )
+        {
+#ifndef WIN32
+            PUSH_VAR( "intf-switch" );
+#endif
+        }
+        else
+            PUSH_VAR( "intf-switch" );
         PUSH_VAR( "intf-add" );
         PUSH_VAR( "intf-skins" );
         vlc_object_release( p_object );
@@ -328,7 +337,7 @@ void MiscPopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
         InputAutoMenuBuilder( VLC_OBJECT(p_input), ai_objects, as_varnames );
         PUSH_SEPARATOR;
     }
-    IntfAutoMenuBuilder( p_intf, ai_objects, as_varnames );
+    IntfAutoMenuBuilder( p_intf, ai_objects, as_varnames, true );
 
     Menu popupmenu( p_intf, PopupMenu_Events );
     popupmenu.Populate( as_varnames, ai_objects );
@@ -381,7 +390,7 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
 
     /* Interface menu */
     PUSH_SEPARATOR
-    IntfAutoMenuBuilder( p_intf, ai_objects, as_varnames );
+    IntfAutoMenuBuilder( p_intf, ai_objects, as_varnames, true );
 
     /* Build menu */
     Menu popupmenu( p_intf, PopupMenu_Events );
@@ -509,6 +518,7 @@ wxMenu *SettingsMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
                                                 FIND_PARENT );
     if( p_object != NULL )
     {
+        PUSH_VAR( "intf-switch" );
         PUSH_VAR( "intf-add" );
         vlc_object_release( p_object );
     }
@@ -632,6 +642,8 @@ static bool IsMenuEmpty( char *psz_var, vlc_object_t *p_object,
 
     if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE )
     {
+        /* Very evil hack ! intf-switch can have only one value */ 
+        if( !strcmp( psz_var, "intf-switch" ) ) return FALSE;
         if( val.i_int == 1 && b_root ) return TRUE;
         else return FALSE;
     }
@@ -658,7 +670,7 @@ static bool IsMenuEmpty( char *psz_var, vlc_object_t *p_object,
     return i_result;
 }
 
-void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
+void Menu::CreateMenuItem( wxMenu *menu, const char *psz_var,
                            vlc_object_t *p_object )
 {
     wxMenuItemExt *menuitem;
index 4ee2e0834e1aa2b6b4334ae98647d490d9b2dad8..2c06f3d6c187d5fd0c53c618c1ae6ba81a6e28f2 100644 (file)
@@ -329,7 +329,9 @@ static void RunInterface( intf_thread_t *p_intf )
     static char *ppsz_interfaces[] =
     {
         "skins2", "Skins 2",
+#ifndef WIN32
         "wxwidgets", "wxWidgets",
+#endif
         NULL, NULL
     };
     char **ppsz_parser;