diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-10-01 17:05:18 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-10-01 17:05:18 +0000 |
commit | 70901aa00603d6e05e9e26369bc6d26e526c5228 (patch) | |
tree | 0847d0e604319f74b2d0d27c365f8294ce415144 /m_property.c | |
parent | 0189fa7cacc8c61b151f71f21e547265f6993b56 (diff) | |
download | mpv-70901aa00603d6e05e9e26369bc6d26e526c5228.tar.bz2 mpv-70901aa00603d6e05e9e26369bc6d26e526c5228.tar.xz |
Add a m_property_flag_ro function for the default behaviour of a
read-only flag.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27679 b3059339-0415-0410-9bf9-f77b7e298cf2
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); } |