summaryrefslogtreecommitdiff
path: root/src/option.cpp
diff options
context:
space:
mode:
authorJoel Bosveld <Joel.Bosveld@gmail.com>2009-02-27 23:37:34 +0900
committerDennis Kasprzyk <onestone@compiz-fusion.org>2009-02-27 16:17:27 +0100
commit608fef0c2be48ef1c25beb3875819db1ad1a4e70 (patch)
tree38cdcb55f97cf548b725f01e9c1c4fe1b5c37b58 /src/option.cpp
parent573db36d5fddafbaab1940ed5c7b92a1890c6f47 (diff)
downloadunity-window-decorator-608fef0c2be48ef1c25beb3875819db1ad1a4e70.tar.gz
unity-window-decorator-608fef0c2be48ef1c25beb3875819db1ad1a4e70.tar.bz2
Move CompOption::isAction to a static function and use in Value::action
Diffstat (limited to 'src/option.cpp')
-rw-r--r--src/option.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/option.cpp b/src/option.cpp
index 8779244..c41f6a1 100644
--- a/src/option.cpp
+++ b/src/option.cpp
@@ -186,6 +186,24 @@ CompOption::Value::set (CompOption::Type type, const Vector& l)
}
+static bool
+checkIsAction (CompOption::Type type)
+{
+ switch (type) {
+ case CompOption::TypeAction:
+ case CompOption::TypeKey:
+ case CompOption::TypeButton:
+ case CompOption::TypeEdge:
+ case CompOption::TypeBell:
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+
bool
CompOption::Value::b ()
{
@@ -251,11 +269,7 @@ CompOption::Value::match ()
CompAction &
CompOption::Value::action ()
{
- if (priv->type != CompOption::TypeAction &&
- priv->type != CompOption::TypeKey &&
- priv->type != CompOption::TypeButton &&
- priv->type != CompOption::TypeEdge &&
- priv->type != CompOption::TypeBell)
+ if (!checkIsAction(priv->type))
compLogMessage("core", CompLogLevelWarn, "CompOption::Value not an action");
return priv->action;
}
@@ -724,18 +738,7 @@ CompOption::set (CompOption::Value &val)
bool
CompOption::isAction ()
{
- switch (priv->type) {
- case CompOption::TypeAction:
- case CompOption::TypeKey:
- case CompOption::TypeButton:
- case CompOption::TypeEdge:
- case CompOption::TypeBell:
- return true;
- default:
- break;
- }
-
- return false;
+ return checkIsAction (priv->type);
}
CompOption &