summaryrefslogtreecommitdiff
path: root/src/lib/efl/interfaces/efl_config.c
blob: 75d8388d44f376268b661a6971b8ad17b83eae36 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <Efl.h>

static Efl_Config *_main_config = NULL;

EAPI void
__efl_internal_elm_config_set(Efl_Config *cfg)
{
   _main_config = cfg;
}

EOLIAN static Eina_Bool
_efl_config_config_bool_set(Eo *obj, void *_pd EINA_UNUSED, const char * name, Eina_Bool val)
{
   Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_UCHAR);
   Eina_Bool b;
   eina_value_set(v, val);
   b = efl_config_set(obj, name, v);
   eina_value_free(v);
   return b;
}

EOLIAN static Eina_Bool
_efl_config_config_bool_get(Eo *obj, void *_pd EINA_UNUSED, const char * name)
{
   Eina_Value *v = efl_config_get(obj, name);
   Eina_Bool b = 0;
   eina_value_get(v, &b);
   eina_value_free(v);
   return b;
}

EOLIAN static Eina_Bool
_efl_config_config_int_set(Eo *obj, void *_pd EINA_UNUSED, const char * name, int val)
{
   Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_INT);
   Eina_Bool b;
   eina_value_set(v, val);
   b = efl_config_set(obj, name, v);
   eina_value_free(v);
   return b;
}

EOLIAN static int
_efl_config_config_int_get(Eo *obj, void *_pd EINA_UNUSED, const char * name)
{
   Eina_Value *v = efl_config_get(obj, name);
   int b = 0;
   eina_value_get(v, &b);
   eina_value_free(v);
   return b;
}

EOLIAN static Eina_Bool
_efl_config_config_uint_set(Eo *obj, void *_pd EINA_UNUSED, const char * name, unsigned int val)
{
   Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_UINT);
   Eina_Bool b;
   eina_value_set(v, val);
   b = efl_config_set(obj, name, v);
   eina_value_free(v);
   return b;
}

EOLIAN static unsigned int
_efl_config_config_uint_get(Eo *obj, void *_pd EINA_UNUSED, const char * name)
{
   Eina_Value *v = efl_config_get(obj, name);
   unsigned int b = 0;
   eina_value_get(v, &b);
   eina_value_free(v);
   return b;
}

EOLIAN static Eina_Bool
_efl_config_config_double_set(Eo *obj, void *_pd EINA_UNUSED, const char * name, double val)
{
   Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_DOUBLE);
   Eina_Bool b;
   eina_value_set(v, val);
   b = efl_config_set(obj, name, v);
   eina_value_free(v);
   return b;
}

EOLIAN static double
_efl_config_config_double_get(Eo *obj, void *_pd EINA_UNUSED, const char * name)
{
   Eina_Value *v = efl_config_get(obj, name);
   double b = 0;
   eina_value_get(v, &b);
   eina_value_free(v);
   return b;
}

EOLIAN static Eina_Bool
_efl_config_config_string_set(Eo *obj, void *_pd EINA_UNUSED, const char *name, const char *val)
{
   Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_STRING);
   Eina_Bool b;
   eina_value_set(v, val);
   b = efl_config_set(obj, name, v);
   eina_value_free(v);
   return b;
}

EOLIAN static const char *
_efl_config_config_string_get(Eo *obj, void *_pd EINA_UNUSED, const char *name)
{
   Eina_Value *v = efl_config_get(obj, name);
   Eina_Stringshare *s;
   const char *b = 0;
   eina_value_get(v, &b);
   s = eina_stringshare_add(b);
   eina_value_free(v);
   return s;
}

EOLIAN static Efl_Config *
_efl_config_config_global_get(Eo *klass EINA_UNUSED, void *_pd EINA_UNUSED)
{
   return _main_config;
}

#include "interfaces/efl_config.eo.c"