summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--m_property.c15
-rw-r--r--m_property.h3
2 files changed, 15 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);
}
diff --git a/m_property.h b/m_property.h
index 7bf43289e9..375aea6cfa 100644
--- a/m_property.h
+++ b/m_property.h
@@ -169,6 +169,9 @@ int m_property_int_range(const m_option_t* prop,int action,
int m_property_choice(const m_option_t* prop,int action,
void* arg,int* var);
+int m_property_flag_ro(const m_option_t* prop,int action,
+ void* arg,int var);
+
/// Switch betwen min and max.
int m_property_flag(const m_option_t* prop,int action,
void* arg,int* var);