aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/bin/test_icon_desktops.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/elementary/src/bin/test_icon_desktops.c')
-rw-r--r--libraries/elementary/src/bin/test_icon_desktops.c100
1 files changed, 100 insertions, 0 deletions
diff --git a/libraries/elementary/src/bin/test_icon_desktops.c b/libraries/elementary/src/bin/test_icon_desktops.c
new file mode 100644
index 0000000..aed269a
--- /dev/null
+++ b/libraries/elementary/src/bin/test_icon_desktops.c
@@ -0,0 +1,100 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5#ifndef ELM_LIB_QUICKLAUNCH
6static Elm_Genlist_Item_Class it_desk;
7
8static char *
9desk_gl_text_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
10{
11#ifdef ELM_EFREET
12 Efreet_Desktop *d = (Efreet_Desktop *)data;
13 return strdup(d->name);
14#else
15 return NULL;
16 (void)data;
17#endif
18}
19static Evas_Object *
20desk_gl_content_get(void *data, Evas_Object *obj, const char *part)
21{
22#ifdef ELM_EFREET
23 Efreet_Desktop *d = (Efreet_Desktop *)data;
24 Evas_Object *ic;
25
26 ic = elm_icon_add(obj);
27 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
28 if (!(!strcmp(part, "elm.swallow.icon"))) return ic;
29 if (!d->icon) return ic;
30 elm_icon_standard_set(ic, d->icon);
31 return ic;
32#else
33 return NULL;
34 (void)data;
35 (void)obj;
36 (void)part;
37#endif
38}
39static void
40desk_gl_del(void *data, Evas_Object *obj __UNUSED__)
41{
42#ifdef ELM_EFREET
43 Efreet_Desktop *d = (Efreet_Desktop *)data;
44 efreet_desktop_free(d);
45#else
46 return;
47 (void)data;
48#endif
49}
50
51#ifdef ELM_EFREET
52static void
53desktop_sel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
54{
55 printf("sel\n");
56}
57#endif
58
59void
60test_icon_desktops(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
61{
62 Evas_Object *win, *gl;
63#ifdef ELM_EFREET
64 Eina_List *desktops;
65#endif
66
67 win = elm_win_util_standard_add("icon-desktops", "Icon Desktops");
68 elm_win_autodel_set(win, EINA_TRUE);
69
70 it_desk.item_style = "default";
71 it_desk.func.text_get = desk_gl_text_get;
72 it_desk.func.content_get = desk_gl_content_get;
73 it_desk.func.state_get = NULL;
74 it_desk.func.del = desk_gl_del;
75
76 gl = elm_genlist_add(win);
77 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
78 elm_win_resize_object_add(win, gl);
79 evas_object_show(gl);
80
81#ifdef ELM_EFREET
82 if (elm_need_efreet())
83 {
84 desktops = efreet_util_desktop_name_glob_list("*");
85 if (desktops)
86 {
87 Efreet_Desktop *d;
88
89 EINA_LIST_FREE(desktops, d)
90 elm_genlist_item_append(gl, &it_desk, d,
91 NULL, ELM_GENLIST_ITEM_NONE,
92 desktop_sel, NULL);
93 }
94 }
95#endif
96
97 evas_object_resize(win, 320, 480);
98 evas_object_show(win);
99}
100#endif