2 #include "e_busycover.h"
3 #include "e_mod_config.h"
5 /* local function prototypes */
6 static void _e_busycover_cb_free(E_Busycover *cover);
9 e_busycover_new(E_Win *win)
14 cover = E_OBJECT_ALLOC(E_Busycover, E_BUSYCOVER_TYPE, _e_busycover_cb_free);
15 if (!cover) return NULL;
16 snprintf(buff, sizeof(buff), "%s/e-module-illume-home.edj",
17 il_home_cfg->mod_dir);
19 cover->o_base = edje_object_add(e_win_evas_get(win));
20 if (!e_theme_edje_object_set(cover->o_base,
21 "base/theme/modules/illume-home",
22 "modules/illume-home/busycover"))
23 edje_object_file_set(cover->o_base, buff, "modules/illume-home/busycover");
24 edje_object_part_text_set(cover->o_base, "e.text.title", _("LOADING"));
25 evas_object_move(cover->o_base, win->x, win->y);
26 evas_object_resize(cover->o_base, win->w, win->h);
27 evas_object_layer_set(cover->o_base, 999);
31 EAPI E_Busycover_Handle *
32 e_busycover_push(E_Busycover *cover, const char *msg, const char *icon)
34 E_Busycover_Handle *handle;
36 E_OBJECT_CHECK(cover);
37 E_OBJECT_TYPE_CHECK_RETURN(cover, E_BUSYCOVER_TYPE, NULL);
39 handle = E_NEW(E_Busycover_Handle, 1);
40 handle->cover = cover;
41 if (msg) handle->msg = eina_stringshare_add(msg);
42 if (icon) handle->icon = eina_stringshare_add(icon);
43 cover->handles = eina_list_append(cover->handles, handle);
44 edje_object_part_text_set(cover->o_base, "e.text.title", msg);
45 evas_object_show(cover->o_base);
50 e_busycover_pop(E_Busycover *cover, E_Busycover_Handle *handle)
52 E_OBJECT_CHECK(cover);
53 E_OBJECT_TYPE_CHECK(cover, E_BUSYCOVER_TYPE);
54 if (!eina_list_data_find(cover->handles, handle)) return;
55 cover->handles = eina_list_remove(cover->handles, handle);
56 if (handle->msg) eina_stringshare_del(handle->msg);
57 if (handle->icon) eina_stringshare_del(handle->icon);
61 handle = cover->handles->data;
62 edje_object_part_text_set(cover->o_base, "e.text.title", handle->msg);
65 evas_object_hide(cover->o_base);
69 e_busycover_resize(E_Busycover *cover, int w, int h)
71 E_OBJECT_CHECK(cover);
72 E_OBJECT_TYPE_CHECK(cover, E_BUSYCOVER_TYPE);
73 evas_object_resize(cover->o_base, w, h);
76 /* local function prototypes */
78 _e_busycover_cb_free(E_Busycover *cover)
80 E_Busycover_Handle *handle;
82 EINA_LIST_FREE(cover->handles, handle)
84 if (handle->msg) eina_stringshare_del(handle->msg);
85 if (handle->icon) eina_stringshare_del(handle->icon);
89 if (cover->o_base) evas_object_del(cover->o_base);