summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStafford Mitchell Horne <shorne@gmail.com>2006-04-09 11:55:18 +0000
committerStafford Mitchell Horne <shorne@gmail.com>2006-04-09 11:55:18 +0000
commit30cdc91f0c2a40d94a69031c5d62d8b7dd3a47ae (patch)
treef689c8396d54e3eb460c926997dfe6c43f7cdbd1
parent222d049ac81034400c14dc0dcd62364287c05b9d (diff)
Add a simple search path configuration dialog, plus:
* Add some widget API used by new dialog * Fix typo SVN revision: 21983
Diffstat (limited to '')
-rw-r--r--src/bin/Makefile.am4
-rw-r--r--src/bin/e_configure.c3
-rw-r--r--src/bin/e_includes.h1
-rw-r--r--src/bin/e_int_config_fonts.c2
-rw-r--r--src/bin/e_int_config_paths.c235
-rw-r--r--src/bin/e_int_config_paths.h12
-rw-r--r--src/bin/e_ipc_handlers.h2
-rw-r--r--src/bin/e_path.c14
-rw-r--r--src/bin/e_path.h1
-rw-r--r--src/bin/e_widget_config_list.c18
-rw-r--r--src/bin/e_widget_config_list.h3
11 files changed, 286 insertions, 9 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 03b972c..ca5339b 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -150,7 +150,8 @@ e_apps_error.h \
150e_stolen.h \ 150e_stolen.h \
151e_gadcon.h \ 151e_gadcon.h \
152e_shelf.h \ 152e_shelf.h \
153e_widget_preview.h 153e_widget_preview.h \
154e_int_config_paths.h
154 155
155enlightenment_src = \ 156enlightenment_src = \
156e_user.c \ 157e_user.c \
@@ -282,6 +283,7 @@ e_stolen.c \
282e_gadcon.c \ 283e_gadcon.c \
283e_shelf.c \ 284e_shelf.c \
284e_widget_preview.c \ 285e_widget_preview.c \
286e_int_config_paths.c \
285$(ENLIGHTENMENTHEADERS) 287$(ENLIGHTENMENTHEADERS)
286 288
287enlightenment_SOURCES = \ 289enlightenment_SOURCES = \
diff --git a/src/bin/e_configure.c b/src/bin/e_configure.c
index cd172d6..143bfef 100644
--- a/src/bin/e_configure.c
+++ b/src/bin/e_configure.c
@@ -95,7 +95,8 @@ e_configure_show(E_Container *con)
95 e_configure_standard_item_add(eco, "enlightenment/windows", _("Window List Settings"), e_int_config_winlist); 95 e_configure_standard_item_add(eco, "enlightenment/windows", _("Window List Settings"), e_int_config_winlist);
96 e_configure_standard_item_add(eco, "enlightenment/windows", _("Window Manipulation Settings"), e_int_config_window_manipulation); 96 e_configure_standard_item_add(eco, "enlightenment/windows", _("Window Manipulation Settings"), e_int_config_window_manipulation);
97 e_configure_standard_item_add(eco, "enlightenment/run", _("Run Command Settings"), e_int_config_exebuf); 97 e_configure_standard_item_add(eco, "enlightenment/run", _("Run Command Settings"), e_int_config_exebuf);
98 98 e_configure_standard_item_add(eco, "enlightenment/e", _("Search Paths"), e_int_config_paths);
99
99 /* FIXME: we should have a way for modules to hook in here and add their 100 /* FIXME: we should have a way for modules to hook in here and add their
100 * own entries 101 * own entries
101 */ 102 */
diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h
index c857f14..dafd26f 100644
--- a/src/bin/e_includes.h
+++ b/src/bin/e_includes.h
@@ -130,3 +130,4 @@
130#include "e_shelf.h" 130#include "e_shelf.h"
131#include "e_tlist.h" 131#include "e_tlist.h"
132#include "e_widget_preview.h" 132#include "e_widget_preview.h"
133#include "e_int_config_paths.h"
diff --git a/src/bin/e_int_config_fonts.c b/src/bin/e_int_config_fonts.c
index 2b2654f..489dd1c 100644
--- a/src/bin/e_int_config_fonts.c
+++ b/src/bin/e_int_config_fonts.c
@@ -359,7 +359,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
359 of = e_widget_framelist_add(evas, _("Font Fallbacks"), 0); 359 of = e_widget_framelist_add(evas, _("Font Fallbacks"), 0);
360 e_widget_framelist_content_align_set(of, 0.5, 0.5); 360 e_widget_framelist_content_align_set(of, 0.5, 0.5);
361 361
362 ob = e_widget_config_list_add(evas, e_widget_entry_add, _("Fallback Name")); 362 ob = e_widget_config_list_add(evas, e_widget_entry_add, _("Fallback Name"), 1);
363 cfdata->gui.fallback_list = ob; 363 cfdata->gui.fallback_list = ob;
364 e_widget_framelist_object_append(of, ob); 364 e_widget_framelist_object_append(of, ob);
365 365
diff --git a/src/bin/e_int_config_paths.c b/src/bin/e_int_config_paths.c
new file mode 100644
index 0000000..3ebbb9b
--- /dev/null
+++ b/src/bin/e_int_config_paths.c
@@ -0,0 +1,235 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4#include "e.h"
5
6typedef struct _E_Path_Pair E_Path_Pair;
7typedef struct _CFPath_Change_Data CFPath_Change_Data;
8
9static void *_create_data(E_Config_Dialog *cfd);
10static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
11static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
12static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
13
14static void _ilist_update(Evas_Object *obj, E_Path *old, E_Path *new);
15static void _ilist_path_cb_change(void *data);
16
17struct _E_Path_Pair
18{
19 E_Path *path;
20 const char *path_description;
21};
22
23struct _CFPath_Change_Data
24{
25 E_Path *path;
26 E_Config_Dialog_Data *cfdata;
27};
28
29struct _E_Config_Dialog_Data
30{
31 E_Config_Dialog *cfd;
32
33 /* Current data */
34 E_Path *cur_path;
35
36 Evas_List *pcd_list;
37 E_Path_Pair *paths_available;
38 struct
39 {
40 Evas_Object *path_list;
41
42 Evas_Object *default_list; /* Read Only */
43 Evas_Object *user_list; /* Editable */
44 }
45 gui;
46};
47
48EAPI E_Config_Dialog *
49e_int_config_paths(E_Container *con)
50{
51 E_Config_Dialog *cfd;
52 E_Config_Dialog_View *v;
53
54 v = E_NEW(E_Config_Dialog_View, 1);
55
56 v->create_cfdata = _create_data;
57 v->free_cfdata = _free_data;
58 v->basic.create_widgets = _basic_create_widgets;
59 v->basic.apply_cfdata = _basic_apply_data;
60
61 cfd = e_config_dialog_new(con, _("Search Path Configuration"), NULL, 0, v, NULL);
62 return cfd;
63}
64
65static void
66_fill_data(E_Config_Dialog_Data *cfdata)
67{
68 cfdata->paths_available = E_NEW(E_Path_Pair, 11);
69 cfdata->paths_available[0].path = path_data;
70 cfdata->paths_available[0].path_description = "Data";
71 cfdata->paths_available[1].path = path_images;
72 cfdata->paths_available[1].path_description = "Images";
73 cfdata->paths_available[2].path = path_fonts;
74 cfdata->paths_available[2].path_description = "Fonts";
75 cfdata->paths_available[3].path = path_themes;
76 cfdata->paths_available[3].path_description = "Themes";
77 cfdata->paths_available[4].path = path_init;
78 cfdata->paths_available[4].path_description = "Init";
79 cfdata->paths_available[5].path = path_icons;
80 cfdata->paths_available[5].path_description = "Icons";
81 cfdata->paths_available[6].path = path_modules;
82 cfdata->paths_available[6].path_description = "Modules";
83 cfdata->paths_available[7].path = path_backgrounds;
84 cfdata->paths_available[7].path_description = "Backgrounds";
85 cfdata->paths_available[8].path = path_input_methods;
86 cfdata->paths_available[8].path_description = "Input Methods";
87 cfdata->paths_available[9].path = path_messages;
88 cfdata->paths_available[9].path_description = "Messages";
89 cfdata->paths_available[10].path = NULL;
90 cfdata->paths_available[10].path_description = NULL;
91
92 return;
93}
94
95static void *
96_create_data(E_Config_Dialog *cfd)
97{
98 E_Config_Dialog_Data *cfdata;
99
100 cfdata = E_NEW(E_Config_Dialog_Data, 1);
101 cfdata->cfd = cfd;
102 _fill_data(cfdata);
103 return cfdata;
104}
105
106static void
107_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
108{
109 while (cfdata->pcd_list)
110 {
111 free(cfdata->pcd_list->data);
112 cfdata->pcd_list = evas_list_remove_list(cfdata->pcd_list, cfdata->pcd_list);
113 }
114 free(cfdata->paths_available);
115 free(cfdata);
116}
117
118static int
119_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
120{
121 _ilist_update( cfdata->gui.user_list,
122 cfdata->cur_path,
123 NULL);
124 return 1;
125}
126
127static Evas_Object *
128_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
129{
130 Evas_Object *o, *of, *ob;
131 int i;
132
133 o = e_widget_table_add(evas, 1);
134
135 of = e_widget_framelist_add(evas, _("E Paths"), 0);
136 ob = e_widget_ilist_add(evas, 0, 0, NULL);
137 cfdata->gui.path_list = ob;
138 e_widget_min_size_set(ob, 100, 100);
139
140 /* Fill In Ilist */
141 for (i = 0; cfdata->paths_available[i].path; i++)
142 {
143 CFPath_Change_Data *pcd;
144 pcd = E_NEW(CFPath_Change_Data, 1);
145
146 pcd->path = cfdata->paths_available[i].path;
147 pcd->cfdata = cfdata;
148 cfdata->pcd_list = evas_list_append(cfdata->pcd_list, pcd);
149 e_widget_ilist_append(ob, NULL, _(cfdata->paths_available[i].path_description), _ilist_path_cb_change, pcd, NULL);
150 }
151
152 e_widget_ilist_go(ob);
153 e_widget_framelist_object_append(of, ob);
154 e_widget_table_object_append(o, of, 0, 0, 1, 1, 1, 1, 1, 1);
155
156 of = e_widget_framelist_add(evas, _("Default Directories"), 0);
157 ob = e_widget_ilist_add(evas, 0, 0, NULL);
158 cfdata->gui.default_list = ob;
159 e_widget_min_size_set(ob, 100, 100);
160 e_widget_framelist_object_append(of, ob);
161 e_widget_table_object_append(o, of, 1, 0, 2, 1, 1, 1, 1, 1);
162
163 of = e_widget_framelist_add(evas, _("User Defined Directories"), 0);
164 e_widget_framelist_content_align_set(of, 0.5, 0.5);
165 ob = e_widget_config_list_add(evas, e_widget_entry_add, _("New Directory"), 2);
166 e_widget_disabled_set(ob, 1);
167 cfdata->gui.user_list = ob;
168 e_widget_framelist_object_append(of, ob);
169
170 e_widget_table_object_append(o, of, 0, 1, 3, 1, 1, 1, 1, 1);
171
172 return o;
173}
174
175static void
176_ilist_path_cb_change(void *data)
177{
178 CFPath_Change_Data *pcd;
179 Evas_List *default_list;
180 int i;
181
182 pcd = data;
183 default_list = pcd->path->default_dir_list;
184
185 /* Update Default List */
186 e_widget_ilist_clear(pcd->cfdata->gui.default_list);
187 for (i = 0; i < evas_list_count(default_list); i++)
188 {
189 const char *dir;
190
191 dir = ((E_Path_Dir *)evas_list_nth(default_list, i))->dir;
192 e_widget_ilist_append(pcd->cfdata->gui.default_list, NULL, dir, NULL, NULL, NULL);
193 }
194 e_widget_ilist_go(pcd->cfdata->gui.default_list);
195
196 _ilist_update( pcd->cfdata->gui.user_list,
197 pcd->cfdata->cur_path,
198 pcd->path);
199
200 pcd->cfdata->cur_path = pcd->path;
201}
202
203static void
204_ilist_update(Evas_Object *obj, E_Path *old, E_Path *new)
205{
206 /* Save current data to old path */
207 if (old)
208 {
209 int i;
210
211 e_path_user_path_clear(old);
212 for (i = 0; i < e_widget_config_list_count(obj); i++)
213 {
214 const char *dir;
215 dir = e_widget_config_list_nth_get(obj, i);
216 e_path_user_path_append(old, dir);
217 }
218 }
219
220 /* Fill list with selected data */
221 if (new)
222 {
223 Evas_List *l;
224
225 e_widget_disabled_set(obj, 0);
226 e_widget_config_list_clear(obj);
227 for (l = *(new->user_dir_list); l; l = l->next)
228 {
229 E_Path_Dir *epd;
230 epd = l->data;
231 e_widget_config_list_append(obj, epd->dir);
232 }
233 }
234}
235
diff --git a/src/bin/e_int_config_paths.h b/src/bin/e_int_config_paths.h
new file mode 100644
index 0000000..6a986f7
--- /dev/null
+++ b/src/bin/e_int_config_paths.h
@@ -0,0 +1,12 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4#ifdef E_TYPEDEFS
5#else
6#ifndef E_INT_CONFIG_PATHS_H
7#define E_INT_CONFIG_PATHS_H
8
9EAPI E_Config_Dialog *e_int_config_paths(E_Container *con);
10
11#endif
12#endif
diff --git a/src/bin/e_ipc_handlers.h b/src/bin/e_ipc_handlers.h
index bbf923d..df06545 100644
--- a/src/bin/e_ipc_handlers.h
+++ b/src/bin/e_ipc_handlers.h
@@ -3,7 +3,7 @@
3 */ 3 */
4/* NOTE: 4/* NOTE:
5 * 5 *
6 * This is a very SPECIAL file. This servers as a kind of "auto code generator" 6 * This is a very SPECIAL file. This serves as a kind of "auto code generator"
7 * to handle the encoder, decoder etc. aspects of ipc requests. the aim here 7 * to handle the encoder, decoder etc. aspects of ipc requests. the aim here
8 * is to make writing support for a new opcode simple and compact. It intends 8 * is to make writing support for a new opcode simple and compact. It intends
9 * to centralize the handling into 1 spot, instead of having ti spread around 9 * to centralize the handling into 1 spot, instead of having ti spread around
diff --git a/src/bin/e_path.c b/src/bin/e_path.c
index 6b181ad..67de09d 100644
--- a/src/bin/e_path.c
+++ b/src/bin/e_path.c
@@ -249,6 +249,20 @@ e_path_user_path_remove(E_Path *ep, const char *path)
249 } 249 }
250} 250}
251 251
252EAPI void
253e_path_user_path_clear(E_Path *ep)
254{
255 while (*(ep->user_dir_list))
256 {
257 E_Path_Dir *epd;
258 epd = (*(ep->user_dir_list))->data;
259 *(ep->user_dir_list) = evas_list_remove_list(*(ep->user_dir_list), *(ep->user_dir_list));
260 evas_stringshare_del(epd->dir);
261 free(epd);
262 }
263 _e_path_cache_free(ep);
264}
265
252EAPI const char * 266EAPI const char *
253e_path_find(E_Path *ep, const char *file) 267e_path_find(E_Path *ep, const char *file)
254{ 268{
diff --git a/src/bin/e_path.h b/src/bin/e_path.h
index 4ecbf4c..e94c132 100644
--- a/src/bin/e_path.h
+++ b/src/bin/e_path.h
@@ -38,6 +38,7 @@ EAPI void e_path_default_path_append(E_Path *ep, const char *path);
38EAPI void e_path_user_path_append(E_Path *ep, const char *path); 38EAPI void e_path_user_path_append(E_Path *ep, const char *path);
39EAPI void e_path_user_path_prepend(E_Path *ep, const char *path); 39EAPI void e_path_user_path_prepend(E_Path *ep, const char *path);
40EAPI void e_path_user_path_remove(E_Path *ep, const char *path); 40EAPI void e_path_user_path_remove(E_Path *ep, const char *path);
41EAPI void e_path_user_path_clear(E_Path *ep);
41EAPI const char *e_path_find(E_Path *ep, const char *file); 42EAPI const char *e_path_find(E_Path *ep, const char *file);
42EAPI void e_path_evas_append(E_Path *ep, Evas *evas); 43EAPI void e_path_evas_append(E_Path *ep, Evas *evas);
43EAPI Evas_List *e_path_dir_list_get(E_Path *ep); 44EAPI Evas_List *e_path_dir_list_get(E_Path *ep);
diff --git a/src/bin/e_widget_config_list.c b/src/bin/e_widget_config_list.c
index f3b660e..b686f5e 100644
--- a/src/bin/e_widget_config_list.c
+++ b/src/bin/e_widget_config_list.c
@@ -38,7 +38,7 @@ struct _E_Widget_Data
38 38
39/* Externally accessible functions */ 39/* Externally accessible functions */
40EAPI Evas_Object * 40EAPI Evas_Object *
41e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas, char **val), const char *label) 41e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas, char **val), const char *label, int listspan)
42{ 42{
43 Evas_Object *obj, *o; 43 Evas_Object *obj, *o;
44 E_Widget_Data *wd; 44 E_Widget_Data *wd;
@@ -72,7 +72,7 @@ e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas,
72 1, 1, 1, 1); 72 1, 1, 1, 1);
73 73
74 74
75 o = e_widget_ilist_add(evas, 16, 16, NULL); 75 o = e_widget_ilist_add(evas, 0, 0, NULL);
76 wd->gui.list = o; 76 wd->gui.list = o;
77 e_widget_disabled_set(o, 1); 77 e_widget_disabled_set(o, 1);
78 e_widget_min_size_set(o, 100, 100); 78 e_widget_min_size_set(o, 100, 100);
@@ -80,7 +80,7 @@ e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas,
80 e_widget_ilist_go(o); 80 e_widget_ilist_go(o);
81 e_widget_table_object_append( wd->gui.table, 81 e_widget_table_object_append( wd->gui.table,
82 o, 82 o,
83 2, 0, 1, 4, 83 2, 0, listspan, 4,
84 1, 1, 1, 1); 84 1, 1, 1, 1);
85 85
86 o = e_widget_label_add(evas, label); 86 o = e_widget_label_add(evas, label);
@@ -130,6 +130,16 @@ e_widget_config_list_count(Evas_Object *obj)
130 return e_widget_ilist_count(wd->gui.list); 130 return e_widget_ilist_count(wd->gui.list);
131} 131}
132 132
133EAPI void
134e_widget_config_list_clear(Evas_Object *obj)
135{
136 E_Widget_Data *wd;
137
138 wd = e_widget_data_get(obj);
139 e_widget_ilist_clear(wd->gui.list);
140 _list_select_num(wd, -1);
141}
142
133EAPI const char * 143EAPI const char *
134e_widget_config_list_nth_get(Evas_Object *obj, int n) 144e_widget_config_list_nth_get(Evas_Object *obj, int n)
135{ 145{
@@ -330,7 +340,7 @@ _e_wid_disable_hook(Evas_Object *obj)
330 if (!wd) return; 340 if (!wd) return;
331 341
332 wd->cur_enabled = !e_widget_disabled_get(obj); 342 wd->cur_enabled = !e_widget_disabled_get(obj);
333 343
334 if (wd->cur_enabled) 344 if (wd->cur_enabled)
335 { 345 {
336 e_widget_disabled_set(wd->gui.list, 0); 346 e_widget_disabled_set(wd->gui.list, 0);
diff --git a/src/bin/e_widget_config_list.h b/src/bin/e_widget_config_list.h
index a77e97c..81080d2 100644
--- a/src/bin/e_widget_config_list.h
+++ b/src/bin/e_widget_config_list.h
@@ -6,11 +6,12 @@
6#ifndef E_WIDGET_CONFIG_LIST_H 6#ifndef E_WIDGET_CONFIG_LIST_H
7#define E_WIDGET_CONFIG_LIST_H 7#define E_WIDGET_CONFIG_LIST_H
8 8
9EAPI Evas_Object *e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas, char **val), const char *label); 9EAPI Evas_Object *e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas, char **val), const char *label, int listspan);
10EAPI int e_widget_config_list_count(Evas_Object *obj); 10EAPI int e_widget_config_list_count(Evas_Object *obj);
11EAPI const char *e_widget_config_list_nth_get(Evas_Object *obj, int n); 11EAPI const char *e_widget_config_list_nth_get(Evas_Object *obj, int n);
12EAPI void e_widget_config_list_append(Evas_Object *obj, const char *entry); 12EAPI void e_widget_config_list_append(Evas_Object *obj, const char *entry);
13EAPI void e_widget_config_list_object_append(Evas_Object *obj, Evas_Object *sobj, int col, int row, int colspan, int rowspan, int fill_w, int fill_h, int expand_w, int expand_h); 13EAPI void e_widget_config_list_object_append(Evas_Object *obj, Evas_Object *sobj, int col, int row, int colspan, int rowspan, int fill_w, int fill_h, int expand_w, int expand_h);
14EAPI void e_widget_config_list_clear(Evas_Object *obj);
14 15
15#endif 16#endif
16#endif 17#endif