apply FSL(Flora Software License)
[apps/home/ug-memo-efl.git] / extend / supplement.c
1 /*
2   * Copyright 2012  Samsung Electronics Co., Ltd
3   * 
4   * Licensed under the Flora License, Version 1.0 (the "License");
5   * you may not use this file except in compliance with the License.
6   * You may obtain a copy of the License at
7   * 
8   *     http://www.tizenopensource.org/license
9   * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16
17 #include <dlog.h>
18 #include <gravel.h>
19 #include <supplement.h>
20
21 static void _bundle_iterate_dump_cb(const char *k, const char *v, void *data)
22 {
23     LOGD("%s -> %s\n", k, v);
24 }
25
26 void bundle_dump(bundle *b)
27 {
28     if (b != NULL) {
29         bundle_iterate(b, _bundle_iterate_dump_cb, NULL);
30     }
31 }
32
33 Eina_Bool bundle_key_check(bundle *b, const char *key, const char *val)
34 {
35     const char *str = bundle_get_val(b, key);
36     if (str != NULL) {
37         if (strcmp(str, val) == 0) {
38             return EINA_TRUE;
39         }
40     }
41     return EINA_FALSE;
42 }
43
44 void evas_object_geometry_dump(Evas_Object *eo)
45 {
46     Evas_Coord x, y, w, h;
47     evas_object_geometry_get(eo, &x, &y, &w, &h);
48     LOGD("[evas_object_geometry_dump] geometry of %x : %d %d %d %d\n", eo, x, y, w, h);
49 }
50
51 void evas_object_event_hit(void *data, Evas *e, Evas_Object *obj, void *event_info)
52 {
53     LOGD("[%s] %x : %s\n", __func__, obj, (char *)data);
54 }
55
56 void evas_object_smart_event_hit(void *data, Evas_Object *obj, void *event_info)
57 {
58     LOGD("[%s] %x : %s\n", __func__, obj, (char *)data);
59 }
60
61 typedef struct __rf_data_t {
62     Evas_Smart_Cb cb;
63     void *data;
64 }rf_data_t;
65
66 static void _render_flush_post_cb(void *data, Evas *e, void *event_info)
67 {
68     rf_data_t *rf = (rf_data_t *)data;
69     rf->cb(rf->data, NULL, NULL);
70     evas_event_callback_del(e, EVAS_CALLBACK_RENDER_FLUSH_POST, _render_flush_post_cb);
71     SFREE(rf);
72 }
73
74 void evas_object_render_flush_hook(Evas_Object *obj, Evas_Smart_Cb cb, void *data)
75 {
76     RETIF(obj==NULL);
77     Evas *e = evas_object_evas_get(obj);
78     rf_data_t *rf = SMALLOC(rf_data_t);
79     RETIF(rf==NULL);
80     rf->cb = cb;
81     rf->data = data;
82     evas_event_callback_add(e, EVAS_CALLBACK_RENDER_FLUSH_POST, _render_flush_post_cb, rf);
83 }
84