1 | /* GNOME panel: Individual panel configurations |
---|
2 | * |
---|
3 | * (C) 1998 the Free Software Foundation |
---|
4 | * Copyright 2000 Helix Code, Inc. |
---|
5 | * |
---|
6 | * Authors: Jacob Berkman |
---|
7 | * George Lebl |
---|
8 | */ |
---|
9 | |
---|
10 | #include <gtk/gtk.h> |
---|
11 | |
---|
12 | #include <config.h> |
---|
13 | #include <gnome.h> |
---|
14 | |
---|
15 | #include "panel-include.h" |
---|
16 | |
---|
17 | #include <gdk-pixbuf/gdk-pixbuf.h> |
---|
18 | #include <libart_lgpl/art_misc.h> |
---|
19 | #include <libart_lgpl/art_affine.h> |
---|
20 | #include <libart_lgpl/art_filterlevel.h> |
---|
21 | #include "rgb-stuff.h" |
---|
22 | #include "multiscreen-stuff.h" |
---|
23 | #include "nothing.cP" |
---|
24 | |
---|
25 | static void config_apply (PerPanelConfig *ppc); |
---|
26 | |
---|
27 | static GList *ppconfigs = NULL; |
---|
28 | |
---|
29 | /* register changes */ |
---|
30 | void |
---|
31 | panel_config_register_changes (PerPanelConfig *ppc) |
---|
32 | { |
---|
33 | if (ppc->register_changes) { |
---|
34 | config_apply (ppc); |
---|
35 | if (ppc->update_function != NULL) |
---|
36 | ppc->update_function (ppc->update_data); |
---|
37 | } |
---|
38 | } |
---|
39 | |
---|
40 | static PerPanelConfig * |
---|
41 | get_config_struct(GtkWidget *panel) |
---|
42 | { |
---|
43 | GList *list; |
---|
44 | for (list = ppconfigs; list != NULL; list = list->next) { |
---|
45 | PerPanelConfig *ppc = list->data; |
---|
46 | if (ppc->panel == panel) |
---|
47 | return ppc; |
---|
48 | } |
---|
49 | return NULL; |
---|
50 | } |
---|
51 | |
---|
52 | void |
---|
53 | kill_config_dialog (GtkWidget *panel) |
---|
54 | { |
---|
55 | PerPanelConfig *ppc; |
---|
56 | |
---|
57 | g_return_if_fail (panel != NULL); |
---|
58 | g_return_if_fail (GTK_IS_WIDGET (panel)); |
---|
59 | |
---|
60 | ppc = get_config_struct (panel); |
---|
61 | if (ppc != NULL && |
---|
62 | ppc->config_window != NULL) |
---|
63 | gtk_widget_destroy (ppc->config_window); |
---|
64 | } |
---|
65 | |
---|
66 | static void |
---|
67 | update_position_toggles (PerPanelConfig *ppc) |
---|
68 | { |
---|
69 | GtkWidget *toggle = ppc->toggle[ppc->edge][ppc->align]; |
---|
70 | |
---|
71 | /* this could happen during type changes */ |
---|
72 | if (toggle == NULL) |
---|
73 | return; |
---|
74 | |
---|
75 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), TRUE); |
---|
76 | } |
---|
77 | |
---|
78 | void |
---|
79 | update_config_edge (BasePWidget *panel) |
---|
80 | { |
---|
81 | PerPanelConfig *ppc; |
---|
82 | |
---|
83 | g_return_if_fail (panel != NULL); |
---|
84 | g_return_if_fail (GTK_IS_WIDGET (panel)); |
---|
85 | |
---|
86 | ppc = get_config_struct (GTK_WIDGET (panel)); |
---|
87 | |
---|
88 | if (ppc == NULL || |
---|
89 | ppc->ppc_origin_change) |
---|
90 | return; |
---|
91 | |
---|
92 | g_return_if_fail (IS_BORDER_WIDGET (panel)); |
---|
93 | |
---|
94 | if (ppc->edge == BORDER_POS (panel->pos)->edge) |
---|
95 | return; |
---|
96 | |
---|
97 | ppc->edge = BORDER_POS (panel->pos)->edge; |
---|
98 | update_position_toggles (ppc); |
---|
99 | } |
---|
100 | |
---|
101 | void |
---|
102 | update_config_floating_pos (BasePWidget *panel) |
---|
103 | { |
---|
104 | PerPanelConfig *ppc; |
---|
105 | |
---|
106 | g_return_if_fail (panel != NULL); |
---|
107 | g_return_if_fail (GTK_IS_WIDGET (panel)); |
---|
108 | |
---|
109 | ppc = get_config_struct (GTK_WIDGET (panel)); |
---|
110 | |
---|
111 | if (ppc == NULL || |
---|
112 | ppc->ppc_origin_change) |
---|
113 | return; |
---|
114 | |
---|
115 | gtk_spin_button_set_value (GTK_SPIN_BUTTON (ppc->x_spin), |
---|
116 | FLOATING_POS (panel->pos)->x); |
---|
117 | |
---|
118 | gtk_spin_button_set_value (GTK_SPIN_BUTTON (ppc->y_spin), |
---|
119 | FLOATING_POS (panel->pos)->y); |
---|
120 | } |
---|
121 | |
---|
122 | void |
---|
123 | update_config_floating_pos_limits (BasePWidget *panel) |
---|
124 | { |
---|
125 | GtkWidget *widget; |
---|
126 | PerPanelConfig *ppc; |
---|
127 | int xlimit, ylimit; |
---|
128 | int val; |
---|
129 | GtkAdjustment *adj; |
---|
130 | |
---|
131 | g_return_if_fail (panel != NULL); |
---|
132 | g_return_if_fail (GTK_IS_WIDGET (panel)); |
---|
133 | |
---|
134 | widget = GTK_WIDGET (panel); |
---|
135 | ppc = get_config_struct (widget); |
---|
136 | |
---|
137 | if (ppc == NULL || |
---|
138 | ppc->ppc_origin_change) |
---|
139 | return; |
---|
140 | |
---|
141 | xlimit = multiscreen_width(panel->screen) - widget->allocation.width; |
---|
142 | ylimit = multiscreen_height(panel->screen) - widget->allocation.height; |
---|
143 | |
---|
144 | adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON (ppc->x_spin)); |
---|
145 | if((int)adj->upper == xlimit) { |
---|
146 | adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON (ppc->y_spin)); |
---|
147 | if((int)adj->upper == ylimit) |
---|
148 | return; |
---|
149 | } |
---|
150 | |
---|
151 | |
---|
152 | val = FLOATING_POS (panel->pos)->x; |
---|
153 | if(val > xlimit) |
---|
154 | val = xlimit; |
---|
155 | adj = GTK_ADJUSTMENT(gtk_adjustment_new (val, 0, xlimit, 1, 10, 10)); |
---|
156 | gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (ppc->x_spin), adj); |
---|
157 | gtk_adjustment_value_changed(adj); |
---|
158 | |
---|
159 | val = FLOATING_POS (panel->pos)->y; |
---|
160 | if(val > ylimit) |
---|
161 | val = ylimit; |
---|
162 | adj = GTK_ADJUSTMENT(gtk_adjustment_new (val, 0, ylimit, 1, 10, 10)); |
---|
163 | gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (ppc->y_spin), adj); |
---|
164 | gtk_adjustment_value_changed(adj); |
---|
165 | } |
---|
166 | |
---|
167 | void |
---|
168 | update_config_floating_orient (BasePWidget *panel) |
---|
169 | { |
---|
170 | PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (panel)); |
---|
171 | GtkWidget *toggle; |
---|
172 | |
---|
173 | if (ppc == NULL || |
---|
174 | ppc->ppc_origin_change) |
---|
175 | return; |
---|
176 | |
---|
177 | toggle = (PANEL_WIDGET (panel->panel)->orient == PANEL_HORIZONTAL) |
---|
178 | ? ppc->h_orient : ppc->v_orient; |
---|
179 | |
---|
180 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), |
---|
181 | TRUE); |
---|
182 | } |
---|
183 | |
---|
184 | void |
---|
185 | update_config_avoid_on_maximize (BasePWidget *panel) |
---|
186 | { |
---|
187 | PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (panel)); |
---|
188 | GtkWidget *toggle; |
---|
189 | |
---|
190 | if (ppc == NULL || |
---|
191 | ppc->ppc_origin_change) |
---|
192 | return; |
---|
193 | |
---|
194 | toggle = ppc->avoid_on_maximize_button; |
---|
195 | |
---|
196 | if (panel->avoid_on_maximize && |
---|
197 | ! GTK_TOGGLE_BUTTON (toggle)->active) |
---|
198 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), |
---|
199 | TRUE); |
---|
200 | else if ( ! panel->avoid_on_maximize && |
---|
201 | GTK_TOGGLE_BUTTON (toggle)->active) |
---|
202 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), |
---|
203 | FALSE); |
---|
204 | } |
---|
205 | |
---|
206 | void |
---|
207 | update_config_screen (BasePWidget *w) |
---|
208 | { |
---|
209 | PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (w)); |
---|
210 | |
---|
211 | if (ppc == NULL || |
---|
212 | ppc->ppc_origin_change) |
---|
213 | return; |
---|
214 | |
---|
215 | gtk_spin_button_set_value (GTK_SPIN_BUTTON (ppc->screen_spin), |
---|
216 | w->screen); |
---|
217 | |
---|
218 | if (IS_FLOATING_WIDGET (w)) |
---|
219 | update_config_floating_pos_limits (w); |
---|
220 | else if (IS_SLIDING_WIDGET (w)) |
---|
221 | update_config_offset_limit (w); |
---|
222 | } |
---|
223 | |
---|
224 | void |
---|
225 | update_config_mode (BasePWidget *panel) |
---|
226 | { |
---|
227 | PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (panel)); |
---|
228 | GtkWidget *toggle; |
---|
229 | |
---|
230 | if (ppc == NULL || |
---|
231 | ppc->ppc_origin_change) |
---|
232 | return; |
---|
233 | |
---|
234 | toggle = ppc->autohide_button; |
---|
235 | |
---|
236 | if (panel->mode == BASEP_AUTO_HIDE && |
---|
237 | ! GTK_TOGGLE_BUTTON (toggle)->active) |
---|
238 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), |
---|
239 | TRUE); |
---|
240 | else if (panel->mode == BASEP_EXPLICIT_HIDE && |
---|
241 | GTK_TOGGLE_BUTTON (toggle)->active) |
---|
242 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), |
---|
243 | FALSE); |
---|
244 | } |
---|
245 | |
---|
246 | void |
---|
247 | update_config_hidebuttons (BasePWidget *panel) |
---|
248 | { |
---|
249 | PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (panel)); |
---|
250 | GtkWidget *toggle; |
---|
251 | |
---|
252 | if (ppc == NULL || |
---|
253 | ppc->ppc_origin_change) |
---|
254 | return; |
---|
255 | |
---|
256 | toggle = ppc->hidebuttons_button; |
---|
257 | |
---|
258 | if (panel->hidebuttons_enabled && |
---|
259 | ! GTK_TOGGLE_BUTTON (toggle)->active) |
---|
260 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), |
---|
261 | TRUE); |
---|
262 | else if ( ! panel->hidebuttons_enabled && |
---|
263 | GTK_TOGGLE_BUTTON (toggle)->active) |
---|
264 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), |
---|
265 | FALSE); |
---|
266 | |
---|
267 | toggle = ppc->hidebutton_pixmaps_button; |
---|
268 | |
---|
269 | if (panel->hidebutton_pixmaps_enabled && |
---|
270 | ! GTK_TOGGLE_BUTTON (toggle)->active) |
---|
271 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), |
---|
272 | TRUE); |
---|
273 | else if ( ! panel->hidebutton_pixmaps_enabled && |
---|
274 | GTK_TOGGLE_BUTTON (toggle)->active) |
---|
275 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), |
---|
276 | FALSE); |
---|
277 | } |
---|
278 | |
---|
279 | void |
---|
280 | update_config_size (GtkWidget *panel) |
---|
281 | { |
---|
282 | PerPanelConfig *ppc = get_config_struct(panel); |
---|
283 | int i; |
---|
284 | PanelWidget *p; |
---|
285 | GtkWidget *menuitem; |
---|
286 | |
---|
287 | if (ppc == NULL || |
---|
288 | ppc->ppc_origin_change) |
---|
289 | return; |
---|
290 | |
---|
291 | p = PANEL_WIDGET(BASEP_WIDGET(panel)->panel); |
---|
292 | switch(p->sz) { |
---|
293 | case SIZE_ULTRA_TINY: |
---|
294 | i = 0; |
---|
295 | break; |
---|
296 | case SIZE_TINY: |
---|
297 | i = 1; |
---|
298 | break; |
---|
299 | case SIZE_SMALL: |
---|
300 | i = 2; |
---|
301 | break; |
---|
302 | default: |
---|
303 | case SIZE_STANDARD: |
---|
304 | i = 3; |
---|
305 | break; |
---|
306 | case SIZE_LARGE: |
---|
307 | i = 4; |
---|
308 | break; |
---|
309 | case SIZE_HUGE: |
---|
310 | i = 5; |
---|
311 | break; |
---|
312 | case SIZE_RIDICULOUS: |
---|
313 | i = 6; |
---|
314 | break; |
---|
315 | } |
---|
316 | |
---|
317 | gtk_option_menu_set_history (GTK_OPTION_MENU (ppc->size_menu), i); |
---|
318 | menuitem = g_list_nth_data(GTK_MENU_SHELL(GTK_OPTION_MENU(ppc->size_menu)->menu)->children, i); |
---|
319 | gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); |
---|
320 | } |
---|
321 | |
---|
322 | void |
---|
323 | update_config_level (BasePWidget *panel) |
---|
324 | { |
---|
325 | PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (panel)); |
---|
326 | int i; |
---|
327 | GtkWidget *menuitem; |
---|
328 | |
---|
329 | if (ppc == NULL || |
---|
330 | ppc->ppc_origin_change) |
---|
331 | return; |
---|
332 | |
---|
333 | switch (panel->level) { |
---|
334 | default: |
---|
335 | case BASEP_LEVEL_DEFAULT: |
---|
336 | i = 0; |
---|
337 | break; |
---|
338 | case BASEP_LEVEL_ABOVE: |
---|
339 | i = 1; |
---|
340 | break; |
---|
341 | case BASEP_LEVEL_NORMAL: |
---|
342 | i = 2; |
---|
343 | break; |
---|
344 | case BASEP_LEVEL_BELOW: |
---|
345 | i = 3; |
---|
346 | break; |
---|
347 | } |
---|
348 | |
---|
349 | gtk_option_menu_set_history (GTK_OPTION_MENU (ppc->level_menu), i); |
---|
350 | menuitem = g_list_nth_data(GTK_MENU_SHELL(GTK_OPTION_MENU(ppc->level_menu)->menu)->children, i); |
---|
351 | gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); |
---|
352 | } |
---|
353 | |
---|
354 | void |
---|
355 | update_config_back (PanelWidget *pw) |
---|
356 | { |
---|
357 | GtkWidget *t, *item = NULL; |
---|
358 | int history = 0; |
---|
359 | PerPanelConfig *ppc; |
---|
360 | char *text; |
---|
361 | |
---|
362 | g_return_if_fail (pw); |
---|
363 | g_return_if_fail (IS_PANEL_WIDGET(pw)); |
---|
364 | g_return_if_fail (pw->panel_parent); |
---|
365 | |
---|
366 | ppc = get_config_struct (pw->panel_parent); |
---|
367 | |
---|
368 | if (ppc == NULL || |
---|
369 | ppc->ppc_origin_change) |
---|
370 | return; |
---|
371 | |
---|
372 | switch(pw->back_type) { |
---|
373 | default: |
---|
374 | case PANEL_BACK_NONE: |
---|
375 | item = ppc->non; |
---|
376 | history = 0; |
---|
377 | break; |
---|
378 | case PANEL_BACK_COLOR: |
---|
379 | gnome_color_picker_set_i16(GNOME_COLOR_PICKER(ppc->backsel), |
---|
380 | pw->back_color.red, |
---|
381 | pw->back_color.green, |
---|
382 | pw->back_color.blue, |
---|
383 | 65535); |
---|
384 | item = ppc->col; |
---|
385 | history = 1; |
---|
386 | break; |
---|
387 | case PANEL_BACK_PIXMAP: |
---|
388 | t = gnome_pixmap_entry_gtk_entry |
---|
389 | (GNOME_PIXMAP_ENTRY (ppc->pix_entry)); |
---|
390 | text = gtk_entry_get_text (GTK_ENTRY (t)); |
---|
391 | if (strcmp (sure_string (pw->back_pixmap), |
---|
392 | text) != 0) { |
---|
393 | gtk_entry_set_text (GTK_ENTRY (t), |
---|
394 | sure_string (pw->back_pixmap)); |
---|
395 | } |
---|
396 | item = ppc->pix; |
---|
397 | history = 2; |
---|
398 | break; |
---|
399 | case PANEL_BACK_TRANSLUCENT: |
---|
400 | item = ppc->trans; |
---|
401 | history = 3; |
---|
402 | break; |
---|
403 | } |
---|
404 | |
---|
405 | gtk_option_menu_set_history(GTK_OPTION_MENU(ppc->back_om), history); |
---|
406 | gtk_menu_item_activate(GTK_MENU_ITEM(item)); |
---|
407 | } |
---|
408 | |
---|
409 | void |
---|
410 | update_config_anchor (BasePWidget *w) |
---|
411 | { |
---|
412 | PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (w)); |
---|
413 | g_return_if_fail (IS_SLIDING_WIDGET (w)); |
---|
414 | |
---|
415 | if (ppc == NULL || |
---|
416 | ppc->ppc_origin_change) |
---|
417 | return; |
---|
418 | |
---|
419 | ppc->align = SLIDING_POS (w->pos)->anchor; |
---|
420 | update_position_toggles (ppc); |
---|
421 | } |
---|
422 | |
---|
423 | void |
---|
424 | update_config_offset (BasePWidget *w) |
---|
425 | { |
---|
426 | PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (w)); |
---|
427 | |
---|
428 | g_return_if_fail (IS_SLIDING_WIDGET (w)); |
---|
429 | |
---|
430 | if (ppc == NULL || |
---|
431 | ppc->ppc_origin_change) |
---|
432 | return; |
---|
433 | |
---|
434 | gtk_spin_button_set_value (GTK_SPIN_BUTTON (ppc->offset_spin), |
---|
435 | SLIDING_POS (w->pos)->offset); |
---|
436 | } |
---|
437 | |
---|
438 | void |
---|
439 | update_config_offset_limit (BasePWidget *panel) |
---|
440 | { |
---|
441 | GtkWidget *widget = GTK_WIDGET(panel); |
---|
442 | PerPanelConfig *ppc = get_config_struct (widget); |
---|
443 | int range, val; |
---|
444 | GtkAdjustment *adj; |
---|
445 | |
---|
446 | if (ppc == NULL || |
---|
447 | ppc->ppc_origin_change) |
---|
448 | return; |
---|
449 | |
---|
450 | if(ppc->edge == BORDER_LEFT || ppc->edge == BORDER_RIGHT) |
---|
451 | range = multiscreen_height (panel->screen) |
---|
452 | - widget->allocation.height; |
---|
453 | else |
---|
454 | range = multiscreen_width (panel->screen) |
---|
455 | - widget->allocation.width; |
---|
456 | |
---|
457 | adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON (ppc->offset_spin)); |
---|
458 | if((int)adj->upper == range) |
---|
459 | return; |
---|
460 | |
---|
461 | val = SLIDING_POS (panel->pos)->offset; |
---|
462 | if(val > range) val = range; |
---|
463 | adj = GTK_ADJUSTMENT(gtk_adjustment_new (val, 0, range, 1, 10, 10)); |
---|
464 | gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (ppc->offset_spin), adj); |
---|
465 | gtk_adjustment_value_changed(adj); |
---|
466 | } |
---|
467 | |
---|
468 | |
---|
469 | void |
---|
470 | update_config_align (BasePWidget *w) |
---|
471 | { |
---|
472 | PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (w)); |
---|
473 | g_return_if_fail (IS_ALIGNED_WIDGET (w)); |
---|
474 | |
---|
475 | if (ppc == NULL || |
---|
476 | ppc->ppc_origin_change) |
---|
477 | return; |
---|
478 | |
---|
479 | if (ppc->align == ALIGNED_POS (w->pos)->align) |
---|
480 | return; |
---|
481 | |
---|
482 | ppc->align = ALIGNED_POS (w->pos)->align; |
---|
483 | update_position_toggles (ppc); |
---|
484 | } |
---|
485 | |
---|
486 | |
---|
487 | static void |
---|
488 | config_destroy(GtkWidget *widget, gpointer data) |
---|
489 | { |
---|
490 | PerPanelConfig *ppc = data; |
---|
491 | |
---|
492 | ppconfigs = g_list_remove (ppconfigs, ppc); |
---|
493 | |
---|
494 | g_free (ppc->back_pixmap); |
---|
495 | ppc->back_pixmap = NULL; |
---|
496 | g_free (ppc); |
---|
497 | } |
---|
498 | |
---|
499 | static void |
---|
500 | config_apply (PerPanelConfig *ppc) |
---|
501 | { |
---|
502 | /* don't update selves, all changes coming from ME */ |
---|
503 | ppc->ppc_origin_change = TRUE; |
---|
504 | |
---|
505 | panel_freeze_changes (PANEL_WIDGET (BASEP_WIDGET (ppc->panel)->panel)); |
---|
506 | |
---|
507 | if(IS_EDGE_WIDGET(ppc->panel)) |
---|
508 | border_widget_change_params(BORDER_WIDGET(ppc->panel), |
---|
509 | ppc->screen, |
---|
510 | ppc->edge, |
---|
511 | ppc->sz, |
---|
512 | ppc->mode, |
---|
513 | BASEP_WIDGET(ppc->panel)->state, |
---|
514 | ppc->level, |
---|
515 | ppc->avoid_on_maximize, |
---|
516 | ppc->hidebuttons, |
---|
517 | ppc->hidebutton_pixmaps, |
---|
518 | ppc->back_type, |
---|
519 | ppc->back_pixmap, |
---|
520 | ppc->fit_pixmap_bg, |
---|
521 | ppc->strech_pixmap_bg, |
---|
522 | ppc->rotate_pixmap_bg, |
---|
523 | &ppc->back_color); |
---|
524 | else if(IS_SLIDING_WIDGET(ppc->panel)) |
---|
525 | sliding_widget_change_params(SLIDING_WIDGET(ppc->panel), |
---|
526 | ppc->screen, |
---|
527 | ppc->align, |
---|
528 | ppc->offset, |
---|
529 | ppc->edge, |
---|
530 | ppc->sz, |
---|
531 | ppc->mode, |
---|
532 | BASEP_WIDGET(ppc->panel)->state, |
---|
533 | ppc->level, |
---|
534 | ppc->avoid_on_maximize, |
---|
535 | ppc->hidebuttons, |
---|
536 | ppc->hidebutton_pixmaps, |
---|
537 | ppc->back_type, |
---|
538 | ppc->back_pixmap, |
---|
539 | ppc->fit_pixmap_bg, |
---|
540 | ppc->strech_pixmap_bg, |
---|
541 | ppc->rotate_pixmap_bg, |
---|
542 | &ppc->back_color); |
---|
543 | else if (IS_ALIGNED_WIDGET (ppc->panel)) |
---|
544 | aligned_widget_change_params (ALIGNED_WIDGET (ppc->panel), |
---|
545 | ppc->screen, |
---|
546 | ppc->align, |
---|
547 | ppc->edge, |
---|
548 | ppc->sz, |
---|
549 | ppc->mode, |
---|
550 | BASEP_WIDGET(ppc->panel)->state, |
---|
551 | ppc->level, |
---|
552 | ppc->avoid_on_maximize, |
---|
553 | ppc->hidebuttons, |
---|
554 | ppc->hidebutton_pixmaps, |
---|
555 | ppc->back_type, |
---|
556 | ppc->back_pixmap, |
---|
557 | ppc->fit_pixmap_bg, |
---|
558 | ppc->strech_pixmap_bg, |
---|
559 | ppc->rotate_pixmap_bg, |
---|
560 | &ppc->back_color); |
---|
561 | else if (IS_FLOATING_WIDGET (ppc->panel)) |
---|
562 | floating_widget_change_params (FLOATING_WIDGET (ppc->panel), |
---|
563 | ppc->screen, |
---|
564 | ppc->x, |
---|
565 | ppc->y, |
---|
566 | ppc->orient, |
---|
567 | ppc->mode, |
---|
568 | BASEP_WIDGET (ppc->panel)->state, |
---|
569 | ppc->level, |
---|
570 | ppc->avoid_on_maximize, |
---|
571 | ppc->sz, |
---|
572 | ppc->hidebuttons, |
---|
573 | ppc->hidebutton_pixmaps, |
---|
574 | ppc->back_type, |
---|
575 | ppc->back_pixmap, |
---|
576 | ppc->fit_pixmap_bg, |
---|
577 | ppc->strech_pixmap_bg, |
---|
578 | ppc->rotate_pixmap_bg, |
---|
579 | &ppc->back_color); |
---|
580 | else if(IS_DRAWER_WIDGET(ppc->panel)) { |
---|
581 | DrawerPos *dp = DRAWER_POS (BASEP_WIDGET (ppc->panel)->pos); |
---|
582 | drawer_widget_change_params(DRAWER_WIDGET (ppc->panel), |
---|
583 | dp->orient, |
---|
584 | ppc->mode, |
---|
585 | BASEP_WIDGET (ppc->panel)->state, |
---|
586 | ppc->level, |
---|
587 | ppc->avoid_on_maximize, |
---|
588 | ppc->sz, |
---|
589 | ppc->hidebuttons, |
---|
590 | ppc->hidebutton_pixmaps, |
---|
591 | ppc->back_type, |
---|
592 | ppc->back_pixmap, |
---|
593 | ppc->fit_pixmap_bg, |
---|
594 | ppc->strech_pixmap_bg, |
---|
595 | ppc->rotate_pixmap_bg, |
---|
596 | &ppc->back_color); |
---|
597 | } |
---|
598 | |
---|
599 | panel_thaw_changes (PANEL_WIDGET (BASEP_WIDGET (ppc->panel)->panel)); |
---|
600 | |
---|
601 | /* start registering changes again */ |
---|
602 | ppc->ppc_origin_change = FALSE; |
---|
603 | |
---|
604 | gtk_widget_queue_draw (ppc->panel); |
---|
605 | } |
---|
606 | |
---|
607 | static void |
---|
608 | set_toggle (GtkWidget *widget, gpointer data) |
---|
609 | { |
---|
610 | PerPanelConfig *ppc = gtk_object_get_user_data(GTK_OBJECT(widget)); |
---|
611 | int *the_toggle = data; |
---|
612 | |
---|
613 | *the_toggle = GTK_TOGGLE_BUTTON(widget)->active; |
---|
614 | |
---|
615 | panel_config_register_changes (ppc); |
---|
616 | } |
---|
617 | |
---|
618 | static void |
---|
619 | set_sensitive_toggle (GtkWidget *widget, GtkWidget *widget2) |
---|
620 | { |
---|
621 | gtk_widget_set_sensitive(widget2,GTK_TOGGLE_BUTTON(widget)->active); |
---|
622 | } |
---|
623 | |
---|
624 | static void |
---|
625 | basep_set_avoid (GtkWidget *widget, gpointer data) |
---|
626 | { |
---|
627 | PerPanelConfig *ppc = gtk_object_get_user_data (GTK_OBJECT (widget)); |
---|
628 | |
---|
629 | ppc->avoid_on_maximize = GTK_TOGGLE_BUTTON (widget)->active ? TRUE : FALSE; |
---|
630 | |
---|
631 | panel_config_register_changes (ppc); |
---|
632 | } |
---|
633 | |
---|
634 | static void |
---|
635 | basep_set_auto_hide (GtkWidget *widget, gpointer data) |
---|
636 | { |
---|
637 | PerPanelConfig *ppc = gtk_object_get_user_data (GTK_OBJECT (widget)); |
---|
638 | |
---|
639 | ppc->mode = (GTK_TOGGLE_BUTTON (widget)->active) |
---|
640 | ? BASEP_AUTO_HIDE |
---|
641 | : BASEP_EXPLICIT_HIDE; |
---|
642 | |
---|
643 | |
---|
644 | panel_config_register_changes (ppc); |
---|
645 | } |
---|
646 | |
---|
647 | static GtkWidget * |
---|
648 | make_hidebuttons_widget (PerPanelConfig *ppc) |
---|
649 | { |
---|
650 | GtkWidget *frame; |
---|
651 | GtkWidget *box; |
---|
652 | GtkWidget *button; |
---|
653 | GtkWidget *w; |
---|
654 | |
---|
655 | frame = gtk_frame_new (_("Hiding")); |
---|
656 | gtk_container_set_border_width (GTK_CONTAINER (frame), GNOME_PAD_SMALL); |
---|
657 | |
---|
658 | box = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
659 | gtk_container_set_border_width (GTK_CONTAINER (box), GNOME_PAD_SMALL); |
---|
660 | gtk_container_add (GTK_CONTAINER (frame), box); |
---|
661 | |
---|
662 | /* Auto-hide */ |
---|
663 | button = gtk_check_button_new_with_label(_("Enable Auto-hide")); |
---|
664 | ppc->autohide_button = button; |
---|
665 | gtk_object_set_user_data(GTK_OBJECT(button), ppc); |
---|
666 | if (ppc->mode == BASEP_AUTO_HIDE) |
---|
667 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); |
---|
668 | gtk_signal_connect (GTK_OBJECT (button), "toggled", |
---|
669 | GTK_SIGNAL_FUNC (basep_set_auto_hide), |
---|
670 | NULL); |
---|
671 | gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE,0); |
---|
672 | |
---|
673 | /* Hidebuttons enable */ |
---|
674 | w = button = gtk_check_button_new_with_label (_("Show hide buttons")); |
---|
675 | ppc->hidebuttons_button = button; |
---|
676 | gtk_object_set_user_data(GTK_OBJECT(button), ppc); |
---|
677 | if (ppc->hidebuttons) |
---|
678 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); |
---|
679 | gtk_signal_connect (GTK_OBJECT (button), "toggled", |
---|
680 | GTK_SIGNAL_FUNC (set_toggle), |
---|
681 | &ppc->hidebuttons); |
---|
682 | gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE,0); |
---|
683 | |
---|
684 | /* Arrow enable */ |
---|
685 | button = gtk_check_button_new_with_label (_("Show arrows on hide button")); |
---|
686 | ppc->hidebutton_pixmaps_button = button; |
---|
687 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
688 | GTK_SIGNAL_FUNC (set_sensitive_toggle), |
---|
689 | button); |
---|
690 | if (!ppc->hidebuttons) |
---|
691 | gtk_widget_set_sensitive(button,FALSE); |
---|
692 | gtk_object_set_user_data(GTK_OBJECT(button), ppc); |
---|
693 | if (ppc->hidebutton_pixmaps) |
---|
694 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); |
---|
695 | gtk_signal_connect (GTK_OBJECT (button), "toggled", |
---|
696 | GTK_SIGNAL_FUNC (set_toggle), |
---|
697 | &ppc->hidebutton_pixmaps); |
---|
698 | gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE,0); |
---|
699 | |
---|
700 | return frame; |
---|
701 | } |
---|
702 | |
---|
703 | static void |
---|
704 | screen_set (GtkWidget *widget, gpointer data) |
---|
705 | { |
---|
706 | PerPanelConfig *ppc = gtk_object_get_user_data (GTK_OBJECT (widget)); |
---|
707 | |
---|
708 | ppc->screen = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget)); |
---|
709 | panel_config_register_changes (ppc); |
---|
710 | } |
---|
711 | |
---|
712 | static GtkWidget * |
---|
713 | make_misc_widget (PerPanelConfig *ppc, gboolean avoiding) |
---|
714 | { |
---|
715 | GtkWidget *frame; |
---|
716 | GtkWidget *box, *hbox; |
---|
717 | GtkWidget *button, *label; |
---|
718 | GtkObject *range; |
---|
719 | |
---|
720 | if ( ! avoiding && |
---|
721 | multiscreen_screens () <= 1) |
---|
722 | return NULL; |
---|
723 | |
---|
724 | frame = gtk_frame_new (_("Miscellaneous")); |
---|
725 | gtk_container_set_border_width (GTK_CONTAINER (frame), GNOME_PAD_SMALL); |
---|
726 | |
---|
727 | box = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
728 | gtk_container_set_border_width (GTK_CONTAINER (box), GNOME_PAD_SMALL); |
---|
729 | gtk_container_add (GTK_CONTAINER (frame), box); |
---|
730 | |
---|
731 | /* Avoid */ |
---|
732 | button = gtk_check_button_new_with_label |
---|
733 | (_("Avoid this panel when maximizing windows")); |
---|
734 | ppc->avoid_on_maximize_button = button; |
---|
735 | gtk_object_set_user_data(GTK_OBJECT(button), ppc); |
---|
736 | if (ppc->avoid_on_maximize) |
---|
737 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); |
---|
738 | gtk_signal_connect (GTK_OBJECT (button), "toggled", |
---|
739 | GTK_SIGNAL_FUNC (basep_set_avoid), |
---|
740 | NULL); |
---|
741 | gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE,0); |
---|
742 | |
---|
743 | if (multiscreen_screens () > 1) { |
---|
744 | hbox = gtk_hbox_new (FALSE, 0); |
---|
745 | gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0); |
---|
746 | |
---|
747 | label = gtk_label_new (_("Current screen:")); |
---|
748 | gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
---|
749 | |
---|
750 | range = gtk_adjustment_new (ppc->screen, |
---|
751 | 0, multiscreen_screens () - 1, |
---|
752 | 1, 1, 1); |
---|
753 | ppc->screen_spin = button = |
---|
754 | gtk_spin_button_new (GTK_ADJUSTMENT (range), 1, 0); |
---|
755 | gtk_widget_set_usize (GTK_WIDGET (button), 65, 0); |
---|
756 | gtk_object_set_user_data (GTK_OBJECT (button), ppc); |
---|
757 | gtk_spin_button_set_value (GTK_SPIN_BUTTON (button), ppc->screen); |
---|
758 | gtk_signal_connect (GTK_OBJECT (button), "changed", |
---|
759 | GTK_SIGNAL_FUNC (screen_set), NULL); |
---|
760 | gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); |
---|
761 | } |
---|
762 | |
---|
763 | return frame; |
---|
764 | } |
---|
765 | |
---|
766 | static void |
---|
767 | border_set_edge (GtkWidget *widget, gpointer data) |
---|
768 | { |
---|
769 | int edge = GPOINTER_TO_INT (data); |
---|
770 | PerPanelConfig *ppc = gtk_object_get_user_data (GTK_OBJECT (widget)); |
---|
771 | |
---|
772 | if (ppc->edge == edge) |
---|
773 | return; |
---|
774 | |
---|
775 | ppc->edge = edge; |
---|
776 | |
---|
777 | panel_config_register_changes (ppc); |
---|
778 | } |
---|
779 | |
---|
780 | static void |
---|
781 | border_set_align (GtkWidget *widget, gpointer data) |
---|
782 | { |
---|
783 | int align = GPOINTER_TO_INT (data); |
---|
784 | PerPanelConfig *ppc = gtk_object_get_user_data (GTK_OBJECT (widget)); |
---|
785 | |
---|
786 | if (ppc->align == align) |
---|
787 | return; |
---|
788 | |
---|
789 | ppc->align = align; |
---|
790 | |
---|
791 | panel_config_register_changes (ppc); |
---|
792 | } |
---|
793 | |
---|
794 | static GtkWidget * |
---|
795 | make_position_widget (PerPanelConfig *ppc, int aligns) |
---|
796 | { |
---|
797 | GtkWidget *pos_box; |
---|
798 | GtkWidget *table; |
---|
799 | GtkWidget *w = NULL; |
---|
800 | int align; |
---|
801 | |
---|
802 | pos_box = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
803 | gtk_container_set_border_width (GTK_CONTAINER (pos_box), |
---|
804 | GNOME_PAD_SMALL); |
---|
805 | |
---|
806 | w = gtk_label_new (_("Panel Position")); |
---|
807 | gtk_box_pack_start (GTK_BOX (pos_box), w, FALSE, FALSE, 0); |
---|
808 | |
---|
809 | w = gtk_alignment_new (0.5, 0.5, 0, 0); |
---|
810 | gtk_box_pack_start (GTK_BOX (pos_box), w, FALSE, FALSE, 0); |
---|
811 | |
---|
812 | table = gtk_table_new (2 + aligns, 2 + aligns, FALSE); |
---|
813 | gtk_container_add (GTK_CONTAINER (w), table); |
---|
814 | |
---|
815 | w = NULL; |
---|
816 | |
---|
817 | /* LEFT */ |
---|
818 | for (align = 0; align < aligns; ++align) { |
---|
819 | w = w |
---|
820 | ? gtk_radio_button_new_from_widget ( |
---|
821 | GTK_RADIO_BUTTON (w)) |
---|
822 | : gtk_radio_button_new (NULL); |
---|
823 | ppc->toggle[BORDER_LEFT][align] = w; |
---|
824 | gtk_widget_set_usize (w, 18, 18); |
---|
825 | gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (w), FALSE); |
---|
826 | gtk_object_set_user_data (GTK_OBJECT (w), ppc); |
---|
827 | gtk_table_attach (GTK_TABLE (table), w, 0, 1, |
---|
828 | 1 + align, 2 + align, |
---|
829 | GTK_FILL, |
---|
830 | GTK_EXPAND | GTK_FILL, 0, 0); |
---|
831 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
832 | GTK_SIGNAL_FUNC (border_set_edge), |
---|
833 | GINT_TO_POINTER (BORDER_LEFT)); |
---|
834 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
835 | GTK_SIGNAL_FUNC (border_set_align), |
---|
836 | GINT_TO_POINTER (align)); |
---|
837 | } |
---|
838 | |
---|
839 | |
---|
840 | /* TOP */ |
---|
841 | for (align = 0; align < aligns; ++align) { |
---|
842 | w = gtk_radio_button_new_from_widget ( |
---|
843 | GTK_RADIO_BUTTON (w)); |
---|
844 | ppc->toggle[BORDER_TOP][align] = w; |
---|
845 | gtk_widget_set_usize (w, 18, 18); |
---|
846 | gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (w), FALSE); |
---|
847 | gtk_object_set_user_data (GTK_OBJECT (w), ppc); |
---|
848 | gtk_table_attach (GTK_TABLE (table), w, |
---|
849 | 1 + align, 2 + align, 0, 1, |
---|
850 | GTK_EXPAND | GTK_FILL, |
---|
851 | 0, 0, 0); |
---|
852 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
853 | GTK_SIGNAL_FUNC (border_set_edge), |
---|
854 | GINT_TO_POINTER (BORDER_TOP)); |
---|
855 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
856 | GTK_SIGNAL_FUNC (border_set_align), |
---|
857 | GINT_TO_POINTER (align)); |
---|
858 | } |
---|
859 | |
---|
860 | |
---|
861 | /* RIGHT */ |
---|
862 | for (align = 0; align < aligns; ++align) { |
---|
863 | w = gtk_radio_button_new_from_widget ( |
---|
864 | GTK_RADIO_BUTTON (w)); |
---|
865 | ppc->toggle[BORDER_RIGHT][align] = w; |
---|
866 | gtk_widget_set_usize (w, 18, 18); |
---|
867 | gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (w), FALSE); |
---|
868 | gtk_object_set_user_data (GTK_OBJECT (w), ppc); |
---|
869 | gtk_table_attach (GTK_TABLE (table), w, |
---|
870 | 1 + aligns, 2 + aligns, |
---|
871 | 1 + align, 2 + align, |
---|
872 | GTK_FILL, |
---|
873 | GTK_FILL | GTK_EXPAND, 0, 0); |
---|
874 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
875 | GTK_SIGNAL_FUNC (border_set_edge), |
---|
876 | GINT_TO_POINTER (BORDER_RIGHT)); |
---|
877 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
878 | GTK_SIGNAL_FUNC (border_set_align), |
---|
879 | GINT_TO_POINTER (align)); |
---|
880 | } |
---|
881 | |
---|
882 | |
---|
883 | /* BOTTOM */ |
---|
884 | for (align = 0; align < aligns; ++align) { |
---|
885 | w = gtk_radio_button_new_from_widget ( |
---|
886 | GTK_RADIO_BUTTON (w)); |
---|
887 | ppc->toggle[BORDER_BOTTOM][align] = w; |
---|
888 | gtk_widget_set_usize (w, 18, 18); |
---|
889 | gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (w), FALSE); |
---|
890 | gtk_object_set_user_data (GTK_OBJECT (w), ppc); |
---|
891 | gtk_table_attach (GTK_TABLE (table), w, |
---|
892 | 1 + align, 2 + align, |
---|
893 | 1 + aligns, 2 + aligns, |
---|
894 | GTK_EXPAND | GTK_FILL, |
---|
895 | 0, 0, 0); |
---|
896 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
897 | GTK_SIGNAL_FUNC (border_set_edge), |
---|
898 | GINT_TO_POINTER (BORDER_BOTTOM)); |
---|
899 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
900 | GTK_SIGNAL_FUNC (border_set_align), |
---|
901 | GINT_TO_POINTER (align)); |
---|
902 | } |
---|
903 | |
---|
904 | update_position_toggles (ppc); |
---|
905 | |
---|
906 | w = gtk_frame_new (NULL); |
---|
907 | gtk_frame_set_shadow_type(GTK_FRAME(w), GTK_SHADOW_IN); |
---|
908 | gtk_table_attach (GTK_TABLE (table), w, |
---|
909 | 1, 1 + aligns, |
---|
910 | 1, 1 + aligns, |
---|
911 | GTK_FILL, GTK_FILL, 0, 0); |
---|
912 | gtk_widget_set_usize (w, 103, 77); |
---|
913 | |
---|
914 | return pos_box; |
---|
915 | } |
---|
916 | |
---|
917 | static GtkWidget * |
---|
918 | edge_notebook_page (PerPanelConfig *ppc) |
---|
919 | { |
---|
920 | GtkWidget *vbox, *box, *vvbox; |
---|
921 | GtkWidget *w, *f; |
---|
922 | |
---|
923 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
924 | |
---|
925 | f = gtk_frame_new (_("Size and Position")); |
---|
926 | gtk_container_set_border_width (GTK_CONTAINER (f), GNOME_PAD_SMALL); |
---|
927 | gtk_box_pack_start (GTK_BOX (vbox), f, TRUE, TRUE, 0); |
---|
928 | |
---|
929 | vvbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
930 | gtk_container_set_border_width (GTK_CONTAINER (vvbox), GNOME_PAD_SMALL); |
---|
931 | gtk_container_add (GTK_CONTAINER (f), vvbox); |
---|
932 | |
---|
933 | box = gtk_hbox_new (TRUE, GNOME_PAD_SMALL); |
---|
934 | gtk_box_pack_start (GTK_BOX (vvbox), box, TRUE, TRUE, 0); |
---|
935 | |
---|
936 | w = make_size_widget (ppc); |
---|
937 | gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0); |
---|
938 | |
---|
939 | w = make_position_widget (ppc, 1); |
---|
940 | gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0); |
---|
941 | |
---|
942 | w = make_level_widget (ppc); |
---|
943 | gtk_box_pack_start (GTK_BOX (vvbox), w, FALSE, FALSE, 0); |
---|
944 | |
---|
945 | w = make_hidebuttons_widget (ppc); |
---|
946 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
947 | |
---|
948 | w = make_misc_widget (ppc, TRUE); |
---|
949 | if (w != NULL) |
---|
950 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
951 | |
---|
952 | return vbox; |
---|
953 | } |
---|
954 | |
---|
955 | static GtkWidget * |
---|
956 | aligned_notebook_page (PerPanelConfig *ppc) |
---|
957 | { |
---|
958 | GtkWidget *vbox, *vvbox, *box; |
---|
959 | GtkWidget *w, *f; |
---|
960 | |
---|
961 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
962 | |
---|
963 | f = gtk_frame_new (_("Size and Position")); |
---|
964 | gtk_container_set_border_width (GTK_CONTAINER (f), GNOME_PAD_SMALL); |
---|
965 | gtk_box_pack_start (GTK_BOX (vbox), f, FALSE, TRUE, 0); |
---|
966 | |
---|
967 | vvbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
968 | gtk_container_set_border_width (GTK_CONTAINER (vvbox), GNOME_PAD_SMALL); |
---|
969 | gtk_container_add (GTK_CONTAINER (f), vvbox); |
---|
970 | |
---|
971 | box = gtk_hbox_new (TRUE, GNOME_PAD_SMALL); |
---|
972 | gtk_box_pack_start (GTK_BOX (vvbox), box, TRUE, TRUE, 0); |
---|
973 | |
---|
974 | w = make_size_widget (ppc); |
---|
975 | gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0); |
---|
976 | |
---|
977 | w = make_position_widget (ppc, 3); |
---|
978 | gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0); |
---|
979 | |
---|
980 | w = make_level_widget (ppc); |
---|
981 | gtk_box_pack_start (GTK_BOX (vvbox), w, FALSE, FALSE, 0); |
---|
982 | |
---|
983 | w = make_hidebuttons_widget (ppc); |
---|
984 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
985 | |
---|
986 | w = make_misc_widget (ppc, TRUE); |
---|
987 | if (w != NULL) |
---|
988 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
989 | |
---|
990 | return vbox; |
---|
991 | } |
---|
992 | |
---|
993 | static void |
---|
994 | floating_set_orient (GtkWidget *widget, gpointer data) |
---|
995 | { |
---|
996 | PanelOrientation orient = GPOINTER_TO_INT (data); |
---|
997 | PerPanelConfig *ppc = gtk_object_get_user_data (GTK_OBJECT (widget)); |
---|
998 | |
---|
999 | if (!(GTK_TOGGLE_BUTTON (widget)->active)) |
---|
1000 | return; |
---|
1001 | |
---|
1002 | ppc->orient = orient; |
---|
1003 | |
---|
1004 | panel_config_register_changes (ppc); |
---|
1005 | } |
---|
1006 | |
---|
1007 | static void |
---|
1008 | floating_set_xy (GtkWidget *widget, gpointer data) |
---|
1009 | { |
---|
1010 | gint16 *xy = data; |
---|
1011 | PerPanelConfig *ppc = gtk_object_get_user_data (GTK_OBJECT (widget)); |
---|
1012 | |
---|
1013 | *xy = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget)); |
---|
1014 | panel_config_register_changes (ppc); |
---|
1015 | } |
---|
1016 | |
---|
1017 | static GtkWidget * |
---|
1018 | floating_notebook_page (PerPanelConfig *ppc) |
---|
1019 | { |
---|
1020 | GtkWidget *vbox; |
---|
1021 | GtkWidget *vvbox; |
---|
1022 | GtkWidget *box; |
---|
1023 | GtkWidget *button, *label; |
---|
1024 | GtkWidget *orientbox; |
---|
1025 | GtkObject *range; |
---|
1026 | GtkWidget *f, *w; |
---|
1027 | GtkWidget *hbox; |
---|
1028 | int xlimit, ylimit; |
---|
1029 | |
---|
1030 | xlimit = multiscreen_width (ppc->screen) |
---|
1031 | - ppc->panel->allocation.width; |
---|
1032 | ylimit = multiscreen_height (ppc->screen) |
---|
1033 | - ppc->panel->allocation.height; |
---|
1034 | |
---|
1035 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1036 | |
---|
1037 | f = gtk_frame_new (_("Size and Position")); |
---|
1038 | gtk_container_set_border_width (GTK_CONTAINER (f), GNOME_PAD_SMALL); |
---|
1039 | gtk_box_pack_start (GTK_BOX (vbox), f, FALSE, TRUE, 0); |
---|
1040 | |
---|
1041 | vvbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1042 | gtk_container_set_border_width (GTK_CONTAINER (vvbox), GNOME_PAD_SMALL); |
---|
1043 | gtk_container_add (GTK_CONTAINER (f), vvbox); |
---|
1044 | |
---|
1045 | box = gtk_hbox_new (TRUE, GNOME_PAD_SMALL); |
---|
1046 | gtk_box_pack_start (GTK_BOX (vvbox), box, TRUE, TRUE, 0); |
---|
1047 | |
---|
1048 | w = make_size_widget (ppc); |
---|
1049 | gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0); |
---|
1050 | |
---|
1051 | /****** bleh ********/ |
---|
1052 | orientbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1053 | gtk_box_pack_start (GTK_BOX (box), orientbox, FALSE, FALSE, 0); |
---|
1054 | |
---|
1055 | ppc->h_orient = button = gtk_radio_button_new_with_label ( |
---|
1056 | NULL, _("Orient panel horizontally")); |
---|
1057 | if(ppc->orient == PANEL_HORIZONTAL) |
---|
1058 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); |
---|
1059 | gtk_object_set_user_data (GTK_OBJECT (button), ppc); |
---|
1060 | gtk_signal_connect (GTK_OBJECT (button), "toggled", |
---|
1061 | GTK_SIGNAL_FUNC (floating_set_orient), |
---|
1062 | GINT_TO_POINTER (PANEL_HORIZONTAL)); |
---|
1063 | gtk_box_pack_start (GTK_BOX (orientbox), button, FALSE, FALSE, 0); |
---|
1064 | |
---|
1065 | ppc->v_orient = button = |
---|
1066 | gtk_radio_button_new_with_label_from_widget ( |
---|
1067 | GTK_RADIO_BUTTON (ppc->h_orient), |
---|
1068 | _("Orient panel vertically")); |
---|
1069 | if(ppc->orient == PANEL_VERTICAL) |
---|
1070 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); |
---|
1071 | gtk_object_set_user_data (GTK_OBJECT (button), ppc); |
---|
1072 | gtk_signal_connect (GTK_OBJECT (button), "toggled", |
---|
1073 | GTK_SIGNAL_FUNC (floating_set_orient), |
---|
1074 | GINT_TO_POINTER (PANEL_VERTICAL)); |
---|
1075 | gtk_box_pack_start (GTK_BOX (orientbox), button, FALSE, FALSE, 0); |
---|
1076 | |
---|
1077 | hbox = gtk_hbox_new (FALSE, 0); |
---|
1078 | gtk_box_pack_start (GTK_BOX (orientbox), hbox, FALSE, FALSE, 0); |
---|
1079 | |
---|
1080 | label = gtk_label_new (_("Top left corner's position: X")); |
---|
1081 | gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
---|
1082 | |
---|
1083 | range = gtk_adjustment_new (ppc->x, 0, xlimit, 1, 10, 10); |
---|
1084 | ppc->x_spin = button = |
---|
1085 | gtk_spin_button_new (GTK_ADJUSTMENT (range), 1, 0); |
---|
1086 | gtk_widget_set_usize (GTK_WIDGET (button), 65, 0); |
---|
1087 | gtk_object_set_user_data (GTK_OBJECT (button), ppc); |
---|
1088 | gtk_spin_button_set_value (GTK_SPIN_BUTTON (button), ppc->x); |
---|
1089 | gtk_signal_connect (GTK_OBJECT (button), "changed", |
---|
1090 | GTK_SIGNAL_FUNC (floating_set_xy), |
---|
1091 | &ppc->x); |
---|
1092 | gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); |
---|
1093 | |
---|
1094 | label = gtk_label_new (_("Y")); |
---|
1095 | gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
---|
1096 | |
---|
1097 | range = gtk_adjustment_new (ppc->y, 0, ylimit, 1, 10, 10); |
---|
1098 | ppc->y_spin = button = |
---|
1099 | gtk_spin_button_new (GTK_ADJUSTMENT (range), 1, 0); |
---|
1100 | gtk_widget_set_usize (GTK_WIDGET (button), 65, 0); |
---|
1101 | gtk_object_set_user_data (GTK_OBJECT (button), ppc); |
---|
1102 | gtk_spin_button_set_value (GTK_SPIN_BUTTON (button), ppc->y); |
---|
1103 | gtk_signal_connect (GTK_OBJECT (button), "changed", |
---|
1104 | GTK_SIGNAL_FUNC (floating_set_xy), |
---|
1105 | &ppc->y); |
---|
1106 | gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); |
---|
1107 | |
---|
1108 | w = make_level_widget (ppc); |
---|
1109 | gtk_box_pack_start (GTK_BOX (vvbox), w, FALSE, FALSE, 0); |
---|
1110 | |
---|
1111 | w = make_hidebuttons_widget (ppc); |
---|
1112 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
1113 | |
---|
1114 | w = make_misc_widget (ppc, FALSE); |
---|
1115 | if (w != NULL) |
---|
1116 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
1117 | |
---|
1118 | return vbox; |
---|
1119 | } |
---|
1120 | |
---|
1121 | |
---|
1122 | static void |
---|
1123 | sliding_set_offset (GtkWidget *widget, gpointer data) |
---|
1124 | { |
---|
1125 | PerPanelConfig *ppc = data; |
---|
1126 | |
---|
1127 | ppc->offset = |
---|
1128 | gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ppc->offset_spin)); |
---|
1129 | |
---|
1130 | panel_config_register_changes (ppc); |
---|
1131 | } |
---|
1132 | |
---|
1133 | |
---|
1134 | static GtkWidget * |
---|
1135 | sliding_notebook_page (PerPanelConfig *ppc) |
---|
1136 | { |
---|
1137 | GtkWidget *vvbox, *vbox, *box, *hbox; |
---|
1138 | GtkWidget *w, *f; |
---|
1139 | GtkWidget *l; |
---|
1140 | GtkWidget *button; |
---|
1141 | GtkAdjustment *adj; |
---|
1142 | int range; |
---|
1143 | |
---|
1144 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1145 | |
---|
1146 | f = gtk_frame_new (_("Size and Position")); |
---|
1147 | gtk_container_set_border_width (GTK_CONTAINER (f), GNOME_PAD_SMALL); |
---|
1148 | gtk_box_pack_start (GTK_BOX (vbox), f, FALSE, TRUE, 0); |
---|
1149 | |
---|
1150 | vvbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1151 | gtk_container_set_border_width (GTK_CONTAINER (vvbox), GNOME_PAD_SMALL); |
---|
1152 | gtk_container_add (GTK_CONTAINER (f), vvbox); |
---|
1153 | |
---|
1154 | box = gtk_hbox_new (TRUE, GNOME_PAD_SMALL); |
---|
1155 | |
---|
1156 | w = make_size_widget (ppc); |
---|
1157 | gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0); |
---|
1158 | |
---|
1159 | hbox = gtk_hbox_new (TRUE, GNOME_PAD_SMALL); |
---|
1160 | gtk_box_pack_start (GTK_BOX (vvbox), hbox, TRUE, TRUE, 0); |
---|
1161 | gtk_container_set_border_width (GTK_CONTAINER (hbox), GNOME_PAD_SMALL); |
---|
1162 | |
---|
1163 | gtk_box_pack_start (GTK_BOX (hbox), box, FALSE, FALSE, 0); |
---|
1164 | |
---|
1165 | w = make_position_widget (ppc, 2); |
---|
1166 | gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0); |
---|
1167 | |
---|
1168 | hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1169 | gtk_box_pack_start (GTK_BOX (vvbox), hbox, TRUE, TRUE, 0); |
---|
1170 | |
---|
1171 | l = gtk_label_new (_("Offset from screen edge:")); |
---|
1172 | gtk_box_pack_start (GTK_BOX (hbox), l, FALSE, FALSE, 0); |
---|
1173 | |
---|
1174 | if(ppc->edge == BORDER_LEFT || ppc->edge == BORDER_RIGHT) |
---|
1175 | range = multiscreen_height (ppc->screen) |
---|
1176 | - ppc->panel->allocation.height; |
---|
1177 | else |
---|
1178 | range = multiscreen_width (ppc->screen) |
---|
1179 | - ppc->panel->allocation.width; |
---|
1180 | adj = GTK_ADJUSTMENT(gtk_adjustment_new (ppc->offset, 0, range, 1, 10, 10)); |
---|
1181 | ppc->offset_spin = button = |
---|
1182 | gtk_spin_button_new (adj, 1, 0); |
---|
1183 | gtk_widget_set_usize (button, 100, 0); |
---|
1184 | gtk_spin_button_set_value (GTK_SPIN_BUTTON (button), ppc->offset); |
---|
1185 | gtk_signal_connect (GTK_OBJECT (button), "changed", |
---|
1186 | GTK_SIGNAL_FUNC (sliding_set_offset), ppc); |
---|
1187 | gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); |
---|
1188 | |
---|
1189 | w = make_level_widget (ppc); |
---|
1190 | gtk_box_pack_start (GTK_BOX (vvbox), w, FALSE, FALSE, 0); |
---|
1191 | |
---|
1192 | w = make_hidebuttons_widget (ppc); |
---|
1193 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
1194 | |
---|
1195 | w = make_misc_widget (ppc, TRUE); |
---|
1196 | if (w != NULL) |
---|
1197 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
1198 | |
---|
1199 | return vbox; |
---|
1200 | } |
---|
1201 | |
---|
1202 | static void |
---|
1203 | size_set_size (GtkWidget *widget, gpointer data) |
---|
1204 | { |
---|
1205 | int sz = GPOINTER_TO_INT(data); |
---|
1206 | PerPanelConfig *ppc = gtk_object_get_user_data(GTK_OBJECT(widget)); |
---|
1207 | |
---|
1208 | if(ppc->sz == sz) |
---|
1209 | return; |
---|
1210 | |
---|
1211 | ppc->sz = sz; |
---|
1212 | |
---|
1213 | panel_config_register_changes (ppc); |
---|
1214 | } |
---|
1215 | |
---|
1216 | /* XXX: until this is fixed in GTK+ */ |
---|
1217 | static void |
---|
1218 | activate_proper_item (GtkMenu *menu) |
---|
1219 | { |
---|
1220 | GtkWidget *active; |
---|
1221 | active = gtk_menu_get_active (menu); |
---|
1222 | if (active != NULL) |
---|
1223 | gtk_menu_item_activate (GTK_MENU_ITEM (active)); |
---|
1224 | } |
---|
1225 | |
---|
1226 | GtkWidget * |
---|
1227 | make_size_widget (PerPanelConfig *ppc) |
---|
1228 | { |
---|
1229 | GtkWidget *box; |
---|
1230 | GtkWidget *vbox; |
---|
1231 | GtkWidget *menu; |
---|
1232 | GtkWidget *menuitem; |
---|
1233 | GtkWidget *w; |
---|
1234 | gchar *s; |
---|
1235 | int i; |
---|
1236 | |
---|
1237 | /* main vbox */ |
---|
1238 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1239 | |
---|
1240 | box = gtk_hbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1241 | gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0); |
---|
1242 | |
---|
1243 | gtk_box_pack_start (GTK_BOX (box), |
---|
1244 | gtk_label_new (_("Panel size:")), |
---|
1245 | FALSE, FALSE, 0); |
---|
1246 | |
---|
1247 | |
---|
1248 | menu = gtk_menu_new (); |
---|
1249 | gtk_signal_connect (GTK_OBJECT (menu), "deactivate", |
---|
1250 | GTK_SIGNAL_FUNC (activate_proper_item), |
---|
1251 | NULL); |
---|
1252 | |
---|
1253 | menuitem = gtk_menu_item_new_with_label (_("Ultra Tiny (12 pixels)")); |
---|
1254 | gtk_widget_show(menuitem); |
---|
1255 | gtk_menu_append (GTK_MENU (menu), menuitem); |
---|
1256 | gtk_object_set_user_data (GTK_OBJECT (menuitem), ppc); |
---|
1257 | gtk_signal_connect (GTK_OBJECT (menuitem), "activate", |
---|
1258 | GTK_SIGNAL_FUNC (size_set_size), |
---|
1259 | GINT_TO_POINTER (SIZE_ULTRA_TINY)); |
---|
1260 | |
---|
1261 | menuitem = gtk_menu_item_new_with_label (_("Tiny (24 pixels)")); |
---|
1262 | gtk_widget_show(menuitem); |
---|
1263 | gtk_menu_append (GTK_MENU (menu), menuitem); |
---|
1264 | gtk_object_set_user_data (GTK_OBJECT (menuitem), ppc); |
---|
1265 | gtk_signal_connect (GTK_OBJECT (menuitem), "activate", |
---|
1266 | GTK_SIGNAL_FUNC (size_set_size), |
---|
1267 | GINT_TO_POINTER (SIZE_TINY)); |
---|
1268 | |
---|
1269 | menuitem = gtk_menu_item_new_with_label (_("Small (36 pixels)")); |
---|
1270 | gtk_widget_show(menuitem); |
---|
1271 | gtk_menu_append (GTK_MENU (menu), menuitem); |
---|
1272 | gtk_object_set_user_data (GTK_OBJECT (menuitem), ppc); |
---|
1273 | gtk_signal_connect (GTK_OBJECT (menuitem), "activate", |
---|
1274 | GTK_SIGNAL_FUNC (size_set_size), |
---|
1275 | GINT_TO_POINTER (SIZE_SMALL)); |
---|
1276 | |
---|
1277 | menuitem = gtk_menu_item_new_with_label (_("Standard (48 pixels)")); |
---|
1278 | gtk_widget_show(menuitem); |
---|
1279 | gtk_menu_append (GTK_MENU (menu), menuitem); |
---|
1280 | gtk_object_set_user_data (GTK_OBJECT (menuitem), ppc); |
---|
1281 | gtk_signal_connect (GTK_OBJECT (menuitem), "activate", |
---|
1282 | GTK_SIGNAL_FUNC (size_set_size), |
---|
1283 | GINT_TO_POINTER (SIZE_STANDARD)); |
---|
1284 | |
---|
1285 | menuitem = gtk_menu_item_new_with_label (_("Large (64 pixels)")); |
---|
1286 | gtk_widget_show(menuitem); |
---|
1287 | gtk_menu_append (GTK_MENU (menu), menuitem); |
---|
1288 | gtk_object_set_user_data (GTK_OBJECT (menuitem), ppc); |
---|
1289 | gtk_signal_connect (GTK_OBJECT (menuitem), "activate", |
---|
1290 | GTK_SIGNAL_FUNC (size_set_size), |
---|
1291 | GINT_TO_POINTER (SIZE_LARGE)); |
---|
1292 | |
---|
1293 | menuitem = gtk_menu_item_new_with_label (_("Huge (80 pixels)")); |
---|
1294 | gtk_widget_show(menuitem); |
---|
1295 | gtk_menu_append (GTK_MENU (menu), menuitem); |
---|
1296 | gtk_object_set_user_data (GTK_OBJECT (menuitem), ppc); |
---|
1297 | gtk_signal_connect (GTK_OBJECT (menuitem), "activate", |
---|
1298 | GTK_SIGNAL_FUNC (size_set_size), |
---|
1299 | GINT_TO_POINTER (SIZE_HUGE)); |
---|
1300 | |
---|
1301 | menuitem = gtk_menu_item_new_with_label (_("Ridiculous (128 pixels)")); |
---|
1302 | gtk_widget_show(menuitem); |
---|
1303 | gtk_menu_append (GTK_MENU (menu), menuitem); |
---|
1304 | gtk_object_set_user_data (GTK_OBJECT (menuitem), ppc); |
---|
1305 | gtk_signal_connect (GTK_OBJECT (menuitem), "activate", |
---|
1306 | GTK_SIGNAL_FUNC (size_set_size), |
---|
1307 | GINT_TO_POINTER (SIZE_RIDICULOUS)); |
---|
1308 | |
---|
1309 | ppc->size_menu = gtk_option_menu_new (); |
---|
1310 | gtk_option_menu_set_menu (GTK_OPTION_MENU (ppc->size_menu), menu); |
---|
1311 | |
---|
1312 | gtk_box_pack_start (GTK_BOX (box), ppc->size_menu, |
---|
1313 | FALSE, FALSE, 0); |
---|
1314 | |
---|
1315 | s = _("Note: The panel will size itself to the\n" |
---|
1316 | "largest applet in the panel, and that\n" |
---|
1317 | "not all applets obey these sizes."); |
---|
1318 | |
---|
1319 | w = gtk_label_new (s); |
---|
1320 | gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_LEFT); |
---|
1321 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
1322 | |
---|
1323 | switch(ppc->sz) { |
---|
1324 | case SIZE_ULTRA_TINY: |
---|
1325 | i = 0; |
---|
1326 | break; |
---|
1327 | case SIZE_TINY: |
---|
1328 | i = 1; |
---|
1329 | break; |
---|
1330 | case SIZE_SMALL: |
---|
1331 | i = 2; |
---|
1332 | break; |
---|
1333 | default: |
---|
1334 | case SIZE_STANDARD: |
---|
1335 | i = 3; |
---|
1336 | break; |
---|
1337 | case SIZE_LARGE: |
---|
1338 | i = 4; |
---|
1339 | break; |
---|
1340 | case SIZE_HUGE: |
---|
1341 | i = 5; |
---|
1342 | break; |
---|
1343 | case SIZE_RIDICULOUS: |
---|
1344 | i = 6; |
---|
1345 | break; |
---|
1346 | } |
---|
1347 | |
---|
1348 | gtk_option_menu_set_history (GTK_OPTION_MENU (ppc->size_menu), i); |
---|
1349 | menuitem = g_list_nth_data(GTK_MENU_SHELL(GTK_OPTION_MENU(ppc->size_menu)->menu)->children, i); |
---|
1350 | gtk_menu_item_activate(GTK_MENU_ITEM(menuitem)); |
---|
1351 | |
---|
1352 | return vbox; |
---|
1353 | } |
---|
1354 | |
---|
1355 | static void |
---|
1356 | level_set_level (GtkWidget *widget, gpointer data) |
---|
1357 | { |
---|
1358 | BasePLevel level = GPOINTER_TO_INT (data); |
---|
1359 | PerPanelConfig *ppc = gtk_object_get_user_data (GTK_OBJECT (widget)); |
---|
1360 | |
---|
1361 | if(ppc->level == level) |
---|
1362 | return; |
---|
1363 | |
---|
1364 | ppc->level = level; |
---|
1365 | |
---|
1366 | panel_config_register_changes (ppc); |
---|
1367 | } |
---|
1368 | |
---|
1369 | GtkWidget * |
---|
1370 | make_level_widget (PerPanelConfig *ppc) |
---|
1371 | { |
---|
1372 | GtkWidget *box; |
---|
1373 | GtkWidget *menu; |
---|
1374 | GtkWidget *menuitem; |
---|
1375 | int i; |
---|
1376 | |
---|
1377 | box = gtk_hbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1378 | |
---|
1379 | gtk_box_pack_start (GTK_BOX (box), |
---|
1380 | gtk_label_new (_("Panel window level:")), |
---|
1381 | FALSE, FALSE, 0); |
---|
1382 | |
---|
1383 | menu = gtk_menu_new (); |
---|
1384 | gtk_signal_connect (GTK_OBJECT (menu), "deactivate", |
---|
1385 | GTK_SIGNAL_FUNC (activate_proper_item), |
---|
1386 | NULL); |
---|
1387 | |
---|
1388 | menuitem = gtk_menu_item_new_with_label (_("Default (from global preferences)")); |
---|
1389 | gtk_widget_show(menuitem); |
---|
1390 | gtk_menu_append (GTK_MENU (menu), menuitem); |
---|
1391 | gtk_object_set_user_data (GTK_OBJECT (menuitem), ppc); |
---|
1392 | gtk_signal_connect (GTK_OBJECT (menuitem), "activate", |
---|
1393 | GTK_SIGNAL_FUNC (level_set_level), |
---|
1394 | GINT_TO_POINTER (BASEP_LEVEL_DEFAULT)); |
---|
1395 | |
---|
1396 | menuitem = gtk_menu_item_new_with_label (_("Above other windows")); |
---|
1397 | gtk_widget_show(menuitem); |
---|
1398 | gtk_menu_append (GTK_MENU (menu), menuitem); |
---|
1399 | gtk_object_set_user_data (GTK_OBJECT (menuitem), ppc); |
---|
1400 | gtk_signal_connect (GTK_OBJECT (menuitem), "activate", |
---|
1401 | GTK_SIGNAL_FUNC (level_set_level), |
---|
1402 | GINT_TO_POINTER (BASEP_LEVEL_ABOVE)); |
---|
1403 | |
---|
1404 | menuitem = gtk_menu_item_new_with_label (_("Normal")); |
---|
1405 | gtk_widget_show(menuitem); |
---|
1406 | gtk_menu_append (GTK_MENU (menu), menuitem); |
---|
1407 | gtk_object_set_user_data (GTK_OBJECT (menuitem), ppc); |
---|
1408 | gtk_signal_connect (GTK_OBJECT (menuitem), "activate", |
---|
1409 | GTK_SIGNAL_FUNC (level_set_level), |
---|
1410 | GINT_TO_POINTER (BASEP_LEVEL_NORMAL)); |
---|
1411 | |
---|
1412 | menuitem = gtk_menu_item_new_with_label (_("Below other windows")); |
---|
1413 | gtk_widget_show(menuitem); |
---|
1414 | gtk_menu_append (GTK_MENU (menu), menuitem); |
---|
1415 | gtk_object_set_user_data (GTK_OBJECT (menuitem), ppc); |
---|
1416 | gtk_signal_connect (GTK_OBJECT (menuitem), "activate", |
---|
1417 | GTK_SIGNAL_FUNC (level_set_level), |
---|
1418 | GINT_TO_POINTER (BASEP_LEVEL_BELOW)); |
---|
1419 | |
---|
1420 | ppc->level_menu = gtk_option_menu_new (); |
---|
1421 | gtk_option_menu_set_menu (GTK_OPTION_MENU (ppc->level_menu), menu); |
---|
1422 | |
---|
1423 | gtk_box_pack_start (GTK_BOX (box), ppc->level_menu, |
---|
1424 | FALSE, FALSE, 0); |
---|
1425 | |
---|
1426 | switch (ppc->level) { |
---|
1427 | default: |
---|
1428 | case BASEP_LEVEL_DEFAULT: |
---|
1429 | i = 0; |
---|
1430 | break; |
---|
1431 | case BASEP_LEVEL_ABOVE: |
---|
1432 | i = 1; |
---|
1433 | break; |
---|
1434 | case BASEP_LEVEL_NORMAL: |
---|
1435 | i = 2; |
---|
1436 | break; |
---|
1437 | case BASEP_LEVEL_BELOW: |
---|
1438 | i = 3; |
---|
1439 | break; |
---|
1440 | } |
---|
1441 | |
---|
1442 | gtk_option_menu_set_history (GTK_OPTION_MENU (ppc->level_menu), i); |
---|
1443 | menuitem = g_list_nth_data (GTK_MENU_SHELL (GTK_OPTION_MENU (ppc->level_menu)->menu)->children, i); |
---|
1444 | gtk_menu_item_activate (GTK_MENU_ITEM (menuitem)); |
---|
1445 | |
---|
1446 | return box; |
---|
1447 | } |
---|
1448 | |
---|
1449 | static void |
---|
1450 | value_changed (GtkWidget *w, gpointer data) |
---|
1451 | { |
---|
1452 | PerPanelConfig *ppc = data; |
---|
1453 | |
---|
1454 | g_free(ppc->back_pixmap); |
---|
1455 | ppc->back_pixmap = gnome_pixmap_entry_get_filename(GNOME_PIXMAP_ENTRY(ppc->pix_entry)); |
---|
1456 | |
---|
1457 | panel_config_register_changes (ppc); |
---|
1458 | } |
---|
1459 | |
---|
1460 | static void |
---|
1461 | set_fit_pixmap_bg (GtkToggleButton *toggle, gpointer data) |
---|
1462 | { |
---|
1463 | PerPanelConfig *ppc = data; |
---|
1464 | ppc->fit_pixmap_bg = toggle->active; |
---|
1465 | |
---|
1466 | panel_config_register_changes (ppc); |
---|
1467 | } |
---|
1468 | |
---|
1469 | static void |
---|
1470 | set_strech_pixmap_bg (GtkToggleButton *toggle, gpointer data) |
---|
1471 | { |
---|
1472 | PerPanelConfig *ppc = data; |
---|
1473 | ppc->strech_pixmap_bg = toggle->active; |
---|
1474 | |
---|
1475 | panel_config_register_changes (ppc); |
---|
1476 | } |
---|
1477 | |
---|
1478 | static void |
---|
1479 | set_rotate_pixmap_bg (GtkToggleButton *toggle, gpointer data) |
---|
1480 | { |
---|
1481 | PerPanelConfig *ppc = data; |
---|
1482 | ppc->rotate_pixmap_bg = toggle->active; |
---|
1483 | |
---|
1484 | panel_config_register_changes (ppc); |
---|
1485 | } |
---|
1486 | |
---|
1487 | static void |
---|
1488 | color_set_cb (GtkWidget *w, int r, int g, int b, int a, gpointer data) |
---|
1489 | { |
---|
1490 | PerPanelConfig *ppc = data; |
---|
1491 | |
---|
1492 | ppc->back_color.red = r; |
---|
1493 | ppc->back_color.green = g; |
---|
1494 | ppc->back_color.blue = b; |
---|
1495 | |
---|
1496 | panel_config_register_changes (ppc); |
---|
1497 | } |
---|
1498 | |
---|
1499 | static void |
---|
1500 | set_back (GtkWidget *widget, gpointer data) |
---|
1501 | { |
---|
1502 | GtkWidget *pixf,*colf; |
---|
1503 | PerPanelConfig *ppc = gtk_object_get_user_data(GTK_OBJECT(widget)); |
---|
1504 | PanelBackType back_type = GPOINTER_TO_INT (data); |
---|
1505 | |
---|
1506 | if (ppc->back_type == back_type) |
---|
1507 | return; |
---|
1508 | |
---|
1509 | pixf = gtk_object_get_data (GTK_OBJECT (widget), "pix"); |
---|
1510 | colf = gtk_object_get_data (GTK_OBJECT (widget), "col"); |
---|
1511 | |
---|
1512 | if (back_type == PANEL_BACK_NONE) { |
---|
1513 | gtk_widget_set_sensitive (pixf, FALSE); |
---|
1514 | gtk_widget_set_sensitive (colf, FALSE); |
---|
1515 | } else if (back_type == PANEL_BACK_COLOR) { |
---|
1516 | gtk_widget_set_sensitive (pixf, FALSE); |
---|
1517 | gtk_widget_set_sensitive (colf, TRUE); |
---|
1518 | } else if (back_type == PANEL_BACK_TRANSLUCENT) { |
---|
1519 | gtk_widget_set_sensitive (pixf, FALSE); |
---|
1520 | gtk_widget_set_sensitive (colf, FALSE); |
---|
1521 | } else { |
---|
1522 | gtk_widget_set_sensitive (pixf, TRUE); |
---|
1523 | gtk_widget_set_sensitive (colf, FALSE); |
---|
1524 | } |
---|
1525 | |
---|
1526 | ppc->back_type = back_type; |
---|
1527 | |
---|
1528 | panel_config_register_changes (ppc); |
---|
1529 | } |
---|
1530 | |
---|
1531 | static void |
---|
1532 | color_picker_clicked_signal (GtkWidget *widget, gpointer data) |
---|
1533 | { |
---|
1534 | GtkWidget *toplevel; |
---|
1535 | GnomeColorPicker *cp; |
---|
1536 | |
---|
1537 | cp = GNOME_COLOR_PICKER (widget); |
---|
1538 | |
---|
1539 | if (cp->cs_dialog == NULL) |
---|
1540 | return; |
---|
1541 | |
---|
1542 | toplevel = gtk_widget_get_toplevel (widget); |
---|
1543 | |
---|
1544 | /* sanity */ |
---|
1545 | if (toplevel == NULL) |
---|
1546 | return; |
---|
1547 | |
---|
1548 | gtk_window_set_transient_for (GTK_WINDOW (cp->cs_dialog), |
---|
1549 | GTK_WINDOW (toplevel)); |
---|
1550 | } |
---|
1551 | |
---|
1552 | static GtkWidget * |
---|
1553 | background_page (PerPanelConfig *ppc) |
---|
1554 | { |
---|
1555 | GtkWidget *box, *f, *t; |
---|
1556 | GtkWidget *vbox, *noscale, *fit, *strech; |
---|
1557 | GtkWidget *w, *m; |
---|
1558 | GtkWidget *spinbutton; |
---|
1559 | |
---|
1560 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1561 | gtk_container_set_border_width(GTK_CONTAINER (vbox), GNOME_PAD_SMALL); |
---|
1562 | |
---|
1563 | box = gtk_hbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1564 | gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0); |
---|
1565 | |
---|
1566 | w = gtk_label_new(_("Background Type: ")); |
---|
1567 | gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0); |
---|
1568 | |
---|
1569 | /*background type option menu*/ |
---|
1570 | m = gtk_menu_new (); |
---|
1571 | gtk_signal_connect (GTK_OBJECT (m), "deactivate", |
---|
1572 | GTK_SIGNAL_FUNC (activate_proper_item), |
---|
1573 | NULL); |
---|
1574 | ppc->non = gtk_menu_item_new_with_label (_("Standard")); |
---|
1575 | gtk_object_set_user_data(GTK_OBJECT(ppc->non),ppc); |
---|
1576 | gtk_widget_show (ppc->non); |
---|
1577 | gtk_menu_append (GTK_MENU (m), ppc->non); |
---|
1578 | ppc->col = gtk_menu_item_new_with_label (_("Color")); |
---|
1579 | gtk_object_set_user_data(GTK_OBJECT(ppc->col),ppc); |
---|
1580 | gtk_widget_show (ppc->col); |
---|
1581 | gtk_menu_append (GTK_MENU (m), ppc->col); |
---|
1582 | ppc->pix = gtk_menu_item_new_with_label (_("Pixmap")); |
---|
1583 | gtk_object_set_user_data(GTK_OBJECT(ppc->pix),ppc); |
---|
1584 | gtk_widget_show (ppc->pix); |
---|
1585 | gtk_menu_append (GTK_MENU (m), ppc->pix); |
---|
1586 | ppc->trans = gtk_menu_item_new_with_label (_("Translucent")); |
---|
1587 | gtk_object_set_user_data(GTK_OBJECT(ppc->trans),ppc); |
---|
1588 | gtk_widget_show (ppc->trans); |
---|
1589 | gtk_menu_append (GTK_MENU (m), ppc->trans); |
---|
1590 | |
---|
1591 | ppc->back_om = gtk_option_menu_new (); |
---|
1592 | gtk_option_menu_set_menu (GTK_OPTION_MENU (ppc->back_om), m); |
---|
1593 | gtk_box_pack_start (GTK_BOX (box), ppc->back_om, FALSE, FALSE, 0); |
---|
1594 | |
---|
1595 | |
---|
1596 | /*color frame*/ |
---|
1597 | f = gtk_frame_new (_("Color")); |
---|
1598 | gtk_widget_set_sensitive (f, ppc->back_type == PANEL_BACK_COLOR); |
---|
1599 | gtk_object_set_data(GTK_OBJECT(ppc->trans),"col",f); |
---|
1600 | gtk_object_set_data(GTK_OBJECT(ppc->pix),"col",f); |
---|
1601 | gtk_object_set_data(GTK_OBJECT(ppc->col),"col",f); |
---|
1602 | gtk_object_set_data(GTK_OBJECT(ppc->non),"col",f); |
---|
1603 | gtk_container_set_border_width(GTK_CONTAINER (f), GNOME_PAD_SMALL); |
---|
1604 | gtk_box_pack_start (GTK_BOX (vbox), f, FALSE, FALSE, 0); |
---|
1605 | |
---|
1606 | box = gtk_hbox_new (0, 0); |
---|
1607 | gtk_container_set_border_width(GTK_CONTAINER (box), GNOME_PAD_SMALL); |
---|
1608 | gtk_container_add (GTK_CONTAINER (f), box); |
---|
1609 | |
---|
1610 | gtk_box_pack_start (GTK_BOX (box), gtk_label_new (_("Color to use:")), |
---|
1611 | FALSE, FALSE, GNOME_PAD_SMALL); |
---|
1612 | |
---|
1613 | ppc->backsel = gnome_color_picker_new(); |
---|
1614 | /* This will make sure the selection dialog is set as a transient for |
---|
1615 | * the config dialog */ |
---|
1616 | gtk_signal_connect_after (GTK_OBJECT (ppc->backsel), |
---|
1617 | "clicked", |
---|
1618 | GTK_SIGNAL_FUNC (color_picker_clicked_signal), |
---|
1619 | NULL); |
---|
1620 | |
---|
1621 | gtk_signal_connect(GTK_OBJECT(ppc->backsel),"color_set", |
---|
1622 | GTK_SIGNAL_FUNC(color_set_cb), ppc); |
---|
1623 | gnome_color_picker_set_i16(GNOME_COLOR_PICKER(ppc->backsel), |
---|
1624 | ppc->back_color.red, |
---|
1625 | ppc->back_color.green, |
---|
1626 | ppc->back_color.blue, |
---|
1627 | 65535); |
---|
1628 | |
---|
1629 | gtk_box_pack_start (GTK_BOX (box), ppc->backsel, FALSE, FALSE, 0); |
---|
1630 | |
---|
1631 | /*image frame*/ |
---|
1632 | f = gtk_frame_new (_("Image")); |
---|
1633 | gtk_widget_set_sensitive (f, ppc->back_type == PANEL_BACK_PIXMAP); |
---|
1634 | gtk_object_set_data(GTK_OBJECT(ppc->trans),"pix",f); |
---|
1635 | gtk_object_set_data(GTK_OBJECT(ppc->pix),"pix",f); |
---|
1636 | gtk_object_set_data(GTK_OBJECT(ppc->col),"pix",f); |
---|
1637 | gtk_object_set_data(GTK_OBJECT(ppc->non),"pix",f); |
---|
1638 | gtk_container_set_border_width(GTK_CONTAINER (f), GNOME_PAD_SMALL); |
---|
1639 | gtk_box_pack_start (GTK_BOX (vbox), f, FALSE, FALSE, 0); |
---|
1640 | |
---|
1641 | box = gtk_vbox_new (0, 0); |
---|
1642 | gtk_container_set_border_width(GTK_CONTAINER (box), GNOME_PAD_SMALL); |
---|
1643 | gtk_container_add (GTK_CONTAINER (f), box); |
---|
1644 | |
---|
1645 | ppc->pix_entry = gnome_pixmap_entry_new ("pixmap", _("Browse"), TRUE); |
---|
1646 | if(gdk_screen_height()<600) |
---|
1647 | gnome_pixmap_entry_set_preview_size (GNOME_PIXMAP_ENTRY (ppc->pix_entry), |
---|
1648 | 0,50); |
---|
1649 | t = gnome_pixmap_entry_gtk_entry (GNOME_PIXMAP_ENTRY (ppc->pix_entry)); |
---|
1650 | gtk_signal_connect_while_alive (GTK_OBJECT (t), "changed", |
---|
1651 | GTK_SIGNAL_FUNC (value_changed), ppc, |
---|
1652 | GTK_OBJECT (ppc->pix_entry)); |
---|
1653 | gtk_box_pack_start (GTK_BOX (box), ppc->pix_entry, FALSE, FALSE, 0); |
---|
1654 | |
---|
1655 | gtk_entry_set_text (GTK_ENTRY (t), |
---|
1656 | sure_string (ppc->back_pixmap)); |
---|
1657 | |
---|
1658 | noscale = gtk_radio_button_new_with_label ( |
---|
1659 | NULL, _("Don't scale image to fit")); |
---|
1660 | |
---|
1661 | gtk_box_pack_start (GTK_BOX (box), noscale, FALSE, FALSE,0); |
---|
1662 | |
---|
1663 | fit = gtk_radio_button_new_with_label ( |
---|
1664 | gtk_radio_button_group(GTK_RADIO_BUTTON(noscale)), |
---|
1665 | _("Scale image (keep proportions)")); |
---|
1666 | gtk_box_pack_start (GTK_BOX (box), fit, FALSE, FALSE,0); |
---|
1667 | |
---|
1668 | strech = gtk_radio_button_new_with_label ( |
---|
1669 | gtk_radio_button_group(GTK_RADIO_BUTTON(noscale)), |
---|
1670 | _("Stretch image (change proportions)")); |
---|
1671 | gtk_box_pack_start (GTK_BOX (box), strech, FALSE, FALSE,0); |
---|
1672 | |
---|
1673 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (noscale), |
---|
1674 | ppc->strech_pixmap_bg && |
---|
1675 | ppc->strech_pixmap_bg); |
---|
1676 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (strech), |
---|
1677 | ppc->strech_pixmap_bg); |
---|
1678 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fit), |
---|
1679 | ppc->fit_pixmap_bg); |
---|
1680 | gtk_signal_connect (GTK_OBJECT (fit), "toggled", |
---|
1681 | GTK_SIGNAL_FUNC (set_fit_pixmap_bg), ppc); |
---|
1682 | gtk_signal_connect (GTK_OBJECT (strech), "toggled", |
---|
1683 | GTK_SIGNAL_FUNC (set_strech_pixmap_bg), ppc); |
---|
1684 | |
---|
1685 | w = gtk_check_button_new_with_label (_("Rotate image for vertical panels")); |
---|
1686 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), |
---|
1687 | ppc->rotate_pixmap_bg); |
---|
1688 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
1689 | GTK_SIGNAL_FUNC (set_rotate_pixmap_bg), ppc); |
---|
1690 | gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE,0); |
---|
1691 | |
---|
1692 | gtk_signal_connect (GTK_OBJECT (ppc->non), "activate", |
---|
1693 | GTK_SIGNAL_FUNC (set_back), |
---|
1694 | GINT_TO_POINTER(PANEL_BACK_NONE)); |
---|
1695 | gtk_signal_connect (GTK_OBJECT (ppc->pix), "activate", |
---|
1696 | GTK_SIGNAL_FUNC (set_back), |
---|
1697 | GINT_TO_POINTER(PANEL_BACK_PIXMAP)); |
---|
1698 | gtk_signal_connect (GTK_OBJECT (ppc->trans), "activate", |
---|
1699 | GTK_SIGNAL_FUNC (set_back), |
---|
1700 | GINT_TO_POINTER(PANEL_BACK_TRANSLUCENT)); |
---|
1701 | gtk_signal_connect (GTK_OBJECT (ppc->col), "activate", |
---|
1702 | GTK_SIGNAL_FUNC (set_back), |
---|
1703 | GINT_TO_POINTER(PANEL_BACK_COLOR)); |
---|
1704 | |
---|
1705 | if(ppc->back_type == PANEL_BACK_NONE) { |
---|
1706 | gtk_option_menu_set_history(GTK_OPTION_MENU(ppc->back_om), 0); |
---|
1707 | gtk_menu_item_activate(GTK_MENU_ITEM(ppc->non)); |
---|
1708 | } else if(ppc->back_type == PANEL_BACK_COLOR) { |
---|
1709 | gtk_option_menu_set_history(GTK_OPTION_MENU(ppc->back_om), 1); |
---|
1710 | gtk_menu_item_activate(GTK_MENU_ITEM(ppc->col)); |
---|
1711 | } else if(ppc->back_type == PANEL_BACK_PIXMAP) { |
---|
1712 | gtk_option_menu_set_history(GTK_OPTION_MENU(ppc->back_om), 2); |
---|
1713 | gtk_menu_item_activate(GTK_MENU_ITEM(ppc->pix)); |
---|
1714 | } else { /* ppc->back_type == PANEL_BACK_TRANSLUCENT */ |
---|
1715 | gtk_option_menu_set_history(GTK_OPTION_MENU(ppc->back_om), 3); |
---|
1716 | gtk_menu_item_activate(GTK_MENU_ITEM(ppc->trans)); |
---|
1717 | } |
---|
1718 | |
---|
1719 | return vbox; |
---|
1720 | } |
---|
1721 | |
---|
1722 | static void |
---|
1723 | setup_pertype_defs (BasePWidget *basep, PerPanelConfig *ppc) |
---|
1724 | { |
---|
1725 | if (IS_BORDER_WIDGET (basep)) |
---|
1726 | ppc->edge = BORDER_POS (basep->pos)->edge; |
---|
1727 | |
---|
1728 | if (IS_ALIGNED_WIDGET(basep)) { |
---|
1729 | ppc->align = ALIGNED_POS (basep->pos)->align; |
---|
1730 | } else if (IS_FLOATING_WIDGET (basep)) { |
---|
1731 | FloatingPos *pos = FLOATING_POS (basep->pos); |
---|
1732 | ppc->x = pos->x; |
---|
1733 | ppc->y = pos->y; |
---|
1734 | ppc->orient = PANEL_WIDGET(basep->panel)->orient; |
---|
1735 | } else if (IS_SLIDING_WIDGET(basep)) { |
---|
1736 | SlidingPos *pos = SLIDING_POS (basep->pos); |
---|
1737 | ppc->offset = pos->offset; |
---|
1738 | ppc->align = pos->anchor; |
---|
1739 | } else { |
---|
1740 | ppc->align = 0; |
---|
1741 | } |
---|
1742 | } |
---|
1743 | |
---|
1744 | void |
---|
1745 | update_config_type (BasePWidget *w) |
---|
1746 | { |
---|
1747 | PerPanelConfig *ppc = get_config_struct (GTK_WIDGET (w)); |
---|
1748 | int i,j; |
---|
1749 | GtkWidget *page; |
---|
1750 | |
---|
1751 | if (ppc == NULL || |
---|
1752 | ppc->ppc_origin_change) |
---|
1753 | return; |
---|
1754 | |
---|
1755 | g_return_if_fail(ppc->type_tab); |
---|
1756 | |
---|
1757 | ppc->register_changes = FALSE; |
---|
1758 | gtk_widget_destroy(GTK_BIN(ppc->type_tab)->child); |
---|
1759 | |
---|
1760 | for(i = 0; i < POSITION_EDGES; i++) |
---|
1761 | for(j = 0; j < POSITION_ALIGNS; j++) |
---|
1762 | ppc->toggle[i][j] = NULL; |
---|
1763 | |
---|
1764 | setup_pertype_defs (BASEP_WIDGET(w), ppc); |
---|
1765 | |
---|
1766 | if(IS_EDGE_WIDGET(w)) { |
---|
1767 | /* edge notebook page */ |
---|
1768 | page = edge_notebook_page(ppc); |
---|
1769 | gtk_label_set(GTK_LABEL(ppc->type_tab_label), |
---|
1770 | _("Edge panel")); |
---|
1771 | gtk_container_add(GTK_CONTAINER(ppc->type_tab), page); |
---|
1772 | } else if(IS_ALIGNED_WIDGET(w)) { |
---|
1773 | /* aligned notebook page */ |
---|
1774 | page = aligned_notebook_page(ppc); |
---|
1775 | gtk_container_add(GTK_CONTAINER(ppc->type_tab), page); |
---|
1776 | gtk_label_set(GTK_LABEL(ppc->type_tab_label), |
---|
1777 | _("Aligned panel")); |
---|
1778 | } else if(IS_SLIDING_WIDGET(w)) { |
---|
1779 | /* sliding notebook page */ |
---|
1780 | page = sliding_notebook_page(ppc); |
---|
1781 | gtk_container_add(GTK_CONTAINER(ppc->type_tab), page); |
---|
1782 | gtk_label_set(GTK_LABEL(ppc->type_tab_label), |
---|
1783 | _("Sliding panel")); |
---|
1784 | } else if(IS_FLOATING_WIDGET(w)) { |
---|
1785 | /* floating notebook page */ |
---|
1786 | page = floating_notebook_page(ppc); |
---|
1787 | gtk_container_add(GTK_CONTAINER(ppc->type_tab), page); |
---|
1788 | gtk_label_set(GTK_LABEL(ppc->type_tab_label), |
---|
1789 | _("Floating panel")); |
---|
1790 | } |
---|
1791 | gtk_widget_show_all (ppc->type_tab); |
---|
1792 | ppc->register_changes = TRUE; |
---|
1793 | } |
---|
1794 | |
---|
1795 | static void |
---|
1796 | window_clicked (GtkWidget *w, int button, gpointer data) |
---|
1797 | { |
---|
1798 | GtkWidget *notebook = data; |
---|
1799 | char *help_path = gtk_object_get_data (GTK_OBJECT (w), "help_path"); |
---|
1800 | |
---|
1801 | if (button == 1) { /* help */ |
---|
1802 | int tab; |
---|
1803 | |
---|
1804 | tab = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)); |
---|
1805 | |
---|
1806 | if (tab == 1) |
---|
1807 | panel_show_help ("panelproperties.html#PANELBACKTAB"); |
---|
1808 | else |
---|
1809 | panel_show_help (help_path); |
---|
1810 | } else { |
---|
1811 | gnome_dialog_close (GNOME_DIALOG (w)); |
---|
1812 | } |
---|
1813 | } |
---|
1814 | |
---|
1815 | void |
---|
1816 | panel_config (GtkWidget *panel) |
---|
1817 | { |
---|
1818 | GtkWidget *page; |
---|
1819 | PerPanelConfig *ppc; |
---|
1820 | GtkWidget *prop_nbook; |
---|
1821 | BasePWidget *basep = BASEP_WIDGET (panel); |
---|
1822 | PanelWidget *pw = PANEL_WIDGET (basep->panel); |
---|
1823 | char *help_path = ""; |
---|
1824 | ppc = get_config_struct(panel); |
---|
1825 | |
---|
1826 | /* return if the window is already up. */ |
---|
1827 | if (ppc != NULL) { |
---|
1828 | g_assert (ppc->config_window != NULL); |
---|
1829 | |
---|
1830 | gtk_widget_show_now (ppc->config_window); |
---|
1831 | gdk_window_raise (ppc->config_window->window); |
---|
1832 | return; |
---|
1833 | } |
---|
1834 | |
---|
1835 | ppc = g_new0 (PerPanelConfig, 1); |
---|
1836 | ppconfigs = g_list_prepend(ppconfigs, ppc); |
---|
1837 | ppc->register_changes = FALSE; /*don't notify property box of changes |
---|
1838 | until everything is all set up*/ |
---|
1839 | ppc->ppc_origin_change = FALSE; /* default state */ |
---|
1840 | |
---|
1841 | ppc->sz = pw->sz; |
---|
1842 | ppc->screen = basep->screen; |
---|
1843 | ppc->level = basep->level; |
---|
1844 | ppc->avoid_on_maximize = basep->avoid_on_maximize; |
---|
1845 | ppc->hidebuttons = basep->hidebuttons_enabled; |
---|
1846 | ppc->hidebutton_pixmaps = basep->hidebutton_pixmaps_enabled; |
---|
1847 | ppc->fit_pixmap_bg = pw->fit_pixmap_bg; |
---|
1848 | ppc->strech_pixmap_bg = pw->strech_pixmap_bg; |
---|
1849 | ppc->rotate_pixmap_bg = pw->rotate_pixmap_bg; |
---|
1850 | ppc->back_pixmap = g_strdup(pw->back_pixmap); |
---|
1851 | ppc->back_color = pw->back_color; |
---|
1852 | ppc->back_type = pw->back_type; |
---|
1853 | ppc->mode = basep->mode; |
---|
1854 | ppc->update_function = NULL; |
---|
1855 | ppc->update_data = NULL; |
---|
1856 | |
---|
1857 | setup_pertype_defs (basep, ppc); |
---|
1858 | |
---|
1859 | ppc->panel = panel; |
---|
1860 | |
---|
1861 | /* main window */ |
---|
1862 | ppc->config_window = gnome_dialog_new (_("Panel properties"), |
---|
1863 | GNOME_STOCK_BUTTON_CLOSE, |
---|
1864 | GNOME_STOCK_BUTTON_HELP, |
---|
1865 | NULL); |
---|
1866 | gnome_dialog_set_close (GNOME_DIALOG (ppc->config_window), |
---|
1867 | FALSE /* click_closes */); |
---|
1868 | gtk_window_set_wmclass (GTK_WINDOW(ppc->config_window), |
---|
1869 | "panel_properties", "Panel"); |
---|
1870 | gtk_widget_set_events (ppc->config_window, |
---|
1871 | gtk_widget_get_events (ppc->config_window) | |
---|
1872 | GDK_BUTTON_PRESS_MASK); |
---|
1873 | /*gtk_window_set_position(GTK_WINDOW(ppc->config_window), GTK_WIN_POS_CENTER);*/ |
---|
1874 | gtk_window_set_policy(GTK_WINDOW(ppc->config_window), FALSE, FALSE, TRUE); |
---|
1875 | |
---|
1876 | gtk_signal_connect(GTK_OBJECT(ppc->config_window), "destroy", |
---|
1877 | GTK_SIGNAL_FUNC (config_destroy), ppc); |
---|
1878 | |
---|
1879 | prop_nbook = gtk_notebook_new (); |
---|
1880 | |
---|
1881 | gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (ppc->config_window)->vbox), |
---|
1882 | prop_nbook, TRUE, TRUE, 0); |
---|
1883 | |
---|
1884 | if(IS_EDGE_WIDGET(panel)) { |
---|
1885 | /* edge notebook page */ |
---|
1886 | help_path = "panelproperties.html#EDGETAB"; |
---|
1887 | page = edge_notebook_page(ppc); |
---|
1888 | ppc->type_tab = gtk_event_box_new(); |
---|
1889 | gtk_container_add(GTK_CONTAINER(ppc->type_tab), page); |
---|
1890 | ppc->type_tab_label = gtk_label_new (_("Edge panel")); |
---|
1891 | gtk_notebook_append_page(GTK_NOTEBOOK(prop_nbook), |
---|
1892 | ppc->type_tab, |
---|
1893 | ppc->type_tab_label); |
---|
1894 | } else if(IS_ALIGNED_WIDGET(panel)) { |
---|
1895 | /* aligned notebook page */ |
---|
1896 | help_path = "panelproperties.html#EDGETAB"; |
---|
1897 | page = aligned_notebook_page(ppc); |
---|
1898 | ppc->type_tab = gtk_event_box_new(); |
---|
1899 | gtk_container_add(GTK_CONTAINER(ppc->type_tab), page); |
---|
1900 | ppc->type_tab_label = gtk_label_new (_("Aligned panel")); |
---|
1901 | gtk_notebook_append_page(GTK_NOTEBOOK(prop_nbook), |
---|
1902 | ppc->type_tab, |
---|
1903 | ppc->type_tab_label); |
---|
1904 | } else if(IS_SLIDING_WIDGET(panel)) { |
---|
1905 | /* sliding notebook page */ |
---|
1906 | help_path = "panelproperties.html#EDGETAB"; |
---|
1907 | page = sliding_notebook_page(ppc); |
---|
1908 | ppc->type_tab = gtk_event_box_new(); |
---|
1909 | gtk_container_add(GTK_CONTAINER(ppc->type_tab), page); |
---|
1910 | ppc->type_tab_label = gtk_label_new (_("Sliding panel")); |
---|
1911 | gtk_notebook_append_page(GTK_NOTEBOOK (prop_nbook), |
---|
1912 | ppc->type_tab, |
---|
1913 | ppc->type_tab_label); |
---|
1914 | } else if(IS_FLOATING_WIDGET(panel)) { |
---|
1915 | /* floating notebook page */ |
---|
1916 | help_path = "panelproperties.html#EDGETAB"; |
---|
1917 | page = floating_notebook_page(ppc); |
---|
1918 | ppc->type_tab = gtk_event_box_new(); |
---|
1919 | gtk_container_add(GTK_CONTAINER(ppc->type_tab), page); |
---|
1920 | ppc->type_tab_label = gtk_label_new (_("Floating panel")); |
---|
1921 | gtk_notebook_append_page(GTK_NOTEBOOK (prop_nbook), |
---|
1922 | ppc->type_tab, |
---|
1923 | ppc->type_tab_label); |
---|
1924 | } else if(IS_DRAWER_WIDGET(panel)) { |
---|
1925 | BasePWidget *basep = BASEP_WIDGET(panel); |
---|
1926 | GtkWidget *applet = PANEL_WIDGET(basep->panel)->master_widget; |
---|
1927 | AppletInfo *info = |
---|
1928 | gtk_object_get_data(GTK_OBJECT(applet), "applet_info"); |
---|
1929 | add_drawer_properties_page(ppc, GTK_NOTEBOOK (prop_nbook), info->data); |
---|
1930 | help_path = "drawers.html"; |
---|
1931 | /* we can't change to/from drawers anyhow */ |
---|
1932 | ppc->type_tab = NULL; |
---|
1933 | } |
---|
1934 | |
---|
1935 | /* Backing configuration */ |
---|
1936 | page = background_page (ppc); |
---|
1937 | gtk_notebook_append_page (GTK_NOTEBOOK(prop_nbook), |
---|
1938 | page, gtk_label_new (_("Background"))); |
---|
1939 | |
---|
1940 | gtk_object_set_data (GTK_OBJECT (ppc->config_window), "help_path", |
---|
1941 | help_path); |
---|
1942 | gtk_signal_connect (GTK_OBJECT (ppc->config_window), "clicked", |
---|
1943 | GTK_SIGNAL_FUNC (window_clicked), |
---|
1944 | prop_nbook); |
---|
1945 | |
---|
1946 | gtk_signal_connect (GTK_OBJECT (ppc->config_window), "event", |
---|
1947 | GTK_SIGNAL_FUNC (config_event), |
---|
1948 | prop_nbook); |
---|
1949 | |
---|
1950 | ppc->register_changes = TRUE; |
---|
1951 | |
---|
1952 | /* show main window */ |
---|
1953 | gtk_widget_show_all (ppc->config_window); |
---|
1954 | |
---|
1955 | /* grab the focus on the size menu always, if it exists */ |
---|
1956 | if (ppc->size_menu != NULL) |
---|
1957 | gtk_widget_grab_focus (ppc->size_menu); |
---|
1958 | } |
---|
1959 | |
---|
1960 | |
---|