Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
+Robert Erickson <rerickso@jaguarlandrover.com>
wkb-ibus-defs.h \
wkb-ibus-panel.c \
wkb-ibus-config.c \
+ wkb-ibus-config.h \
wkb-ibus-config-key.c \
wkb-ibus-config-key.h \
wkb-ibus-config-eet.c \
text-protocol.c \
text-client-protocol.h
-
noinst_PROGRAMS = \
weekeyboard-config-eet-test \
weekeyboard-ibus-test
wkb-ibus-config-eet.h \
wkb-ibus-config-eet-test.c
-
weekeyboard_ibus_test_SOURCES = \
wkb-ibus.h \
wkb-ibus.c \
wkb-ibus-defs.h \
wkb-ibus-panel.c \
wkb-ibus-config.c \
+ wkb-ibus-config.h \
wkb-ibus-config-key.c \
wkb-ibus-config-key.h \
wkb-ibus-config-eet.c \
/*
* Copyright © 2013 Intel Corporation
+ * Copyright © 2014 Jaguar Landrover
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Eina_Bool
wkb_ibus_config_eet_get_value(struct wkb_ibus_config_eet *config_eet, const char *section, const char *name, Eldbus_Message_Iter *reply)
{
- Eina_Bool ret = EINA_FALSE;
struct wkb_config_key *key;
if (!(key = _config_section_find_key(config_eet->ibus_config, section, name)))
{
ERR("Config key with id '%s' not found", name);
- goto end;
+ return EINA_FALSE;
}
- ret = wkb_config_key_get(key, reply);
+ return wkb_config_key_get(key, reply);
+}
-end:
- return ret;
+int
+wkb_ibus_config_eet_get_value_int(struct wkb_ibus_config_eet *config_eet, const char *section, const char *name)
+{
+ struct wkb_config_key *key;
+
+ if (!(key = _config_section_find_key(config_eet->ibus_config, section, name)))
+ {
+ ERR("Config key with id '%s' not found", name);
+ return -1;
+ }
+
+ DBG("Found key: section = <%s> name = <%s>", section, name);
+
+ return wkb_config_key_get_int(key);
+}
+
+Eina_Bool
+wkb_ibus_config_eet_get_value_bool(struct wkb_ibus_config_eet *config_eet, const char *section, const char *name)
+{
+ struct wkb_config_key *key;
+
+ if (!(key = _config_section_find_key(config_eet->ibus_config, section, name)))
+ {
+ ERR("Config key with id '%s' not found", name);
+ return EINA_FALSE;
+ }
+
+ DBG("Found key: section = <%s> name = <%s>", section, name);
+
+ return wkb_config_key_get_bool(key);
+}
+
+const char *
+wkb_ibus_config_eet_get_value_string(struct wkb_ibus_config_eet *config_eet, const char *section, const char *name)
+{
+ struct wkb_config_key *key;
+
+ if (!(key = _config_section_find_key(config_eet->ibus_config, section, name)))
+ {
+ ERR("Config key with id '%s' not found", name);
+ return NULL;
+ }
+
+ DBG("Found key: section = <%s> name = <%s>", section, name);
+
+ return wkb_config_key_get_string(key);
}
Eina_Bool
/*
* Copyright © 2013 Intel Corporation
+ * Copyright © 2014 Jaguar Landrover
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
int wkb_ibus_config_eet_init(void);
void wkb_ibus_config_eet_shutdown(void);
+int wkb_ibus_config_eet_get_value_int(struct wkb_ibus_config_eet *config_eet, const char *section, const char *name);
+Eina_Bool wkb_ibus_config_eet_get_value_bool(struct wkb_ibus_config_eet *config_eet, const char *section, const char *name);
+const char *wkb_ibus_config_eet_get_value_string(struct wkb_ibus_config_eet *config_eet, const char *section, const char *name);
#ifdef __cplusplus
}
#endif
/*
* Copyright © 2013 Intel Corporation
+ * Copyright © 2014 Jaguar Landrover
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
+#include <assert.h>
#include "wkb-ibus-config-key.h"
#include "wkb-log.h"
ERR("Error decoding string value using 's'");
return EINA_FALSE;
}
+ DBG("Setting key <%s> to <%s>", key->id, str);
if ((field = (const char **) key->field))
_key_string_free(field);
return ret;
}
+int
+wkb_config_key_get_int(struct wkb_config_key* key)
+{
+ assert(!strcmp(key->signature, "i"));
+
+ return *((int *) key->field);
+}
+
+Eina_Bool
+wkb_config_key_get_bool(struct wkb_config_key* key)
+{
+ assert(!strcmp(key->signature, "b"));
+
+ return *((Eina_Bool *) key->field);
+}
+
+const char *
+wkb_config_key_get_string(struct wkb_config_key* key)
+{
+ DBG("Found key: id = <%s> signature = <%s> field = 0x%p", key->id, key->signature, key->field);
+ DBG("Found key: id = <%s> signature = <%s> field as string = <%s>", key->id, key->signature, *(const char **)key->field);
+
+ assert(!strcmp(key->signature, "s"));
+
+ return *((const char **) key->field);
+}
+
/*
* Copyright © 2013 Intel Corporation
+ * Copyright © 2014 Jaguar Landrover
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Eina_Bool wkb_config_key_set(struct wkb_config_key * key, Eldbus_Message_Iter *iter);
Eina_Bool wkb_config_key_get(struct wkb_config_key *key, Eldbus_Message_Iter *reply);
+int wkb_config_key_get_int(struct wkb_config_key* key);
+Eina_Bool wkb_config_key_get_bool(struct wkb_config_key* key);
+const char *wkb_config_key_get_string(struct wkb_config_key* key);
+
#ifdef __cplusplus
}
#endif
/*
* Copyright © 2013 Intel Corporation
+ * Copyright © 2014 Jaguar Landrover
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <Eina.h>
#include <Eldbus.h>
+#include "wkb-ibus-config.h"
+
#include "wkb-ibus.h"
#include "wkb-ibus-defs.h"
#include "wkb-ibus-config-eet.h"
DBG("Message '%s' with signature '%s'", eldbus_message_member_get(_msg), eldbus_message_signature_get(_msg)); \
} while (0)
+int
+wkb_ibus_config_get_value_int(const char *section, const char *name)
+{
+ if (!_conf_eet)
+ return -1;
+
+ return wkb_ibus_config_eet_get_value_int(_conf_eet, section, name);
+}
+
+Eina_Bool
+wkb_ibus_config_get_value_bool(const char *section, const char *name)
+{
+ if (!_conf_eet)
+ return EINA_FALSE;
+
+ return wkb_ibus_config_eet_get_value_bool(_conf_eet, section, name);
+}
+
+const char *
+wkb_ibus_config_get_value_string(const char *section, const char *name)
+{
+ if (!_conf_eet)
+ return NULL;
+
+ return wkb_ibus_config_eet_get_value_string(_conf_eet, section, name);
+}
+
static Eldbus_Message *
_config_set_value(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
{
const char *section, *name;
Eldbus_Message_Iter *value;
+ DBG("in _config_set_value");
+
_config_check_message_errors(msg);
if (!eldbus_message_arguments_get(msg, "ssv", §ion, &name, &value))
--- /dev/null
+/*
+ * Copyright © 2014 Jaguar Landrover
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _WKB_IBUS_CONFIG_H_
+#define _WKB_IBUS_CONFIG_H_
+
+#include <Eina.h>
+#include <Eldbus.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int wkb_ibus_config_get_value_int(const char *section, const char *name);
+Eina_Bool wkb_ibus_config_get_value_bool(const char *section, const char *name);
+const char *wkb_ibus_config_get_value_string(const char *section, const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WKB_IBUS_CONFIG_H_ */