Initial push
[shermanaquarium] / sherman-aquarium / shermans / pref.c
1
2 /*
3
4   Preference window for Sherman's aquarium, 
5   using the General Applet Interface.
6
7   Preference generator v2 interface.
8
9 */
10
11 #include <stdio.h>
12 #include <gai/gai.h>
13 #include <stdlib.h>
14 #include <time.h>
15 #include <string.h>
16 #include "../config.h"
17
18 #include "clock.h"
19 #include "date.h"
20 #include "background.h"
21 #include "soundeffects.h"
22 #include "bottom.h"
23 #include "bubble.h"
24 #include "fish.h"
25 #include "over.h"
26 #include "leds.h"
27 #include "thermometer.h"
28 #ifdef XMMS
29 #include "xmms_sn.h"
30 #endif
31 #include "settings.h"
32 #include "status.h"
33 #include "tetris.h"
34
35 static Date_settings date_settings;
36 static Clock_settings clock_settings;
37 static Background_settings background_settings;
38 static Sound_settings sound_settings;
39 static Bottom_settings bottom_settings;
40 static Bubble_settings bubble_settings;
41 static Fish_settings fish_settings;
42 static Over_settings over_settings;
43 static Leds_settings leds_settings;
44 static Thermometer_settings thermometer_settings;
45 static Tetris_settings tetris_settings;
46 #ifdef XMMS
47 static Xmms_sn_settings xmms_settings;
48 #endif
49 static General_settings general_settings;
50
51 static char *draw_list[] = {"Background", "Forground",NULL};
52 static char *vert_list[] = {"Top", "Center", "Bottom", NULL};
53 static char *horz_list[] = {"Left", "Center", "Right", NULL};
54 static char *vert_horz_list[] = {"Vertical", "Horizontal", NULL};
55 #ifdef XMMS
56 static char *xmms_scroll_list[] = {"Vertical","Horizontal",NULL};
57 #endif
58
59
60 static char *clock_type_list[] = {"Off", "Analog", "Digital", "Fuzzy",NULL};
61 static char *clock_fontsize_list[] = {"Large", "Small", NULL};
62 static char *bg_names[] = {"Solid colour", "Shaded colour", "Wateralike", "Image", NULL};
63 static char *sound_type[] = {"Use Mp3 files for sound effects", "Use Ogg files for sound effects", NULL};
64 static char *leds_func_list[] = {"Off", "Numlock", "Capslock", "Scrollock", NULL};
65 static char *leds_colour_list[] = {"Blue", "Blue-Green", "Orange", "Red", "Violet", "Yellow", "Pink", "Green", "Dark Blue", "Light blue", "Yellow-Green", NULL};
66 static char *mouse_list[] = {"Off", "Executes", NULL};
67
68 static GaiSS l_0_1000_1 = {0, 1000, 1}, l_0_100_1 = {0,100,1}, l_10_1000_5 = {10, 1000, 5}, l_0_50_1 = {0,50,1};
69 static GaiSS l_1_20_1 = {1, 20, 1},  l_0_200_1 = {0, 200, 1}, l_0_100_5 = {0, 100, 5}, l_0_1000000_1 = {0,1000000,1};
70 static GaiSS l_0_255_1 = {0, 255, 1}, l_4_50_1 = {4, 50, 1};
71
72 static char *fish_radio[] = {"User defined selection and population", 
73                              "Random selection and given population size", 
74                              "Random selection and random population size", 
75                              NULL};
76
77 static char *over_radio[] = {"Nothing", "Matrix scroller", "Plasma", "Tetris", NULL};
78
79
80 static char *messure_list[] = {
81                                "Off",
82 #ifdef STATUS_HAVE_FAN1
83                                "Fan 1",
84 #endif 
85 #ifdef STATUS_HAVE_FAN2
86                                "Fan 2",
87 #endif 
88 #ifdef STATUS_HAVE_TEMP1
89                                "Thermometer 1 (CPU)",
90 #endif 
91 #ifdef STATUS_HAVE_TEMP2
92                                "Thermometer 2 (Motherboard)",
93 #endif 
94 #ifdef STATUS_HAVE_SWAP
95                                "Swap usage",
96 #endif 
97 #ifdef STATUS_HAVE_DISC
98                                "Disc usage",
99 #endif 
100 #ifdef STATUS_HAVE_CPU
101                                "CPU load",
102 #endif 
103 #ifdef STATUS_HAVE_MEM
104                                "Memory usage",
105 #endif 
106 #ifdef STATUS_HAVE_NET_ETH0
107                                "Network ETH0 (1st network card) recieve",
108                                "Network ETH0 (1st network card) send",
109                                "Network ETH0 (1st network card) mixed",
110 #endif 
111 #ifdef STATUS_HAVE_NET_ETH1
112                                "Network ETH1 (2nd network card) recieve",
113                                "Network ETH1 (2nd network card) send",
114                                "Network ETH1 (2nd network card) mixed",
115
116 #endif 
117 #ifdef STATUS_HAVE_NET_PPP0
118                                "Network: PPP0 (Dial-up modem) recieve",
119                                "Network: PPP0 (Dial-up modem) send",
120                                "Network: PPP0 (Dial-up modem) mixed",
121 #endif 
122 #ifdef STATUS_HAVE_NET_LO
123                                "Network: Loopback recieve",
124                                "Network: Loopback send",
125                                "Network: Loopback mixed",
126 #endif
127                                NULL}; 
128
129
130 GaiPI shermans_pref[] = {
131
132
133
134 /*--------------------------------------------------------------------------------*/
135 /* General */
136 /*--------------------------------------------------------------------------------*/
137
138
139
140 {GAI_NOTEBOOK, "General"},
141 {GAI_FRAME, "Sound format"},
142      {GAI_CHECKBUTTON, "Sound effects",&sound_settings.on, &sound_settings.on},
143      {GAI_TEXTENTRY, "External sound playing program: ", &sound_settings.prg, &sound_settings.prg},
144      {GAI_RADIOBUTTON, sound_type, &sound_settings.type, &sound_settings.type},
145 {GAI_FRAME_E},
146
147 {GAI_FRAME_R, "Applet size ratio"},
148      {GAI_SPINBUTTON, "Width:",  &general_settings.ratio_width,  &general_settings.ratio_width, &l_1_20_1},
149      {GAI_SPINBUTTON, "Height:",  &general_settings.ratio_height,  &general_settings.ratio_height, &l_1_20_1},
150      {GAI_TEXT,  "The ratios might be compromised\n"
151             "in order to fit the gnome panel.\n"
152             "When the gnome panel is in vertical\n"
153             "mode, the ratios will be rotated 90\n"
154             "degrees."},
155 {GAI_FRAME_E},
156 {GAI_SPINBUTTON, "Max bubbles", &bubble_settings.max_bubbles,  &bubble_settings.max_bubbles, &l_0_1000_1},
157
158 {GAI_FRAME, "Bottom"},
159      {GAI_CHECKBUTTON, "Have sea floor", &bottom_settings.have_sea_floor, &bottom_settings.have_sea_floor},
160      {GAI_CHECKBUTTON, "Random number of plants up to the number below", &bottom_settings.random_plants, &bottom_settings.random_plants},
161      {GAI_SPINBUTTON, "Number of plants:",  &bottom_settings.max_plants,&bottom_settings.max_plants, &l_0_100_1},
162      {GAI_SPINBUTTON, "Scale  of plants:",  &bottom_settings.scale,&bottom_settings.scale, &l_10_1000_5},
163      {GAI_SPINBUTTON, "Number of bottom animals:", &bottom_settings.num_bottom_animals,  &bottom_settings.num_bottom_animals, &l_0_50_1},
164 {GAI_FRAME_E},
165
166 /*--------------------------------------------------------------------------------*/
167 /* Background settings */
168 /*--------------------------------------------------------------------------------*/
169
170 {GAI_FRAME_R, "Background"},
171      {GAI_RADIOBUTTON, bg_names, &background_settings.type,  &background_settings.type},
172      {GAI_COLORSELECTOR, "Solid colour", &background_settings.solid_c, &background_settings.solid_c}, // r1
173      {GAI_COLORSELECTOR, "Shaded - Top colour", &background_settings.shaded_top_c, &background_settings.shaded_top_c}, /// r2, r2
174      {GAI_COLORSELECTOR, "Shaded - Bottom colour", &background_settings.shaded_bot_c, &background_settings.shaded_bot_c},
175      {GAI_FILESELECTOR, "Background image", &background_settings.imagename, &background_settings.imagename_new},
176 {GAI_FRAME_E},
177
178 {GAI_NOTEBOOK_E},
179
180 /*--------------------------------------------------------------------------------*/
181 /* Mouse */
182 /*--------------------------------------------------------------------------------*/
183
184 {GAI_NOTEBOOK, "Mouse"},
185 {GAI_FRAME, "Mouse clicks"},
186
187 {GAI_FRAME, "Left button"},
188 {GAI_OPTIONMENU, "Does: ", &general_settings.mouse_left, &general_settings.mouse_left, mouse_list},
189 {GAI_TEXTENTRY, "Option: ", &general_settings.mouse_left_option, &general_settings.mouse_left_option},
190 {GAI_FRAME_E},
191 {GAI_FRAME_R, "Middle button"},
192 {GAI_OPTIONMENU, "Does: ", &general_settings.mouse_middle, &general_settings.mouse_middle, mouse_list},
193 {GAI_TEXTENTRY, "Option: ", &general_settings.mouse_middle_option, &general_settings.mouse_middle_option},
194 {GAI_FRAME_E},
195
196 {GAI_FRAME, "Scroll button up"},
197 {GAI_OPTIONMENU, "Does: ", &general_settings.mouse_up, &general_settings.mouse_up, mouse_list},
198 {GAI_TEXTENTRY, "Option: ", &general_settings.mouse_up_option, &general_settings.mouse_up_option},
199 {GAI_FRAME_E},
200 {GAI_FRAME_R, "Scroll button button down"},
201 {GAI_OPTIONMENU, "Does: ", &general_settings.mouse_down, &general_settings.mouse_down, mouse_list},
202 {GAI_TEXTENTRY, "Option: ", &general_settings.mouse_down_option, &general_settings.mouse_down_option},
203 {GAI_FRAME_E},
204
205
206 {GAI_FRAME_E},
207 {GAI_NOTEBOOK_E},
208
209
210 /*--------------------------------------------------------------------------------*/
211 /* Time */
212 /*--------------------------------------------------------------------------------*/
213 {GAI_NOTEBOOK, "Time"},
214 {GAI_FRAME, "Date"},
215      {GAI_CHECKBUTTON, "On", &date_settings.on, &date_settings.on},
216      {GAI_OPTIONMENU, "Draw on:", &date_settings.draw, &date_settings.draw, draw_list},
217      {GAI_OPTIONMENU, "Vertical placement:", &date_settings.vert, &date_settings.vert, vert_list},
218      {GAI_OPTIONMENU, "Horizontal placement:", &date_settings.horz, &date_settings.horz, horz_list}, 
219      {GAI_COLORSELECTOR, "Font colour",&date_settings.c,&date_settings.c},
220 {GAI_FRAME_E},
221
222 {GAI_FRAME, "Clock"},
223      {GAI_OPTIONMENU, "Vertical placement:", &clock_settings.vert, &clock_settings.vert, vert_list},
224      {GAI_OPTIONMENU, "Horizontal placement:", &clock_settings.horz, &clock_settings.horz, horz_list},
225      {GAI_OPTIONMENU, "Draw on:", &clock_settings.draw, &clock_settings.draw, draw_list},
226      {GAI_OPTIONMENU, "Clock type:", &clock_settings.type, &clock_settings.type,clock_type_list},
227      {GAI_FRAME, "Analog"},
228           {GAI_CHECKBUTTON, "Keep the clock circular", &clock_settings.analog_keep_circular, &clock_settings.analog_keep_circular},
229           {GAI_COLORSELECTOR, "Colour of the hour pointer",&clock_settings.analog_colour_hour, &clock_settings.analog_colour_hour},
230           {GAI_COLORSELECTOR, "Colour of the minute pointer",&clock_settings.analog_colour_min, &clock_settings.analog_colour_min},
231           {GAI_COLORSELECTOR, "Colour of the second pointer", &clock_settings.analog_colour_sec, &clock_settings.analog_colour_sec},
232           {GAI_CHECKBUTTON, "With seconds",  &clock_settings.analog_seconds, &clock_settings.analog_seconds},
233      {GAI_FRAME_E},
234      {GAI_FRAME_R, "Digital"},
235           {GAI_OPTIONMENU, "Font size:", &clock_settings.digital_fontsize, &clock_settings.digital_fontsize, clock_fontsize_list},
236           {GAI_CHECKBUTTON, "Make the colon blink", &clock_settings.digital_blinking, &clock_settings.digital_blinking},
237           {GAI_COLORSELECTOR, "Font colour", &clock_settings.digital_colour, &clock_settings.digital_colour},
238           {GAI_CHECKBUTTON, "With seconds", &clock_settings.digital_seconds, &clock_settings.digital_seconds},
239      {GAI_FRAME_E},
240      {GAI_FRAME, "Fuzzy"},
241           {GAI_COLORSELECTOR, "Font colour", &clock_settings.fuzzy_colour, &clock_settings.fuzzy_colour},
242      {GAI_FRAME_E},
243 {GAI_FRAME_E},
244 {GAI_NOTEBOOK_E},
245
246
247 /*--------------------------------------------------------------------------------*/
248 /* Fish */
249 /*--------------------------------------------------------------------------------*/
250
251 {GAI_NOTEBOOK, "Fish"},
252
253 {GAI_FRAME, "Fish"},
254      {GAI_SPINBUTTON, "Fish 1:", &fish_settings.fish1, &fish_settings.fish1, &l_0_100_1},
255      {GAI_SPINBUTTON, "Fish 2:", &fish_settings.fish2, &fish_settings.fish2, &l_0_100_1},
256      {GAI_SPINBUTTON, "Fish 3:", &fish_settings.fish3, &fish_settings.fish3, &l_0_100_1},
257      {GAI_SPINBUTTON, "Fish 4:", &fish_settings.fish4, &fish_settings.fish4, &l_0_100_1},
258      {GAI_SPINBUTTON, "Fish 5:", &fish_settings.fish5, &fish_settings.fish5, &l_0_100_1},
259      {GAI_SPINBUTTON, "Fish 6:", &fish_settings.fish6, &fish_settings.fish6, &l_0_100_1},
260      {GAI_SPINBUTTON, "Swordfish:", &fish_settings.swordfish, &fish_settings.swordfish, &l_0_100_1},
261      {GAI_SPINBUTTON, "Blowfish:", &fish_settings.blowfish, &fish_settings.blowfish, &l_0_100_1},
262      {GAI_SPINBUTTON, "Bottomdweller:", &fish_settings.bdweller, &fish_settings.bdweller, &l_0_100_1},
263 {GAI_FRAME_E},
264 {GAI_FRAME_R, "More fish"},
265      {GAI_SPINBUTTON, "Fillmore:", &fish_settings.fillmore, &fish_settings.fillmore, &l_0_100_1},
266      {GAI_SPINBUTTON, "Sherman:", &fish_settings.sherman, &fish_settings.sherman, &l_0_100_1},
267      {GAI_SPINBUTTON, "Megan:", &fish_settings.megan, &fish_settings.megan, &l_0_100_1},
268      {GAI_SPINBUTTON, "Prey:", &fish_settings.prey, &fish_settings.prey, &l_0_100_1},
269      {GAI_SPINBUTTON, "Hunter:", &fish_settings.hunter, &fish_settings.hunter, &l_0_100_1},
270      {GAI_SPINBUTTON, "Lori:", &fish_settings.lori, &fish_settings.lori, &l_0_100_1},
271      {GAI_SPINBUTTON, "Ernest:", &fish_settings.ernest, &fish_settings.ernest, &l_0_100_1},
272      {GAI_SPINBUTTON, "Squid:", &fish_settings.squid, &fish_settings.squid, &l_0_100_1},
273      {GAI_SPINBUTTON, "Hawthorne:", &fish_settings.hawthorne, &fish_settings.hawthorne, &l_0_100_1},
274 {GAI_FRAME_E},
275
276 {GAI_FRAME, "Fish population"},
277      {GAI_RADIOBUTTON, fish_radio, &fish_settings.type, &fish_settings.type},
278      {GAI_SPINBUTTON, "Population size:",  &fish_settings.num_fish,  &fish_settings.num_fish, &l_0_200_1},
279 {GAI_FRAME_E},
280
281 {GAI_FRAME_R, "Fish behaviour"},
282      {GAI_CHECKBUTTON, "Eating prey fish is ok", &fish_settings.eat,  &fish_settings.eat},
283      {GAI_CHECKBUTTON, "Make blowfish explode is ok", &fish_settings.explode,  &fish_settings.explode},
284      {GAI_CHECKBUTTON, "Dead fish might be reborn", &fish_settings.rebirth, &fish_settings.rebirth},
285      {GAI_CHECKBUTTON,  "Fish from the same kind may differ in size.", &fish_settings.scale_diff, &fish_settings.scale_diff},
286      {GAI_SPINBUTTON, "Scale (in %):",  &fish_settings.scale,  &fish_settings.scale, &l_10_1000_5},
287      {GAI_SPINBUTTON, "Speed (in %):", &fish_settings.speed, &fish_settings.speed, &l_10_1000_5},
288      {GAI_SPINBUTTON, "Hunter agressiveness (in %):", &fish_settings.hunter_agr,  &fish_settings.hunter_agr, &l_0_100_5},
289      {GAI_SPINBUTTON, "Swordfish agressiveness (in %):", &fish_settings.swordfish_agr,  &fish_settings.swordfish_agr, &l_0_100_5},
290 {GAI_FRAME_E},
291 {GAI_NOTEBOOK_E},
292
293 /*--------------------------------------------------------------------------------*/
294 /* Thermometer */
295 /*--------------------------------------------------------------------------------*/
296
297 {GAI_NOTEBOOK, "Thermometer"},
298 {GAI_FRAME,"First Thermometer"},
299      {GAI_OPTIONMENU, "Draw on: ", &thermometer_settings.draw1, &thermometer_settings.draw1, draw_list}, 
300      {GAI_OPTIONMENU, "Vertical placement: ", &thermometer_settings.vert1, &thermometer_settings.vert1, vert_list}, 
301      {GAI_OPTIONMENU, "Horizontal placement: ", &thermometer_settings.horz1, &thermometer_settings.horz1, horz_list}, 
302      {GAI_CHECKBUTTON, "Split", &thermometer_settings.split1,&thermometer_settings.split1},
303      {GAI_COLORSELECTOR, "Thermometer colour: ", &thermometer_settings.c1, &thermometer_settings.c1},
304      {GAI_OPTIONMENU, "Messures: ", &thermometer_settings.messure1, &thermometer_settings.messure1, messure_list},
305      {GAI_SPINBUTTON, "Roof level: ", &thermometer_settings.roof1, &thermometer_settings.roof1, &l_0_1000000_1},
306      {GAI_TEXT, "Fans, thermometer and network/modem\nneed a roof level limit set."},
307      {GAI_TEXTENTRY, "Mount point: ", &thermometer_settings.mount_point1, &thermometer_settings.mount_point1},
308      {GAI_TEXT, "A mount point is needed for disc usage."},
309      {GAI_FRAME, "Split"},
310           {GAI_COLORSELECTOR, "Thermometer colour: ", &thermometer_settings.c1_s, &thermometer_settings.c1_s},
311           {GAI_OPTIONMENU, "Messures: ", &thermometer_settings.messure1_s, &thermometer_settings.messure1_s, messure_list},
312           {GAI_SPINBUTTON, "Roof level: ", &thermometer_settings.roof1_s, &thermometer_settings.roof1_s, &l_0_1000000_1},
313           {GAI_TEXT, "Fans, thermometer and network/modem\nneed a roof level limit set."},
314           {GAI_TEXTENTRY, "Mount point: ", &thermometer_settings.mount_point1_s, &thermometer_settings.mount_point1_s},
315           {GAI_TEXT, "A mount point is needed for disc usage."},
316      {GAI_FRAME_E},
317 {GAI_FRAME_E},
318
319 {GAI_FRAME_R,"Second Thermometer"},
320      {GAI_OPTIONMENU, "Draw on: ", &thermometer_settings.draw2, &thermometer_settings.draw2, draw_list}, 
321      {GAI_OPTIONMENU, "Vertical placement: ", &thermometer_settings.vert2, &thermometer_settings.vert2, vert_list}, 
322      {GAI_OPTIONMENU, "Horizontal placement: ", &thermometer_settings.horz2, &thermometer_settings.horz2, horz_list}, 
323      {GAI_CHECKBUTTON, "Split", &thermometer_settings.split2,&thermometer_settings.split2},
324      {GAI_COLORSELECTOR, "Thermometer colour: ", &thermometer_settings.c2, &thermometer_settings.c2},
325      {GAI_OPTIONMENU, "Messures: ", &thermometer_settings.messure2, &thermometer_settings.messure2, messure_list},
326      {GAI_SPINBUTTON, "Roof level: ", &thermometer_settings.roof2, &thermometer_settings.roof2, &l_0_1000000_1},
327      {GAI_TEXT, "Fans, thermometer and network/modem\nneed a roof level limit set."},
328      {GAI_TEXTENTRY, "Mount point: ", &thermometer_settings.mount_point2, &thermometer_settings.mount_point2},
329      {GAI_TEXT, "A mount point is needed for disc usage."},
330      {GAI_FRAME, "Split"},
331           {GAI_COLORSELECTOR, "Thermometer colour: ", &thermometer_settings.c2_s, &thermometer_settings.c2_s},
332           {GAI_OPTIONMENU, "Messures: ", &thermometer_settings.messure2_s, &thermometer_settings.messure2_s, messure_list},
333           {GAI_SPINBUTTON, "Roof level: ", &thermometer_settings.roof2_s, &thermometer_settings.roof2_s, &l_0_1000000_1},
334           {GAI_TEXT, "Fans, thermometer and network/modem\nneed a roof level limit set."},
335           {GAI_TEXTENTRY, "Mount point: ", &thermometer_settings.mount_point2_s, &thermometer_settings.mount_point2_s},
336           {GAI_TEXT, "A mount point is needed for disc usage."},
337      {GAI_FRAME_E},
338 {GAI_FRAME_E},
339 {GAI_NOTEBOOK_E},
340 /*--------------------------------------------------------------------------------*/
341 /* Leds */
342 /*--------------------------------------------------------------------------------*/
343 {GAI_NOTEBOOK, "Leds"},
344 {GAI_OPTIONMENU, "Draw on: ", &leds_settings.draw,  &leds_settings.draw, draw_list},
345 {GAI_OPTIONMENU, "Vertical placement: ", &leds_settings.vert, &leds_settings.vert, vert_list},
346 {GAI_OPTIONMENU, "Horizontal placement: ", &leds_settings.horz, &leds_settings.horz, horz_list},
347 {GAI_OPTIONMENU, "Layout: ", &leds_settings.vert_horz, &leds_settings.vert_horz, vert_horz_list},
348 {GAI_SPINBUTTON, "Alpha: ", &leds_settings.alpha, &leds_settings.alpha, &l_0_255_1},
349
350 {GAI_FRAME, "Led one"},
351      {GAI_OPTIONMENU, "Is: ", &leds_settings.leds_func[0], &leds_settings.leds_func[0], leds_func_list},
352      {GAI_OPTIONMENU, "Colour: ", &leds_settings.leds_colour[0],&leds_settings.leds_colour[0], leds_colour_list},
353      {GAI_CHECKBUTTON, "Show shadow when off", &leds_settings.leds_show_off[0], &leds_settings.leds_show_off[0]},
354 {GAI_FRAME_E},
355
356 {GAI_FRAME_R, "Led two"},
357      {GAI_OPTIONMENU, "Is: ", &leds_settings.leds_func[1], &leds_settings.leds_func[1], leds_func_list},
358      {GAI_OPTIONMENU, "Colour: ", &leds_settings.leds_colour[1],&leds_settings.leds_colour[1], leds_colour_list},
359      {GAI_CHECKBUTTON, "Show shadow when off", &leds_settings.leds_show_off[1], &leds_settings.leds_show_off[1]},
360 {GAI_FRAME_E},
361
362 {GAI_FRAME, "Led three"},
363      {GAI_OPTIONMENU, "Is: ", &leds_settings.leds_func[2], &leds_settings.leds_func[2], leds_func_list},
364      {GAI_OPTIONMENU, "Colour: ", &leds_settings.leds_colour[2],&leds_settings.leds_colour[2], leds_colour_list},
365      {GAI_CHECKBUTTON, "Show shadow when off", &leds_settings.leds_show_off[2], &leds_settings.leds_show_off[2]},
366 {GAI_FRAME_E},
367
368 {GAI_FRAME_R, "Led four"},
369      {GAI_OPTIONMENU, "Is: ", &leds_settings.leds_func[3], &leds_settings.leds_func[3], leds_func_list},
370      {GAI_OPTIONMENU, "Colour: ", &leds_settings.leds_colour[3],&leds_settings.leds_colour[3], leds_colour_list},
371      {GAI_CHECKBUTTON, "Show shadow when off", &leds_settings.leds_show_off[3], &leds_settings.leds_show_off[3]},
372 {GAI_FRAME_E},
373
374 {GAI_NOTEBOOK_E},
375
376
377 /*--------------------------------------------------------------------------------*/
378 /* Extra */
379 /*--------------------------------------------------------------------------------*/
380
381 {GAI_NOTEBOOK, "Extra"},
382 {GAI_CHECKBUTTON, "Hide mouse cursor when over applet", &over_settings.cursor_off, &over_settings.cursor_off},
383 {GAI_CHECKBUTTON, "Fade when mouse cursor is over", &over_settings.fade, &over_settings.fade},
384
385 {GAI_FRAME, "Mouse pointer over activates"},
386      {GAI_RADIOBUTTON, over_radio, &over_settings.type,&over_settings.type},
387 {GAI_FRAME_E},
388
389 #ifdef XMMS
390 {GAI_FRAME, "Xmms song name displayer"},
391      {GAI_CHECKBUTTON, "On", &xmms_settings.on,&xmms_settings.on},
392      {GAI_OPTIONMENU, "Draw on:", &xmms_settings.draw,  &xmms_settings.draw, draw_list},
393      {GAI_OPTIONMENU, "Vertical placement:", &xmms_settings.vert, &xmms_settings.vert, vert_list},
394      {GAI_OPTIONMENU, "Horizontal placement:", &xmms_settings.horz, &xmms_settings.horz, horz_list},
395      {GAI_OPTIONMENU, "Text scroll direction:", &xmms_settings.direction, &xmms_settings.direction, xmms_scroll_list},
396      {GAI_COLORSELECTOR, "Font colour", &xmms_settings.c, &xmms_settings.c},
397 {GAI_FRAME_E},
398 #endif
399 {GAI_FRAME, "Tetris"},
400     {GAI_CHECKBUTTON, "Use maximum size", &tetris_settings.size_limit, &tetris_settings.size_limit},
401     {GAI_CHECKBUTTON, "Show next piece", &tetris_settings.show_next, &tetris_settings.show_next},
402     {GAI_SPINBUTTON, "Width: ", &tetris_settings.width, &tetris_settings.width, &l_4_50_1},
403     {GAI_SPINBUTTON, "Height: ", &tetris_settings.height, &tetris_settings.height, &l_4_50_1},
404 {GAI_FRAME_E},
405
406 {GAI_NOTEBOOK_E},
407
408 {GAI_END}};
409
410
411 void pref_restart(gpointer d)
412 {
413     Background_settings *bas;
414     Bottom_settings *bos;
415     Bubble_settings *bus;
416     Clock_settings *cs;
417     Date_settings *ds;
418     Fish_settings *fs;
419     General_settings *gs;
420     Leds_settings *ls;
421     Over_settings *os;
422     Sound_settings *ss;
423     Tetris_settings *tt;
424     Thermometer_settings *ts;
425 #ifdef XMMS
426     Xmms_sn_settings *xss;
427 #endif
428     AquariumData *ad;
429
430     ad = aquarium_get_settings_ptr();
431     ad->dont_update = 1;
432     
433     bas = background_get_settings_ptr();
434     bos = bottom_get_settings_ptr();
435     bus = bubble_get_settings_ptr();
436     cs = clock_get_settings_ptr();
437     ds = date_get_settings_ptr();
438     fs = fish_get_settings_ptr();
439     gs = general_get_settings_ptr();
440
441     
442     ls = leds_get_settings_ptr();
443     os = over_get_settings_ptr();
444     ss = sound_get_settings_ptr();
445     ts = thermometer_get_settings_ptr();
446     tt = tetris_get_settings_ptr();
447 #ifdef XMMS
448     xss = xmms_sn_get_settings_ptr();
449 #endif
450
451     memcpy(bas, &background_settings, sizeof(Background_settings));
452     memcpy(bos, &bottom_settings, sizeof(Bottom_settings));
453     memcpy(bus, &bubble_settings, sizeof(Bubble_settings));
454     memcpy(cs, &clock_settings, sizeof(Clock_settings));
455     memcpy(ds, &date_settings, sizeof(Date_settings));
456     memcpy(fs, &fish_settings, sizeof(Fish_settings));
457     memcpy(gs, &general_settings, sizeof(General_settings));
458     memcpy(ls, &leds_settings, sizeof(Leds_settings));
459     memcpy(os, &over_settings, sizeof(Over_settings));
460     memcpy(ss, &sound_settings, sizeof(Sound_settings));    
461     memcpy(tt, &tetris_settings, sizeof(Tetris_settings));
462     memcpy(ts, &thermometer_settings, sizeof(Thermometer_settings)); 
463 #ifdef XMMS
464     memcpy(xss, &xmms_settings, sizeof(Xmms_sn_settings));
465 #endif
466
467     clock_save_settings();
468     date_save_settings();
469     bubble_save_settings();
470     background_save_settings();
471     fish_save_settings();
472     general_save_settings();
473     bottom_save_settings();
474
475     over_save_settings();
476     leds_save_settings();
477     tetris_save_settings();
478     thermometer_save_settings();
479 #ifdef XMMS
480     xmms_sn_save_settings();
481 #endif
482     sound_save_settings();
483
484     aquarium_free_all();
485
486     /* Load the fishes early, since aquarium change will need them */
487     fish_init();
488
489     if(gai_applet_mode() == GAI_DOCKAPP){
490         if(gs->ratio_width > gs->ratio_height)
491             aquarium_change(GAI_HORIZONTAL, gai_get_size(), gai_get_size(), NULL);
492         else
493             aquarium_change(GAI_VERTICAL, gai_get_size(), gai_get_size(), NULL);
494     }
495     else
496         aquarium_change(gai_get_orient(), gai_get_size(), gai_get_size(), NULL);
497
498     aquarium_reload_all();
499     ad->dont_update = 0;
500 }
501
502 void pref_init(void)
503 {
504     Background_settings *bas;
505     Bottom_settings *bos;
506     Bubble_settings *bus;
507     Clock_settings *cs;
508     Date_settings *ds;
509     Fish_settings *fs;
510     Leds_settings *ls;
511     Over_settings *os;
512     Sound_settings *ss;
513     Tetris_settings *tt;
514     Thermometer_settings *ts;
515 #ifdef XMMS
516     Xmms_sn_settings *xss;
517 #endif
518     General_settings *gs;
519
520     AquariumData *ad;
521
522     
523     ad = aquarium_get_settings_ptr();
524     
525     bas = background_get_settings_ptr();
526     bos = bottom_get_settings_ptr();
527     bus = bubble_get_settings_ptr();
528     cs = clock_get_settings_ptr();
529     ds = date_get_settings_ptr();
530     fs = fish_get_settings_ptr();
531     gs = general_get_settings_ptr();
532
533     ls = leds_get_settings_ptr();
534     os = over_get_settings_ptr();
535     ss = sound_get_settings_ptr();
536     tt = tetris_get_settings_ptr();
537     ts = thermometer_get_settings_ptr();
538 #ifdef XMMS
539     xss = xmms_sn_get_settings_ptr();
540 #endif
541
542     memcpy(&background_settings, bas, sizeof(Background_settings));
543     memcpy(&bottom_settings, bos, sizeof(Bottom_settings));
544     memcpy(&bubble_settings, bus, sizeof(Bubble_settings));
545     memcpy(&clock_settings, cs, sizeof(Clock_settings));
546     memcpy(&date_settings, ds, sizeof(Date_settings));
547     memcpy(&fish_settings, fs, sizeof(Fish_settings));
548     memcpy(&general_settings, gs, sizeof(General_settings));
549     memcpy(&leds_settings, ls, sizeof(Leds_settings));
550     memcpy(&over_settings, os, sizeof(Over_settings));
551     memcpy(&sound_settings, ss, sizeof(Sound_settings));
552     memcpy(&tetris_settings, tt, sizeof(Tetris_settings));
553     memcpy(&thermometer_settings, ts, sizeof(Thermometer_settings));
554 #ifdef XMMS
555     memcpy(&xmms_settings, xss, sizeof(Xmms_sn_settings));
556 #endif
557
558 }