summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Lima (Etrunko) <eduardo.lima@intel.com>2013-09-26 12:37:57 -0300
committerEduardo Lima (Etrunko) <eduardo.lima@intel.com>2013-09-26 17:33:24 -0300
commitc115bd2177e186e7b3c4fa81e84d86f1fb5c5aef (patch)
tree6d7fbd94385c77895babbd539c4f6158fab283fa
parent8cace5af04363d1b51d89f3c92f723b9a941a31b (diff)
downloadweekeyboard-c115bd2177e186e7b3c4fa81e84d86f1fb5c5aef.tar.gz
weekeyboard-c115bd2177e186e7b3c4fa81e84d86f1fb5c5aef.tar.bz2
weekeyboard-c115bd2177e186e7b3c4fa81e84d86f1fb5c5aef.zip
Fix section/key search
We only need to set the id of a section if it is not the toplevel Change-Id: If1bfcc07ca657e859493b1cf98c9e68d11016d13 Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
-rw-r--r--src/wkb-ibus-config-eet.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/wkb-ibus-config-eet.c b/src/wkb-ibus-config-eet.c
index 55f0f25..780b9ac 100644
--- a/src/wkb-ibus-config-eet.c
+++ b/src/wkb-ibus-config-eet.c
@@ -85,9 +85,11 @@ _config_section_find(struct _config_section *base, const char *section)
if (!section)
return NULL;
- printf("Requested section '%s'\n", section);
- if (!strncasecmp(section, base->id, strlen(base->id)))
- return base;
+ if (base->id && !strncasecmp(section, base->id, strlen(section)))
+ {
+ printf("Requested section: '%s' match: '%s' \n", section, base->id);
+ return base;
+ }
EINA_LIST_FOREACH(base->subsections, node, sub)
if ((ret = _config_section_find(sub, section)))
@@ -110,12 +112,12 @@ _config_section_find_key(struct _config_section *base, const char *section, cons
goto end;
}
- printf("Requested key '%s'\n", name);
- EINA_LIST_FOREACH(base->keys, node, key)
+ EINA_LIST_FOREACH(sec->keys, node, key)
{
key_id = wkb_config_key_id(key);
- if (!strncasecmp(name, key_id, strlen(key_id)))
+ if (!strcasecmp(name, key_id))
{
+ printf("Requested key: '%s' match: '%s'\n", name, key_id);
ret = key;
break;
}
@@ -130,13 +132,12 @@ end:
_section->set_defaults = _config_ ## _id ## _set_defaults; \
if (parent) \
{ \
- _section->id = eina_stringshare_printf("%s/" #_id, parent->id); \
+ if (parent->id) \
+ _section->id = eina_stringshare_printf("%s/" #_id, parent->id); \
+ else \
+ _section->id = eina_stringshare_add(#_id); \
parent->subsections = eina_list_append(parent->subsections, _section); \
} \
- else \
- { \
- _section->id = eina_stringshare_add("/" #_id); \
- } \
} while (0)
#define _config_section_add_key(_section, _section_id, _key_type, _field) \