1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
/* Profile chooser */
#include "e_wizard.h"
static const char *profile = NULL;
static Evas_Object *textblock = NULL;
static void
_profile_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
{
char buf[PATH_MAX];
char *dir;
Efreet_Desktop *desk = NULL;
e_prefix_data_snprintf(buf, sizeof(buf), "data/config/%s", profile);
dir = strdupa(buf);
snprintf(buf, sizeof(buf), "%s/profile.desktop", dir);
desk = efreet_desktop_new(buf);
if (desk)
{
e_widget_textblock_markup_set(textblock, desk->comment);
efreet_desktop_free(desk);
}
else
e_widget_textblock_markup_set(textblock, _("Unknown"));
// enable next once you choose a profile
e_wizard_button_next_enable_set(1);
}
/*
EAPI int
wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
EAPI int
wizard_page_shutdown(E_Wizard_Page *pg __UNUSED__)
{
return 1;
}
*/
EAPI int
wizard_page_show(E_Wizard_Page *pg)
{
Evas_Object *o, *of, *ob;
Eina_List *l, *profiles;
int i, sel = -1;
Evas_Object *ilist;
o = e_widget_list_add(pg->evas, 1, 0);
e_wizard_title_set(_("Profile"));
of = e_widget_framelist_add(pg->evas, _("Select one"), 0);
ob = e_widget_ilist_add(pg->evas, 32 * e_scale, 32 * e_scale, &profile);
e_widget_size_min_set(ob, 140 * e_scale, 70 * e_scale);
ilist = ob;
e_widget_on_change_hook_set(ob, _profile_change, NULL);
e_widget_ilist_freeze(ob);
profiles = e_config_profile_list();
for (i = 0, l = profiles; l; l = l->next)
{
Efreet_Desktop *desk = NULL;
char buf[PATH_MAX], *prof;
const char *label, *dir;
Evas_Object *ic;
prof = l->data;
if (e_config_profile_get())
{
if (!strcmp(prof, e_config_profile_get()))
{
free(prof);
continue;
}
}
e_prefix_data_snprintf(buf, sizeof(buf), "data/config/%s", prof);
// if it's not a system profile - don't offer it
if (!ecore_file_is_dir(buf))
{
free(prof);
continue;
}
dir = strdupa(buf);
if (!strcmp(prof, "standard")) sel = i;
snprintf(buf, sizeof(buf), "%s/profile.desktop", dir);
desk = efreet_desktop_new(buf);
label = prof;
if ((desk) && (desk->name)) label = desk->name;
snprintf(buf, sizeof(buf), "%s/icon.edj", dir);
if ((desk) && (desk->icon))
{
if (eina_str_has_extension(desk->icon, "png"))
snprintf(buf, sizeof(buf), "%s/%s", dir, desk->icon);
else
snprintf(buf, sizeof(buf), "%s/%s.png", dir, desk->icon);
}
else
e_prefix_data_concat_static(buf, "data/images/enlightenment.png");
ic = e_util_icon_add(buf, pg->evas);
e_widget_ilist_append(ob, ic, label, NULL, NULL, prof);
free(prof);
if (desk) efreet_desktop_free(desk);
/* We incremet here, because we don't want to increment it unless we
* actually found an item. */
i++;
}
if (profiles) eina_list_free(profiles);
e_widget_ilist_go(ob);
e_widget_ilist_thaw(ob);
e_widget_framelist_object_append(of, ob);
ob = e_widget_textblock_add(pg->evas);
e_widget_size_min_set(ob, 140 * e_scale, 70 * e_scale);
e_widget_textblock_markup_set(ob, _("Select a profile"));
textblock = ob;
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
if (sel >= 0) e_widget_ilist_selected_set(ilist, sel);
evas_object_show(ob);
evas_object_show(of);
e_wizard_page_show(o);
// pg->data = o;
e_wizard_button_next_enable_set(0);
return 1; /* 1 == show ui, and wait for user, 0 == just continue */
}
EAPI int
wizard_page_hide(E_Wizard_Page *pg __UNUSED__)
{
// evas_object_del(pg->data);
// actually apply profile
if (!profile) profile = "standard";
e_config_profile_set(profile);
e_config_profile_del(e_config_profile_get());
e_config_load();
e_config_save();
return 1;
}
/*
EAPI int
wizard_page_apply(E_Wizard_Page *pg __UNUSED__)
{
return 1;
}
*/
|