summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-01-30 10:45:39 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-14 09:20:21 +0100
commit94a29d05dea1e9c35b9f595119dd6f73d79fdb5b (patch)
treed4fadafcf1183752ee5c6ed821c785fc674e8f29
parent0f2a61b5f280f11ba661996482a509f370d7e5e1 (diff)
efl/config: move C wrappers for this out of elm_config.h to Efl.h
this is beta API and belongs in its proper header Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11247
-rw-r--r--src/lib/efl/Efl.h94
-rw-r--r--src/lib/elementary/elm_config.h98
2 files changed, 94 insertions, 98 deletions
diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h
index 649383f2c9..ea891223e9 100644
--- a/src/lib/efl/Efl.h
+++ b/src/lib/efl/Efl.h
@@ -234,6 +234,100 @@ EAPI Efl_Object *efl_part(const Eo *obj, const char *name);
234 234
235EAPI void efl_observable_tuple_free(Efl_Observable_Tuple *tuple); 235EAPI void efl_observable_tuple_free(Efl_Observable_Tuple *tuple);
236 236
237
238
239static inline Eina_Bool
240efl_config_bool_set(Efl_Config *obj, const char * name, Eina_Bool val)
241{
242 Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_UCHAR);
243 Eina_Bool b;
244 eina_value_set(v, val);
245 b = efl_config_set(obj, name, v);
246 eina_value_free(v);
247 return b;
248}
249
250static inline Eina_Bool
251efl_config_bool_get(const Efl_Config *obj, const char * name)
252{
253 Eina_Value *v = efl_config_get(obj, name);
254 Eina_Bool b = 0;
255 if (eina_value_type_get(v) == EINA_VALUE_TYPE_UCHAR)
256 eina_value_get(v, &b);
257 eina_value_free(v);
258 return b;
259}
260
261static inline Eina_Bool
262efl_config_int_set(Efl_Config *obj, const char * name, int val)
263{
264 Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_INT);
265 Eina_Bool b;
266 eina_value_set(v, val);
267 b = efl_config_set(obj, name, v);
268 eina_value_free(v);
269 return b;
270}
271
272static inline int
273efl_config_int_get(const Efl_Config *obj, const char * name)
274{
275 Eina_Value *v = efl_config_get(obj, name);
276 int b = 0;
277 if (eina_value_type_get(v) == EINA_VALUE_TYPE_INT)
278 eina_value_get(v, &b);
279 eina_value_free(v);
280 return b;
281}
282
283static inline Eina_Bool
284efl_config_double_set(Efl_Config *obj, const char * name, double val)
285{
286 Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_DOUBLE);
287 Eina_Bool b;
288 eina_value_set(v, val);
289 b = efl_config_set(obj, name, v);
290 eina_value_free(v);
291 return b;
292}
293
294static inline double
295efl_config_double_get(const Efl_Config *obj, const char * name)
296{
297 Eina_Value *v = efl_config_get(obj, name);
298 double b = 0;
299 if (eina_value_type_get(v) == EINA_VALUE_TYPE_DOUBLE)
300 eina_value_get(v, &b);
301 eina_value_free(v);
302 return b;
303}
304
305static inline Eina_Bool
306efl_config_string_set(Efl_Config *obj, const char *name, const char *val)
307{
308 Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_STRING);
309 Eina_Bool b;
310 eina_value_set(v, val);
311 b = efl_config_set(obj, name, v);
312 eina_value_free(v);
313 return b;
314}
315
316static inline Eina_Stringshare *
317efl_config_string_get(const Efl_Config *obj, const char *name)
318{
319 Eina_Value *v = efl_config_get(obj, name);
320 Eina_Stringshare *s = 0;
321 if (eina_value_type_get(v) == EINA_VALUE_TYPE_STRING)
322 {
323 const char *b = 0;
324 eina_value_get(v, &b);
325 s = eina_stringshare_add(b);
326 }
327 eina_value_free(v);
328 return s;
329}
330
237#else 331#else
238 332
239#ifndef EFL_NOLEGACY_API_SUPPORT 333#ifndef EFL_NOLEGACY_API_SUPPORT
diff --git a/src/lib/elementary/elm_config.h b/src/lib/elementary/elm_config.h
index 48f8778d75..f42fee4a87 100644
--- a/src/lib/elementary/elm_config.h
+++ b/src/lib/elementary/elm_config.h
@@ -2370,104 +2370,6 @@ EAPI double elm_config_drag_anim_duration_get(void);
2370 */ 2370 */
2371EAPI void elm_config_drag_anim_duration_set(double set); 2371EAPI void elm_config_drag_anim_duration_set(double set);
2372 2372
2373/* new efl.config interface helpers in C */
2374
2375/* FIXME these depend on stuff from Efl.h but this is included before that */
2376#ifdef EFL_BETA_API_SUPPORT
2377
2378static inline Eina_Bool
2379efl_config_bool_set(Efl_Config *obj, const char * name, Eina_Bool val)
2380{
2381 Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_UCHAR);
2382 Eina_Bool b;
2383 eina_value_set(v, val);
2384 b = efl_config_set(obj, name, v);
2385 eina_value_free(v);
2386 return b;
2387}
2388
2389static inline Eina_Bool
2390efl_config_bool_get(const Efl_Config *obj, const char * name)
2391{
2392 Eina_Value *v = efl_config_get(obj, name);
2393 Eina_Bool b = 0;
2394 if (eina_value_type_get(v) == EINA_VALUE_TYPE_UCHAR)
2395 eina_value_get(v, &b);
2396 eina_value_free(v);
2397 return b;
2398}
2399
2400static inline Eina_Bool
2401efl_config_int_set(Efl_Config *obj, const char * name, int val)
2402{
2403 Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_INT);
2404 Eina_Bool b;
2405 eina_value_set(v, val);
2406 b = efl_config_set(obj, name, v);
2407 eina_value_free(v);
2408 return b;
2409}
2410
2411static inline int
2412efl_config_int_get(const Efl_Config *obj, const char * name)
2413{
2414 Eina_Value *v = efl_config_get(obj, name);
2415 int b = 0;
2416 if (eina_value_type_get(v) == EINA_VALUE_TYPE_INT)
2417 eina_value_get(v, &b);
2418 eina_value_free(v);
2419 return b;
2420}
2421
2422static inline Eina_Bool
2423efl_config_double_set(Efl_Config *obj, const char * name, double val)
2424{
2425 Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_DOUBLE);
2426 Eina_Bool b;
2427 eina_value_set(v, val);
2428 b = efl_config_set(obj, name, v);
2429 eina_value_free(v);
2430 return b;
2431}
2432
2433static inline double
2434efl_config_double_get(const Efl_Config *obj, const char * name)
2435{
2436 Eina_Value *v = efl_config_get(obj, name);
2437 double b = 0;
2438 if (eina_value_type_get(v) == EINA_VALUE_TYPE_DOUBLE)
2439 eina_value_get(v, &b);
2440 eina_value_free(v);
2441 return b;
2442}
2443
2444static inline Eina_Bool
2445efl_config_string_set(Efl_Config *obj, const char *name, const char *val)
2446{
2447 Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_STRING);
2448 Eina_Bool b;
2449 eina_value_set(v, val);
2450 b = efl_config_set(obj, name, v);
2451 eina_value_free(v);
2452 return b;
2453}
2454
2455static inline Eina_Stringshare *
2456efl_config_string_get(const Efl_Config *obj, const char *name)
2457{
2458 Eina_Value *v = efl_config_get(obj, name);
2459 Eina_Stringshare *s = 0;
2460 if (eina_value_type_get(v) == EINA_VALUE_TYPE_STRING)
2461 {
2462 const char *b = 0;
2463 eina_value_get(v, &b);
2464 s = eina_stringshare_add(b);
2465 }
2466 eina_value_free(v);
2467 return s;
2468}
2469
2470#endif
2471 2373
2472/** 2374/**
2473 * @} 2375 * @}