<action rule="test.player" after="BMJ">beatles-yesterday.mp3</action>
<action ID="1" rule="test.printInt" priority="-100"
>PRINT_TWO</action>
+ <undo ID="undo1" rule="test.printBool">true</undo>
</mode>
</tizenModes>
%{modes_data_dir}/schema/*
%dir %{modes_data_dir}/mode
%dir %{modes_data_dir}/rule
-%dir %{modes_info_dir}/undo-info
-%attr(0755,system_fw,system_fw) %{modes_info_dir}/undo-info
-%dir %{modes_data_dir}/custom-mode
-%attr(0755,system_fw,system_fw) %{modes_data_dir}/custom-mode
+%dir %attr(0755,system_fw,system_fw) %{modes_info_dir}/undo-info
+%dir %attr(0755,system_fw,system_fw) %{modes_data_dir}/custom-mode
%license LICENSE.APLv2
%files lib
void Action::valueChangedCallback(const std::string &key, void *userData)
{
Action *action = (Action*)userData;
- if (action->getRuleName() == key) {
- action->setIsChanged();
- DBG("Action(%s) Changed", key.c_str());
- }
+ RET_IF(NULL == action);
+
+ action->setIsChanged();
+ DBG("Action(%s) Changed", key.c_str());
}
Action::Action()
gboolean RequestHandler::getModesHandler(mdsDbus *object, GDBusMethodInvocation *invocation, gpointer userData)
{
+ int ret = MODES_ERROR_NONE;
+
RETV_IF(NULL == modeMgr, FALSE);
std::list<std::tuple<std::string, int>> modeList = modeMgr->getModes();
if (modeList.empty()) {
ERR("getModes() : No Data");
- mds_dbus_complete_get_modes(object, invocation, NULL, MODES_ERROR_NO_DATA);
- return TRUE;
+ ret = MODES_ERROR_NO_DATA;
}
GVariantBuilder *modeListBuilder = g_variant_builder_new(G_VARIANT_TYPE(MODES_DBUS_GET_MODES_SIG));
GVariant *outList = g_variant_new(MODES_DBUS_GET_MODES_SIG, modeListBuilder);
g_variant_builder_unref(modeListBuilder);
- mds_dbus_complete_get_modes(object, invocation, outList, MODES_ERROR_NONE);
+ mds_dbus_complete_get_modes(object, invocation, outList, ret);
return TRUE;
}
ruleXsd = actionRuleXsd;
}
-string RuleManager::getProp(xmlNodePtr node, int att)
-{
- char *tmp;
- string returnStr;
-
- tmp = (char*)xmlGetProp(node, RULE_TAGS[att]);
- if (tmp) {
- returnStr = tmp;
- xmlFree(tmp);
- } else {
- ERR("Rule : No %s", RULE_TAGS[att]);
- throw ModesEx(ModesEx::NO_DATA);
- }
-
- return returnStr;
-}
-
void RuleManager::addBoolAlias(ActionRule *actionRule)
{
actionRule->addAlias("true", "1");
ActionRule *actionRule = NULL;
try {
- name = getProp(node, TagAttName);
- type = getProp(node, TagAttType);
- plugin = getProp(node, TagAttPlugin);
+ name = XMLParser::extractValueOfTag(node, RULE_TAGS[TagAttName]);
+ type = XMLParser::extractValueOfTag(node, RULE_TAGS[TagAttType]);
+ plugin = XMLParser::extractValueOfTag(node, RULE_TAGS[TagAttPlugin]);
} catch (ModesEx &e) {
- ERR("getProp() Fail(%s)", e.what());
+ ERR("extractValueOfTag() Fail(%s)", e.what());
throw;
}
ActionRule* makeRule(xmlNodePtr node);
void parseRule(xmlNodePtr node);
- std::string getProp(xmlNodePtr node, int att);
void addBoolAlias(ActionRule * actionRule);
void parseActionRule(const std::string &xmlFile);
void parseElement(xmlNodePtr node, ActionRule *actionRule);
XMLParser(const std::string &xmlFile);
~XMLParser();
- void validate(const std::string &xsd);
- std::string extractValueOfTag(xmlNodePtr node, const xmlChar * tag);
xmlNodePtr getRoot();
-
+ void validate(const std::string &xsd);
+ static std::string extractValueOfTag(xmlNodePtr node, const xmlChar *tag);
private:
xmlDocPtr doc;
xmlNodePtr root;