X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fentry.c;h=88ddce3461a6b26fed4503295ba265e5013cc054;hb=3c31b6cdbfec4c228f8e566a944447f7e5b80a36;hp=70816df31b19aaf8abb327f1d603c525523958c5;hpb=d2a0694d908f98db8b8dadbaaa2db07253344f16;p=vlc diff --git a/src/modules/entry.c b/src/modules/entry.c index 70816df31b..88ddce3461 100644 --- a/src/modules/entry.c +++ b/src/modules/entry.c @@ -23,13 +23,17 @@ # include "config.h" #endif -#include +#include +#include #include #include #include "modules/modules.h" #include "config/configuration.h" #include "libvlc.h" +#ifndef ENABLE_NLS +# define dgettext(d, m) ((char *)(m)) +#endif static const char default_name[] = "unnamed"; @@ -43,7 +47,7 @@ module_t *vlc_module_create (vlc_object_t *obj) module->b_reentrant = module->b_unloadable = true; module->psz_object_name = strdup( default_name ); - module->psz_longname = default_name; + module->psz_longname = (char*)default_name; module->psz_capability = (char*)""; module->i_score = 1; module->i_config_items = module->i_bool_items = 0; @@ -107,17 +111,26 @@ int vlc_module_set (module_t *module, int propid, ...) break; } - case VLC_MODULE_SHORTNAME: - module->psz_shortname = va_arg (ap, char *); + case VLC_MODULE_SHORTNAME_NODOMAIN: + { + const char *name = va_arg (ap, char *); + ret = vlc_module_set (module, VLC_MODULE_SHORTNAME, NULL, name); break; + } - case VLC_MODULE_DESCRIPTION: - module->psz_longname = va_arg (ap, char *); + case VLC_MODULE_DESCRIPTION_NODOMAIN: + { + const char *desc = va_arg (ap, char *); + ret = vlc_module_set (module, VLC_MODULE_DESCRIPTION, NULL, desc); break; + } - case VLC_MODULE_HELP: - module->psz_help = va_arg (ap, char *); + case VLC_MODULE_HELP_NODOMAIN: + { + const char *help = va_arg (ap, char *); + ret = vlc_module_set (module, VLC_MODULE_HELP, NULL, help); break; + } case VLC_MODULE_CAPABILITY: module->psz_capability = va_arg (ap, char *); @@ -127,6 +140,10 @@ int vlc_module_set (module_t *module, int propid, ...) module->i_score = va_arg (ap, int); break; + case VLC_MODULE_PROGRAM: + msg_Warn (module, "deprecated module property %d", propid); + break; + case VLC_MODULE_CB_OPEN: module->pf_activate = va_arg (ap, int (*) (vlc_object_t *)); break; @@ -144,15 +161,38 @@ int vlc_module_set (module_t *module, int propid, ...) const char *value = va_arg (ap, const char *); free( module->psz_object_name ); module->psz_object_name = strdup( value ); - module->pp_shortcuts[0] = value; + module->pp_shortcuts[0] = (char*)value; /* dooh! */ if (module->psz_longname == default_name) - module->psz_longname = value; + module->psz_longname = (char*)value; /* dooh! */ break; } - case VLC_MODULE_PROGRAM: - msg_Warn (module, "deprecated module property %d", propid); + case VLC_MODULE_SHORTNAME: + { + const char *domain = va_arg (ap, const char *); + if (domain == NULL) + domain = PACKAGE; + module->psz_shortname = dgettext (domain, va_arg (ap, char *)); + break; + } + + case VLC_MODULE_DESCRIPTION: + { + const char *domain = va_arg (ap, const char *); + if (domain == NULL) + domain = PACKAGE; + module->psz_longname = dgettext (domain, va_arg (ap, char *)); break; + } + + case VLC_MODULE_HELP: + { + const char *domain = va_arg (ap, const char *); + if (domain == NULL) + domain = PACKAGE; + module->psz_help = dgettext (domain, va_arg (ap, char *)); + break; + } default: msg_Err (module, "unknown module property %d", propid); @@ -180,7 +220,7 @@ module_config_t *vlc_config_create (module_t *module, int type) memset (tab + confsize, 0, sizeof (tab[confsize])); tab[confsize].i_type = type; - tab[confsize].p_lock = &module->object_lock; + tab[confsize].p_lock = &(vlc_internals(module)->lock); if (type & CONFIG_ITEM) { @@ -215,14 +255,11 @@ int vlc_config_set (module_config_t *restrict item, int id, ...) break; } - case VLC_CONFIG_DESC: + case VLC_CONFIG_DESC_NODOMAIN: { const char *text = va_arg (ap, const char *); const char *longtext = va_arg (ap, const char *); - - item->psz_text = text ? strdup ( _(text)) : NULL; - item->psz_longtext = longtext ? strdup ( _(longtext)) : NULL; - ret = 0; + ret = vlc_config_set (item, VLC_CONFIG_DESC, NULL, text, longtext); break; } @@ -314,8 +351,66 @@ int vlc_config_set (module_config_t *restrict item, int id, ...) ret = 0; break; + case VLC_CONFIG_LIST_NODOMAIN: + { + size_t len = va_arg (ap, size_t); + if (IsConfigIntegerType (item->i_type)) + { + const int *src = va_arg (ap, const int *); + const char *const *text = va_arg (ap, const char *const *); + ret = vlc_config_set (item, VLC_CONFIG_LIST, NULL, len, src, + text); + } + else + if (IsConfigStringType (item->i_type)) + { + const char *const *src = va_arg (ap, const char *const *); + const char *const *text = va_arg (ap, const char *const *); + ret = vlc_config_set (item, VLC_CONFIG_LIST, NULL, len, src, + text); + } + break; + } + + case VLC_CONFIG_ADD_ACTION_NODOMAIN: + { + vlc_callback_t cb = va_arg (ap, vlc_callback_t); + const char *name = va_arg (ap, const char *); + ret = vlc_config_set (item, VLC_CONFIG_ADD_ACTION, NULL, cb, name); + 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 = true; + ret = 0; + break; + + case VLC_CONFIG_DESC: + { + const char *domain = va_arg (ap, const char *); + const char *text = va_arg (ap, const char *); + const char *longtext = va_arg (ap, const char *); + + if (domain == NULL) + domain = PACKAGE; + item->psz_text = text ? strdup (dgettext (domain, text)) : NULL; + item->psz_longtext = + longtext ? strdup (dgettext (domain, longtext)) : NULL; + ret = 0; + break; + } + case VLC_CONFIG_LIST: { + const char *domain = va_arg (ap, const char *); size_t len = va_arg (ap, size_t); char **dtext = malloc (sizeof (char *) * (len + 1)); @@ -368,11 +463,15 @@ int vlc_config_set (module_config_t *restrict item, int id, ...) break; /* Copy textual descriptions */ + if (domain == NULL) + domain = PACKAGE; + const char *const *text = va_arg (ap, const char *const *); if (text != NULL) { for (size_t i = 0; i < len; i++) - dtext[i] = text[i] ? strdup ( _(text[i])) : NULL; + dtext[i] = + text[i] ? strdup (dgettext (domain, text[i])) : NULL; dtext[len] = NULL; item->ppsz_list_text = dtext; @@ -391,6 +490,7 @@ int vlc_config_set (module_config_t *restrict item, int id, ...) case VLC_CONFIG_ADD_ACTION: { + const char *domain = va_arg (ap, const char *); vlc_callback_t cb = va_arg (ap, vlc_callback_t), *tabcb; const char *name = va_arg (ap, const char *); char **tabtext; @@ -409,8 +509,10 @@ int vlc_config_set (module_config_t *restrict item, int id, ...) break; item->ppsz_action_text = tabtext; + if (domain == NULL) + domain = PACKAGE; if (name) - tabtext[item->i_action] = strdup ( _(name)); + tabtext[item->i_action] = strdup (dgettext (domain, name)); else tabtext[item->i_action] = NULL; tabtext[item->i_action + 1] = NULL; @@ -419,19 +521,6 @@ int vlc_config_set (module_config_t *restrict item, int id, ...) 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 = true; - ret = 0; - break; } va_end (ap);