summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <juyung.seo@samsung.com>2013-12-07 22:15:54 +0900
committerDaniel Juyung Seo <juyung.seo@samsung.com>2013-12-07 22:15:54 +0900
commiteb3f01f9511c340d212a3ca676cdb687943930c9 (patch)
tree06f42eef2329a5a1101042a95d5ce3ca178be8d8
parent610797343f3448664b738449ba66bbf33de354b9 (diff)
ecore/glib: use g_idle.
-rw-r--r--ecore/glib.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/ecore/glib.c b/ecore/glib.c
index ced87b9..f3e71c5 100644
--- a/ecore/glib.c
+++ b/ecore/glib.c
@@ -1,12 +1,43 @@
1/* 1/*
2 * gcc glib.c -o glib`pkg-config --cflags --libs elementary` 2 * gcc glib.c -o glib -g `pkg-config --cflags --libs elementary`
3 */ 3 */
4#include <Elementary.h> 4#include <Elementary.h>
5#include <glib.h>
6
7static gboolean
8_g_idle_cb(gpointer data)
9{
10 static count = 1;
11 fprintf(stderr, "%s called %d\n", __func__, count++);
12 return FALSE;
13}
14
15static Eina_Bool
16_timer_cb(void *data)
17{
18 g_idle_add(_g_idle_cb, NULL);
19
20 return ECORE_CALLBACK_CANCEL;
21}
22
23static void
24_timer_btn_cb(void *data, Evas_Object *obj, void *event_info)
25{
26 fprintf(stderr, "%s called\n", __func__);
27
28 ecore_timer_add(2.0, _timer_cb, NULL);
29}
30
31static void
32_g_idle_btn_cb(void *data, Evas_Object *obj, void *event_info)
33{
34 g_idle_add(_g_idle_cb, NULL);
35}
5 36
6EAPI_MAIN int 37EAPI_MAIN int
7elm_main(int argc, char **argv) 38elm_main(int argc, char **argv)
8{ 39{
9 Evas_Object *win; 40 Evas_Object *win = NULL, *btn = NULL;
10 41
11 ecore_main_loop_glib_integrate(); 42 ecore_main_loop_glib_integrate();
12 43
@@ -17,6 +48,22 @@ elm_main(int argc, char **argv)
17 evas_object_resize(win, 300, 400); 48 evas_object_resize(win, 300, 400);
18 evas_object_show(win); 49 evas_object_show(win);
19 50
51 btn = elm_button_add(win);
52 elm_object_text_set(btn, "Timer");
53 evas_object_resize(btn, 100, 50);
54 evas_object_move(btn, 10, 10);
55 evas_object_show(btn);
56 evas_object_smart_callback_add(btn, "clicked", _timer_btn_cb, NULL);
57
58 btn = elm_button_add(win);
59 elm_object_text_set(btn, "g_idle");
60 evas_object_resize(btn, 100, 50);
61 evas_object_move(btn, 120, 10);
62 evas_object_show(btn);
63 evas_object_smart_callback_add(btn, "clicked", _g_idle_btn_cb, NULL);
64
65 g_idle_add(_g_idle_cb, NULL);
66
20 elm_run(); 67 elm_run();
21 elm_shutdown(); 68 elm_shutdown();
22 69