Initial revision
[geeqie.git] / src / config.c
1 /*
2  * GQview image viewer
3  * (C)1999 John Ellis
4  *
5  * Author: John Ellis
6  *
7  */
8
9 #include "gqview.h"
10
11 /* config memory values */
12 static gint startup_path_enable_c;
13 static gint confirm_delete_c;
14 static gint restore_tool_c;
15 static gint save_window_positions_c;
16 static gint zoom_mode_c;
17 static gint fit_window_c;
18 static gint limit_window_size_c;
19 static gint max_window_size_c;
20 static gint progressive_key_scrolling_c;
21 static gint thumb_max_width_c;
22 static gint thumb_max_height_c;
23 static gint enable_thumb_caching_c;
24 static gint use_xvpics_thumbnails_c;
25 static gint show_dot_files_c;
26 static gint file_filter_disable_c;
27 static gint filter_include_jpg_c;
28 static gint filter_include_xpm_c;
29 static gint filter_include_tif_c;
30 static gint filter_include_gif_c;
31 static gint filter_include_png_c;
32 static gint filter_include_ppm_c;
33 static gint filter_include_pgm_c;
34 static gint filter_include_pcx_c;
35 static gint filter_include_bmp_c;
36 static gint slideshow_delay_c;
37 static gint slideshow_random_c;
38 static gint slideshow_repeat_c;
39
40 static GtkWidget *configwindow = NULL;
41 static GtkWidget *startup_path_entry;
42 static GtkWidget *custom_filter_entry;
43 static GtkWidget *editor_name_entry[8];
44 static GtkWidget *editor_command_entry[8];
45
46 static void startup_path_set_current(GtkWidget *widget, gpointer data);
47 static void slideshow_delay_cb(GtkObject *adj, gpointer data);
48 static void zoom_mode_original_cb(GtkWidget *widget, gpointer data);
49 static void zoom_mode_fit_cb(GtkWidget *widget, gpointer data);
50 static void zoom_mode_none_cb(GtkWidget *widget, gpointer data);
51 static void max_window_size_cb(GtkObject *adj, gpointer data);
52 static void thumb_size_48_selected(GtkWidget *w, gpointer data);
53 static void thumb_size_64_selected(GtkWidget *w, gpointer data);
54 static void thumb_size_85_selected(GtkWidget *w, gpointer data);
55 static void thumb_size_100_selected(GtkWidget *w, gpointer data);
56
57 static void config_window_apply();
58 static void config_window_close_cb(GtkWidget *widget, gpointer data);
59 static void config_window_destroy(GtkWidget *w, GdkEvent *event, gpointer data);
60 static void config_window_ok_cb(GtkWidget *widget, gpointer data);
61 static void config_window_save_cb(GtkWidget *widget, gpointer data);
62
63 static void check_button_cb(GtkWidget *widget, gpointer data);
64 static void add_check_button(gint option, gint *option_c, gchar *text, GtkWidget *box);
65 static void config_window_create(gint start_tab);
66
67 /*
68  *-----------------------------------------------------------------------------
69  * option widget callbacks (private)
70  *-----------------------------------------------------------------------------
71  */ 
72
73 static void startup_path_set_current(GtkWidget *widget, gpointer data)
74 {
75         gtk_entry_set_text(GTK_ENTRY(startup_path_entry), current_path);
76 }
77
78 static void slideshow_delay_cb(GtkObject *adj, gpointer data)
79 {
80         slideshow_delay_c = (gint)GTK_ADJUSTMENT(adj)->value;
81 }
82
83 static void zoom_mode_original_cb(GtkWidget *widget, gpointer data)
84 {
85         if (GTK_TOGGLE_BUTTON (widget)->active)
86                 zoom_mode_c = ZOOM_RESET_ORIGINAL;
87 }
88
89 static void zoom_mode_fit_cb(GtkWidget *widget, gpointer data)
90 {
91         if (GTK_TOGGLE_BUTTON (widget)->active)
92                 zoom_mode_c = ZOOM_RESET_FIT_WINDOW;
93 }
94
95 static void zoom_mode_none_cb(GtkWidget *widget, gpointer data)
96 {
97         if (GTK_TOGGLE_BUTTON (widget)->active)
98                 zoom_mode_c = ZOOM_RESET_NONE;
99 }
100
101 static void max_window_size_cb(GtkObject *adj, gpointer data)
102 {
103         max_window_size_c = (gint)GTK_ADJUSTMENT(adj)->value;
104 }
105
106 static void thumb_size_48_selected(GtkWidget *w, gpointer data)
107 {
108         if (GTK_TOGGLE_BUTTON (w)->active)
109                 {
110                 thumb_max_width_c = 48;
111                 thumb_max_height_c = 48;
112                 }
113 }
114
115 static void thumb_size_64_selected(GtkWidget *w, gpointer data)
116 {
117         if (GTK_TOGGLE_BUTTON (w)->active)
118                 {
119                 thumb_max_width_c = 64;
120                 thumb_max_height_c = 64;
121                 }
122 }
123
124 static void thumb_size_85_selected(GtkWidget *w, gpointer data)
125 {
126         if (GTK_TOGGLE_BUTTON (w)->active)
127                 {
128                 thumb_max_width_c = 85;
129                 thumb_max_height_c = 64;
130                 }
131 }
132
133 static void thumb_size_100_selected(GtkWidget *w, gpointer data)
134 {
135         if (GTK_TOGGLE_BUTTON (w)->active)
136                 {
137                 thumb_max_width_c = 100;
138                 thumb_max_height_c = 100;
139                 }
140 }
141
142 /*
143  *-----------------------------------------------------------------------------
144  * sync progam to config window routine (private)
145  *-----------------------------------------------------------------------------
146  */ 
147
148 static void config_window_apply()
149 {
150         gchar *buf;
151         gint i;
152         gint refresh = FALSE;
153
154         for(i=0; i<8; i++)
155                 {
156                 g_free(editor_name[i]);
157                 editor_name[i] = NULL;
158                 buf = gtk_entry_get_text(GTK_ENTRY(editor_name_entry[i]));
159                 if (buf && strlen(buf) > 0) editor_name[i] = g_strdup(buf);
160
161                 g_free(editor_command[i]);
162                 editor_command[i] = NULL;
163                 buf = gtk_entry_get_text(GTK_ENTRY(editor_command_entry[i]));
164                 if (buf && strlen(buf) > 0) editor_command[i] = g_strdup(buf);
165                 }
166         update_edit_menus(mainwindow_accel_grp);
167
168         g_free(startup_path);
169         startup_path = NULL;
170         buf = gtk_entry_get_text(GTK_ENTRY(startup_path_entry));
171         if (buf && strlen(buf) > 0) startup_path = remove_trailing_slash(buf);
172
173         buf = gtk_entry_get_text(GTK_ENTRY(custom_filter_entry));
174         if ((buf && strlen(buf) > 0) != (custom_filter != NULL)) refresh = TRUE;
175         if ((buf && strlen(buf) > 0 && custom_filter) && strcmp(buf, custom_filter) != 0) refresh = TRUE;
176         g_free(custom_filter);
177         custom_filter = NULL;
178         if (buf && strlen(buf) > 0) custom_filter = g_strdup(buf);
179
180         if (show_dot_files != show_dot_files_c) refresh = TRUE;
181         if (file_filter_disable != file_filter_disable_c) refresh = TRUE;
182         if (filter_include_jpg != filter_include_jpg_c) refresh = TRUE;
183         if (filter_include_xpm != filter_include_xpm_c) refresh = TRUE;
184         if (filter_include_tif != filter_include_tif_c) refresh = TRUE;
185         if (filter_include_gif != filter_include_gif_c) refresh = TRUE;
186         if (filter_include_png != filter_include_png_c) refresh = TRUE;
187         if (filter_include_ppm != filter_include_ppm_c) refresh = TRUE;
188         if (filter_include_pgm != filter_include_pgm_c) refresh = TRUE;
189         if (filter_include_pcx != filter_include_pcx_c) refresh = TRUE;
190         if (filter_include_bmp != filter_include_bmp_c) refresh = TRUE;
191
192         startup_path_enable = startup_path_enable_c;
193         confirm_delete = confirm_delete_c;
194         restore_tool = restore_tool_c;
195         save_window_positions = save_window_positions_c;
196         zoom_mode = zoom_mode_c;
197         fit_window = fit_window_c;
198         limit_window_size = limit_window_size_c;
199         max_window_size = max_window_size_c;
200         progressive_key_scrolling = progressive_key_scrolling_c;
201         thumb_max_width = thumb_max_width_c;
202         thumb_max_height = thumb_max_height_c;
203         enable_thumb_caching = enable_thumb_caching_c;
204         use_xvpics_thumbnails = use_xvpics_thumbnails_c;
205         show_dot_files = show_dot_files_c;
206         file_filter_disable = file_filter_disable_c;
207         filter_include_jpg = filter_include_jpg_c;
208         filter_include_xpm = filter_include_xpm_c;
209         filter_include_tif = filter_include_tif_c;
210         filter_include_gif = filter_include_gif_c;
211         filter_include_png = filter_include_png_c;
212         filter_include_ppm = filter_include_ppm_c;
213         filter_include_pgm = filter_include_pgm_c;
214         filter_include_pcx = filter_include_pcx_c;
215         filter_include_bmp = filter_include_bmp_c;
216
217         slideshow_random = slideshow_random_c;
218         slideshow_repeat = slideshow_repeat_c;
219         slideshow_delay = slideshow_delay_c;
220
221         if (refresh)
222                 {
223                 rebuild_file_filter();
224                 filelist_refresh();
225                 }
226 }
227
228 /*
229  *-----------------------------------------------------------------------------
230  * config window main button callbacks (private)
231  *-----------------------------------------------------------------------------
232  */ 
233
234 static void config_window_close_cb(GtkWidget *widget, gpointer data)
235 {
236         gtk_widget_destroy(configwindow);
237         configwindow = NULL;
238 }
239
240 static void config_window_destroy(GtkWidget *w, GdkEvent *event, gpointer data)
241 {
242         config_window_close_cb(NULL, NULL);
243 }
244
245 static void config_window_ok_cb(GtkWidget *widget, gpointer data)
246 {
247         config_window_apply();
248         config_window_close_cb(NULL, NULL);
249 }
250
251 static void config_window_apply_cb(GtkWidget *widget, gpointer data)
252 {
253         config_window_apply();
254 }
255
256 /*
257  *-----------------------------------------------------------------------------
258  * config window setup (private)
259  *-----------------------------------------------------------------------------
260  */ 
261
262 static void check_button_cb(GtkWidget *widget, gpointer data)
263 {
264         gint *value_ptr = data;
265         *value_ptr = GTK_TOGGLE_BUTTON (widget)->active;
266 }
267
268 static void add_check_button(gint option, gint *option_c, gchar *text, GtkWidget *box)
269 {
270         GtkWidget *button;
271         *option_c = option;
272         button = gtk_check_button_new_with_label (text);
273         gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
274         gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(button), option);
275         gtk_signal_connect (GTK_OBJECT(button),"clicked",(GtkSignalFunc) check_button_cb, option_c);
276         gtk_widget_show(button);
277 }
278
279 static void config_window_create(gint start_tab)
280 {
281         GtkWidget *win_vbox;
282         GtkWidget *hbox;
283         GtkWidget *notebook;
284         GtkWidget *frame;
285         GtkWidget *label;
286         GtkWidget *vbox;
287         GtkWidget *vbox1;
288         GtkWidget *vbox2;
289         GtkWidget *button;
290         GtkWidget *tabcomp;
291         GtkWidget *radiobuttongroup;
292         GtkWidget *table;
293         GtkObject *adj;
294         GtkWidget *spin;
295         GdkImlibImage* im;
296         GdkPixmap *pixmap;
297         gchar buf[255];
298         gint i;
299
300         configwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
301         gtk_signal_connect (GTK_OBJECT (configwindow), "delete_event",(GtkSignalFunc) config_window_destroy, NULL);
302         gtk_window_set_policy (GTK_WINDOW (configwindow), FALSE, FALSE, FALSE);
303         gtk_window_set_title (GTK_WINDOW (configwindow), _("GQview configuration"));
304         gtk_window_set_wmclass(GTK_WINDOW (configwindow), "config", "GQview");
305         gtk_container_border_width (GTK_CONTAINER (configwindow), 5);
306
307         win_vbox = gtk_vbox_new(FALSE, 5);
308         gtk_container_add(GTK_CONTAINER(configwindow), win_vbox);
309         gtk_widget_show(win_vbox);
310
311         hbox = gtk_hbox_new (TRUE, 0);
312         gtk_box_pack_end(GTK_BOX(win_vbox), hbox, FALSE, FALSE, 0);
313         gtk_widget_show(hbox);
314
315         button = gtk_button_new_with_label(_("Ok"));
316         gtk_signal_connect (GTK_OBJECT (button), "clicked",(GtkSignalFunc) config_window_ok_cb, NULL);
317         gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 20);
318         gtk_widget_show(button);
319
320         button = gtk_button_new_with_label(_("Apply"));
321         gtk_signal_connect (GTK_OBJECT (button), "clicked",(GtkSignalFunc) config_window_apply_cb, NULL);
322         gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 20);
323         gtk_widget_show(button);
324
325         button = gtk_button_new_with_label(_("Cancel"));
326         gtk_signal_connect (GTK_OBJECT (button), "clicked",(GtkSignalFunc) config_window_close_cb, NULL);
327         gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 20);
328         gtk_widget_show(button);
329
330         notebook = gtk_notebook_new();
331         gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);
332         gtk_box_pack_start (GTK_BOX(win_vbox), notebook, TRUE, TRUE, 0);
333
334         /* general options tab */
335
336         frame = gtk_frame_new(NULL);
337         gtk_container_border_width (GTK_CONTAINER (frame), 5);
338         gtk_widget_show(frame);
339         label = gtk_label_new(_("General"));
340         gtk_notebook_append_page (GTK_NOTEBOOK(notebook), frame, label);
341
342         vbox = gtk_vbox_new (FALSE, 0);
343         gtk_container_border_width (GTK_CONTAINER (vbox), 5);
344         gtk_container_add (GTK_CONTAINER(frame),vbox);
345         gtk_widget_show(vbox);
346
347         frame = gtk_frame_new(_("Initial directory"));
348         gtk_container_border_width (GTK_CONTAINER (frame), 5);
349         gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
350         gtk_widget_show(frame);
351
352         vbox1 = gtk_vbox_new (FALSE, 0);
353         gtk_container_add (GTK_CONTAINER(frame),vbox1);
354         gtk_widget_show(vbox1);
355
356         add_check_button(startup_path_enable, &startup_path_enable_c,
357                          _("On startup, change to this directory:"), vbox1);
358
359         hbox = gtk_hbox_new (FALSE, 0);
360         gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0);
361         gtk_widget_show(hbox);
362
363         gtk_widget_realize(configwindow);
364
365         tabcomp = tab_completion_new(&startup_path_entry, configwindow, startup_path, NULL, NULL);
366         gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0);
367         gtk_widget_show(tabcomp);
368
369         button = gtk_button_new_with_label (_("Use current"));
370         gtk_signal_connect (GTK_OBJECT(button),"clicked",(GtkSignalFunc) startup_path_set_current, NULL);
371         gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
372         gtk_widget_show(button);
373
374         add_check_button(confirm_delete, &confirm_delete_c,
375                          _("Confirm file delete"), vbox);
376         add_check_button(restore_tool, &restore_tool_c,
377                          _("Remember tool state (float/hidden)"), vbox);
378         add_check_button(save_window_positions, &save_window_positions_c,
379                          _("Remember window positions"), vbox);
380
381         frame = gtk_frame_new(_("Slide show"));
382         gtk_container_border_width (GTK_CONTAINER (frame), 5);
383         gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
384         gtk_widget_show(frame);
385
386         vbox1 = gtk_vbox_new (FALSE, 0);
387         gtk_container_add (GTK_CONTAINER(frame),vbox1);
388         gtk_widget_show(vbox1);
389
390         hbox = gtk_hbox_new (FALSE, 0);
391         gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0);
392         gtk_widget_show(hbox);
393
394         label = gtk_label_new(_("Delay before image change (seconds):"));
395         gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
396         gtk_widget_show(label);
397
398         slideshow_delay_c = slideshow_delay;
399         adj = gtk_adjustment_new((float)slideshow_delay_c, 1.0, 1200.0, 1, 1, 1);
400         spin = gtk_spin_button_new( GTK_ADJUSTMENT(adj), 1, 0 );
401         gtk_box_pack_start( GTK_BOX(hbox), spin, FALSE, FALSE, 5);
402         gtk_signal_connect( GTK_OBJECT(adj),"value_changed",GTK_SIGNAL_FUNC(slideshow_delay_cb), NULL);
403         gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON(spin),GTK_UPDATE_ALWAYS );
404         gtk_widget_show(spin);
405         
406         add_check_button(slideshow_random, &slideshow_random_c,
407                          _("Random"), vbox1);
408         add_check_button(slideshow_repeat, &slideshow_repeat_c,
409                          _("Repeat"), vbox1);
410
411         /* image tab */
412
413         frame = gtk_frame_new(NULL);
414         gtk_container_border_width (GTK_CONTAINER (frame), 5);
415         gtk_widget_show(frame);
416         label = gtk_label_new(_("Image"));
417         gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, label);
418
419         vbox = gtk_vbox_new (FALSE, 0);
420         gtk_container_border_width (GTK_CONTAINER (vbox), 5);
421         gtk_container_add (GTK_CONTAINER(frame),vbox);
422         gtk_widget_show(vbox);
423         
424         frame = gtk_frame_new(_("When new image is selected:"));
425         gtk_container_border_width (GTK_CONTAINER (frame), 5);
426         gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
427         gtk_widget_show(frame);
428
429         vbox1 = gtk_vbox_new (FALSE, 0);
430         gtk_container_add (GTK_CONTAINER(frame),vbox1);
431         gtk_widget_show(vbox1);
432
433         zoom_mode_c = zoom_mode;
434         radiobuttongroup = gtk_radio_button_new_with_label (NULL, _("Zoom to original size"));
435         if (zoom_mode == ZOOM_RESET_ORIGINAL) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(radiobuttongroup), 1);
436         gtk_signal_connect (GTK_OBJECT(radiobuttongroup),"clicked",(GtkSignalFunc) zoom_mode_original_cb, NULL);
437         gtk_box_pack_start(GTK_BOX(vbox1), radiobuttongroup, FALSE, FALSE, 0);
438         gtk_widget_show(radiobuttongroup);
439
440         button = gtk_radio_button_new_with_label (gtk_radio_button_group(GTK_RADIO_BUTTON(radiobuttongroup)),_("Fit image to window"));
441         if (zoom_mode == ZOOM_RESET_FIT_WINDOW) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(button), 1);
442         gtk_signal_connect (GTK_OBJECT(button),"clicked",(GtkSignalFunc) zoom_mode_fit_cb, NULL);
443         gtk_box_pack_start(GTK_BOX(vbox1), button, FALSE, FALSE, 0);
444         gtk_widget_show(button);
445
446         button = gtk_radio_button_new_with_label (gtk_radio_button_group(GTK_RADIO_BUTTON(radiobuttongroup)),_("Leave Zoom at previous setting"));
447         if (zoom_mode == ZOOM_RESET_NONE) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(button), 1);
448         gtk_signal_connect (GTK_OBJECT(button),"clicked",(GtkSignalFunc) zoom_mode_none_cb, NULL);
449         gtk_box_pack_start(GTK_BOX(vbox1), button, FALSE, FALSE, 0);
450         gtk_widget_show(button);
451
452         add_check_button(fit_window, &fit_window_c,
453                          _("Fit window to image when tools are hidden/floating"), vbox);
454
455         hbox = gtk_hbox_new (FALSE, 0);
456         gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
457         gtk_widget_show(hbox);
458
459         add_check_button(limit_window_size, &limit_window_size_c,
460                          _("Limit size when auto-sizing window"), hbox);
461
462         max_window_size_c = max_window_size;
463         adj = gtk_adjustment_new((float)max_window_size_c, 10.0, 150.0, 1, 1, 1);
464         spin = gtk_spin_button_new( GTK_ADJUSTMENT(adj), 1, 0 );
465         gtk_box_pack_start( GTK_BOX(hbox), spin, FALSE, FALSE, 5);
466         gtk_signal_connect( GTK_OBJECT(adj),"value_changed",GTK_SIGNAL_FUNC(max_window_size_cb), NULL);
467         gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON(spin),GTK_UPDATE_ALWAYS );
468         gtk_widget_show(spin);
469
470         frame = gtk_frame_new(_("Thumbnails"));
471         gtk_container_border_width (GTK_CONTAINER (frame), 5);
472         gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
473         gtk_widget_show(frame);
474
475         vbox1 = gtk_vbox_new (FALSE, 0);
476         gtk_container_add (GTK_CONTAINER(frame),vbox1);
477         gtk_widget_show(vbox1);
478
479         hbox = gtk_hbox_new (FALSE, 0);
480         gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 0);
481         gtk_widget_show(hbox);
482
483         thumb_max_width_c = thumb_max_width;
484         thumb_max_height_c = thumb_max_height;
485
486         label = gtk_label_new(_("Size:"));
487         gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
488         gtk_widget_show(label);
489
490         radiobuttongroup = gtk_radio_button_new_with_label (NULL,"48x48");
491         gtk_box_pack_start(GTK_BOX(hbox), radiobuttongroup, FALSE, FALSE, 0);
492         if (thumb_max_width_c == 48 && thumb_max_height_c == 48) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(radiobuttongroup), 1);
493         gtk_signal_connect (GTK_OBJECT(radiobuttongroup),"clicked",(GtkSignalFunc) thumb_size_48_selected, NULL);
494         gtk_widget_show(radiobuttongroup);
495
496         button = gtk_radio_button_new_with_label (gtk_radio_button_group(GTK_RADIO_BUTTON(radiobuttongroup)),"64x64");
497         gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
498         if (thumb_max_width_c == 64 && thumb_max_height_c == 64) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(button), 1);
499         gtk_signal_connect (GTK_OBJECT(button),"clicked",(GtkSignalFunc) thumb_size_64_selected, NULL);
500         gtk_widget_show(button);
501
502         button = gtk_radio_button_new_with_label (gtk_radio_button_group(GTK_RADIO_BUTTON(radiobuttongroup)),"85x64");
503         gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
504         if (thumb_max_width_c == 85 && thumb_max_height_c == 64) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(button), 1);
505         gtk_signal_connect (GTK_OBJECT(button),"clicked",(GtkSignalFunc) thumb_size_85_selected, NULL);
506         gtk_widget_show(button);
507
508         button = gtk_radio_button_new_with_label (gtk_radio_button_group(GTK_RADIO_BUTTON(radiobuttongroup)),"100x100");
509         gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
510         if (thumb_max_width_c == 100 && thumb_max_height_c == 100) gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(button), 1);
511         gtk_signal_connect (GTK_OBJECT(button),"clicked",(GtkSignalFunc) thumb_size_100_selected, NULL);
512         gtk_widget_show(button);
513
514         add_check_button(enable_thumb_caching, &enable_thumb_caching_c,
515                          _("Cache thumbnails"), vbox1);
516         add_check_button(use_xvpics_thumbnails, &use_xvpics_thumbnails_c,
517                          _("Use xvpics thumbnails when found (read only)"), vbox1);
518
519         add_check_button(progressive_key_scrolling, &progressive_key_scrolling_c,
520                          _("Progressive keyboard scrolling"), vbox);
521
522         /* filtering tab */
523
524         frame = gtk_frame_new(NULL);
525         gtk_container_border_width (GTK_CONTAINER (frame), 5);
526         gtk_widget_show(frame);
527         label = gtk_label_new(_("Filtering"));
528         gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, label);
529
530         vbox = gtk_vbox_new (FALSE, 0);
531         gtk_container_border_width (GTK_CONTAINER (vbox), 5);
532         gtk_container_add (GTK_CONTAINER(frame),vbox);
533         gtk_widget_show(vbox);
534
535         add_check_button(show_dot_files, &show_dot_files_c,
536                          _("Show entries that begin with a dot"), vbox);
537         add_check_button(file_filter_disable, &file_filter_disable_c,
538                          _("Disable File Filtering"), vbox);
539
540         frame = gtk_frame_new(_("Include files of type:"));
541         gtk_container_border_width (GTK_CONTAINER (frame), 5);
542         gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
543         gtk_widget_show(frame);
544
545         vbox1 = gtk_vbox_new (FALSE, 0);
546         gtk_container_add (GTK_CONTAINER(frame),vbox1);
547         gtk_widget_show(vbox1);
548
549         hbox = gtk_hbox_new (TRUE, 0);
550         gtk_box_pack_start (GTK_BOX(vbox1), hbox, FALSE, FALSE, 0);
551         gtk_widget_show(hbox);
552
553         vbox2 = gtk_vbox_new (FALSE, 0);
554         gtk_box_pack_start (GTK_BOX(hbox), vbox2,FALSE, FALSE, 0);
555         gtk_widget_show(vbox2);
556
557         add_check_button(filter_include_jpg, &filter_include_jpg_c,
558                          "JPG / JPEG", vbox2);
559         add_check_button(filter_include_xpm, &filter_include_xpm_c,
560                          "XPM", vbox2);
561         add_check_button(filter_include_tif, &filter_include_tif_c,
562                          "TIF / TIFF", vbox2);
563
564         vbox2 = gtk_vbox_new (FALSE, 0);
565         gtk_box_pack_start (GTK_BOX(hbox), vbox2,FALSE, FALSE, 0);
566         gtk_widget_show(vbox2);
567
568         add_check_button(filter_include_gif, &filter_include_gif_c,
569                          "GIF", vbox2);
570         add_check_button(filter_include_png, &filter_include_png_c,
571                          "PNG", vbox2);
572         add_check_button(filter_include_ppm, &filter_include_ppm_c,
573                          "PPM", vbox2);
574
575         vbox2 = gtk_vbox_new (FALSE, 0);
576         gtk_box_pack_start (GTK_BOX(hbox), vbox2,FALSE, FALSE, 0);
577         gtk_widget_show(vbox2);
578
579         add_check_button(filter_include_pgm, &filter_include_pgm_c,
580                          "PGM", vbox2);
581         add_check_button(filter_include_pcx, &filter_include_pcx_c,
582                          "PCX", vbox2);
583         add_check_button(filter_include_bmp, &filter_include_bmp_c,
584                          "BMP", vbox2);
585
586         hbox = gtk_hbox_new (FALSE, 0);
587         gtk_box_pack_start (GTK_BOX(vbox1), hbox, FALSE, FALSE, 0);
588         gtk_widget_show(hbox);
589
590         label = gtk_label_new(_("Custom file types:"));
591         gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
592         gtk_widget_show(label);
593
594         custom_filter_entry = gtk_entry_new();
595         if (custom_filter) gtk_entry_set_text(GTK_ENTRY(custom_filter_entry), custom_filter);
596         gtk_box_pack_start(GTK_BOX(vbox1),custom_filter_entry,FALSE,FALSE,0);
597         gtk_widget_show(custom_filter_entry);
598
599         hbox = gtk_hbox_new (FALSE, 0);
600         gtk_box_pack_start (GTK_BOX(vbox1), hbox, FALSE, FALSE, 0);
601         gtk_widget_show(hbox);
602
603         label = gtk_label_new(_("format: [.foo;.bar]"));
604         gtk_box_pack_end(GTK_BOX(hbox),label,FALSE,FALSE,5);
605         gtk_widget_show(label);
606
607         /* editor entry tab */
608
609         frame = gtk_frame_new(NULL);
610         gtk_container_border_width (GTK_CONTAINER (frame), 5);
611         gtk_widget_show(frame);
612         label = gtk_label_new(_("External Editors"));
613         gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, label);
614
615         vbox = gtk_vbox_new(FALSE,0);
616         gtk_container_border_width (GTK_CONTAINER (vbox), 5);
617         gtk_container_add (GTK_CONTAINER(frame),vbox);
618         gtk_widget_show(vbox);
619
620         table=gtk_table_new(3,9,FALSE);
621         gtk_container_add (GTK_CONTAINER(vbox),table);
622         gtk_widget_show(table);
623
624         label = gtk_label_new(_("#"));
625         gtk_table_attach_defaults(GTK_TABLE (table),label, 0, 1, 0, 1);
626         gtk_widget_show(label);
627         label = gtk_label_new(_("Menu name"));
628         gtk_table_attach_defaults(GTK_TABLE (table),label, 1, 2, 0, 1);
629         gtk_widget_show(label);
630         label = gtk_label_new(_("Command Line"));
631         gtk_table_attach_defaults(GTK_TABLE (table),label, 2, 3, 0, 1);
632         gtk_widget_show(label);
633
634         for (i=0; i<8; i++)
635                 {
636                 sprintf(buf,"%d",i+1);
637                 label = gtk_label_new(buf);
638                 gtk_table_attach_defaults(GTK_TABLE (table),label, 0, 1, i+1, i+2);
639                 gtk_widget_show(label);
640
641                 editor_name_entry[i] = gtk_entry_new_with_max_length(32);
642                 gtk_widget_set_usize(editor_name_entry[i],80,-1);
643                 if (editor_name[i]) gtk_entry_set_text(GTK_ENTRY(editor_name_entry[i]),editor_name[i]);
644                 gtk_table_attach_defaults(GTK_TABLE (table),editor_name_entry[i],1,2,i+1,i+2);
645                 gtk_widget_show(editor_name_entry[i]);
646
647                 editor_command_entry[i] = gtk_entry_new_with_max_length(255);
648                 gtk_widget_set_usize(editor_command_entry[i],160,-1);
649                 tab_completion_add_to_entry(editor_command_entry[i], NULL, NULL);
650                 if (editor_command[i]) gtk_entry_set_text(GTK_ENTRY(editor_command_entry[i]), editor_command[i]);
651                 gtk_table_attach_defaults(GTK_TABLE (table),editor_command_entry[i],2,3,i+1,i+2);
652                 gtk_widget_show(editor_command_entry[i]);
653                 }
654
655         /* about tab */
656
657         frame = gtk_frame_new(NULL);
658         gtk_container_border_width (GTK_CONTAINER (frame), 5);
659         gtk_widget_show(frame);
660         label = gtk_label_new(_("About"));
661         gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, label);
662
663         vbox = gtk_vbox_new (FALSE, 0);
664         gtk_container_add (GTK_CONTAINER(frame),vbox);
665         gtk_widget_show(vbox);
666
667         im = gdk_imlib_create_image_from_data((char *)logo, NULL, logo_width, logo_height);
668         gdk_imlib_render(im, logo_width, logo_height);
669         pixmap = gdk_imlib_move_image(im);
670         gdk_imlib_destroy_image(im);
671         
672         button=gtk_pixmap_new(pixmap, NULL);
673         gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 0);
674         gtk_widget_show (button);
675
676         sprintf(buf, _("GQview %s\n\nCopyright (c) 1999 by John Ellis\nhttp://gqview.netpedia.net\ngqview@email.com\n\nReleased under the GNU Public License"), VERSION);
677         label = gtk_label_new(buf);
678         gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
679         gtk_widget_show (label);
680
681         gtk_notebook_set_page (GTK_NOTEBOOK(notebook), start_tab);
682         gtk_widget_show(notebook);
683
684         gtk_widget_show(configwindow);
685 }
686
687 /*
688  *-----------------------------------------------------------------------------
689  * config/about window show (public)
690  *-----------------------------------------------------------------------------
691  */ 
692
693 void show_config_window()
694 {
695         if (configwindow) return;
696         config_window_create(0);
697 }
698
699 void show_about_window()
700 {
701         if (configwindow) return;
702         config_window_create(4);
703 }
704