config: Simplify EO API

This is:
 - using a property (but terribly ugly due to the ownership on the
   returned value)
 - removing an unused function

Note: This interface Efl.Config covers only elm_config for now. But it's
very generic and could be used in the future for application specific
configuration.
This commit is contained in:
Jean-Philippe Andre 2017-10-18 18:12:13 +09:00
parent 315e865f18
commit 24c0eced77
3 changed files with 24 additions and 36 deletions

View File

@ -2,30 +2,29 @@ interface Efl.Config ()
{
[[A generic configuration interface, that holds key-value pairs.]]
methods {
/* FIXME: make this a property -- @own is a problem */
config_set {
[[Set configuration]]
params {
name: string; [[Configuration option name]]
val: const(any_value_ptr); [[Configuration option value]]
@property config {
[[A generic configuration value, refered to by name.]]
get {
keys {
name: string; [[Configuration option name.]]
}
values {
value: any_value_ptr @owned;
[[The value. It will be empty if it doesn't exist. The caller
must free it after use (using $eina_value_free() in C).]]
}
}
return: bool; [[$false in case of error: value type was invalid, the
config can't be changed, config does not exist...]]
}
config_get @const {
[[Get configuration]]
params {
name: string; [[Configuration option name]]
set {
keys {
name: string; [[Configuration option name.]]
}
values {
value: const(any_value_ptr);
[[Configuration option value. May be $null if not found.]]
}
return: bool; [[$false in case of error: value type was invalid, the
config can't be changed, config does not exist...]]
}
return: any_value_ptr @owned; [[Configuration option value]]
}
config_list_get @const {
[[Returns a list of generic values under a given key.]]
params {
@in name: string; [[Configuration option name]]
}
return: iterator<any_value_ptr> @owned; [[
List of configuration option values]]
}
}
}

View File

@ -106,8 +106,6 @@ class Efl.Config.Global (Efl.Object, Efl.Config)
}
}
implements {
Efl.Config.config_set;
Efl.Config.config_get;
Efl.Config.config_list_get;
Efl.Config.config { get; set; }
}
}

View File

@ -4639,8 +4639,8 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU
}
EOLIAN static Eina_Value *
_efl_config_global_efl_config_config_get(const Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED,
const char *name)
_efl_config_global_efl_config_config_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED,
const char *name)
{
Eina_Value *val = NULL;
@ -4766,15 +4766,6 @@ _efl_config_global_efl_config_config_get(const Eo *obj EINA_UNUSED, void *_pd EI
return NULL;
}
EOLIAN static Eina_Iterator *
_efl_config_global_efl_config_config_list_get(const Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED,
const char *name)
{
// Not implemented: none of the elm_config functions returns a list of primitive types
(void) name;
return NULL;
}
EOLIAN static void
_efl_config_global_profile_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, const char *profile)
{