]> git.sesse.net Git - vlc/blobdiff - src/modules/entry.c
simplify *install_input_item_observer()
[vlc] / src / modules / entry.c
index bb0da23f90d3fee543cfc762230718d88e50d89e..ded237248d3f32a4cda637eaa655c67cb47f3af1 100644 (file)
@@ -40,6 +40,8 @@ module_t *vlc_module_create (vlc_object_t *obj)
     module->psz_object_name = module->psz_longname = default_name;
     module->psz_capability = "";
     module->i_score = 1;
+    module->i_config_items = module->i_bool_items = 0;
+
     return module;
 }
 
@@ -155,12 +157,19 @@ module_config_t *vlc_config_create (module_t *module, int type)
 
         module->p_config = tab;
     }
-    module->confsize++;
 
     memset (tab + confsize, 0, sizeof (tab[confsize]));
     tab[confsize].i_type = type;
     tab[confsize].p_lock = &module->object_lock;
 
+    if (type & CONFIG_ITEM)
+    {
+        module->i_config_items++;
+        if (type == CONFIG_ITEM_BOOL)
+            module->i_bool_items++;
+    }
+
+    module->confsize++;
     return tab + confsize;
 }
 
@@ -191,8 +200,8 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
             const char *text = va_arg (ap, const char *);
             const char *longtext = va_arg (ap, const char *);
 
-            item->psz_text = text ? strdup (gettext (text)) : NULL;
-            item->psz_longtext = longtext ? strdup (gettext (text)) : NULL;
+            item->psz_text = text ? strdup ( _(text)) : NULL;
+            item->psz_longtext = longtext ? strdup ( _(longtext)) : NULL;
             ret = 0;
             break;
         }
@@ -268,7 +277,7 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
             break;
 
         case VLC_CONFIG_REMOVED:
-            item->psz_current = "SUPPRESSED";
+            item->b_removed = VLC_TRUE;
             ret = 0;
             break;
 
@@ -343,13 +352,16 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
             if (text != NULL)
             {
                 for (size_t i = 0; i < len; i++)
-                    dtext[i] = text[i] ? strdup (gettext (text[i])) : NULL;
+                    dtext[i] = text[i] ? strdup ( _(text[i])) : NULL;
 
                 dtext[len] = NULL;
                 item->ppsz_list_text = dtext;
             }
             else
+            {
+                free (dtext);
                 item->ppsz_list_text = NULL;
+            }
 
             item->i_list = len;
             ret = 0;
@@ -377,14 +389,28 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
             item->ppsz_action_text = tabtext;
 
             if (name)
-                tabtext[item->i_action] = strdup (gettext (name));
+                tabtext[item->i_action] = strdup ( _(name));
             else
                 tabtext[item->i_action] = NULL;
             tabtext[item->i_action + 1] = NULL;
 
             item->i_action++;
             ret = 0;
+            break;
         }
+
+        case VLC_CONFIG_OLDNAME:
+        {
+            const char *oldname = va_arg (ap, const char *);
+            item->psz_oldname = oldname ? strdup (oldname) : NULL;
+            ret = 0;
+            break;
+        }
+
+        case VLC_CONFIG_SAFE:
+            item->b_safe = VLC_TRUE;
+            ret = 0;
+            break;
     }
 
     va_end (ap);