"SfR Fresh" - the SfR Freeware/Shareware Archive 
Member "mpdist-3.7.1/mptool/callbacks.c" of archive mpdist-3.7.1.tar.gz:
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1
2 /*
3 * $Header: /cvsroot/mpdist/mpdist/mptool/callbacks.c,v 1.2 2002/10/15 19:09:32 richbastard Exp $
4 *
5 * Copyright (c) 1987-2002 Rich Burridge, Sun Microsystems Inc.
6 * All rights reserved.
7 *
8 * This software is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Library General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * This software is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16 * License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this software; if not, write to the Free Software Foundation,
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23 #ifdef HAVE_CONFIG_H
24 # include <config.h>
25 #endif
26
27 #include <gtk/gtk.h>
28 #include <gdk/gdkkeysyms.h>
29
30 #include "callbacks.h"
31 #include "interface.h"
32 #include "support.h"
33 #include "main.h"
34 #include "mptool.h"
35 #include <stdio.h>
36 #include <string.h>
37
38 static GList *hdr_selection = NULL;
39
40
41 void
42 ShowFile (GtkMenuItem *menuitem,
43 gpointer user_data)
44 {
45 do_show_file();
46 }
47
48
49 void
50 ExitMptool (GtkMenuItem *menuitem,
51 gpointer user_data)
52 {
53 exit(0);
54 }
55
56
57 void
58 ShowHeaders (GtkMenuItem *menuitem,
59 gpointer user_data)
60 {
61 if (header_frame_widget == NULL) {
62 header_frame_widget = create_header_frame_widget();
63 }
64 set_active(F_HDRS, "hdr_add_button", False);
65 set_active(F_HDRS, "hdr_remove_button", False);
66 do_hdrs_reset(); /* Headers to print. */
67
68 add_help(F_HDRS, tips, "header_form", wi_header_frame_help);
69 add_help(F_HDRS, tips, "hdrs_all", wi_headers_all_help);
70 add_help(F_HDRS, tips, "hdr_list", wi_hdr_list_help);
71 add_help(F_HDRS, tips, "hdr_list_add", wi_hdr_add_help);
72 add_help(F_HDRS, tips, "hdr_add_label", wi_hdr_add_help);
73 add_help(F_HDRS, tips, "hdr_apply", wi_hdr_apply_help);
74 add_help(F_HDRS, tips, "hdr_dismiss", wi_hdr_dismiss_help);
75 add_help(F_HDRS, tips, "hdr_add_button", wi_hdr_add_help);
76 add_help(F_HDRS, tips, "hdr_remove_button", wi_hdr_remove_help);
77 add_help(F_HDRS, tips, "hdr_reset", wi_hdr_reset_help);
78
79 gtk_widget_show(header_frame_widget);
80 }
81
82
83 void
84 ShowInput (GtkMenuItem *menuitem,
85 gpointer user_data)
86 {
87 if (input_frame_widget == NULL) {
88 input_frame_widget = create_input_frame_widget();
89 }
90 InputReset(NULL, NULL);
91
92 add_help(F_INPUT, tips, "input_form", wi_input_frame_help);
93 add_help(F_INPUT, tips, "prologue_label", wi_prologue_help);
94 add_help(F_INPUT, tips, "prologue", wi_prologue_help);
95 add_help(F_INPUT, tips, "input_folder", wi_opt_folder_help);
96 add_help(F_INPUT, tips, "input_digest", wi_opt_digest_help);
97 add_help(F_INPUT, tips, "input_elm", wi_props_elm_help);
98 add_help(F_INPUT, tips, "input_from", wi_props_from_help);
99 add_help(F_INPUT, tips, "input_content", wi_props_content_help);
100 add_help(F_INPUT, tips, "input_modtime", wi_props_modtime_help);
101 add_help(F_INPUT, tips, "input_apply", wi_input_apply_help);
102 add_help(F_INPUT, tips, "input_reset", wi_input_reset_help);
103 add_help(F_INPUT, tips, "input_dismiss", wi_input_dismiss_help);
104
105 gtk_widget_show(input_frame_widget);
106 }
107
108
109 void
110 ShowOutput (GtkMenuItem *menuitem,
111 gpointer user_data)
112 {
113 if (output_frame_widget == NULL) {
114 output_frame_widget = create_output_frame_widget();
115 }
116 OutputReset(NULL, NULL);
117
118 add_help(F_OUTPUT, tips, "output_form", wi_output_frame_help);
119 add_help(F_OUTPUT, tips, "output_apply", wi_output_apply_help);
120 add_help(F_OUTPUT, tips, "output_reset", wi_output_reset_help);
121 add_help(F_OUTPUT, tips, "output_dismiss", wi_output_dismiss_help);
122 add_help(F_OUTPUT, tips, "line_length_label", wi_line_length_help);
123 add_help(F_OUTPUT, tips, "line_length", wi_line_length_help);
124 add_help(F_OUTPUT, tips, "page_length_label", wi_page_length_help);
125 add_help(F_OUTPUT, tips, "page_length", wi_page_length_help);
126 add_help(F_OUTPUT, tips, "printer_name_label", wi_printer_name_help);
127 add_help(F_OUTPUT, tips, "printer_name", wi_printer_name_help);
128
129 gtk_widget_show(output_frame_widget);
130 }
131
132
133 void
134 ShowPrinting (GtkMenuItem *menuitem,
135 gpointer user_data)
136 {
137 if (printing_frame_widget == NULL) {
138 printing_frame_widget = create_printing_frame_widget ();
139 }
140 PrintingReset(NULL, NULL);
141
142 add_help(F_PRINT, tips, "printing_form", wi_props_frame_help);
143 add_help(F_PRINT, tips, "print_col_label", wi_props_col_help);
144 add_help(F_PRINT, tips, "print_col", wi_props_col_help);
145 add_help(F_PRINT, tips, "print_tab_label", wi_props_tab_help);
146 add_help(F_PRINT, tips, "print_tab", wi_props_tab_help);
147 add_help(F_PRINT, tips, "print_bmargin", wi_props_margin_help);
148 add_help(F_PRINT, tips, "print_lmargin", wi_props_margin_help);
149 add_help(F_PRINT, tips, "print_rmargin", wi_props_margin_help);
150 add_help(F_PRINT, tips, "print_tmargin", wi_props_margin_help);
151 add_help(F_PRINT, tips, "print_bmlabel", wi_props_margin_help);
152 add_help(F_PRINT, tips, "print_lmlabel", wi_props_margin_help);
153 add_help(F_PRINT, tips, "print_rmlabel", wi_props_margin_help);
154 add_help(F_PRINT, tips, "print_tmlabel", wi_props_margin_help);
155 add_help(F_PRINT, tips, "print_margins_label", wi_props_margin_help);
156 add_help(F_PRINT, tips, "print_header", wi_opt_header_help);
157 add_help(F_PRINT, tips, "print_wrap", wi_props_wrap_help);
158 add_help(F_PRINT, tips, "print_flip", wi_props_flip_help);
159 add_help(F_PRINT, tips, "print_forcepage", wi_props_forcepage_help);
160 add_help(F_PRINT, tips, "print_number", wi_props_number_help);
161 add_help(F_PRINT, tips, "print_reverse", wi_props_reverse_help);
162 add_help(F_PRINT, tips, "print_apply", wi_props_apply_help);
163 add_help(F_PRINT, tips, "print_reset", wi_props_reset_help);
164 add_help(F_PRINT, tips, "print_dismiss", wi_props_dismiss_help);
165
166 gtk_widget_show(printing_frame_widget);
167 }
168
169
170 void
171 SaveDefaults (GtkMenuItem *menuitem,
172 gpointer user_data)
173 {
174 do_save_defaults();
175 }
176
177
178 void
179 ShowUsername (GtkMenuItem *menuitem,
180 gpointer user_data)
181 {
182 if (username_frame_widget == NULL) {
183 username_frame_widget = create_username_frame_widget();
184 }
185 UNReset(NULL, NULL);
186
187 add_help(F_USER, tips, "un_form", wi_un_form_help);
188 add_help(F_USER, tips, "un_apply", wi_un_apply_help);
189 add_help(F_USER, tips, "un_reset", wi_un_reset_help);
190 add_help(F_USER, tips, "un_dismiss", wi_un_dismiss_help);
191 add_help(F_USER, tips, "aliasname_label", wi_aliasname_help);
192 add_help(F_USER, tips, "aliasname", wi_aliasname_help);
193 add_help(F_USER, tips, "unc_label", wi_props_passc_help);
194 add_help(F_USER, tips, "un_chars", wi_props_passc_help);
195 add_help(F_USER, tips, "unw_label", wi_props_passw_help);
196 add_help(F_USER, tips, "un_words", wi_props_passw_help);
197
198 gtk_widget_show(username_frame_widget);
199 }
200
201
202 void
203 HelpGeneral (GtkMenuItem *menuitem,
204 gpointer user_data)
205 {
206 do_show_help(g_strjoin("\n\n",
207 wi_main_frame_help,
208 wi_filename_help,
209 wi_file_type_help,
210 wi_output_help,
211 wi_org_type_help,
212 wi_paper_size_help,
213 wi_subject_help,
214 wi_no_sides_help,
215 wi_copies_help,
216 wi_print_help,
217 wi_reset_help,
218 NULL));
219 }
220
221
222 void
223 HelpHeaders (GtkMenuItem *menuitem,
224 gpointer user_data)
225 {
226 do_show_help(g_strjoin("\n\n",
227 wi_header_frame_help,
228 wi_headers_all_help,
229 wi_hdr_list_help,
230 wi_hdr_add_help,
231 wi_hdr_remove_help,
232 wi_hdr_apply_help,
233 wi_hdr_reset_help,
234 wi_hdr_dismiss_help,
235 NULL));
236 }
237
238
239 void
240 HelpInput (GtkMenuItem *menuitem,
241 gpointer user_data)
242 {
243 do_show_help(g_strjoin("\n\n",
244 wi_input_frame_help,
245 wi_prologue_help,
246 wi_opt_folder_help,
247 wi_opt_digest_help,
248 wi_props_elm_help,
249 wi_props_from_help,
250 wi_props_content_help,
251 wi_props_modtime_help,
252 wi_input_apply_help,
253 wi_input_reset_help,
254 wi_input_dismiss_help,
255 NULL));
256 }
257
258
259 void
260 HelpOutput (GtkMenuItem *menuitem,
261 gpointer user_data)
262 {
263 do_show_help(g_strjoin("\n\n",
264 wi_output_frame_help,
265 wi_printer_name_help,
266 wi_line_length_help,
267 wi_page_length_help,
268 wi_output_bsd_help,
269 wi_output_apply_help,
270 wi_output_reset_help,
271 wi_output_dismiss_help,
272 NULL));
273 }
274
275
276 void
277 HelpPrinting (GtkMenuItem *menuitem,
278 gpointer user_data)
279 {
280 do_show_help(g_strjoin("\n\n",
281 wi_props_frame_help,
282 wi_props_col_help,
283 wi_props_tab_help,
284 wi_opt_header_help,
285 wi_props_wrap_help,
286 wi_props_flip_help,
287 wi_props_forcepage_help,
288 wi_props_number_help,
289 wi_props_reverse_help,
290 wi_props_apply_help,
291 wi_props_reset_help,
292 wi_props_dismiss_help,
293 NULL));
294 }
295
296
297 void
298 HelpSave (GtkMenuItem *menuitem,
299 gpointer user_data)
300 {
301 do_show_help(g_strjoin("\n\n",
302 wi_props_defs_help,
303 NULL));
304 }
305
306
307 void
308 HelpUsername (GtkMenuItem *menuitem,
309 gpointer user_data)
310 {
311 do_show_help(g_strjoin("\n\n",
312 wi_un_form_help,
313 wi_aliasname_help,
314 wi_props_passc_help,
315 wi_props_passw_help,
316 wi_un_apply_help,
317 wi_un_reset_help,
318 wi_un_dismiss_help,
319 NULL));
320 }
321
322
323 /*
324 * Do corrections like in 'adjust_paper_size' (../common/option.c)
325 *
326 * Save values with 'set_int_opt_val' and - if output widget is realised -
327 * update the displayed values. This is the same action (apart from the
328 * printername) as done with the apply-button. I hesitated to set the
329 * variables plen and llen via 'set_int_opt_val' since these seem to be used
330 * as defaults. But if the output widget is not shown, incorrect values would
331 * be used.
332 *
333 * Unlike 'adjust_paper_size', this function will not honour settings for the
334 * parameters 'O_LLEN' and 'O_PLEN' from the commandline or a resource file.
335 */
336
337 void
338 OutputUpdate (GtkToggleButton *togglebutton,
339 gpointer user_data)
340 {
341 enum paper_type psize;
342 int linelen, pagelen, land;
343
344 if (get_bool_value(F_MAIN, "paper_size_a4")) {
345 psize = P_A4;
346 } else if (get_bool_value(F_MAIN, "paper_size_us")) {
347 psize = P_US;
348 } else {
349 psize = P_NONE;
350 }
351
352 if (get_bool_value(F_MAIN, "output_land")) {
353 land = 1;
354 } else if (get_bool_value(F_MAIN, "output_port")) {
355 land = 0;
356 } else {
357 land = -1;
358 }
359
360 if (land == -1) {
361 return; /* Organizer formats - do nothing. */
362 }
363
364 switch (psize) {
365 case P_US:
366 linelen = (land) ? 80 : 80;
367 pagelen = (land) ? 68 : 72;
368 break;
369
370 case P_A4:
371 linelen = (land) ? 90 : 80;
372 pagelen = (land) ? 66 : 78;
373 break;
374
375 /*
376 * Not nice: this uses the system default and ignores
377 * resources and command line options. Maybe should do
378 * nothing at all ...
379 */
380
381 default:
382 linelen = LINELENGTH;
383 pagelen = PAGELENGTH;
384 break;
385 }
386
387 /* Now set correct values as new default (?) values. */
388
389 set_int_opt_val(O_LLEN, linelen);
390 set_int_opt_val(O_PLEN, pagelen);
391
392 if (output_frame_widget == NULL) {
393 return;
394 } else {
395
396 /* Show new values in output widget. */
397
398 set_int_value(F_OUTPUT, "line_length", linelen);
399 set_int_value(F_OUTPUT, "page_length", pagelen);
400 }
401 }
402
403
404 void
405 PrintFiles (GtkButton *button,
406 gpointer user_data)
407 {
408 do_print_files();
409 }
410
411
412 void
413 ResetOptions (GtkButton *button,
414 gpointer user_data)
415 {
416 do_reset_options();
417 }
418
419
420 void
421 ToggleHdrList (GtkToggleButton *togglebutton,
422 gpointer user_data)
423 {
424 do_toggle_hdr_list();
425 }
426
427
428 void
429 HdrsAdd (GtkButton *button,
430 gpointer user_data)
431 {
432 do_hdrs_add();
433 }
434
435
436 void
437 HdrsRemove (GtkButton *button,
438 gpointer user_data)
439 {
440 GtkWidget *hdr_list = lookup_widget(F_HDRS, "hdr_list");
441
442 if (hdr_selection != NULL) {
443 GList *copy = g_list_copy(hdr_selection);
444
445 g_list_free(hdr_selection);
446 hdr_selection = NULL;
447 gtk_list_remove_items(GTK_LIST(hdr_list), copy);
448 } else {
449 notice(F_HDRS, mptool_strs[(int) S_NONE]);
450 }
451 }
452
453
454 void
455 HdrsApply (GtkButton *button,
456 gpointer user_data)
457 {
458 do_hdrs_apply();
459 }
460
461
462 void
463 HdrsReset (GtkButton *button,
464 gpointer user_data)
465 {
466 do_hdrs_reset();
467 }
468
469
470 void
471 HdrsDismiss (GtkButton *button,
472 gpointer user_data)
473 {
474 gtk_widget_hide(F_HDRS);
475 }
476
477
478 void
479 InputApply (GtkButton *button,
480 gpointer user_data)
481 {
482 char *prologue = get_str_value(F_INPUT, "prologue");
483
484 if (prologue && *prologue != '\0') {
485 STRCPY(proname, prologue);
486 }
487
488 set_int_opt_val(O_FOLDER, get_bool_value(F_INPUT, "input_folder"));
489 set_int_opt_val(O_DIGEST, get_bool_value(F_INPUT, "input_digest"));
490 set_int_opt_val(O_ELM, get_bool_value(F_INPUT, "input_elm"));
491 set_int_opt_val(O_PR_ORIG, get_bool_value(F_INPUT, "input_from"));
492 set_int_opt_val(O_CONTENT, get_bool_value(F_INPUT, "input_content"));
493 set_int_opt_val(O_MODTIME, get_bool_value(F_INPUT, "input_modtime"));
494 }
495
496
497 void
498 InputReset (GtkButton *button,
499 gpointer user_data)
500 {
501 set_str_value(F_INPUT, "prologue", proname);
502 set_bool_value(F_INPUT, "input_folder", int_opt_val(O_FOLDER));
503 set_bool_value(F_INPUT, "input_digest", int_opt_val(O_DIGEST));
504 set_bool_value(F_INPUT, "input_elm", int_opt_val(O_ELM));
505 set_bool_value(F_INPUT, "input_from", int_opt_val(O_PR_ORIG));
506 set_bool_value(F_INPUT, "input_content", int_opt_val(O_CONTENT));
507 set_bool_value(F_INPUT, "input_modtime", int_opt_val(O_MODTIME));
508 }
509
510
511 void
512 InputDismiss (GtkButton *button,
513 gpointer user_data)
514 {
515 gtk_widget_hide(F_INPUT);
516 }
517
518
519 void
520 OutputApply (GtkButton *button,
521 gpointer user_data)
522 {
523 set_int_opt_val(O_LLEN, get_int_value(F_OUTPUT, "line_length"));
524 set_int_opt_val(O_PLEN, get_int_value(F_OUTPUT, "page_length"));
525 set_str_opt_val(O_PR_NAME, get_str_value(F_OUTPUT, "printer_name"));
526 }
527
528
529 void
530 OutputReset (GtkButton *button,
531 gpointer user_data)
532 {
533 set_int_value(F_OUTPUT, "line_length", int_opt_val(O_LLEN));
534 set_int_value(F_OUTPUT, "page_length", int_opt_val(O_PLEN));
535 set_str_value(F_OUTPUT, "printer_name", str_opt_val(O_PR_NAME));
536 }
537
538
539 void
540 OutputDismiss (GtkButton *button,
541 gpointer user_data)
542 {
543 gtk_widget_hide(F_OUTPUT);
544 }
545
546
547 void
548 PrintingApply (GtkButton *button,
549 gpointer user_data)
550 {
551 int n;
552
553 check_int_value(&n, mptool_strs[(int) S_INVCOL],
554 1, MAXLINELENGTH, DEFCOLUMNS, "print_col");
555 set_int_opt_val(O_NUMCOLS, n);
556 check_int_value(&n, mptool_strs[(int) S_INVTAB],
557 1, MAXLINELENGTH, TABSIZE, "print_tab");
558 set_int_opt_val(O_TABSIZE, n);
559 check_int_value(&n, mptool_strs[(int) S_BMARGIN],
560 0, MAXMARGIN, DEFMARGIN, "print_bmargin");
561 set_margin(M_BOTTOM, n);
562 check_int_value(&n, mptool_strs[(int) S_LMARGIN],
563 0, MAXMARGIN, DEFMARGIN, "print_lmargin");
564 set_margin(M_LEFT, n);
565 check_int_value(&n, mptool_strs[(int) S_RMARGIN],
566 0, MAXMARGIN, DEFMARGIN, "print_rmargin");
567 set_margin(M_RIGHT, n);
568 check_int_value(&n, mptool_strs[(int) S_TMARGIN],
569 0, MAXMARGIN, DEFMARGIN, "print_tmargin");
570 set_margin(M_TOP, n);
571
572 set_int_opt_val(O_BURSTPAGE, get_bool_value(F_PRINT, "print_header"));
573 set_int_opt_val(O_WRAPW, get_bool_value(F_PRINT, "print_wrap"));
574 set_int_opt_val(O_FLIP, get_bool_value(F_PRINT, "print_flip"));
575 set_int_opt_val(O_FORCEPAGE, get_bool_value(F_PRINT, "print_forcepage"));
576 set_int_opt_val(O_NUMBER, get_bool_value(F_PRINT, "print_number"));
577 set_int_opt_val(O_TUMBLE, get_bool_value(F_PRINT, "print_reverse"));
578 }
579
580
581 void
582 PrintingReset (GtkButton *button,
583 gpointer user_data)
584 {
585 set_int_value(F_PRINT, "print_col", int_opt_val(O_NUMCOLS));
586 set_int_value(F_PRINT, "print_tab", int_opt_val(O_TABSIZE));
587 set_int_value(F_PRINT, "print_bmargin", get_margin(M_BOTTOM));
588 set_int_value(F_PRINT, "print_lmargin", get_margin(M_LEFT));
589 set_int_value(F_PRINT, "print_rmargin", get_margin(M_RIGHT));
590 set_int_value(F_PRINT, "print_tmargin", get_margin(M_TOP));
591 set_bool_value(F_PRINT, "print_header", int_opt_val(O_BURSTPAGE));
592 set_bool_value(F_PRINT, "print_wrap", int_opt_val(O_WRAPW));
593 set_bool_value(F_PRINT, "print_flip", int_opt_val(O_FLIP));
594 set_bool_value(F_PRINT, "print_forcepage", int_opt_val(O_FORCEPAGE));
595 set_bool_value(F_PRINT, "print_number", int_opt_val(O_NUMBER));
596 set_bool_value(F_PRINT, "print_reverse", int_opt_val(O_TUMBLE));
597 }
598
599
600 void
601 PrintingDismiss (GtkButton *button,
602 gpointer user_data)
603 {
604 gtk_widget_hide(F_PRINT);
605 }
606
607
608 void
609 UNApply (GtkButton *button,
610 gpointer user_data)
611 {
612 char m[MAXLINE];
613
614 set_str_opt_val(O_ALIAS, get_str_value(F_USER, "aliasname"));
615
616 set_int_opt_val(O_NAMELEN, get_int_value(F_USER, "un_chars"));
617 if (int_opt_val(O_NAMELEN) < 1 || int_opt_val(O_NAMELEN) > MAXLINELENGTH) {
618 SPRINTF(m, mptool_strs[(int) S_INVCHARS], NAMELENGTH);
619 notice(F_USER, m);
620 set_int_opt_val(O_NAMELEN, NAMELENGTH);
621 set_int_value(F_USER, "un_chars", int_opt_val(O_NAMELEN));
622 }
623 set_int_opt_val(O_NAMEF, get_int_value(F_USER, "un_words"));
624 if (int_opt_val(O_NAMEF) < 1 || int_opt_val(O_NAMEF) > MAXLINELENGTH) {
625 SPRINTF(m, mptool_strs[(int) S_INVWORDS], NAMEFIELDS);
626 notice(F_USER, m);
627 set_int_opt_val(O_NAMEF, NAMEFIELDS);
628 set_int_value(F_USER, "un_words", int_opt_val(O_NAMEF));
629 }
630 }
631
632
633 void
634 UNReset (GtkButton *button,
635 gpointer user_data)
636 {
637 set_str_value(F_USER, "aliasname", str_opt_val(O_ALIAS));
638 set_int_value(F_USER, "un_chars", int_opt_val(O_NAMELEN));
639 set_int_value(F_USER, "un_words", int_opt_val(O_NAMEF));
640 }
641
642
643 void
644 UNDismiss (GtkButton *button,
645 gpointer user_data)
646 {
647 gtk_widget_hide(F_USER);
648 }
649
650
651 void
652 HelpDismiss (GtkButton *button,
653 gpointer user_data)
654 {
655 gtk_widget_hide(F_HELP);
656 }
657
658
659 gboolean
660 dismiss_window (GtkWidget *widget,
661 GdkEvent *event,
662 gpointer user_data)
663 {
664 if (widget == header_frame_widget) {
665 header_frame_widget = NULL;
666 } else if (widget == help_frame_widget) {
667 help_frame_widget = NULL;
668 } else if (widget == input_frame_widget) {
669 input_frame_widget = NULL;
670 } else if (widget == output_frame_widget) {
671 output_frame_widget = NULL;
672 } else if (widget == printing_frame_widget) {
673 printing_frame_widget = NULL;
674 } else if (widget == username_frame_widget) {
675 username_frame_widget = NULL;
676 } else if (widget == notice_widget) {
677 notice_widget = NULL;
678 } else if (widget == file_widget) {
679 file_widget = NULL;
680 } else if (widget == main_frame_widget) {
681 exit(0);
682 }
683
684 return(FALSE);
685 }
686
687
688 gboolean
689 frame_interpose(GtkWidget *widget, GdkEvent *event, gpointer user_data)
690 {
691 if (event->type == GDK_KEY_PRESS && event->key.keyval == GDK_Help) {
692 set_int_opt_val(O_TOOLTIP, !int_opt_val(O_TOOLTIP));
693 set_help_state(int_opt_val(O_TOOLTIP));
694 return(TRUE);
695 }
696
697 return(FALSE);
698 }
699
700
701 void
702 HeaderSelected (GtkList *list,
703 GtkWidget *widget,
704 gpointer user_data)
705 {
706 hdr_selection = g_list_append(hdr_selection, widget);
707 set_active(F_HDRS, "hdr_remove_button", True);
708 }
709
710 void
711 HeaderText (GtkEditable *editable,
712 gpointer user_data)
713 {
714 set_active(F_HDRS, "hdr_add_button", True);
715 }
716
717 void
718 HeaderUnselected (GtkList *list,
719 GtkWidget *widget,
720 gpointer user_data)
721 {
722 hdr_selection = g_list_remove(hdr_selection, widget);
723 }
724
725
726 void
727 NoticeDismiss (GtkButton *button,
728 gpointer user_data)
729 {
730 gtk_widget_hide(F_NOTICE);
731 }
732
733
734 void
735 FileApply (GtkButton *button,
736 gpointer user_data)
737 {
738 gchar all[BUFFERSIZE], *previous, *newfile;
739
740 previous = get_str_value(F_MAIN, "filename");
741 newfile = gtk_file_selection_get_filename(GTK_FILE_SELECTION(file_widget));
742
743 all[0] = '\0';
744 if (previous && *previous) {
745 STRCAT(all, previous);
746 }
747 if (newfile && *newfile) {
748 if (previous && *previous) {
749 STRCAT(all, " ");
750 }
751 STRCAT(all, newfile);
752 }
753 set_str_value(F_MAIN, "filename", all);
754 }
755
756
757 void
758 FileDismiss (GtkButton *button,
759 gpointer user_data)
760 {
761 gtk_widget_hide(F_FILE);
762 }