1 | /* gnome-panel-properties: crapplet for global panel properties |
---|
2 | * |
---|
3 | * Copyright (C) 1999 Free Software Foundation |
---|
4 | * Copyright 2000 Helix Code, Inc. |
---|
5 | * Copyright 2000 Eazel, Inc. |
---|
6 | * Authors: George Lebl <jirka@5z.com> |
---|
7 | * Jacob Berkman <jacob@helixcode.com> |
---|
8 | * |
---|
9 | * This program is free software; you can redistribute it and/or |
---|
10 | * modify it under the terms of the GNU General Public License as |
---|
11 | * published by the Free Software Foundation; either version 2 of the |
---|
12 | * License, or (at your option) any later version. |
---|
13 | * |
---|
14 | * This program is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this program; if not, write to the Free Software |
---|
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
22 | * USA |
---|
23 | */ |
---|
24 | |
---|
25 | #include <config.h> |
---|
26 | #include <gnome.h> |
---|
27 | #include <libgnorba/gnorba.h> |
---|
28 | #include <libgnomeui/gnome-window-icon.h> |
---|
29 | #include <gdk/gdkx.h> |
---|
30 | #include "capplet-widget.h" |
---|
31 | #include "global-keys.h" |
---|
32 | /*we just use the GlobalConfig and LAST_TILE definitions, some panel-util stuff, |
---|
33 | and the DEFAULT_* defines from session.h !!!*/ |
---|
34 | #include "panel-types.h" |
---|
35 | #include "panel_config_global.h" |
---|
36 | #include "panel-util.h" |
---|
37 | #include "session.h" |
---|
38 | #include "icon-entry-hack.h" |
---|
39 | #include "conditional.h" |
---|
40 | |
---|
41 | /* for MAIN_MENU_* */ |
---|
42 | #include "menu.h" |
---|
43 | |
---|
44 | #include <gdk-pixbuf/gdk-pixbuf.h> |
---|
45 | #include <libart_lgpl/art_misc.h> |
---|
46 | #include <libart_lgpl/art_affine.h> |
---|
47 | #include <libart_lgpl/art_rgb_affine.h> |
---|
48 | #include <libart_lgpl/art_rgb_rgba_affine.h> |
---|
49 | #include <libart_lgpl/art_filterlevel.h> |
---|
50 | #include <libart_lgpl/art_alphagamma.h> |
---|
51 | |
---|
52 | /* panel-util makes references to this, so yes this is UGLY UGLY UGLY to make |
---|
53 | * it available (and not static), but we're not using those parts, so we just |
---|
54 | * want the compiler to shut up */ |
---|
55 | GlobalConfig global_config = {0}; |
---|
56 | static GlobalConfig loaded_config = {0}; |
---|
57 | |
---|
58 | /* Heh, foo, we want to use utils, but they reference applets, and applets_last, |
---|
59 | * so smoke some more crack and make these available */ |
---|
60 | GSList *applets = NULL; |
---|
61 | GSList *applets_last = NULL; |
---|
62 | |
---|
63 | /* animation page */ |
---|
64 | static GtkWidget *enable_animations_cb; |
---|
65 | static GtkWidget *simple_movement_cb; |
---|
66 | static GtkWidget *anim_frame; |
---|
67 | static GtkAdjustment *auto_hide_step_size; |
---|
68 | static GtkAdjustment *explicit_hide_step_size; |
---|
69 | static GtkAdjustment *drawer_step_size; |
---|
70 | static GtkAdjustment *minimize_delay; |
---|
71 | static GtkAdjustment *maximize_delay; |
---|
72 | static GtkAdjustment *minimized_size; |
---|
73 | |
---|
74 | |
---|
75 | /* buttons page */ |
---|
76 | static GtkWidget *tile_enable_cb[LAST_TILE]; |
---|
77 | static GtkWidget *tile_file_box[LAST_TILE]; |
---|
78 | static GtkWidget *tile_border_box[LAST_TILE]; |
---|
79 | static GtkAdjustment *tile_border[LAST_TILE]; |
---|
80 | static GtkAdjustment *tile_depth[LAST_TILE]; |
---|
81 | |
---|
82 | static GtkWidget *entry_up[LAST_TILE]; |
---|
83 | static GtkWidget *entry_down[LAST_TILE]; |
---|
84 | |
---|
85 | static GtkWidget *hide_panel_frame_cb; |
---|
86 | static GtkWidget *tile_when_over_cb; |
---|
87 | static GtkWidget *saturate_when_over_cb; |
---|
88 | static GtkWidget *fast_button_scaling_cb; |
---|
89 | |
---|
90 | |
---|
91 | /* applet page*/ |
---|
92 | static GtkWidget *movement_type_switch_rb; |
---|
93 | static GtkWidget *movement_type_free_rb; |
---|
94 | static GtkWidget *movement_type_push_rb; |
---|
95 | static GtkAdjustment *applet_padding; |
---|
96 | static GtkAdjustment *applet_border_padding; |
---|
97 | |
---|
98 | |
---|
99 | /* menu page */ |
---|
100 | |
---|
101 | static GtkWidget *show_dot_buttons_cb; |
---|
102 | static GtkWidget *show_menu_titles_cb; |
---|
103 | static GtkWidget *off_panel_popups_cb; |
---|
104 | static GtkWidget *hungry_menus_cb; |
---|
105 | static GtkWidget *use_large_icons_cb; |
---|
106 | static GtkWidget *merge_menus_cb; |
---|
107 | static GtkWidget *menu_check_cb; |
---|
108 | |
---|
109 | typedef struct { |
---|
110 | int inline_flag; |
---|
111 | int submenu_flag; |
---|
112 | char *label; |
---|
113 | |
---|
114 | GtkWidget *inline_rb; |
---|
115 | GtkWidget *submenu_rb; |
---|
116 | GtkWidget *none_rb; |
---|
117 | } MenuOptions; |
---|
118 | |
---|
119 | /* don't forget to update the table size when changing the num of elements |
---|
120 | in this array */ |
---|
121 | static MenuOptions menu_options[] = { |
---|
122 | { MAIN_MENU_SYSTEM, MAIN_MENU_SYSTEM_SUB, N_("Programs: ") }, |
---|
123 | { MAIN_MENU_USER, MAIN_MENU_USER_SUB, N_("Favorites: ") }, |
---|
124 | { MAIN_MENU_APPLETS, MAIN_MENU_APPLETS_SUB, N_("Applets: ") }, |
---|
125 | { MAIN_MENU_DISTRIBUTION, MAIN_MENU_DISTRIBUTION_SUB, N_("Distribution: ") }, |
---|
126 | { MAIN_MENU_KDE, MAIN_MENU_KDE_SUB, N_("KDE: ") }, |
---|
127 | { MAIN_MENU_PANEL, MAIN_MENU_PANEL_SUB, N_("Panel: ") }, |
---|
128 | { MAIN_MENU_DESKTOP, MAIN_MENU_DESKTOP_SUB, N_("Desktop: ") }, |
---|
129 | { 0 } |
---|
130 | }; |
---|
131 | |
---|
132 | /* miscellaneous page */ |
---|
133 | static GtkWidget *tooltips_enabled_cb; |
---|
134 | static GtkWidget *drawer_auto_close_cb; |
---|
135 | static GtkWidget *autoraise_cb; |
---|
136 | static GtkWidget *keep_bottom_cb; |
---|
137 | static GtkWidget *above_cb; |
---|
138 | static GtkWidget *normal_layer_cb; |
---|
139 | static GtkWidget *keys_enabled_cb; |
---|
140 | static GtkWidget *menu_key_entry; |
---|
141 | static GtkWidget *run_key_entry; |
---|
142 | static GtkWidget *screenshot_key_entry; |
---|
143 | static GtkWidget *window_screenshot_key_entry; |
---|
144 | static GtkWidget *confirm_panel_remove_cb; |
---|
145 | static GtkWidget *avoid_collisions_cb; |
---|
146 | |
---|
147 | static gboolean changing = TRUE; |
---|
148 | static GtkWidget *capplet; |
---|
149 | |
---|
150 | /* |
---|
151 | * GEGL Wants Winners, |
---|
152 | * GEGL Wants Solutions, |
---|
153 | * GEGL Wants TV, |
---|
154 | * GEGL Wants Repeated Code... |
---|
155 | * |
---|
156 | * See rgb-stuff.c. |
---|
157 | */ |
---|
158 | |
---|
159 | void transform_pixbuf(guchar *dst, int x0, int y0, int x1, int y1, int drs, |
---|
160 | GdkPixbuf *pixbuf, double affine[6], |
---|
161 | int level, ArtAlphaGamma *ag); |
---|
162 | |
---|
163 | void transform_pixbuf(guchar *dst, int x0, int y0, int x1, int y1, int drs, |
---|
164 | GdkPixbuf *pixbuf, double affine[6], |
---|
165 | int level, ArtAlphaGamma *ag) |
---|
166 | { |
---|
167 | gint w, h, rs; |
---|
168 | |
---|
169 | rs = gdk_pixbuf_get_rowstride(pixbuf); |
---|
170 | h = gdk_pixbuf_get_height(pixbuf); |
---|
171 | w = gdk_pixbuf_get_width(pixbuf); |
---|
172 | |
---|
173 | if (gdk_pixbuf_get_has_alpha(pixbuf)) { |
---|
174 | art_rgb_rgba_affine(dst, x0, y0, x1, y1, drs, |
---|
175 | gdk_pixbuf_get_pixels(pixbuf), |
---|
176 | w, h, rs, affine, level, ag); |
---|
177 | } else { |
---|
178 | art_rgb_affine(dst, x0, y0, x1, y1, drs, |
---|
179 | gdk_pixbuf_get_pixels(pixbuf), |
---|
180 | w, h, rs, affine, level, ag); |
---|
181 | } |
---|
182 | } |
---|
183 | |
---|
184 | #include "nothing.cP" |
---|
185 | |
---|
186 | static void |
---|
187 | set_config (GlobalConfig *dest, GlobalConfig *src) |
---|
188 | { |
---|
189 | int i; |
---|
190 | |
---|
191 | g_return_if_fail (dest != NULL); |
---|
192 | g_return_if_fail (src != NULL); |
---|
193 | |
---|
194 | for (i = 0; i < LAST_TILE; i++) { |
---|
195 | g_free (dest->tile_up[i]); |
---|
196 | g_free (dest->tile_down[i]); |
---|
197 | } |
---|
198 | g_free (dest->menu_key); |
---|
199 | g_free (dest->run_key); |
---|
200 | g_free (dest->screenshot_key); |
---|
201 | g_free (dest->window_screenshot_key); |
---|
202 | |
---|
203 | *dest = *src; |
---|
204 | |
---|
205 | for (i = 0; i < LAST_TILE; i++) { |
---|
206 | dest->tile_up[i] = g_strdup (dest->tile_up[i]); |
---|
207 | dest->tile_down[i] = g_strdup (dest->tile_down[i]); |
---|
208 | } |
---|
209 | dest->menu_key = g_strdup (dest->menu_key); |
---|
210 | dest->run_key = g_strdup (dest->run_key); |
---|
211 | dest->screenshot_key = g_strdup (dest->screenshot_key); |
---|
212 | dest->window_screenshot_key = g_strdup (dest->window_screenshot_key); |
---|
213 | } |
---|
214 | |
---|
215 | |
---|
216 | static void |
---|
217 | changed_cb(void) |
---|
218 | { |
---|
219 | if(!changing) |
---|
220 | capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE); |
---|
221 | } |
---|
222 | |
---|
223 | static GtkWidget * |
---|
224 | make_int_scale_box (char *title, GtkAdjustment **adj, |
---|
225 | double min, double max, double step) |
---|
226 | { |
---|
227 | GtkWidget *label; |
---|
228 | GtkWidget *box; |
---|
229 | GtkWidget *scale; |
---|
230 | |
---|
231 | /* vbox for frame */ |
---|
232 | box = gtk_hbox_new (FALSE, GNOME_PAD_SMALL); |
---|
233 | gtk_widget_show (box); |
---|
234 | |
---|
235 | /* scale label */ |
---|
236 | label = gtk_label_new(title); |
---|
237 | gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0); |
---|
238 | gtk_box_pack_start (GTK_BOX (box), label, FALSE, TRUE, 0); |
---|
239 | gtk_widget_show (label); |
---|
240 | |
---|
241 | /* Animation step_size scale */ |
---|
242 | *adj = GTK_ADJUSTMENT(gtk_adjustment_new(min, min, max, step, step, 0.0)); |
---|
243 | scale = gtk_hscale_new (*adj); |
---|
244 | gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED); |
---|
245 | gtk_scale_set_digits (GTK_SCALE (scale), 0); |
---|
246 | gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); |
---|
247 | gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP); |
---|
248 | gtk_box_pack_start (GTK_BOX (box), scale, TRUE, TRUE, 0); |
---|
249 | gtk_signal_connect(GTK_OBJECT (*adj), |
---|
250 | "value_changed", |
---|
251 | GTK_SIGNAL_FUNC (changed_cb),NULL); |
---|
252 | gtk_widget_show (scale); |
---|
253 | |
---|
254 | return box; |
---|
255 | } |
---|
256 | |
---|
257 | static int |
---|
258 | set_anim_button_value(GtkWidget *w, gpointer data) |
---|
259 | { |
---|
260 | int enable = GTK_TOGGLE_BUTTON(w)->active; |
---|
261 | |
---|
262 | gtk_widget_set_sensitive(simple_movement_cb,enable); |
---|
263 | gtk_widget_set_sensitive(anim_frame,enable); |
---|
264 | |
---|
265 | if(!changing) |
---|
266 | capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE); |
---|
267 | return FALSE; |
---|
268 | } |
---|
269 | |
---|
270 | static void |
---|
271 | sync_animation_page_with_config(GlobalConfig *conf) |
---|
272 | { |
---|
273 | gtk_widget_set_sensitive(simple_movement_cb, |
---|
274 | !conf->disable_animations); |
---|
275 | gtk_widget_set_sensitive(anim_frame, |
---|
276 | !conf->disable_animations); |
---|
277 | |
---|
278 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(enable_animations_cb), |
---|
279 | /*notice the not*/ |
---|
280 | !conf->disable_animations); |
---|
281 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(simple_movement_cb), |
---|
282 | conf->simple_movement); |
---|
283 | gtk_adjustment_set_value(auto_hide_step_size, |
---|
284 | conf->auto_hide_step_size); |
---|
285 | gtk_adjustment_set_value(explicit_hide_step_size, |
---|
286 | conf->explicit_hide_step_size); |
---|
287 | gtk_adjustment_set_value(drawer_step_size, |
---|
288 | conf->drawer_step_size); |
---|
289 | gtk_adjustment_set_value(minimize_delay, |
---|
290 | conf->minimize_delay); |
---|
291 | gtk_adjustment_set_value(maximize_delay, |
---|
292 | conf->maximize_delay); |
---|
293 | gtk_adjustment_set_value(minimized_size, |
---|
294 | conf->minimized_size); |
---|
295 | } |
---|
296 | static void |
---|
297 | sync_config_with_animation_page(GlobalConfig *conf) |
---|
298 | { |
---|
299 | /*notice the not*/ |
---|
300 | conf->disable_animations = |
---|
301 | ! GTK_TOGGLE_BUTTON(enable_animations_cb)->active; |
---|
302 | conf->simple_movement = |
---|
303 | GTK_TOGGLE_BUTTON(simple_movement_cb)->active; |
---|
304 | conf->auto_hide_step_size = auto_hide_step_size->value; |
---|
305 | conf->explicit_hide_step_size = explicit_hide_step_size->value; |
---|
306 | conf->drawer_step_size = drawer_step_size->value; |
---|
307 | conf->minimize_delay = minimize_delay->value; |
---|
308 | conf->maximize_delay = maximize_delay->value; |
---|
309 | conf->minimized_size = minimized_size->value; |
---|
310 | } |
---|
311 | |
---|
312 | static GtkWidget * |
---|
313 | animation_notebook_page(void) |
---|
314 | { |
---|
315 | GtkWidget *frame; |
---|
316 | GtkWidget *box; |
---|
317 | GtkWidget *vbox; |
---|
318 | GtkWidget *frame_vbox; |
---|
319 | |
---|
320 | /* main vbox */ |
---|
321 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
322 | gtk_container_set_border_width(GTK_CONTAINER (vbox), GNOME_PAD_SMALL); |
---|
323 | |
---|
324 | /* Animation enable */ |
---|
325 | enable_animations_cb = gtk_check_button_new_with_label (_("Enable animations")); |
---|
326 | gtk_signal_connect (GTK_OBJECT (enable_animations_cb), "toggled", |
---|
327 | GTK_SIGNAL_FUNC (set_anim_button_value),NULL); |
---|
328 | gtk_box_pack_start (GTK_BOX (vbox), enable_animations_cb, FALSE, FALSE, 0); |
---|
329 | |
---|
330 | simple_movement_cb = gtk_check_button_new_with_label (_("Constant speed animations")); |
---|
331 | gtk_box_pack_start (GTK_BOX (vbox), simple_movement_cb, FALSE, FALSE, 0); |
---|
332 | gtk_signal_connect (GTK_OBJECT (simple_movement_cb), "toggled", |
---|
333 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
334 | |
---|
335 | /* AutoHide Animation step_size scale frame */ |
---|
336 | anim_frame = gtk_frame_new (_("Animation speed")); |
---|
337 | gtk_container_set_border_width(GTK_CONTAINER (anim_frame), GNOME_PAD_SMALL); |
---|
338 | gtk_box_pack_start (GTK_BOX (vbox), anim_frame, TRUE, TRUE, 0); |
---|
339 | gtk_widget_show (anim_frame); |
---|
340 | |
---|
341 | frame_vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
342 | gtk_container_set_border_width (GTK_CONTAINER (frame_vbox), GNOME_PAD_SMALL); |
---|
343 | gtk_container_add (GTK_CONTAINER (anim_frame), frame_vbox); |
---|
344 | gtk_widget_show (frame_vbox); |
---|
345 | |
---|
346 | box = make_int_scale_box(_("Auto hide"), |
---|
347 | &auto_hide_step_size, |
---|
348 | 1.0, 100.0, 1.0); |
---|
349 | gtk_box_pack_start (GTK_BOX (frame_vbox), box, TRUE, FALSE,0); |
---|
350 | gtk_widget_show (box); |
---|
351 | |
---|
352 | /* ExplicitHide Animation step_size scale frame */ |
---|
353 | box = make_int_scale_box(_("Explicit hide"), |
---|
354 | &explicit_hide_step_size, |
---|
355 | 1.0, 100.0, 1.0); |
---|
356 | gtk_box_pack_start (GTK_BOX (frame_vbox), box, TRUE, FALSE,0); |
---|
357 | |
---|
358 | /* DrawerHide Animation step_size scale frame */ |
---|
359 | box = make_int_scale_box(_("Drawer sliding"), |
---|
360 | &drawer_step_size, |
---|
361 | 1.0, 100.0, 1.0); |
---|
362 | gtk_box_pack_start (GTK_BOX (frame_vbox), box, TRUE, FALSE,0); |
---|
363 | |
---|
364 | frame = gtk_frame_new (_("Auto hide")); |
---|
365 | gtk_container_set_border_width(GTK_CONTAINER (frame), GNOME_PAD_SMALL); |
---|
366 | gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); |
---|
367 | gtk_widget_show (frame); |
---|
368 | |
---|
369 | frame_vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
370 | gtk_container_set_border_width (GTK_CONTAINER (frame_vbox), GNOME_PAD_SMALL); |
---|
371 | gtk_container_add (GTK_CONTAINER (frame), frame_vbox); |
---|
372 | gtk_widget_show (frame_vbox); |
---|
373 | |
---|
374 | /* Minimize Delay scale frame */ |
---|
375 | box = make_int_scale_box (_("Hide delay (ms)"), |
---|
376 | &minimize_delay, |
---|
377 | 30.0, 3000.0, 10.0); |
---|
378 | gtk_box_pack_start (GTK_BOX (frame_vbox), box, TRUE, FALSE, 0); |
---|
379 | |
---|
380 | /* Minimize Delay scale frame */ |
---|
381 | box = make_int_scale_box (_("Show delay (ms)"), |
---|
382 | &maximize_delay, |
---|
383 | 0.0, 3000.0, 10.0); |
---|
384 | gtk_box_pack_start (GTK_BOX (frame_vbox), box, TRUE, FALSE, 0); |
---|
385 | |
---|
386 | /* Minimized size scale frame */ |
---|
387 | box = make_int_scale_box (_("Size (pixels)"), |
---|
388 | &minimized_size, |
---|
389 | 1.0, 10.0, 1.0); |
---|
390 | gtk_box_pack_start (GTK_BOX (frame_vbox), box, TRUE, FALSE, 0); |
---|
391 | |
---|
392 | return (vbox); |
---|
393 | } |
---|
394 | |
---|
395 | static char * |
---|
396 | get_full_tile(const char *file) |
---|
397 | { |
---|
398 | if (file == NULL) |
---|
399 | return NULL; |
---|
400 | else if (g_path_is_absolute(file)) |
---|
401 | return g_strdup(file); |
---|
402 | else |
---|
403 | return gnome_unconditional_pixmap_file(file); |
---|
404 | } |
---|
405 | |
---|
406 | static void |
---|
407 | sync_buttons_page_with_config(GlobalConfig *conf) |
---|
408 | { |
---|
409 | int i; |
---|
410 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(hide_panel_frame_cb), |
---|
411 | conf->hide_panel_frame); |
---|
412 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(tile_when_over_cb), |
---|
413 | conf->tile_when_over); |
---|
414 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(saturate_when_over_cb), |
---|
415 | conf->saturate_when_over); |
---|
416 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(fast_button_scaling_cb), |
---|
417 | conf->fast_button_scaling); |
---|
418 | |
---|
419 | for(i=0;i<LAST_TILE;i++) { |
---|
420 | char *file; |
---|
421 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(tile_enable_cb[i]), |
---|
422 | conf->tiles_enabled[i]); |
---|
423 | |
---|
424 | file = get_full_tile(conf->tile_up[i]); |
---|
425 | hack_icon_entry_set_icon(GNOME_ICON_ENTRY(entry_up[i]), file); |
---|
426 | g_free(file); |
---|
427 | file = get_full_tile(conf->tile_down[i]); |
---|
428 | hack_icon_entry_set_icon(GNOME_ICON_ENTRY(entry_down[i]), file); |
---|
429 | g_free(file); |
---|
430 | gtk_adjustment_set_value(tile_border[i], conf->tile_border[i]); |
---|
431 | gtk_adjustment_set_value(tile_depth[i], conf->tile_depth[i]); |
---|
432 | } |
---|
433 | } |
---|
434 | static void |
---|
435 | sync_config_with_buttons_page(GlobalConfig *conf) |
---|
436 | { |
---|
437 | int i; |
---|
438 | conf->hide_panel_frame = |
---|
439 | GTK_TOGGLE_BUTTON(hide_panel_frame_cb)->active; |
---|
440 | conf->tile_when_over = |
---|
441 | GTK_TOGGLE_BUTTON(tile_when_over_cb)->active; |
---|
442 | conf->saturate_when_over = |
---|
443 | GTK_TOGGLE_BUTTON(saturate_when_over_cb)->active; |
---|
444 | conf->fast_button_scaling = |
---|
445 | GTK_TOGGLE_BUTTON(fast_button_scaling_cb)->active; |
---|
446 | |
---|
447 | for(i=0;i<LAST_TILE;i++) { |
---|
448 | conf->tiles_enabled[i] = |
---|
449 | GTK_TOGGLE_BUTTON(tile_enable_cb[i])->active; |
---|
450 | g_free(conf->tile_up[i]); |
---|
451 | conf->tile_up[i] = |
---|
452 | hack_icon_entry_get_icon (GNOME_ICON_ENTRY(entry_up[i])); |
---|
453 | g_free(conf->tile_down[i]); |
---|
454 | conf->tile_down[i] = |
---|
455 | hack_icon_entry_get_icon (GNOME_ICON_ENTRY(entry_down[i])); |
---|
456 | conf->tile_border[i] = tile_border[i]->value; |
---|
457 | conf->tile_depth[i] = tile_depth[i]->value; |
---|
458 | } |
---|
459 | } |
---|
460 | |
---|
461 | static void |
---|
462 | set_icon_button(GtkWidget *w, gpointer data) |
---|
463 | { |
---|
464 | int i = GPOINTER_TO_INT(data); |
---|
465 | int active = GTK_TOGGLE_BUTTON(w)->active; |
---|
466 | |
---|
467 | gtk_widget_set_sensitive(tile_file_box[i],active); |
---|
468 | gtk_widget_set_sensitive(tile_border_box[i],active); |
---|
469 | |
---|
470 | changed_cb(); |
---|
471 | } |
---|
472 | |
---|
473 | enum { |
---|
474 | LAUNCHER_PAGE, |
---|
475 | DRAWER_PAGE, |
---|
476 | MENU_PAGE, |
---|
477 | SPECIAL_PAGE, |
---|
478 | N_PAGES |
---|
479 | }; |
---|
480 | |
---|
481 | static void |
---|
482 | show_page (GtkWidget *w, gpointer data) |
---|
483 | { |
---|
484 | GtkWidget *notebook = gtk_object_get_user_data (GTK_OBJECT (w)); |
---|
485 | gtk_notebook_set_page (GTK_NOTEBOOK (notebook), GPOINTER_TO_INT (data)); |
---|
486 | } |
---|
487 | |
---|
488 | static GtkWidget * |
---|
489 | icon_notebook_page(int i) |
---|
490 | { |
---|
491 | GtkWidget *frame; |
---|
492 | GtkWidget *w; |
---|
493 | GtkWidget *table; |
---|
494 | GtkWidget *vbox; |
---|
495 | char *file; |
---|
496 | |
---|
497 | char *icon_titles[]={ |
---|
498 | N_("Launcher icon"), |
---|
499 | N_("Drawer icon"), |
---|
500 | N_("Menu icon"), |
---|
501 | N_("Special icon")}; |
---|
502 | |
---|
503 | /* Image frame */ |
---|
504 | frame = gtk_frame_new (_(icon_titles[i])); |
---|
505 | gtk_container_set_border_width(GTK_CONTAINER (frame), GNOME_PAD_SMALL); |
---|
506 | |
---|
507 | /* main vbox */ |
---|
508 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
509 | gtk_container_set_border_width(GTK_CONTAINER (vbox), GNOME_PAD_SMALL); |
---|
510 | gtk_container_add (GTK_CONTAINER (frame), vbox); |
---|
511 | |
---|
512 | /* toggle button */ |
---|
513 | tile_enable_cb[i] = gtk_check_button_new_with_label (_("Tiles enabled")); |
---|
514 | gtk_signal_connect (GTK_OBJECT (tile_enable_cb[i]), "toggled", |
---|
515 | GTK_SIGNAL_FUNC (set_icon_button), |
---|
516 | GINT_TO_POINTER(i)); |
---|
517 | gtk_box_pack_start (GTK_BOX (vbox), tile_enable_cb[i], FALSE, FALSE, 0); |
---|
518 | |
---|
519 | |
---|
520 | /* table for frame */ |
---|
521 | tile_file_box[i] = table = gtk_table_new(2,3,FALSE); |
---|
522 | gtk_container_set_border_width(GTK_CONTAINER (table), GNOME_PAD_SMALL); |
---|
523 | gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); |
---|
524 | |
---|
525 | /* image file entry widgets */ |
---|
526 | file = get_full_tile(global_config.tile_up[i]); |
---|
527 | entry_up[i] = create_icon_entry(table,"tile_file",0, 1, |
---|
528 | _("Normal tile"), |
---|
529 | "tiles", |
---|
530 | file, |
---|
531 | NULL, NULL); |
---|
532 | g_free(file); |
---|
533 | w = gnome_icon_entry_gtk_entry (GNOME_ICON_ENTRY (entry_up[i])); |
---|
534 | gtk_signal_connect_while_alive(GTK_OBJECT(w), "changed", |
---|
535 | GTK_SIGNAL_FUNC(changed_cb), |
---|
536 | NULL, |
---|
537 | GTK_OBJECT(capplet)); |
---|
538 | |
---|
539 | file = get_full_tile(global_config.tile_down[i]); |
---|
540 | entry_down[i] = create_icon_entry(table,"tile_file",1, 2, |
---|
541 | _("Clicked tile"), |
---|
542 | "tiles", |
---|
543 | file, |
---|
544 | NULL, NULL); |
---|
545 | g_free(file); |
---|
546 | w = gnome_icon_entry_gtk_entry (GNOME_ICON_ENTRY (entry_down[i])); |
---|
547 | gtk_signal_connect_while_alive(GTK_OBJECT(w), "changed", |
---|
548 | GTK_SIGNAL_FUNC(changed_cb), |
---|
549 | NULL, |
---|
550 | GTK_OBJECT(capplet)); |
---|
551 | |
---|
552 | w = gtk_hseparator_new (); |
---|
553 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
554 | gtk_widget_show (w); |
---|
555 | |
---|
556 | /* Minimized size scale frame */ |
---|
557 | tile_border_box[i] = w = make_int_scale_box (_("Border width (tile only)"), |
---|
558 | &tile_border[i], |
---|
559 | 0.0, 10.0, 1.0); |
---|
560 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
561 | |
---|
562 | /* Minimized size scale frame */ |
---|
563 | w = make_int_scale_box (_("Depth (displacement when pressed)"), |
---|
564 | &tile_depth[i], |
---|
565 | 0.0, 10.0, 1.0); |
---|
566 | gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0); |
---|
567 | |
---|
568 | return frame; |
---|
569 | } |
---|
570 | |
---|
571 | static GtkWidget * |
---|
572 | buttons_notebook_page (void) |
---|
573 | { |
---|
574 | GtkWidget *m, *w; |
---|
575 | GtkWidget *box; |
---|
576 | GtkWidget *vbox; |
---|
577 | GtkWidget *label; |
---|
578 | GtkWidget *notebook; |
---|
579 | GtkWidget *page; |
---|
580 | int i; |
---|
581 | |
---|
582 | const char *labels[] = { N_("Launcher"), |
---|
583 | N_("Drawer"), |
---|
584 | N_("Menu"), |
---|
585 | N_("Special") }; |
---|
586 | |
---|
587 | /* main vbox */ |
---|
588 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
589 | gtk_container_set_border_width(GTK_CONTAINER (vbox), GNOME_PAD_SMALL); |
---|
590 | |
---|
591 | box = gtk_hbox_new (FALSE, GNOME_PAD_SMALL); |
---|
592 | gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0); |
---|
593 | gtk_widget_show (box); |
---|
594 | |
---|
595 | label = gtk_label_new (_("Button type: ")); |
---|
596 | gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0); |
---|
597 | gtk_widget_show (label); |
---|
598 | |
---|
599 | m = gtk_menu_new (); |
---|
600 | notebook = gtk_notebook_new (); |
---|
601 | gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); |
---|
602 | gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); |
---|
603 | |
---|
604 | for (i = 0; i < N_PAGES; i++) { |
---|
605 | w = gtk_menu_item_new_with_label (_(labels[i])); |
---|
606 | gtk_signal_connect (GTK_OBJECT (w), "activate", |
---|
607 | GTK_SIGNAL_FUNC (show_page), |
---|
608 | GINT_TO_POINTER (i)); |
---|
609 | gtk_widget_show (w); |
---|
610 | gtk_menu_append (GTK_MENU (m), w); |
---|
611 | |
---|
612 | page = icon_notebook_page (i); |
---|
613 | gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL); |
---|
614 | |
---|
615 | gtk_object_set_user_data (GTK_OBJECT (w), notebook); |
---|
616 | } |
---|
617 | |
---|
618 | w = gtk_option_menu_new (); |
---|
619 | gtk_option_menu_set_menu (GTK_OPTION_MENU (w), m); |
---|
620 | gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0); |
---|
621 | gtk_widget_show (w); |
---|
622 | |
---|
623 | gtk_box_pack_start (GTK_BOX (vbox), notebook, FALSE, FALSE, 0); |
---|
624 | gtk_widget_show (notebook); |
---|
625 | |
---|
626 | |
---|
627 | /* show/hide frame */ |
---|
628 | hide_panel_frame_cb = gtk_check_button_new_with_label (_("Make buttons flush with panel edge")); |
---|
629 | gtk_signal_connect (GTK_OBJECT (hide_panel_frame_cb), "toggled", |
---|
630 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
631 | gtk_box_pack_start (GTK_BOX (vbox), hide_panel_frame_cb, FALSE, FALSE, 0); |
---|
632 | |
---|
633 | |
---|
634 | /* only show tiles when mouse is over the button */ |
---|
635 | tile_when_over_cb = gtk_check_button_new_with_label (_("Show button tiles only when cursor is over the button")); |
---|
636 | gtk_signal_connect (GTK_OBJECT (tile_when_over_cb), "toggled", |
---|
637 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
638 | gtk_box_pack_start (GTK_BOX (vbox), tile_when_over_cb, FALSE, FALSE, 0); |
---|
639 | |
---|
640 | /* prelight on mouseovers hack (used to be saturation, hence |
---|
641 | * the config option name) */ |
---|
642 | saturate_when_over_cb = gtk_check_button_new_with_label (_("Prelight buttons on mouseover")); |
---|
643 | gtk_signal_connect (GTK_OBJECT (saturate_when_over_cb), "toggled", |
---|
644 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
645 | gtk_box_pack_start (GTK_BOX (vbox), saturate_when_over_cb, FALSE, FALSE, 0); |
---|
646 | |
---|
647 | /* Fast but low quality scaling (Nearest versus Hyperbolic) */ |
---|
648 | fast_button_scaling_cb = gtk_check_button_new_with_label (_("Fast but low quality scaling of button icons")); |
---|
649 | gtk_signal_connect (GTK_OBJECT (fast_button_scaling_cb), "toggled", |
---|
650 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
651 | gtk_box_pack_start (GTK_BOX (vbox), fast_button_scaling_cb, FALSE, FALSE, 0); |
---|
652 | |
---|
653 | return (vbox); |
---|
654 | } |
---|
655 | |
---|
656 | |
---|
657 | static void |
---|
658 | sync_applets_page_with_config(GlobalConfig *conf) |
---|
659 | { |
---|
660 | switch(conf->movement_type) { |
---|
661 | case PANEL_SWITCH_MOVE: |
---|
662 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(movement_type_switch_rb), |
---|
663 | TRUE); |
---|
664 | break; |
---|
665 | case PANEL_FREE_MOVE: |
---|
666 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(movement_type_free_rb), |
---|
667 | TRUE); |
---|
668 | break; |
---|
669 | case PANEL_PUSH_MOVE: |
---|
670 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(movement_type_push_rb), |
---|
671 | TRUE); |
---|
672 | break; |
---|
673 | default: break; |
---|
674 | } |
---|
675 | gtk_adjustment_set_value (applet_padding, conf->applet_padding); |
---|
676 | gtk_adjustment_set_value (applet_border_padding, conf->applet_border_padding); |
---|
677 | } |
---|
678 | static void |
---|
679 | sync_config_with_applets_page(GlobalConfig *conf) |
---|
680 | { |
---|
681 | if(GTK_TOGGLE_BUTTON(movement_type_switch_rb)->active) |
---|
682 | conf->movement_type = PANEL_SWITCH_MOVE; |
---|
683 | else if(GTK_TOGGLE_BUTTON(movement_type_free_rb)->active) |
---|
684 | conf->movement_type = PANEL_FREE_MOVE; |
---|
685 | else if(GTK_TOGGLE_BUTTON(movement_type_push_rb)->active) |
---|
686 | conf->movement_type = PANEL_PUSH_MOVE; |
---|
687 | |
---|
688 | conf->applet_padding = applet_padding->value; |
---|
689 | conf->applet_border_padding = applet_border_padding->value; |
---|
690 | } |
---|
691 | |
---|
692 | |
---|
693 | static GtkWidget * |
---|
694 | applets_notebook_page (void) |
---|
695 | { |
---|
696 | GtkWidget *frame; |
---|
697 | GtkWidget *box; |
---|
698 | GtkWidget *vbox; |
---|
699 | |
---|
700 | /* main vbox */ |
---|
701 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
702 | gtk_container_set_border_width(GTK_CONTAINER (vbox), GNOME_PAD_SMALL); |
---|
703 | |
---|
704 | /* Movement frame */ |
---|
705 | frame = gtk_frame_new (_("Default movement mode")); |
---|
706 | gtk_container_set_border_width(GTK_CONTAINER (frame), GNOME_PAD_SMALL); |
---|
707 | gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); |
---|
708 | |
---|
709 | /* vbox for frame */ |
---|
710 | box = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
711 | gtk_container_set_border_width(GTK_CONTAINER (box), GNOME_PAD_SMALL); |
---|
712 | gtk_container_add (GTK_CONTAINER (frame), box); |
---|
713 | |
---|
714 | /* Switched */ |
---|
715 | movement_type_switch_rb = gtk_radio_button_new_with_label (NULL, _("Switched movement (or use Ctrl)")); |
---|
716 | gtk_signal_connect (GTK_OBJECT (movement_type_switch_rb), "toggled", |
---|
717 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
718 | gtk_box_pack_start (GTK_BOX (box), movement_type_switch_rb, FALSE, FALSE, 0); |
---|
719 | |
---|
720 | /* Free */ |
---|
721 | movement_type_free_rb = gtk_radio_button_new_with_label ( |
---|
722 | gtk_radio_button_group (GTK_RADIO_BUTTON (movement_type_switch_rb)), |
---|
723 | _("Free movement (doesn't disturb other applets) (or use Alt)")); |
---|
724 | gtk_signal_connect (GTK_OBJECT (movement_type_free_rb), "toggled", |
---|
725 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
726 | gtk_box_pack_start (GTK_BOX (box), movement_type_free_rb, FALSE, FALSE, 0); |
---|
727 | |
---|
728 | /* Push */ |
---|
729 | movement_type_push_rb = gtk_radio_button_new_with_label ( |
---|
730 | gtk_radio_button_group (GTK_RADIO_BUTTON (movement_type_switch_rb)), |
---|
731 | _("Push movement (or use Shift)")); |
---|
732 | gtk_signal_connect (GTK_OBJECT (movement_type_push_rb), "toggled", |
---|
733 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
734 | gtk_box_pack_start (GTK_BOX (box), movement_type_push_rb, FALSE, FALSE, 0); |
---|
735 | |
---|
736 | box = make_int_scale_box (_("Padding between applets"), |
---|
737 | &applet_padding, |
---|
738 | 0.0, 10.0, 1.0); |
---|
739 | gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0); |
---|
740 | |
---|
741 | box = make_int_scale_box (_("Padding between applets and panel border"), |
---|
742 | &applet_border_padding, |
---|
743 | 0.0, 10.0, 1.0); |
---|
744 | gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0); |
---|
745 | |
---|
746 | |
---|
747 | return vbox; |
---|
748 | } |
---|
749 | |
---|
750 | static void |
---|
751 | sync_menu_page_with_config(GlobalConfig *conf) |
---|
752 | { |
---|
753 | MenuOptions *opt; |
---|
754 | GtkWidget *w; |
---|
755 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(show_dot_buttons_cb), |
---|
756 | conf->show_dot_buttons); |
---|
757 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(show_menu_titles_cb), |
---|
758 | conf->show_menu_titles); |
---|
759 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(off_panel_popups_cb), |
---|
760 | conf->off_panel_popups); |
---|
761 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(hungry_menus_cb), |
---|
762 | conf->hungry_menus); |
---|
763 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(use_large_icons_cb), |
---|
764 | conf->use_large_icons); |
---|
765 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(merge_menus_cb), |
---|
766 | conf->merge_menus); |
---|
767 | gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(menu_check_cb), |
---|
768 | conf->menu_check); |
---|
769 | |
---|
770 | for (opt = menu_options; opt->inline_flag; ++opt) { |
---|
771 | if (conf->menu_flags & opt->inline_flag) |
---|
772 | w = opt->inline_rb; |
---|
773 | else if (conf->menu_flags & opt->submenu_flag) |
---|
774 | w = opt->submenu_rb; |
---|
775 | else |
---|
776 | w = opt->none_rb; |
---|
777 | gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w), TRUE); |
---|
778 | } |
---|
779 | } |
---|
780 | |
---|
781 | static void |
---|
782 | sync_config_with_menu_page(GlobalConfig *conf) |
---|
783 | { |
---|
784 | MenuOptions *opt; |
---|
785 | conf->show_dot_buttons = |
---|
786 | GTK_TOGGLE_BUTTON(show_dot_buttons_cb)->active; |
---|
787 | conf->show_menu_titles = |
---|
788 | GTK_TOGGLE_BUTTON(show_menu_titles_cb)->active; |
---|
789 | conf->off_panel_popups = |
---|
790 | GTK_TOGGLE_BUTTON(off_panel_popups_cb)->active; |
---|
791 | conf->hungry_menus = |
---|
792 | GTK_TOGGLE_BUTTON(hungry_menus_cb)->active; |
---|
793 | conf->use_large_icons = |
---|
794 | GTK_TOGGLE_BUTTON(use_large_icons_cb)->active; |
---|
795 | conf->merge_menus = |
---|
796 | GTK_TOGGLE_BUTTON(merge_menus_cb)->active; |
---|
797 | conf->menu_check = |
---|
798 | GTK_TOGGLE_BUTTON(menu_check_cb)->active; |
---|
799 | conf->menu_flags = 0; |
---|
800 | for (opt = menu_options; opt->inline_flag; ++opt) { |
---|
801 | if (GTK_TOGGLE_BUTTON (opt->inline_rb)->active) |
---|
802 | conf->menu_flags |= opt->inline_flag; |
---|
803 | else if (GTK_TOGGLE_BUTTON (opt->submenu_rb)->active) |
---|
804 | conf->menu_flags |= opt->submenu_flag; |
---|
805 | } |
---|
806 | } |
---|
807 | |
---|
808 | static void |
---|
809 | add_menu_options (GtkTable *table, MenuOptions *opt, int row) |
---|
810 | { |
---|
811 | GtkWidget *w; |
---|
812 | GtkRadioButton *rb; |
---|
813 | |
---|
814 | w = gtk_label_new (_(opt->label)); |
---|
815 | gtk_table_attach_defaults (table, w, 0, 1, row, row+1); |
---|
816 | |
---|
817 | w = opt->none_rb = gtk_radio_button_new_with_label (NULL, _("Off")); |
---|
818 | gtk_table_attach_defaults (table, w, 3, 4, row, row+1); |
---|
819 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
820 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
821 | rb = GTK_RADIO_BUTTON (w); |
---|
822 | |
---|
823 | w = opt->submenu_rb = gtk_radio_button_new_with_label ( |
---|
824 | gtk_radio_button_group (rb), _("In a submenu")); |
---|
825 | gtk_table_attach_defaults (table, w, 2, 3, row, row+1); |
---|
826 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
827 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
828 | |
---|
829 | w = opt->inline_rb = gtk_radio_button_new_with_label ( |
---|
830 | gtk_radio_button_group (rb), _("In the menu")); |
---|
831 | gtk_table_attach_defaults (table, w, 1, 2, row, row+1); |
---|
832 | gtk_signal_connect (GTK_OBJECT (w), "toggled", |
---|
833 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
834 | } |
---|
835 | |
---|
836 | static GtkWidget * |
---|
837 | menu_notebook_page(void) |
---|
838 | { |
---|
839 | GtkWidget *frame; |
---|
840 | GtkWidget *table; |
---|
841 | GtkWidget *vbox; |
---|
842 | int i; |
---|
843 | |
---|
844 | /* main vbox */ |
---|
845 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
846 | gtk_container_set_border_width(GTK_CONTAINER (vbox), GNOME_PAD_SMALL); |
---|
847 | |
---|
848 | /* Menu frame */ |
---|
849 | frame = gtk_frame_new (_("Menus")); |
---|
850 | gtk_container_set_border_width(GTK_CONTAINER (frame), GNOME_PAD_SMALL); |
---|
851 | gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); |
---|
852 | |
---|
853 | /* table for frame */ |
---|
854 | table = gtk_table_new(3, 2, FALSE); |
---|
855 | gtk_container_set_border_width(GTK_CONTAINER (table), GNOME_PAD_SMALL); |
---|
856 | gtk_container_add (GTK_CONTAINER (frame), table); |
---|
857 | |
---|
858 | /* large icons */ |
---|
859 | use_large_icons_cb = gtk_check_button_new_with_label (_("Use large icons")); |
---|
860 | gtk_signal_connect (GTK_OBJECT (use_large_icons_cb), "toggled", |
---|
861 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
862 | gtk_table_attach_defaults (GTK_TABLE (table), use_large_icons_cb, |
---|
863 | 0, 1, 0, 1); |
---|
864 | |
---|
865 | /* Dot Buttons */ |
---|
866 | show_dot_buttons_cb = gtk_check_button_new_with_label (_("Show [...] buttons")); |
---|
867 | gtk_signal_connect (GTK_OBJECT (show_dot_buttons_cb), "toggled", |
---|
868 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
869 | gtk_table_attach_defaults(GTK_TABLE(table),show_dot_buttons_cb, 1,2,0,1); |
---|
870 | |
---|
871 | /* Off Panel Popup menus */ |
---|
872 | off_panel_popups_cb = gtk_check_button_new_with_label (_("Show popup menus outside of panels")); |
---|
873 | gtk_signal_connect (GTK_OBJECT (off_panel_popups_cb), "toggled", |
---|
874 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
875 | gtk_table_attach_defaults(GTK_TABLE(table),off_panel_popups_cb, 0,1,1,2); |
---|
876 | |
---|
877 | /* Hungry Menus */ |
---|
878 | hungry_menus_cb = gtk_check_button_new_with_label (_("Keep menus in memory")); |
---|
879 | gtk_signal_connect (GTK_OBJECT (hungry_menus_cb), "toggled", |
---|
880 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
881 | gtk_table_attach_defaults (GTK_TABLE (table), hungry_menus_cb, |
---|
882 | 1, 2, 1, 2); |
---|
883 | |
---|
884 | /* Merge system menus */ |
---|
885 | merge_menus_cb = gtk_check_button_new_with_label (_("Merge in system menus")); |
---|
886 | gtk_signal_connect (GTK_OBJECT (merge_menus_cb), "toggled", |
---|
887 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
888 | gtk_table_attach_defaults(GTK_TABLE(table), merge_menus_cb, |
---|
889 | 0, 1, 2, 3); |
---|
890 | |
---|
891 | /* Menu check */ |
---|
892 | menu_check_cb = gtk_check_button_new_with_label (_("Automatically re-check menus\nfor newly installed software")); |
---|
893 | gtk_signal_connect (GTK_OBJECT (menu_check_cb), "toggled", |
---|
894 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
895 | gtk_table_attach_defaults(GTK_TABLE(table), menu_check_cb, |
---|
896 | 1, 2, 2, 3); |
---|
897 | |
---|
898 | /* Menu titles */ |
---|
899 | show_menu_titles_cb = gtk_check_button_new_with_label (_("Show menu titles")); |
---|
900 | gtk_signal_connect (GTK_OBJECT (show_menu_titles_cb), "toggled", |
---|
901 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
902 | gtk_table_attach_defaults (GTK_TABLE (table), show_menu_titles_cb, |
---|
903 | 0, 1, 3, 4); |
---|
904 | |
---|
905 | |
---|
906 | /* Menu frame */ |
---|
907 | frame = gtk_frame_new (_("Context menu")); |
---|
908 | gtk_container_set_border_width(GTK_CONTAINER (frame), GNOME_PAD_SMALL); |
---|
909 | gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); |
---|
910 | |
---|
911 | /* table for frame */ |
---|
912 | table = gtk_table_new(7,4,FALSE); |
---|
913 | gtk_container_set_border_width(GTK_CONTAINER (table), GNOME_PAD_SMALL); |
---|
914 | gtk_container_add (GTK_CONTAINER (frame), table); |
---|
915 | |
---|
916 | for (i=0; menu_options[i].inline_flag; ++i) |
---|
917 | add_menu_options (GTK_TABLE (table), menu_options+i, i); |
---|
918 | |
---|
919 | return vbox; |
---|
920 | } |
---|
921 | |
---|
922 | static void |
---|
923 | sync_misc_page_with_config(GlobalConfig *conf) |
---|
924 | { |
---|
925 | gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (tooltips_enabled_cb), |
---|
926 | conf->tooltips_enabled); |
---|
927 | gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (drawer_auto_close_cb), |
---|
928 | conf->drawer_auto_close); |
---|
929 | gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (autoraise_cb), |
---|
930 | conf->autoraise); |
---|
931 | gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (keep_bottom_cb), |
---|
932 | conf->keep_bottom); |
---|
933 | gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (normal_layer_cb), |
---|
934 | conf->normal_layer); |
---|
935 | gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (above_cb), |
---|
936 | ! conf->normal_layer && ! conf->keep_bottom); |
---|
937 | |
---|
938 | gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (confirm_panel_remove_cb), |
---|
939 | conf->confirm_panel_remove); |
---|
940 | gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (avoid_collisions_cb), |
---|
941 | conf->avoid_collisions); |
---|
942 | gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (keys_enabled_cb), |
---|
943 | conf->keys_enabled); |
---|
944 | gtk_entry_set_text (GTK_ENTRY (menu_key_entry), |
---|
945 | sure_string (conf->menu_key)); |
---|
946 | gtk_entry_set_text (GTK_ENTRY (run_key_entry), |
---|
947 | sure_string (conf->run_key)); |
---|
948 | gtk_entry_set_text (GTK_ENTRY (screenshot_key_entry), |
---|
949 | sure_string (conf->screenshot_key)); |
---|
950 | gtk_entry_set_text (GTK_ENTRY (window_screenshot_key_entry), |
---|
951 | sure_string (conf->window_screenshot_key)); |
---|
952 | } |
---|
953 | |
---|
954 | static void |
---|
955 | sync_config_with_misc_page(GlobalConfig *conf) |
---|
956 | { |
---|
957 | conf->tooltips_enabled = |
---|
958 | GTK_TOGGLE_BUTTON (tooltips_enabled_cb)->active; |
---|
959 | conf->drawer_auto_close = |
---|
960 | GTK_TOGGLE_BUTTON (drawer_auto_close_cb)->active; |
---|
961 | conf->autoraise = |
---|
962 | GTK_TOGGLE_BUTTON (autoraise_cb)->active; |
---|
963 | conf->keep_bottom = |
---|
964 | GTK_TOGGLE_BUTTON (keep_bottom_cb)->active; |
---|
965 | conf->normal_layer = |
---|
966 | GTK_TOGGLE_BUTTON (normal_layer_cb)->active; |
---|
967 | conf->confirm_panel_remove = |
---|
968 | GTK_TOGGLE_BUTTON (confirm_panel_remove_cb)->active; |
---|
969 | conf->avoid_collisions = |
---|
970 | GTK_TOGGLE_BUTTON (avoid_collisions_cb)->active; |
---|
971 | conf->keys_enabled = |
---|
972 | GTK_TOGGLE_BUTTON (keys_enabled_cb)->active; |
---|
973 | g_free (conf->menu_key); |
---|
974 | conf->menu_key = |
---|
975 | g_strdup (gtk_entry_get_text (GTK_ENTRY (menu_key_entry))); |
---|
976 | g_free (conf->run_key); |
---|
977 | conf->run_key = |
---|
978 | g_strdup (gtk_entry_get_text (GTK_ENTRY (run_key_entry))); |
---|
979 | g_free (conf->screenshot_key); |
---|
980 | conf->screenshot_key = |
---|
981 | g_strdup (gtk_entry_get_text (GTK_ENTRY (screenshot_key_entry))); |
---|
982 | g_free (conf->window_screenshot_key); |
---|
983 | conf->window_screenshot_key = |
---|
984 | g_strdup (gtk_entry_get_text (GTK_ENTRY (window_screenshot_key_entry))); |
---|
985 | } |
---|
986 | |
---|
987 | static GtkWidget *grab_dialog; |
---|
988 | |
---|
989 | static gboolean |
---|
990 | is_modifier (guint keycode) |
---|
991 | { |
---|
992 | gint i; |
---|
993 | gint map_size; |
---|
994 | XModifierKeymap *mod_keymap; |
---|
995 | gboolean retval = FALSE; |
---|
996 | |
---|
997 | mod_keymap = XGetModifierMapping (gdk_display); |
---|
998 | |
---|
999 | map_size = 8 * mod_keymap->max_keypermod; |
---|
1000 | i = 0; |
---|
1001 | while (i < map_size) { |
---|
1002 | |
---|
1003 | if (keycode == mod_keymap->modifiermap[i]) { |
---|
1004 | retval = TRUE; |
---|
1005 | break; |
---|
1006 | } |
---|
1007 | ++i; |
---|
1008 | } |
---|
1009 | |
---|
1010 | XFreeModifiermap (mod_keymap); |
---|
1011 | |
---|
1012 | return retval; |
---|
1013 | } |
---|
1014 | |
---|
1015 | |
---|
1016 | static GdkFilterReturn |
---|
1017 | grab_key_filter (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data) |
---|
1018 | { |
---|
1019 | XEvent *xevent = (XEvent *)gdk_xevent; |
---|
1020 | GtkEntry *entry; |
---|
1021 | char *key; |
---|
1022 | guint keycode, state; |
---|
1023 | char buf[10]; |
---|
1024 | KeySym keysym; |
---|
1025 | |
---|
1026 | if (xevent->type != KeyPress && xevent->type != KeyRelease) |
---|
1027 | return GDK_FILTER_CONTINUE; |
---|
1028 | |
---|
1029 | entry = GTK_ENTRY (data); |
---|
1030 | |
---|
1031 | keycode = xevent->xkey.keycode; |
---|
1032 | |
---|
1033 | if (is_modifier (keycode)) |
---|
1034 | return GDK_FILTER_CONTINUE; |
---|
1035 | |
---|
1036 | state = xevent->xkey.state & USED_MODS; |
---|
1037 | |
---|
1038 | XLookupString (&xevent->xkey, buf, 0, &keysym, NULL); |
---|
1039 | |
---|
1040 | key = convert_keysym_state_to_string (keysym, |
---|
1041 | state); |
---|
1042 | |
---|
1043 | gtk_entry_set_text (entry, key != NULL ? key : ""); |
---|
1044 | g_free (key); |
---|
1045 | |
---|
1046 | gdk_keyboard_ungrab (GDK_CURRENT_TIME); |
---|
1047 | gtk_widget_destroy (grab_dialog); |
---|
1048 | gdk_window_remove_filter (GDK_ROOT_PARENT (), |
---|
1049 | grab_key_filter, data); |
---|
1050 | |
---|
1051 | return GDK_FILTER_REMOVE; |
---|
1052 | } |
---|
1053 | |
---|
1054 | static void |
---|
1055 | grab_button_pressed (GtkButton *button, gpointer data) |
---|
1056 | { |
---|
1057 | GtkWidget *frame; |
---|
1058 | GtkWidget *box; |
---|
1059 | GtkWidget *label; |
---|
1060 | grab_dialog = gtk_window_new (GTK_WINDOW_POPUP); |
---|
1061 | |
---|
1062 | |
---|
1063 | gdk_keyboard_grab (GDK_ROOT_PARENT(), FALSE, GDK_CURRENT_TIME); |
---|
1064 | gdk_window_add_filter (GDK_ROOT_PARENT(), grab_key_filter, data); |
---|
1065 | |
---|
1066 | gtk_window_set_policy (GTK_WINDOW (grab_dialog), FALSE, FALSE, TRUE); |
---|
1067 | gtk_window_set_position (GTK_WINDOW (grab_dialog), GTK_WIN_POS_CENTER); |
---|
1068 | gtk_window_set_modal (GTK_WINDOW (grab_dialog), TRUE); |
---|
1069 | |
---|
1070 | frame = gtk_frame_new (NULL); |
---|
1071 | gtk_container_add (GTK_CONTAINER (grab_dialog), frame); |
---|
1072 | |
---|
1073 | box = gtk_hbox_new (0, 0); |
---|
1074 | gtk_container_set_border_width (GTK_CONTAINER (box), 20); |
---|
1075 | gtk_container_add (GTK_CONTAINER (frame), box); |
---|
1076 | |
---|
1077 | label = gtk_label_new (_("Press a key...")); |
---|
1078 | gtk_container_add (GTK_CONTAINER (box), label); |
---|
1079 | |
---|
1080 | gtk_widget_show_all (grab_dialog); |
---|
1081 | return; |
---|
1082 | } |
---|
1083 | |
---|
1084 | static GtkWidget * |
---|
1085 | misc_notebook_page(void) |
---|
1086 | { |
---|
1087 | GtkWidget *frame; |
---|
1088 | GtkWidget *box; |
---|
1089 | GtkWidget *table; |
---|
1090 | GtkWidget *vbox; |
---|
1091 | GtkWidget *w; |
---|
1092 | GList *list; |
---|
1093 | GSList *group; |
---|
1094 | |
---|
1095 | /* main vbox */ |
---|
1096 | vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); |
---|
1097 | gtk_container_set_border_width(GTK_CONTAINER (vbox), GNOME_PAD_SMALL); |
---|
1098 | |
---|
1099 | /* Miscellaneous frame */ |
---|
1100 | frame = gtk_frame_new (_("Miscellaneous")); |
---|
1101 | gtk_container_set_border_width(GTK_CONTAINER (frame), GNOME_PAD_SMALL); |
---|
1102 | gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); |
---|
1103 | |
---|
1104 | /* vbox for frame */ |
---|
1105 | box = gtk_vbox_new (FALSE, 0); |
---|
1106 | gtk_container_set_border_width(GTK_CONTAINER (box), GNOME_PAD_SMALL); |
---|
1107 | gtk_container_add (GTK_CONTAINER (frame), box); |
---|
1108 | |
---|
1109 | /* Tooltips enable */ |
---|
1110 | tooltips_enabled_cb = gtk_check_button_new_with_label (_("Tooltips enabled")); |
---|
1111 | gtk_signal_connect (GTK_OBJECT (tooltips_enabled_cb), "toggled", |
---|
1112 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1113 | gtk_box_pack_start (GTK_BOX (box), tooltips_enabled_cb, FALSE, FALSE, 0); |
---|
1114 | |
---|
1115 | /* Drawer/launcher auto close */ |
---|
1116 | drawer_auto_close_cb = gtk_check_button_new_with_label (_("Close drawer if a launcher inside it is pressed")); |
---|
1117 | gtk_signal_connect (GTK_OBJECT (drawer_auto_close_cb), "toggled", |
---|
1118 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1119 | gtk_box_pack_start (GTK_BOX (box), drawer_auto_close_cb, FALSE, FALSE, 0); |
---|
1120 | |
---|
1121 | /* Autoraise */ |
---|
1122 | autoraise_cb = gtk_check_button_new_with_label (_("Raise panels on mouse-over")); |
---|
1123 | gtk_signal_connect (GTK_OBJECT (autoraise_cb), "toggled", |
---|
1124 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1125 | gtk_box_pack_start (GTK_BOX (box), autoraise_cb, FALSE, FALSE, 0); |
---|
1126 | |
---|
1127 | /* Confirm panel removal */ |
---|
1128 | confirm_panel_remove_cb = gtk_check_button_new_with_label (_("Confirm the removal of panels with a dialog")); |
---|
1129 | gtk_signal_connect (GTK_OBJECT (confirm_panel_remove_cb), "toggled", |
---|
1130 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1131 | gtk_box_pack_start (GTK_BOX (box), confirm_panel_remove_cb, FALSE, FALSE, 0); |
---|
1132 | |
---|
1133 | /* Collision avoidance */ |
---|
1134 | avoid_collisions_cb = gtk_check_button_new_with_label (_("Try to avoid overlapping panels")); |
---|
1135 | gtk_signal_connect (GTK_OBJECT (avoid_collisions_cb), "toggled", |
---|
1136 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1137 | gtk_box_pack_start (GTK_BOX (box), avoid_collisions_cb, FALSE, FALSE, 0); |
---|
1138 | |
---|
1139 | /* Layer frame */ |
---|
1140 | frame = gtk_frame_new (_("Panel treatment (GNOME compliant window managers only)")); |
---|
1141 | gtk_container_set_border_width(GTK_CONTAINER (frame), GNOME_PAD_SMALL); |
---|
1142 | gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); |
---|
1143 | |
---|
1144 | /* vbox for frame */ |
---|
1145 | box = gtk_vbox_new (FALSE, 0); |
---|
1146 | gtk_container_set_border_width(GTK_CONTAINER (box), GNOME_PAD_SMALL); |
---|
1147 | gtk_container_add (GTK_CONTAINER (frame), box); |
---|
1148 | |
---|
1149 | /* Keep on bottom */ |
---|
1150 | keep_bottom_cb = gtk_radio_button_new_with_label (NULL, _("Keep panels below other windows")); |
---|
1151 | gtk_signal_connect (GTK_OBJECT (keep_bottom_cb), "toggled", |
---|
1152 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1153 | gtk_box_pack_start (GTK_BOX (box), keep_bottom_cb, FALSE, FALSE, 0); |
---|
1154 | |
---|
1155 | /* Normal */ |
---|
1156 | group = gtk_radio_button_group (GTK_RADIO_BUTTON (keep_bottom_cb)); |
---|
1157 | normal_layer_cb = gtk_radio_button_new_with_label (group, _("Keep panels on the same level as other windows")); |
---|
1158 | gtk_signal_connect (GTK_OBJECT (normal_layer_cb), "toggled", |
---|
1159 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1160 | gtk_box_pack_start (GTK_BOX (box), normal_layer_cb, FALSE, FALSE, 0); |
---|
1161 | |
---|
1162 | /* Above */ |
---|
1163 | group = gtk_radio_button_group (GTK_RADIO_BUTTON (keep_bottom_cb)); |
---|
1164 | above_cb = gtk_radio_button_new_with_label (group, _("Keep panels above other windows")); |
---|
1165 | gtk_signal_connect (GTK_OBJECT (above_cb), "toggled", |
---|
1166 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1167 | gtk_box_pack_start (GTK_BOX (box), above_cb, FALSE, FALSE, 0); |
---|
1168 | |
---|
1169 | /* Key Bindings frame */ |
---|
1170 | frame = gtk_frame_new (_("Key Bindings")); |
---|
1171 | gtk_container_set_border_width(GTK_CONTAINER (frame), GNOME_PAD_SMALL); |
---|
1172 | gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); |
---|
1173 | |
---|
1174 | |
---|
1175 | /* table for frame */ |
---|
1176 | table = gtk_table_new (3, 3, FALSE); |
---|
1177 | gtk_table_set_row_spacings (GTK_TABLE (table), GNOME_PAD_SMALL); |
---|
1178 | gtk_table_set_col_spacings (GTK_TABLE (table), GNOME_PAD_SMALL); |
---|
1179 | gtk_container_set_border_width(GTK_CONTAINER (table), GNOME_PAD_SMALL); |
---|
1180 | gtk_container_add (GTK_CONTAINER (frame), table); |
---|
1181 | |
---|
1182 | /* enabled */ |
---|
1183 | keys_enabled_cb = gtk_check_button_new_with_label (_("Enable panel keybindings")); |
---|
1184 | gtk_signal_connect (GTK_OBJECT (keys_enabled_cb), "toggled", |
---|
1185 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1186 | gtk_table_attach_defaults (GTK_TABLE (table), keys_enabled_cb, |
---|
1187 | 0, 3, 0, 1); |
---|
1188 | |
---|
1189 | /* menu key */ |
---|
1190 | w = gtk_label_new (_("Popup menu key")); |
---|
1191 | gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5); |
---|
1192 | gtk_table_attach (GTK_TABLE (table), w, 0, 1, 1, 2, |
---|
1193 | GTK_FILL, GTK_FILL, 0, 0); |
---|
1194 | |
---|
1195 | |
---|
1196 | list = g_list_append(NULL, "Mod1-F1"); |
---|
1197 | list = g_list_append(list, "Menu"); |
---|
1198 | list = g_list_append(list, "Hyper_L"); |
---|
1199 | list = g_list_append(list, "Hyper_R"); |
---|
1200 | list = g_list_append(list, "Control-Mod1-m"); |
---|
1201 | list = g_list_append(list, _("Disabled")); |
---|
1202 | w = gtk_combo_new(); |
---|
1203 | gtk_combo_set_popdown_strings(GTK_COMBO(w), list); |
---|
1204 | g_list_free(list); |
---|
1205 | menu_key_entry = GTK_COMBO(w)->entry; |
---|
1206 | gtk_signal_connect (GTK_OBJECT (menu_key_entry), |
---|
1207 | "changed", |
---|
1208 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1209 | /*gtk_widget_set_sensitive (menu_key_entry, FALSE);*/ |
---|
1210 | gtk_table_attach_defaults (GTK_TABLE (table), w, 1, 2, 1, 2); |
---|
1211 | |
---|
1212 | w = gtk_button_new_with_label (_("Grab key...")); |
---|
1213 | gtk_table_attach (GTK_TABLE (table), w, 2, 3, 1, 2, |
---|
1214 | GTK_FILL, GTK_FILL, 0, 0); |
---|
1215 | gtk_signal_connect (GTK_OBJECT (w), "clicked", |
---|
1216 | GTK_SIGNAL_FUNC (grab_button_pressed), |
---|
1217 | menu_key_entry); |
---|
1218 | |
---|
1219 | /* run key...*/ |
---|
1220 | w = gtk_label_new (_("Run dialog key")); |
---|
1221 | gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5); |
---|
1222 | gtk_table_attach (GTK_TABLE (table), w, 0, 1, 2, 3, |
---|
1223 | GTK_FILL, GTK_FILL, 0, 0); |
---|
1224 | |
---|
1225 | list = g_list_append(NULL, "Mod1-F2"); |
---|
1226 | list = g_list_append(list, "Control-Mod1-r"); |
---|
1227 | list = g_list_append(list, "Hyper_R"); |
---|
1228 | list = g_list_append(list, "Menu"); |
---|
1229 | list = g_list_append(list, _("Disabled")); |
---|
1230 | w = gtk_combo_new(); |
---|
1231 | gtk_combo_set_popdown_strings(GTK_COMBO(w), list); |
---|
1232 | g_list_free(list); |
---|
1233 | run_key_entry = GTK_COMBO(w)->entry; |
---|
1234 | gtk_signal_connect (GTK_OBJECT (run_key_entry), |
---|
1235 | "changed", |
---|
1236 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1237 | /*gtk_widget_set_sensitive (run_key_entry, FALSE);*/ |
---|
1238 | gtk_table_attach_defaults (GTK_TABLE (table), w, 1, 2, 2, 3); |
---|
1239 | |
---|
1240 | w = gtk_button_new_with_label (_("Grab key...")); |
---|
1241 | gtk_table_attach (GTK_TABLE (table), w, 2, 3, 2, 3, |
---|
1242 | GTK_FILL, GTK_FILL, 0, 0); |
---|
1243 | gtk_signal_connect (GTK_OBJECT (w), "clicked", |
---|
1244 | GTK_SIGNAL_FUNC (grab_button_pressed), |
---|
1245 | run_key_entry); |
---|
1246 | |
---|
1247 | /* screenshot key...*/ |
---|
1248 | w = gtk_label_new (_("Take screenshot key")); |
---|
1249 | gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5); |
---|
1250 | gtk_table_attach (GTK_TABLE (table), w, 0, 1, 3, 4, |
---|
1251 | GTK_FILL, GTK_FILL, 0, 0); |
---|
1252 | |
---|
1253 | list = g_list_append (NULL, "Print"); |
---|
1254 | list = g_list_append (list, "Control-Mod1-s"); |
---|
1255 | list = g_list_append (list, "Control-Mod1-p"); |
---|
1256 | list = g_list_append (list, _("Disabled")); |
---|
1257 | w = gtk_combo_new (); |
---|
1258 | gtk_combo_set_popdown_strings(GTK_COMBO(w), list); |
---|
1259 | g_list_free(list); |
---|
1260 | screenshot_key_entry = GTK_COMBO(w)->entry; |
---|
1261 | gtk_signal_connect (GTK_OBJECT (screenshot_key_entry), |
---|
1262 | "changed", |
---|
1263 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1264 | /*gtk_widget_set_sensitive (screenshot_key_entry, FALSE);*/ |
---|
1265 | gtk_table_attach_defaults (GTK_TABLE (table), w, 1, 2, 3, 4); |
---|
1266 | |
---|
1267 | w = gtk_button_new_with_label (_("Grab key...")); |
---|
1268 | gtk_table_attach (GTK_TABLE (table), w, 2, 3, 3, 4, |
---|
1269 | GTK_FILL, GTK_FILL, 0, 0); |
---|
1270 | gtk_signal_connect (GTK_OBJECT (w), "clicked", |
---|
1271 | GTK_SIGNAL_FUNC (grab_button_pressed), |
---|
1272 | screenshot_key_entry); |
---|
1273 | |
---|
1274 | /* window screenshot key...*/ |
---|
1275 | w = gtk_label_new (_("Take window screenshot key")); |
---|
1276 | gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5); |
---|
1277 | gtk_table_attach (GTK_TABLE (table), w, 0, 1, 4, 5, |
---|
1278 | GTK_FILL, GTK_FILL, 0, 0); |
---|
1279 | |
---|
1280 | list = g_list_append (NULL, "Shift-Print"); |
---|
1281 | list = g_list_append (list, "Control-Print"); |
---|
1282 | list = g_list_append (list, "Control-Mod1-w"); |
---|
1283 | list = g_list_append (list, _("Disabled")); |
---|
1284 | w = gtk_combo_new (); |
---|
1285 | gtk_combo_set_popdown_strings (GTK_COMBO (w), list); |
---|
1286 | g_list_free (list); |
---|
1287 | window_screenshot_key_entry = GTK_COMBO(w)->entry; |
---|
1288 | gtk_signal_connect (GTK_OBJECT (window_screenshot_key_entry), |
---|
1289 | "changed", |
---|
1290 | GTK_SIGNAL_FUNC (changed_cb), NULL); |
---|
1291 | /*gtk_widget_set_sensitive (window_screenshot_key_entry, FALSE);*/ |
---|
1292 | gtk_table_attach_defaults (GTK_TABLE (table), w, 1, 2, 4, 5); |
---|
1293 | |
---|
1294 | w = gtk_button_new_with_label (_("Grab key...")); |
---|
1295 | gtk_table_attach (GTK_TABLE (table), w, 2, 3, 4, 5, |
---|
1296 | GTK_FILL, GTK_FILL, 0, 0); |
---|
1297 | gtk_signal_connect (GTK_OBJECT (w), "clicked", |
---|
1298 | GTK_SIGNAL_FUNC (grab_button_pressed), |
---|
1299 | window_screenshot_key_entry); |
---|
1300 | |
---|
1301 | return (vbox); |
---|
1302 | } |
---|
1303 | |
---|
1304 | static void |
---|
1305 | help (GtkWidget *capplet) |
---|
1306 | { |
---|
1307 | panel_show_help ("globalpanelprefs.html"); |
---|
1308 | } |
---|
1309 | |
---|
1310 | static void |
---|
1311 | _push_correct_global_prefix (void) |
---|
1312 | { |
---|
1313 | gboolean foo, def; |
---|
1314 | |
---|
1315 | /*set up global options*/ |
---|
1316 | gnome_config_push_prefix ("/panel/Config/"); |
---|
1317 | |
---|
1318 | foo = conditional_get_bool ("tooltips_enabled", TRUE, &def); |
---|
1319 | if (def) { |
---|
1320 | /* ahhh, this doesn't exist, but tooltips_enabled should be |
---|
1321 | * in every home, every kitchen and every panel configuration, |
---|
1322 | * so we will load up from the global location */ |
---|
1323 | gnome_config_pop_prefix (); |
---|
1324 | gnome_config_push_prefix ("=" GLOBAL_CONFDIR "/panel=/Config/"); |
---|
1325 | } |
---|
1326 | } |
---|
1327 | |
---|
1328 | |
---|
1329 | static void |
---|
1330 | loadup_vals (void) |
---|
1331 | { |
---|
1332 | /* NOTE: !!!!!!! |
---|
1333 | * Keep in sync with load_up_globals in session.c |
---|
1334 | * the function is the same there, but has an added call to |
---|
1335 | * apply_global_config and the default menu flags are hardcoded here |
---|
1336 | * FIXME: make this code common!!!!! |
---|
1337 | */ |
---|
1338 | char *tile_def[] = { |
---|
1339 | "normal", |
---|
1340 | "purple", |
---|
1341 | "green", |
---|
1342 | "blue" |
---|
1343 | }; |
---|
1344 | int i; |
---|
1345 | gboolean def; |
---|
1346 | GString *keybuf; |
---|
1347 | GString *tilebuf; |
---|
1348 | |
---|
1349 | /*set up global options*/ |
---|
1350 | _push_correct_global_prefix (); |
---|
1351 | |
---|
1352 | global_config.tooltips_enabled = |
---|
1353 | conditional_get_bool ("tooltips_enabled", TRUE, NULL); |
---|
1354 | |
---|
1355 | global_config.show_menu_titles = |
---|
1356 | conditional_get_bool ("show_menu_titles", FALSE, NULL); |
---|
1357 | |
---|
1358 | global_config.show_dot_buttons = |
---|
1359 | conditional_get_bool ("show_dot_buttons", FALSE, NULL); |
---|
1360 | |
---|
1361 | global_config.hungry_menus = |
---|
1362 | conditional_get_bool ("memory_hungry_menus", FALSE, NULL); |
---|
1363 | |
---|
1364 | global_config.use_large_icons = |
---|
1365 | conditional_get_bool ("use_large_icons", FALSE, NULL); |
---|
1366 | |
---|
1367 | global_config.merge_menus = |
---|
1368 | conditional_get_bool ("merge_menus", TRUE, NULL); |
---|
1369 | |
---|
1370 | global_config.menu_check = |
---|
1371 | conditional_get_bool ("menu_check", TRUE, NULL); |
---|
1372 | |
---|
1373 | global_config.off_panel_popups = |
---|
1374 | conditional_get_bool ("off_panel_popups", TRUE, NULL); |
---|
1375 | |
---|
1376 | global_config.disable_animations = |
---|
1377 | conditional_get_bool ("disable_animations", FALSE, NULL); |
---|
1378 | |
---|
1379 | global_config.auto_hide_step_size = |
---|
1380 | conditional_get_int ("auto_hide_step_size", |
---|
1381 | DEFAULT_AUTO_HIDE_STEP_SIZE, NULL); |
---|
1382 | |
---|
1383 | global_config.explicit_hide_step_size = |
---|
1384 | conditional_get_int ("explicit_hide_step_size", |
---|
1385 | DEFAULT_EXPLICIT_HIDE_STEP_SIZE, NULL); |
---|
1386 | |
---|
1387 | global_config.drawer_step_size = |
---|
1388 | conditional_get_int ("drawer_step_size", |
---|
1389 | DEFAULT_DRAWER_STEP_SIZE, NULL); |
---|
1390 | |
---|
1391 | global_config.minimize_delay = |
---|
1392 | conditional_get_int ("minimize_delay", |
---|
1393 | DEFAULT_MINIMIZE_DELAY, NULL); |
---|
1394 | |
---|
1395 | global_config.maximize_delay = |
---|
1396 | conditional_get_int ("maximize_delay", |
---|
1397 | DEFAULT_MAXIMIZE_DELAY, NULL); |
---|
1398 | |
---|
1399 | global_config.minimized_size = |
---|
1400 | conditional_get_int("minimized_size", |
---|
1401 | DEFAULT_MINIMIZED_SIZE, NULL); |
---|
1402 | |
---|
1403 | global_config.movement_type = |
---|
1404 | conditional_get_int("movement_type", |
---|
1405 | PANEL_SWITCH_MOVE, NULL); |
---|
1406 | |
---|
1407 | global_config.keys_enabled = conditional_get_bool ("keys_enabled", |
---|
1408 | TRUE, NULL); |
---|
1409 | |
---|
1410 | g_free(global_config.menu_key); |
---|
1411 | global_config.menu_key = conditional_get_string ("menu_key", |
---|
1412 | "Mod1-F1", NULL); |
---|
1413 | convert_string_to_keysym_state(global_config.menu_key, |
---|
1414 | &global_config.menu_keysym, |
---|
1415 | &global_config.menu_state); |
---|
1416 | |
---|
1417 | g_free(global_config.run_key); |
---|
1418 | global_config.run_key = conditional_get_string ("run_key", "Mod1-F2", |
---|
1419 | NULL); |
---|
1420 | convert_string_to_keysym_state(global_config.run_key, |
---|
1421 | &global_config.run_keysym, |
---|
1422 | &global_config.run_state); |
---|
1423 | |
---|
1424 | g_free(global_config.screenshot_key); |
---|
1425 | global_config.screenshot_key = |
---|
1426 | conditional_get_string ("screenshot_key", "Print", |
---|
1427 | NULL); |
---|
1428 | convert_string_to_keysym_state(global_config.screenshot_key, |
---|
1429 | &global_config.screenshot_keysym, |
---|
1430 | &global_config.screenshot_state); |
---|
1431 | |
---|
1432 | g_free(global_config.window_screenshot_key); |
---|
1433 | global_config.window_screenshot_key = |
---|
1434 | conditional_get_string ("window_screenshot_key", |
---|
1435 | "Shift-Print", NULL); |
---|
1436 | convert_string_to_keysym_state(global_config.window_screenshot_key, |
---|
1437 | &global_config.window_screenshot_keysym, |
---|
1438 | &global_config.window_screenshot_state); |
---|
1439 | |
---|
1440 | |
---|
1441 | |
---|
1442 | global_config.applet_padding = |
---|
1443 | conditional_get_int ("applet_padding", 3, NULL); |
---|
1444 | |
---|
1445 | global_config.applet_border_padding = |
---|
1446 | conditional_get_int ("applet_border_padding", 0, NULL); |
---|
1447 | |
---|
1448 | global_config.autoraise = conditional_get_bool ("autoraise", TRUE, NULL); |
---|
1449 | |
---|
1450 | global_config.keep_bottom = |
---|
1451 | conditional_get_bool ("keep_bottom", FALSE, &def); |
---|
1452 | /* if keep bottom was the default, then we want to do a nicer |
---|
1453 | * saner default which is normal layer. If it was not the |
---|
1454 | * default then we don't want to change the layerness as it was |
---|
1455 | * selected by the user and thus we default to FALSE */ |
---|
1456 | if (def) |
---|
1457 | global_config.normal_layer = |
---|
1458 | conditional_get_bool ("normal_layer", TRUE, NULL); |
---|
1459 | else |
---|
1460 | global_config.normal_layer = |
---|
1461 | conditional_get_bool ("normal_layer", FALSE, NULL); |
---|
1462 | |
---|
1463 | global_config.drawer_auto_close = |
---|
1464 | conditional_get_bool ("drawer_auto_close", FALSE, NULL); |
---|
1465 | global_config.simple_movement = |
---|
1466 | conditional_get_bool ("simple_movement", FALSE, NULL); |
---|
1467 | global_config.hide_panel_frame = |
---|
1468 | conditional_get_bool ("hide_panel_frame", FALSE, NULL); |
---|
1469 | global_config.tile_when_over = |
---|
1470 | conditional_get_bool ("tile_when_over", FALSE, NULL); |
---|
1471 | global_config.saturate_when_over = |
---|
1472 | conditional_get_bool ("saturate_when_over", TRUE, NULL); |
---|
1473 | global_config.confirm_panel_remove = |
---|
1474 | conditional_get_bool ("confirm_panel_remove", TRUE, NULL); |
---|
1475 | global_config.fast_button_scaling = |
---|
1476 | conditional_get_bool ("fast_button_scaling", FALSE, NULL); |
---|
1477 | global_config.avoid_collisions = |
---|
1478 | conditional_get_bool ("avoid_collisions", TRUE, NULL); |
---|
1479 | |
---|
1480 | global_config.menu_flags = conditional_get_int |
---|
1481 | ("menu_flags", (MAIN_MENU_SYSTEM_SUB | MAIN_MENU_USER_SUB | |
---|
1482 | MAIN_MENU_APPLETS_SUB | MAIN_MENU_PANEL_SUB | |
---|
1483 | MAIN_MENU_DESKTOP), |
---|
1484 | NULL); |
---|
1485 | |
---|
1486 | if (global_config.menu_flags < 0) { |
---|
1487 | global_config.menu_flags = |
---|
1488 | (MAIN_MENU_SYSTEM_SUB | MAIN_MENU_USER_SUB | |
---|
1489 | MAIN_MENU_APPLETS_SUB | MAIN_MENU_PANEL_SUB | |
---|
1490 | MAIN_MENU_DESKTOP); |
---|
1491 | } |
---|
1492 | |
---|
1493 | keybuf = g_string_new(NULL); |
---|
1494 | tilebuf = g_string_new(NULL); |
---|
1495 | for (i = 0; i < LAST_TILE; i++) { |
---|
1496 | GString *keybuf = g_string_new(NULL); |
---|
1497 | GString *tilebuf = g_string_new(NULL); |
---|
1498 | |
---|
1499 | g_string_sprintf (keybuf, "new_tiles_enabled_%d",i); |
---|
1500 | global_config.tiles_enabled[i] = |
---|
1501 | conditional_get_bool (keybuf->str, FALSE, NULL); |
---|
1502 | |
---|
1503 | g_free (global_config.tile_up[i]); |
---|
1504 | g_string_sprintf (keybuf, "tile_up_%d", i); |
---|
1505 | g_string_sprintf (tilebuf, "tiles/tile-%s-up.png", tile_def[i]); |
---|
1506 | global_config.tile_up[i] = conditional_get_string (keybuf->str, |
---|
1507 | tilebuf->str, |
---|
1508 | NULL); |
---|
1509 | |
---|
1510 | g_free(global_config.tile_down[i]); |
---|
1511 | g_string_sprintf (keybuf, "tile_down_%d", i); |
---|
1512 | g_string_sprintf (tilebuf, "tiles/tile-%s-down.png", |
---|
1513 | tile_def[i]); |
---|
1514 | global_config.tile_down[i] = |
---|
1515 | conditional_get_string (keybuf->str, tilebuf->str, |
---|
1516 | NULL); |
---|
1517 | |
---|
1518 | g_string_sprintf (keybuf, "tile_border_%d", i); |
---|
1519 | global_config.tile_border[i] = |
---|
1520 | conditional_get_int (keybuf->str, 2, NULL); |
---|
1521 | g_string_sprintf (keybuf, "tile_depth_%d", i); |
---|
1522 | global_config.tile_depth[i] = |
---|
1523 | conditional_get_int (keybuf->str, 2, NULL); |
---|
1524 | } |
---|
1525 | g_string_free (tilebuf, TRUE); |
---|
1526 | g_string_free (keybuf, TRUE); |
---|
1527 | |
---|
1528 | gnome_config_sync (); |
---|
1529 | |
---|
1530 | gnome_config_pop_prefix (); |
---|
1531 | } |
---|
1532 | |
---|
1533 | static void |
---|
1534 | tell_panel(void) |
---|
1535 | { |
---|
1536 | CORBA_Environment ev; |
---|
1537 | GNOME_Panel panel_client = CORBA_OBJECT_NIL; |
---|
1538 | |
---|
1539 | panel_client = |
---|
1540 | goad_server_activate_with_repo_id(NULL, |
---|
1541 | "IDL:GNOME/Panel:1.0", |
---|
1542 | GOAD_ACTIVATE_EXISTING_ONLY, |
---|
1543 | NULL); |
---|
1544 | |
---|
1545 | if(!panel_client) return; |
---|
1546 | CORBA_exception_init(&ev); |
---|
1547 | GNOME_Panel_notice_config_changes(panel_client, &ev); |
---|
1548 | CORBA_exception_free(&ev); |
---|
1549 | } |
---|
1550 | |
---|
1551 | static void |
---|
1552 | write_config (GlobalConfig *conf) |
---|
1553 | { |
---|
1554 | int i; |
---|
1555 | GString *buf; |
---|
1556 | gnome_config_push_prefix ("/panel/Config/"); |
---|
1557 | |
---|
1558 | gnome_config_set_int("auto_hide_step_size", |
---|
1559 | conf->auto_hide_step_size); |
---|
1560 | gnome_config_set_int("explicit_hide_step_size", |
---|
1561 | conf->explicit_hide_step_size); |
---|
1562 | gnome_config_set_int("drawer_step_size", |
---|
1563 | conf->drawer_step_size); |
---|
1564 | gnome_config_set_int("minimized_size", |
---|
1565 | conf->minimized_size); |
---|
1566 | gnome_config_set_int("minimize_delay", |
---|
1567 | conf->minimize_delay); |
---|
1568 | gnome_config_set_int("maximize_delay", |
---|
1569 | conf->maximize_delay); |
---|
1570 | gnome_config_set_int("movement_type", |
---|
1571 | (int)conf->movement_type); |
---|
1572 | gnome_config_set_bool("tooltips_enabled", |
---|
1573 | conf->tooltips_enabled); |
---|
1574 | gnome_config_set_bool("show_dot_buttons", |
---|
1575 | conf->show_dot_buttons); |
---|
1576 | gnome_config_set_bool("show_menu_titles", |
---|
1577 | conf->show_menu_titles); |
---|
1578 | gnome_config_set_bool("memory_hungry_menus", |
---|
1579 | conf->hungry_menus); |
---|
1580 | gnome_config_set_bool("use_large_icons", |
---|
1581 | conf->use_large_icons); |
---|
1582 | gnome_config_set_bool("merge_menus", |
---|
1583 | conf->merge_menus); |
---|
1584 | gnome_config_set_bool("menu_check", |
---|
1585 | conf->menu_check); |
---|
1586 | gnome_config_set_bool("off_panel_popups", |
---|
1587 | conf->off_panel_popups); |
---|
1588 | gnome_config_set_bool("disable_animations", |
---|
1589 | conf->disable_animations); |
---|
1590 | gnome_config_set_int("applet_padding", |
---|
1591 | conf->applet_padding); |
---|
1592 | gnome_config_set_int("applet_border_padding", |
---|
1593 | conf->applet_border_padding); |
---|
1594 | gnome_config_set_bool("autoraise", |
---|
1595 | conf->autoraise); |
---|
1596 | gnome_config_set_bool("keep_bottom", |
---|
1597 | conf->keep_bottom); |
---|
1598 | gnome_config_set_bool("normal_layer", |
---|
1599 | conf->normal_layer); |
---|
1600 | gnome_config_set_bool("drawer_auto_close", |
---|
1601 | conf->drawer_auto_close); |
---|
1602 | gnome_config_set_bool("simple_movement", |
---|
1603 | conf->simple_movement); |
---|
1604 | gnome_config_set_bool("hide_panel_frame", |
---|
1605 | conf->hide_panel_frame); |
---|
1606 | gnome_config_set_bool("tile_when_over", |
---|
1607 | conf->tile_when_over); |
---|
1608 | gnome_config_set_bool("saturate_when_over", |
---|
1609 | conf->saturate_when_over); |
---|
1610 | gnome_config_set_bool("confirm_panel_remove", |
---|
1611 | conf->confirm_panel_remove); |
---|
1612 | gnome_config_set_bool("avoid_collisions", |
---|
1613 | conf->avoid_collisions); |
---|
1614 | gnome_config_set_int("menu_flags", conf->menu_flags); |
---|
1615 | gnome_config_set_bool("keys_enabled", conf->keys_enabled); |
---|
1616 | gnome_config_set_string("menu_key", conf->menu_key); |
---|
1617 | gnome_config_set_string("run_key", conf->run_key); |
---|
1618 | gnome_config_set_string("screenshot_key", conf->screenshot_key); |
---|
1619 | gnome_config_set_string("window_screenshot_key", conf->window_screenshot_key); |
---|
1620 | gnome_config_set_bool("fast_button_scaling", conf->fast_button_scaling); |
---|
1621 | |
---|
1622 | buf = g_string_new(NULL); |
---|
1623 | for(i=0;i<LAST_TILE;i++) { |
---|
1624 | g_string_sprintf(buf,"new_tiles_enabled_%d",i); |
---|
1625 | gnome_config_set_bool(buf->str, |
---|
1626 | conf->tiles_enabled[i]); |
---|
1627 | g_string_sprintf(buf,"tile_up_%d",i); |
---|
1628 | gnome_config_set_string(buf->str, |
---|
1629 | conf->tile_up[i]); |
---|
1630 | g_string_sprintf(buf,"tile_down_%d",i); |
---|
1631 | gnome_config_set_string(buf->str, |
---|
1632 | conf->tile_down[i]); |
---|
1633 | g_string_sprintf(buf,"tile_border_%d",i); |
---|
1634 | gnome_config_set_int(buf->str, |
---|
1635 | conf->tile_border[i]); |
---|
1636 | g_string_sprintf(buf,"tile_depth_%d",i); |
---|
1637 | gnome_config_set_int(buf->str, |
---|
1638 | conf->tile_depth[i]); |
---|
1639 | } |
---|
1640 | g_string_free(buf,TRUE); |
---|
1641 | gnome_config_pop_prefix(); |
---|
1642 | gnome_config_sync(); |
---|
1643 | |
---|
1644 | tell_panel(); |
---|
1645 | } |
---|
1646 | |
---|
1647 | static void |
---|
1648 | try(GtkWidget *capplet, gpointer data) |
---|
1649 | { |
---|
1650 | sync_config_with_animation_page(&global_config); |
---|
1651 | sync_config_with_buttons_page(&global_config); |
---|
1652 | sync_config_with_applets_page(&global_config); |
---|
1653 | sync_config_with_menu_page(&global_config); |
---|
1654 | sync_config_with_misc_page(&global_config); |
---|
1655 | write_config(&global_config); |
---|
1656 | } |
---|
1657 | |
---|
1658 | static void |
---|
1659 | revert(GtkWidget *capplet, gpointer data) |
---|
1660 | { |
---|
1661 | changing = TRUE; |
---|
1662 | sync_animation_page_with_config(&loaded_config); |
---|
1663 | sync_buttons_page_with_config(&loaded_config); |
---|
1664 | sync_applets_page_with_config(&loaded_config); |
---|
1665 | sync_menu_page_with_config(&loaded_config); |
---|
1666 | sync_misc_page_with_config(&loaded_config); |
---|
1667 | |
---|
1668 | set_config (&global_config, &loaded_config); |
---|
1669 | |
---|
1670 | write_config(&loaded_config); |
---|
1671 | |
---|
1672 | changing = FALSE; |
---|
1673 | } |
---|
1674 | |
---|
1675 | static void |
---|
1676 | setup_the_ui(GtkWidget *capplet) |
---|
1677 | { |
---|
1678 | GtkWidget *page; |
---|
1679 | GtkWidget *nbook; |
---|
1680 | |
---|
1681 | nbook = gtk_notebook_new(); |
---|
1682 | gtk_container_add(GTK_CONTAINER(capplet),nbook); |
---|
1683 | |
---|
1684 | /* Animation notebook page */ |
---|
1685 | page = animation_notebook_page (); |
---|
1686 | gtk_notebook_append_page (GTK_NOTEBOOK(nbook), |
---|
1687 | page, gtk_label_new (_("Animation"))); |
---|
1688 | |
---|
1689 | /* General icon notebook page */ |
---|
1690 | page = buttons_notebook_page (); |
---|
1691 | gtk_notebook_append_page (GTK_NOTEBOOK(nbook), |
---|
1692 | page, gtk_label_new (_("Buttons"))); |
---|
1693 | |
---|
1694 | /* applet settings */ |
---|
1695 | page = applets_notebook_page (); |
---|
1696 | gtk_notebook_append_page (GTK_NOTEBOOK (nbook), |
---|
1697 | page, gtk_label_new (_("Panel Objects"))); |
---|
1698 | |
---|
1699 | /* Menu notebook page */ |
---|
1700 | page = menu_notebook_page (); |
---|
1701 | gtk_notebook_append_page (GTK_NOTEBOOK (nbook), |
---|
1702 | page, gtk_label_new (_("Menu"))); |
---|
1703 | |
---|
1704 | /* Miscellaneous notebook page */ |
---|
1705 | page = misc_notebook_page (); |
---|
1706 | gtk_notebook_append_page (GTK_NOTEBOOK(nbook), |
---|
1707 | page, gtk_label_new (_("Miscellaneous"))); |
---|
1708 | |
---|
1709 | |
---|
1710 | gtk_signal_connect (GTK_OBJECT (nbook), "event", |
---|
1711 | GTK_SIGNAL_FUNC (config_event), |
---|
1712 | nbook); |
---|
1713 | |
---|
1714 | /* show notebook */ |
---|
1715 | gtk_widget_show_all(nbook); |
---|
1716 | |
---|
1717 | sync_animation_page_with_config(&loaded_config); |
---|
1718 | sync_buttons_page_with_config(&loaded_config); |
---|
1719 | sync_applets_page_with_config(&loaded_config); |
---|
1720 | sync_menu_page_with_config(&loaded_config); |
---|
1721 | sync_misc_page_with_config(&loaded_config); |
---|
1722 | |
---|
1723 | /* Finished */ |
---|
1724 | gtk_widget_show_all(capplet); |
---|
1725 | gtk_signal_connect(GTK_OBJECT(capplet), "try", |
---|
1726 | GTK_SIGNAL_FUNC(try), NULL); |
---|
1727 | gtk_signal_connect(GTK_OBJECT(capplet), "revert", |
---|
1728 | GTK_SIGNAL_FUNC(revert), NULL); |
---|
1729 | gtk_signal_connect(GTK_OBJECT(capplet), "ok", |
---|
1730 | GTK_SIGNAL_FUNC(try), NULL); |
---|
1731 | gtk_signal_connect(GTK_OBJECT(capplet), "cancel", |
---|
1732 | GTK_SIGNAL_FUNC(revert), NULL); |
---|
1733 | gtk_signal_connect(GTK_OBJECT(capplet), "help", |
---|
1734 | GTK_SIGNAL_FUNC(help), NULL); |
---|
1735 | } |
---|
1736 | |
---|
1737 | int |
---|
1738 | main (int argc, char **argv) |
---|
1739 | { |
---|
1740 | bindtextdomain(PACKAGE, GNOMELOCALEDIR); |
---|
1741 | textdomain(PACKAGE); |
---|
1742 | |
---|
1743 | changing = TRUE; |
---|
1744 | |
---|
1745 | if(gnome_capplet_init("gnome-panel-properties", VERSION, argc, |
---|
1746 | argv, NULL, 0, NULL) < 0) |
---|
1747 | return 1; |
---|
1748 | gnome_window_icon_set_default_from_file (GNOME_ICONDIR"/gnome-panel.png"); |
---|
1749 | /* Ahhh, yes the infamous commie mode, don't allow running of this, |
---|
1750 | * just display a label */ |
---|
1751 | if (gnome_config_get_bool |
---|
1752 | ("=" GLOBAL_CONFDIR "/System=/Config/LockDown=FALSE")) { |
---|
1753 | GtkWidget *label; |
---|
1754 | |
---|
1755 | capplet = capplet_widget_new(); |
---|
1756 | |
---|
1757 | label = gtk_label_new (_("The system administrator has " |
---|
1758 | "disallowed modification of the " |
---|
1759 | "panel configuration")); |
---|
1760 | gtk_widget_show (label); |
---|
1761 | |
---|
1762 | gtk_container_add (GTK_CONTAINER (capplet), label); |
---|
1763 | |
---|
1764 | capplet_gtk_main (); |
---|
1765 | |
---|
1766 | return 0; |
---|
1767 | } |
---|
1768 | |
---|
1769 | loadup_vals (); |
---|
1770 | |
---|
1771 | set_config (&loaded_config, &global_config); |
---|
1772 | |
---|
1773 | capplet = capplet_widget_new(); |
---|
1774 | |
---|
1775 | setup_the_ui(capplet); |
---|
1776 | |
---|
1777 | changing = FALSE; |
---|
1778 | capplet_gtk_main(); |
---|
1779 | |
---|
1780 | return 0; |
---|
1781 | } |
---|