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.]] [[A generic configuration interface, that holds key-value pairs.]]
methods { methods {
/* FIXME: make this a property -- @own is a problem */ @property config {
config_set { [[A generic configuration value, refered to by name.]]
[[Set configuration]] get {
params { keys {
name: string; [[Configuration option name]] name: string; [[Configuration option name.]]
val: const(any_value_ptr); [[Configuration option value]] }
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 set {
config can't be changed, config does not exist...]] keys {
} name: string; [[Configuration option name.]]
config_get @const { }
[[Get configuration]] values {
params { value: const(any_value_ptr);
name: string; [[Configuration option name]] [[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 { implements {
Efl.Config.config_set; Efl.Config.config { get; set; }
Efl.Config.config_get;
Efl.Config.config_list_get;
} }
} }

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 * EOLIAN static Eina_Value *
_efl_config_global_efl_config_config_get(const Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, _efl_config_global_efl_config_config_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED,
const char *name) const char *name)
{ {
Eina_Value *val = NULL; 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; 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 EOLIAN static void
_efl_config_global_profile_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, const char *profile) _efl_config_global_profile_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, const char *profile)
{ {