Commit 28d7e588 authored by Erwan Tulou's avatar Erwan Tulou Committed by Jean-Baptiste Kempf

skins2: solve minor problem when opening skin dialog box

(could not be opened twice in a row)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 4d1d6ceb
...@@ -956,15 +956,21 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show ) ...@@ -956,15 +956,21 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
/* In skins interface, append some items */ /* In skins interface, append some items */
if( !mi ) if( !mi )
{ {
objects.clear(); varnames.clear();
vlc_object_t *p_object = ( vlc_object_t* ) vlc_object_t *p_object = ( vlc_object_t* )
vlc_object_find_name( p_intf, "skins2", FIND_PARENT ); vlc_object_find_name( p_intf, "skins2", FIND_PARENT );
if( p_object ) if( p_object )
{ {
objects.clear(); varnames.clear();
objects.push_back( p_object ); objects.push_back( p_object );
varnames.push_back( "intf-skins" ); varnames.push_back( "intf-skins" );
Populate( p_intf, submenu, varnames, objects ); Populate( p_intf, submenu, varnames, objects );
objects.clear(); varnames.clear();
objects.push_back( p_object );
varnames.push_back( "intf-skins-interactive" );
Populate( p_intf, submenu, varnames, objects );
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
else else
......
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
#endif #endif
const char *ThemeRepository::kOpenDialog = "{openSkin}";
ThemeRepository *ThemeRepository::instance( intf_thread_t *pIntf ) ThemeRepository *ThemeRepository::instance( intf_thread_t *pIntf )
{ {
...@@ -78,14 +76,19 @@ ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): SkinObject( pIntf ) ...@@ -78,14 +76,19 @@ ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): SkinObject( pIntf )
parseDirectory( *it ); parseDirectory( *it );
} }
// Add an entry for the "open skin" dialog
val.psz_string = (char*)kOpenDialog;
text.psz_string = _("Open skin...");
var_Change( getIntf(), "intf-skins", VLC_VAR_ADDCHOICE, &val,
&text );
// Set the callback // Set the callback
var_AddCallback( pIntf, "intf-skins", changeSkin, this ); var_AddCallback( pIntf, "intf-skins", changeSkin, this );
// variable for opening a dialog box to change skins
var_Create( pIntf, "intf-skins-interactive", VLC_VAR_VOID |
VLC_VAR_ISCOMMAND );
text.psz_string = _("Open skin ...");
var_Change( pIntf, "intf-skins-interactive", VLC_VAR_SETTEXT, &text, NULL );
// Set the callback
var_AddCallback( pIntf, "intf-skins-interactive", changeSkin, this );
} }
...@@ -147,19 +150,18 @@ void ThemeRepository::parseDirectory( const string &rDir_locale ) ...@@ -147,19 +150,18 @@ void ThemeRepository::parseDirectory( const string &rDir_locale )
int ThemeRepository::changeSkin( vlc_object_t *pIntf, char const *pCmd, int ThemeRepository::changeSkin( vlc_object_t *pIntf, char const *pVariable,
vlc_value_t oldval, vlc_value_t newval, vlc_value_t oldval, vlc_value_t newval,
void *pData ) void *pData )
{ {
ThemeRepository *pThis = (ThemeRepository*)(pData); ThemeRepository *pThis = (ThemeRepository*)(pData);
// Special menu entry for the open skin dialog if( !strcmp( pVariable, "intf-skins-interactive" ) )
if( !strcmp( newval.psz_string, kOpenDialog ) )
{ {
CmdDlgChangeSkin cmd( pThis->getIntf() ); CmdDlgChangeSkin cmd( pThis->getIntf() );
cmd.execute(); cmd.execute();
} }
else else if( !strcmp( pVariable, "intf-skins" ) )
{ {
// Try to load the new skin // Try to load the new skin
CmdChangeSkin *pCmd = new CmdChangeSkin( pThis->getIntf(), CmdChangeSkin *pCmd = new CmdChangeSkin( pThis->getIntf(),
......
...@@ -44,14 +44,12 @@ class ThemeRepository: public SkinObject ...@@ -44,14 +44,12 @@ class ThemeRepository: public SkinObject
virtual ~ThemeRepository(); virtual ~ThemeRepository();
private: private:
/// Identifier for the special menu entry
static const char *kOpenDialog;
/// Look for themes in a directory /// Look for themes in a directory
void parseDirectory( const string &rDir ); void parseDirectory( const string &rDir );
/// Callback for menu item selection /// Callback for menu item selection
static int changeSkin( vlc_object_t *pThis, char const *pCmd, static int changeSkin( vlc_object_t *pThis, char const *pVariable,
vlc_value_t oldval, vlc_value_t newval, vlc_value_t oldval, vlc_value_t newval,
void *pData ); void *pData );
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment