blob: 660a593e150212c42a7bbe5ecab8e2777258889b [file] [log] [blame]
oliverschmidt76872e82004-12-26 14:13:34 +00001/*
2 * Copyright (c) 2004, Adam Dunkels.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following
12 * disclaimer in the documentation and/or other materials provided
13 * with the distribution.
14 * 3. All advertising materials mentioning features or use of this
15 * software must display the following acknowledgement:
16 * This product includes software developed by Adam Dunkels.
17 * 4. The name of the author may not be used to endorse or promote
18 * products derived from this software without specific prior
19 * written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 * This file is part of the Contiki desktop environment
34 *
oliverschmidt356f3662005-05-22 14:04:00 +000035 * $Id: configedit.c,v 1.9 2005/05/22 14:04:01 oliverschmidt Exp $
oliverschmidt76872e82004-12-26 14:13:34 +000036 *
37 */
38
39
40#include <string.h>
oliverschmidt76872e82004-12-26 14:13:34 +000041
42#include "uiplib.h"
43#include "resolv.h"
oliverschmidtd5011942005-05-13 00:00:16 +000044#include "uip_arp.h"
oliverschmidt76872e82004-12-26 14:13:34 +000045#include "ctk.h"
46
oliverschmidt2fa33232005-01-26 21:33:29 +000047#include "program-handler.h"
48#include "packet-service.h"
oliverschmidtbc1dc142005-04-12 21:54:08 +000049#include "kfs.h"
oliverschmidt4c19ccb2005-03-20 00:23:28 +000050#include "cfs.h"
oliverschmidt2fa33232005-01-26 21:33:29 +000051
oliverschmidt0dca9282005-05-06 00:05:46 +000052#include "ctk-textentry-checkbox.h"
53
oliverschmidt76872e82004-12-26 14:13:34 +000054#include "config.h"
55
56
57static config_t config;
58static struct ctk_window window;
59
60#ifdef __APPLE2ENH__
61
62static struct ctk_label backgroundlabel =
oliverschmidtd5011942005-05-13 00:00:16 +000063 {CTK_LABEL(0, 1, 11, 1, "Background")};
oliverschmidt76872e82004-12-26 14:13:34 +000064static char bkgnd[2];
65static struct ctk_textentry backgroundtextentry =
oliverschmidtd5011942005-05-13 00:00:16 +000066 {CTK_TEXTENTRY_INPUT(12, 1, 1, 1, bkgnd, 1, ctk_textentry_checkbox_input)};
oliverschmidt76872e82004-12-26 14:13:34 +000067static struct ctk_label backgrounddescr =
68 {CTK_LABEL(16, 1, 12, 1, "('x' or ' ')")};
69
70#endif /* __APPLE2ENH__ */
71
oliverschmidtd5011942005-05-13 00:00:16 +000072static struct ctk_label screensaverlabel =
73 {CTK_LABEL(0, 3, 11, 1, "Screensaver")};
74static char screensaver[16];
75static struct ctk_textentry screensavertextentry =
76 {CTK_TEXTENTRY(12, 3, 15, 1, screensaver, 15)};
77
78static struct ctk_label timeoutlabel =
79 {CTK_LABEL(0, 4, 11, 1, "Timeout")};
80static char timeout[2];
81static struct ctk_textentry timeouttextentry =
82 {CTK_TEXTENTRY(12, 4, 1, 1, timeout, 1)};
83static struct ctk_label timeoutdescr =
84 {CTK_LABEL(16, 4, 12, 1, "(in Minutes)")};
oliverschmidt76872e82004-12-26 14:13:34 +000085
oliverschmidt2fa33232005-01-26 21:33:29 +000086static struct ctk_label driverlabel =
oliverschmidtd5011942005-05-13 00:00:16 +000087 {CTK_LABEL(0, 6, 11, 1, "LAN driver")};
oliverschmidt2fa33232005-01-26 21:33:29 +000088static char driver[16];
89static struct ctk_textentry drivertextentry =
oliverschmidtd5011942005-05-13 00:00:16 +000090 {CTK_TEXTENTRY(12, 6, 15, 1, driver, 15)};
91
92static struct ctk_label slotlabel =
93 {CTK_LABEL(0, 7, 11, 1, "LAN slot")};
94static char slot[2];
95static struct ctk_textentry slottextentry =
96 {CTK_TEXTENTRY(12, 7, 1, 1, slot, 1)};
97static struct ctk_label slotdescr =
98 {CTK_LABEL(16, 7, 12, 1, "('1' to '7')")};
oliverschmidt2fa33232005-01-26 21:33:29 +000099
oliverschmidt76872e82004-12-26 14:13:34 +0000100static struct ctk_label ipaddrlabel =
oliverschmidtd5011942005-05-13 00:00:16 +0000101 {CTK_LABEL(0, 9, 10, 1, "IP address")};
oliverschmidt76872e82004-12-26 14:13:34 +0000102static char ipaddr[16];
103static struct ctk_textentry ipaddrtextentry =
oliverschmidtd5011942005-05-13 00:00:16 +0000104 {CTK_TEXTENTRY(12, 9, 15, 1, ipaddr, 15)};
oliverschmidt76872e82004-12-26 14:13:34 +0000105
106#ifdef WITH_ETHERNET
107
108static struct ctk_label netmasklabel =
oliverschmidtd5011942005-05-13 00:00:16 +0000109 {CTK_LABEL(0, 10, 11, 1, "Netmask")};
oliverschmidt76872e82004-12-26 14:13:34 +0000110static char netmask[16];
111static struct ctk_textentry netmasktextentry =
oliverschmidtd5011942005-05-13 00:00:16 +0000112 {CTK_TEXTENTRY(12, 10, 15, 1, netmask, 15)};
oliverschmidt76872e82004-12-26 14:13:34 +0000113
114static struct ctk_label gatewaylabel =
oliverschmidtd5011942005-05-13 00:00:16 +0000115 {CTK_LABEL(0, 11, 11, 1, "Gateway")};
oliverschmidt76872e82004-12-26 14:13:34 +0000116static char gateway[16];
117static struct ctk_textentry gatewaytextentry =
oliverschmidtd5011942005-05-13 00:00:16 +0000118 {CTK_TEXTENTRY(12, 11, 15, 1, gateway, 15)};
oliverschmidt76872e82004-12-26 14:13:34 +0000119
120static struct ctk_label dnsserverlabel =
oliverschmidtd5011942005-05-13 00:00:16 +0000121 {CTK_LABEL(0, 12, 11, 1, "DNS server")};
oliverschmidt76872e82004-12-26 14:13:34 +0000122static char dnsserver[16];
123static struct ctk_textentry dnsservertextentry =
oliverschmidtd5011942005-05-13 00:00:16 +0000124 {CTK_TEXTENTRY(12, 12, 15, 1, dnsserver, 15)};
125
126static struct ctk_label maclsblabel =
oliverschmidteb79d842005-05-16 12:56:14 +0000127 {CTK_LABEL(0, 14, 11, 1, "MAC address")};
oliverschmidtd5011942005-05-13 00:00:16 +0000128static char maclsb[4];
129static struct ctk_textentry maclsbtextentry =
130 {CTK_TEXTENTRY(12, 14, 3, 1, maclsb, 3)};
oliverschmidteb79d842005-05-16 12:56:14 +0000131static struct ctk_label maclsbdescr =
132 {CTK_LABEL(18, 14, 10, 1, "(LSB only)")};
oliverschmidt76872e82004-12-26 14:13:34 +0000133
134#else /* WITH_ETHERNET */
135
136static struct ctk_label dnsserverlabel =
oliverschmidtd5011942005-05-13 00:00:16 +0000137 {CTK_LABEL(0, 10, 11, 1, "DNS server")};
oliverschmidt76872e82004-12-26 14:13:34 +0000138static char dnsserver[16];
139static struct ctk_textentry dnsservertextentry =
oliverschmidtd5011942005-05-13 00:00:16 +0000140 {CTK_TEXTENTRY(12, 10, 15, 1, dnsserver, 15)};
oliverschmidt76872e82004-12-26 14:13:34 +0000141
142#endif /* WITH_ETHERNET */
143
144static struct ctk_button okbutton =
oliverschmidtd5011942005-05-13 00:00:16 +0000145 {CTK_BUTTON(0, 16, 12, "Save & close")};
oliverschmidt76872e82004-12-26 14:13:34 +0000146static struct ctk_button cancelbutton =
oliverschmidtd5011942005-05-13 00:00:16 +0000147 {CTK_BUTTON(22, 16, 6, "Cancel")};
oliverschmidt76872e82004-12-26 14:13:34 +0000148
oliverschmidt356f3662005-05-22 14:04:00 +0000149
150static struct ctk_window errordialog;
151
152static struct ctk_label errormsg =
153 {CTK_LABEL(0, 1, 19, 1, "Error saving config")};
154static struct ctk_button errorokbutton =
155 {CTK_BUTTON(7, 3, 2, "Ok")};
156
157
oliverschmidt76872e82004-12-26 14:13:34 +0000158EK_EVENTHANDLER(config_eventhandler, ev, data);
159EK_PROCESS(p, "Configuration", EK_PRIO_NORMAL,
160 config_eventhandler, NULL, NULL);
161static ek_id_t id = EK_ID_NONE;
oliverschmidt3b308a62005-02-01 00:21:36 +0000162static ek_id_t driverid = EK_ID_NONE;
oliverschmidt76872e82004-12-26 14:13:34 +0000163
164/*-----------------------------------------------------------------------------------*/
165LOADER_INIT_FUNC(config_init, arg)
166{
167 arg_free(arg);
168
169 if(id == EK_ID_NONE) {
170 id = ek_start(&p);
171 }
172}
173/*-----------------------------------------------------------------------------------*/
174static char *
175makebyte(u8_t byte, char *str)
176{
177 if(byte >= 100) {
178 *str++ = (byte / 100 ) % 10 + '0';
179 }
180 if(byte >= 10) {
181 *str++ = (byte / 10) % 10 + '0';
182 }
183 *str++ = (byte % 10) + '0';
184
185 return str;
186}
187/*-----------------------------------------------------------------------------------*/
188static void
189makeaddr(u16_t *addr, char *str)
190{
191 str = makebyte(HTONS(addr[0]) >> 8, str);
192 *str++ = '.';
193 str = makebyte(HTONS(addr[0]) & 0xff, str);
194 *str++ = '.';
195 str = makebyte(HTONS(addr[1]) >> 8, str);
196 *str++ = '.';
197 str = makebyte(HTONS(addr[1]) & 0xff, str);
198 *str++ = 0;
199}
200/*-----------------------------------------------------------------------------------*/
oliverschmidt2fa33232005-01-26 21:33:29 +0000201static int
202makedriver(const char *name, char *str)
203{
204 char *pattern = PACKET_SERVICE_NAME ": ";
205
206 while(*pattern) {
207 if(*name++ != *pattern++) {
208 return 0;
209 }
210 }
211
212 while(*name) {
213 *str++ = *name++;
214 }
215 strcpy(str, ".drv");
216
217 return 1;
218}
219/*-----------------------------------------------------------------------------------*/
oliverschmidt76872e82004-12-26 14:13:34 +0000220static void
221makestrings(void)
222{
223 u16_t addr[2], *addrptr;
oliverschmidt2fa33232005-01-26 21:33:29 +0000224 struct ek_proc *p;
oliverschmidt76872e82004-12-26 14:13:34 +0000225
226#ifdef __APPLE2ENH__
227
228 if(ctk_draw_getbackground()) {
229 *bkgnd = 'x';
230 }
231
232#endif /* __APPLE2ENH__ */
233
oliverschmidtd5011942005-05-13 00:00:16 +0000234 strncpy(screensaver, program_handler_getscreensaver(), sizeof(screensaver));
235
236 *timeout = (CTK_SCREENSAVER_TIMEOUT() / 60) % 10 + '0';
oliverschmidt2fa33232005-01-26 21:33:29 +0000237
238 for(p = EK_PROCS(); p != NULL; p = p->next) {
239 if(makedriver(p->name, driver)) {
oliverschmidt3b308a62005-02-01 00:21:36 +0000240 driverid = p->id;
oliverschmidt2fa33232005-01-26 21:33:29 +0000241 break;
242 }
243 }
244
oliverschmidt356f3662005-05-22 14:04:00 +0000245 if(config_getlanslot() != 0) {
246 *slot = config_getlanslot() + '0';
247 }
oliverschmidtd5011942005-05-13 00:00:16 +0000248
oliverschmidt76872e82004-12-26 14:13:34 +0000249#ifdef WITH_UIP
250
251 uip_gethostaddr(addr);
252 makeaddr(addr, ipaddr);
253
254#ifdef WITH_ETHERNET
255
256 uip_getnetmask(addr);
257 makeaddr(addr, netmask);
258
259 uip_getdraddr(addr);
260 makeaddr(addr, gateway);
261
oliverschmidtd5011942005-05-13 00:00:16 +0000262 makebyte(uip_ethaddr.addr[5], maclsb);
263
oliverschmidt76872e82004-12-26 14:13:34 +0000264#endif /* WITH_ETHERNET */
265
266 addrptr = resolv_getserver();
267 if(addrptr != NULL) {
268 makeaddr(addrptr, dnsserver);
269 }
270
271#endif /* WITH_UIP */
272
273}
274/*-----------------------------------------------------------------------------------*/
275static void
276nullterminate(char *cptr)
277{
278 /* Find the first space character in the ipaddr and put a zero there
279 to end the string. */
280 for(; *cptr != ' ' && *cptr != 0; ++cptr);
281 *cptr = 0;
282}
283/*-----------------------------------------------------------------------------------*/
284static void
285makeconfig(void)
286{
287 u16_t addr[2];
oliverschmidtd5011942005-05-13 00:00:16 +0000288 char *cptr;
289 u8_t tmp;
oliverschmidt76872e82004-12-26 14:13:34 +0000290
291#ifdef __APPLE2ENH__
292
oliverschmidt0dca9282005-05-06 00:05:46 +0000293 config.bkgnd = (*bkgnd == 'x');
oliverschmidt76872e82004-12-26 14:13:34 +0000294
295#endif /* __APPLE2ENH__ */
296
oliverschmidtd5011942005-05-13 00:00:16 +0000297 nullterminate(screensaver);
298 strcpy(config.screensaver, screensaver);
299
300 if(*timeout >= '1' && *timeout <= '9') {
301 config.timeout = *timeout - '0';
oliverschmidt76872e82004-12-26 14:13:34 +0000302 }
303
oliverschmidt2fa33232005-01-26 21:33:29 +0000304 nullterminate(driver);
305 strcpy(config.driver, driver);
306
oliverschmidtd5011942005-05-13 00:00:16 +0000307 if(*slot >= '1' && *slot <= '7') {
308 config.slot = *slot - '0';
oliverschmidt356f3662005-05-22 14:04:00 +0000309 } else {
310 config.slot = 0;
oliverschmidtd5011942005-05-13 00:00:16 +0000311 }
312
oliverschmidt76872e82004-12-26 14:13:34 +0000313#ifdef WITH_UIP
314
315 nullterminate(ipaddr);
316 if(uiplib_ipaddrconv(ipaddr, (unsigned char *)addr)) {
317 config.ipaddr[0] = addr[0];
318 config.ipaddr[1] = addr[1];
319 }
320
321#ifdef WITH_ETHERNET
322
323 nullterminate(netmask);
324 if(uiplib_ipaddrconv(netmask, (unsigned char *)addr)) {
325 config.netmask[0] = addr[0];
326 config.netmask[1] = addr[1];
327 }
328
329 nullterminate(gateway);
330 if(uiplib_ipaddrconv(gateway, (unsigned char *)addr)) {
331 config.gateway[0] = addr[0];
332 config.gateway[1] = addr[1];
333 }
334
oliverschmidtd5011942005-05-13 00:00:16 +0000335 *(char *)0x02FF = 0;
336 tmp = 0;
337 for(cptr = maclsb; *cptr >= '0' && *cptr <= '9'; ++cptr) {
338 tmp = (tmp * 10) + (*cptr - '0');
339 }
340 if(tmp != 0) {
341 config.maclsb = tmp;
342 }
343
oliverschmidt76872e82004-12-26 14:13:34 +0000344#endif /* WITH_ETHERNET */
345
346 nullterminate(dnsserver);
347 if(uiplib_ipaddrconv(dnsserver, (unsigned char *)addr)) {
348 config.dnsserver[0] = addr[0];
349 config.dnsserver[1] = addr[1];
350 }
351
352#endif /* WITH_UIP */
353}
354/*-----------------------------------------------------------------------------------*/
355static void
356config_apply(void)
357{
358#ifdef __APPLE2ENH__
359
360 ctk_draw_setbackground(config.bkgnd);
361
362#endif /* __APPLE2ENH__ */
363
oliverschmidtd5011942005-05-13 00:00:16 +0000364 program_handler_setscreensaver(config.screensaver);
365
366 CTK_SCREENSAVER_SET_TIMEOUT(config.timeout * 60);
367
oliverschmidt3b308a62005-02-01 00:21:36 +0000368 if(driverid != EK_ID_NONE) {
369 ek_post(driverid, EK_EVENT_REQUEST_EXIT, NULL);
370 }
371
oliverschmidt2fa33232005-01-26 21:33:29 +0000372 config_setlanslot(config.slot);
373
374 if(*config.driver) {
375 program_handler_load(config.driver, NULL);
376 }
377
oliverschmidt76872e82004-12-26 14:13:34 +0000378#ifdef WITH_UIP
379
380 uip_sethostaddr(config.ipaddr);
381
382#ifdef WITH_ETHERNET
383
384 uip_setnetmask(config.netmask);
385 uip_setdraddr(config.gateway);
oliverschmidtd5011942005-05-13 00:00:16 +0000386 uip_ethaddr.addr[5] = config.maclsb;
oliverschmidt76872e82004-12-26 14:13:34 +0000387
388#endif /* WITH_ETHERNET */
389
390 resolv_conf(config.dnsserver);
391
392#endif /* WITH_UIP */
393}
394/*-----------------------------------------------------------------------------------*/
oliverschmidt356f3662005-05-22 14:04:00 +0000395static int
oliverschmidt76872e82004-12-26 14:13:34 +0000396config_save(void)
397{
oliverschmidt356f3662005-05-22 14:04:00 +0000398 int fd, written = 0;
oliverschmidt76872e82004-12-26 14:13:34 +0000399
oliverschmidtbc1dc142005-04-12 21:54:08 +0000400 fd = cfs_open(strcat(kfs_getdir(), "contiki.cfg"), CFS_WRITE);
oliverschmidt356f3662005-05-22 14:04:00 +0000401 if(fd != -1) {
402 written = cfs_write(fd, &config, sizeof(config));
403 cfs_close(fd);
oliverschmidt76872e82004-12-26 14:13:34 +0000404 }
oliverschmidt356f3662005-05-22 14:04:00 +0000405 return written == sizeof(config);
oliverschmidt76872e82004-12-26 14:13:34 +0000406}
407/*-----------------------------------------------------------------------------------*/
408EK_EVENTHANDLER(config_eventhandler, ev, data)
409{
410 EK_EVENTHANDLER_ARGS(ev, data);
411
412 if(ev == EK_EVENT_INIT) {
oliverschmidtd5011942005-05-13 00:00:16 +0000413 ctk_window_new(&window, 30, 17, "Config editor");
oliverschmidt76872e82004-12-26 14:13:34 +0000414#ifdef __APPLE2ENH__
415 CTK_WIDGET_ADD(&window, &backgroundlabel);
416 CTK_WIDGET_ADD(&window, &backgroundtextentry);
417 CTK_WIDGET_ADD(&window, &backgrounddescr);
418#endif /* __APPLE2ENH__ */
oliverschmidtd5011942005-05-13 00:00:16 +0000419 CTK_WIDGET_ADD(&window, &screensaverlabel);
420 CTK_WIDGET_ADD(&window, &screensavertextentry);
421 CTK_WIDGET_ADD(&window, &timeoutlabel);
422 CTK_WIDGET_ADD(&window, &timeouttextentry);
423 CTK_WIDGET_ADD(&window, &timeoutdescr);
424 CTK_WIDGET_ADD(&window, &driverlabel);
425 CTK_WIDGET_ADD(&window, &drivertextentry);
oliverschmidt76872e82004-12-26 14:13:34 +0000426 CTK_WIDGET_ADD(&window, &slotlabel);
427 CTK_WIDGET_ADD(&window, &slottextentry);
428 CTK_WIDGET_ADD(&window, &slotdescr);
oliverschmidt2fa33232005-01-26 21:33:29 +0000429 CTK_WIDGET_ADD(&window, &ipaddrlabel);
oliverschmidt76872e82004-12-26 14:13:34 +0000430 CTK_WIDGET_ADD(&window, &ipaddrtextentry);
431#ifdef WITH_ETHERNET
432 CTK_WIDGET_ADD(&window, &netmasklabel);
433 CTK_WIDGET_ADD(&window, &netmasktextentry);
434 CTK_WIDGET_ADD(&window, &gatewaylabel);
435 CTK_WIDGET_ADD(&window, &gatewaytextentry);
436#endif /* WITH_ETHERNET */
437 CTK_WIDGET_ADD(&window, &dnsserverlabel);
438 CTK_WIDGET_ADD(&window, &dnsservertextentry);
oliverschmidtd5011942005-05-13 00:00:16 +0000439#ifdef WITH_ETHERNET
440 CTK_WIDGET_ADD(&window, &maclsblabel);
441 CTK_WIDGET_ADD(&window, &maclsbtextentry);
oliverschmidteb79d842005-05-16 12:56:14 +0000442 CTK_WIDGET_ADD(&window, &maclsbdescr);
oliverschmidtd5011942005-05-13 00:00:16 +0000443#endif /* WITH_ETHERNET */
oliverschmidt76872e82004-12-26 14:13:34 +0000444 CTK_WIDGET_ADD(&window, &okbutton);
445 CTK_WIDGET_ADD(&window, &cancelbutton);
446#ifdef __APPLE2ENH__
447 CTK_WIDGET_FOCUS(&window, &backgroundtextentry);
448#else /* __APPLE2ENH__ */
oliverschmidtd5011942005-05-13 00:00:16 +0000449 CTK_WIDGET_FOCUS(&window, &screensavertextentry);
oliverschmidt76872e82004-12-26 14:13:34 +0000450#endif /* __APPLE2ENH__ */
451
oliverschmidt356f3662005-05-22 14:04:00 +0000452 ctk_dialog_new(&errordialog, 19, 5);
453 CTK_WIDGET_ADD(&errordialog, &errormsg);
454 CTK_WIDGET_ADD(&errordialog, &errorokbutton);
455 CTK_WIDGET_FOCUS(&errordialog, &errorokbutton);
456
oliverschmidt76872e82004-12-26 14:13:34 +0000457 /* Fill the configuration strings with values from the current
458 configuration */
459 makestrings();
460 ctk_window_open(&window);
461 } else if(ev == ctk_signal_button_activate) {
462 if(data == (ek_data_t)&okbutton) {
463
464 /* Fill the configuration with values from the current
465 configuration strings */
466 makeconfig();
oliverschmidt356f3662005-05-22 14:04:00 +0000467 if(config_save()) {
468 config_apply();
469 goto quit;
470 }
471 ctk_dialog_open(&errordialog);
472 } else if(data == (ek_data_t)&errorokbutton) {
473 ctk_dialog_close();
oliverschmidt76872e82004-12-26 14:13:34 +0000474 goto quit;
475 } else if(data == (ek_data_t)&cancelbutton) {
476 goto quit;
477 }
478
479 } else if(ev == ctk_signal_window_close ||
480 ev == EK_EVENT_REQUEST_EXIT) {
481 goto quit;
482 }
483 return;
484
485quit:
486 ctk_window_close(&window);
487 ek_exit();
488 id = EK_ID_NONE;
489 LOADER_UNLOAD();
490}
491/*-----------------------------------------------------------------------------------*/