]> git.sesse.net Git - vlc/commitdiff
Enable the last parameter of the macros change_integer_list, change_string_list to...
authorAndré Weber <WeberAndre@gmx.de>
Mon, 3 Mar 2008 18:57:43 +0000 (19:57 +0100)
committerAndré Weber <WeberAndre@gmx.de>
Mon, 3 Mar 2008 18:57:43 +0000 (19:57 +0100)
include/vlc_configuration.h
include/vlc_modules_macros.h
modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/wxwidgets/dialogs/preferences_widgets.cpp
src/modules/entry.c

index 43258e0a516cf599947d867d32a2dbcf0c923c65..4bcadf4ba9342c83e487126f23cda5618c346c0a 100644 (file)
@@ -169,6 +169,7 @@ struct module_config_t
     int         *pi_list;                              /* Idem for integers */
     char       **ppsz_list_text;          /* Friendly names for list values */
     int          i_list;                               /* Options list size */
+    vlc_callback_t pf_update_list; /*callback to initialize dropdownlists */
 
     /* Actions list */
     vlc_callback_t *ppf_action;    /* List of possible actions for a config */
@@ -435,19 +436,22 @@ VLC_EXPORT( int, vlc_config_set, (module_config_t *, int, ...) );
     vlc_config_set (p_config, VLC_CONFIG_LIST, \
                     (size_t)(sizeof (list) / sizeof (char *)), \
                     (const char *const *)(list), \
-                    (const char *const *)(list_text))
+                    (const char *const *)(list_text), \
+                    list_update_func)
 
 #define change_integer_list( list, list_text, list_update_func ) \
     vlc_config_set (p_config, VLC_CONFIG_LIST, \
                     (size_t)(sizeof (list) / sizeof (int)), \
                     (const int *)(list), \
-                    (const char *const *)(list_text))
+                    (const char *const *)(list_text), \
+                    list_update_func)
 
 #define change_float_list( list, list_text, list_update_func ) \
     vlc_config_set (p_config, VLC_CONFIG_LIST, \
                     (size_t)(sizeof (list) / sizeof (float)), \
                     (const float *)(list), \
-                    (const char *const *)(list_text))
+                    (const char *const *)(list_text), \
+                    list_update_func)
 
 #define change_integer_range( minv, maxv ) \
     vlc_config_set (p_config, VLC_CONFIG_RANGE, (int)(minv), (int)(maxv))
index 0e544fddf8b6e776d3ab4685e77c03e1e108108b..426352f0a361fa7375f1f7e1235783e96f1ddcee 100644 (file)
@@ -35,8 +35,8 @@
 /**
  * Current plugin ABI version
  */
-# define MODULE_SYMBOL 0_9_0g
-# define MODULE_SUFFIX "__0_9_0g"
+# define MODULE_SYMBOL 0_9_0h
+# define MODULE_SUFFIX "__0_9_0h"
 
 /*****************************************************************************
  * Add a few defines. You do not want to read this section. Really.
index ba0220c7b6a829037dab43c8766139cc9b225083..d64b207c609943febf6f123707a174570f7440ab 100644 (file)
@@ -373,7 +373,21 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
     combo->setMinimumWidth( MINWIDTH_BOX );
     combo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
 
-    module_config_t *p_module_config = config_FindConfig( p_this, getName() );
+    module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
+    if(p_module_config && p_module_config->pf_update_list) 
+    {
+       vlc_value_t val;
+       val.psz_string = strdup(p_module_config->value.psz);
+       
+       p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
+
+       // assume in a×y case that dirty was set to VLC_TRUE
+       // because lazy programmes will use the same callback for
+       // this, like the one behind the refresh push button?
+       p_module_config->b_dirty = VLC_FALSE;
+
+       if(val.psz_string) free(val.psz_string);
+    }
 
     finish( p_module_config, bycat );
     if( !l )
@@ -473,6 +487,17 @@ void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf,
                       config_FindConfig( VLC_OBJECT(p_intf), configname );
     if( p_config )
     {
+       if(p_config->pf_update_list) 
+        {
+            vlc_value_t val;
+            val.i_int = p_config->value.i;
+            p_config->pf_update_list(VLC_OBJECT(p_intf), configname, val, val, NULL);
+            // assume in any case that dirty was set to VLC_TRUE
+            // because lazy programmes will use the same callback for
+            // this, like the one behind the refresh push button?
+            p_config->b_dirty = VLC_FALSE;
+        }
+
         for ( int i_index = 0; i_index < p_config->i_list; i_index++ )
         {
             combo->addItem( qfu( p_config->ppsz_list_text[i_index] ),
@@ -837,7 +862,20 @@ IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
     combo = new QComboBox();
     combo->setMinimumWidth( MINWIDTH_BOX );
 
-    module_config_t *p_module_config = config_FindConfig( p_this, getName() );
+    module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
+    if(p_module_config && p_module_config->pf_update_list) 
+    {
+       vlc_value_t val;
+       val.i_int = p_module_config->value.i;
+       
+       p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
+
+       // assume in any case that dirty was set to VLC_TRUE
+       // because lazy programmes will use the same callback for
+       // this, like the one behind the refresh push button?
+       p_module_config->b_dirty = VLC_FALSE;
+    }
+
 
     finish( p_module_config, bycat );
     if( !l )
index 1d3974195c66f5763cd2b1d4e9ced6089a6cf372..692c5896f6feae8fb2e3132def17134ef741781d 100644 (file)
@@ -563,7 +563,26 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *p_this,
     combo = new wxComboBox( this, -1, wxT(""),
                             wxDefaultPosition, wxDefaultSize,
                             0, NULL, wxCB_READONLY );
-    UpdateCombo( p_item );
+
+    // was required to do so - because local p_item is a memcpy of
+    // this one, so it won't see the change done by pf_updat_list
+    module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
+    if(p_module_config && p_module_config->pf_update_list)
+    {
+       vlc_value_t val;
+       val.psz_string = strdup(p_module_config->value.psz);
+
+       p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
+
+       // assume in a×y case that dirty was set to VLC_TRUE
+       // because lazy programmes will use the same callback for
+       // this, like the one behind the refresh push button?
+       p_module_config->b_dirty = VLC_FALSE;
+
+       if(val.psz_string) free(val.psz_string);
+    }
+
+    UpdateCombo( p_module_config );
 
     combo->SetToolTip( wxU(p_item->psz_longtext) );
     sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
@@ -793,7 +812,21 @@ IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *p_this,
                             wxDefaultPosition, wxDefaultSize,
                             0, NULL, wxCB_READONLY );
 
-    UpdateCombo( p_item );
+    module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
+    if(p_module_config && p_module_config->pf_update_list)
+    {
+       vlc_value_t val;
+       val.i_int = p_module_config->value.i;
+
+       p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
+
+       // assume in any case that dirty was set to VLC_TRUE
+       // because lazy programmes will use the same callback for
+       // this, like the one behind the refresh push button?
+       p_module_config->b_dirty = VLC_FALSE;
+    }
+
+    UpdateCombo( p_module_config );
 
     combo->SetToolTip( wxU(p_item->psz_longtext) );
     sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
index 52ca2e6f7863ac43838dfe493f535f12026c8b0c..8a87a1a057010ac6863f10600d4f11cfb5083090 100644 (file)
@@ -368,6 +368,7 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
             }
 
             item->i_list = len;
+            item->pf_update_list = va_arg (ap, vlc_callback_t);
             ret = 0;
             break;
         }