diff options
Diffstat (limited to 'm_property.c')
-rw-r--r-- | m_property.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/m_property.c b/m_property.c index 275525851c..d786d26bda 100644 --- a/m_property.c +++ b/m_property.c @@ -245,6 +245,17 @@ int m_property_choice(const m_option_t* prop,int action, return m_property_int_range(prop,action,arg,var); } +int m_property_flag_ro(const m_option_t* prop,int action, + void* arg,int var) { + switch(action) { + case M_PROPERTY_PRINT: + if(!arg) return 0; + *(char**)arg = strdup((var > prop->min) ? MSGTR_Enabled : MSGTR_Disabled); + return 1; + } + return m_property_int_ro(prop,action,arg,var); +} + int m_property_flag(const m_option_t* prop,int action, void* arg,int* var) { switch(action) { @@ -253,9 +264,7 @@ int m_property_flag(const m_option_t* prop,int action, *var = *var == prop->min ? prop->max : prop->min; return 1; case M_PROPERTY_PRINT: - if(!arg) return 0; - *(char**)arg = strdup((*var > prop->min) ? MSGTR_Enabled : MSGTR_Disabled); - return 1; + return m_property_flag_ro(prop, action, arg, *var); } return m_property_int_range(prop,action,arg,var); } |