add ignore thread pixmap
[claws.git] / src / prefs_customheader.c
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2001 Hiroyuki Yamamoto
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifdef HAVE_CONFIG_H
21 #  include "config.h"
22 #endif
23
24 #include "defs.h"
25
26 #include <glib.h>
27 #include <gtk/gtk.h>
28 #include <gdk/gdkkeysyms.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <errno.h>
33
34 #include "intl.h"
35 #include "main.h"
36 #include "prefs.h"
37 #include "prefs_customheader.h"
38 #include "prefs_common.h"
39 #include "prefs_account.h"
40 #include "mainwindow.h"
41 #include "foldersel.h"
42 #include "manage_window.h"
43 #include "customheader.h"
44 #include "folder.h"
45 #include "utils.h"
46 #include "gtkutils.h"
47 #include "alertpanel.h"
48
49 static struct CustomHdr {
50         GtkWidget *window;
51
52         GtkWidget *ok_btn;
53         GtkWidget *cancel_btn;
54
55         GtkWidget *hdr_combo;
56         GtkWidget *hdr_entry;
57         GtkWidget *val_entry;
58         GtkWidget *customhdr_clist;
59 } customhdr;
60
61 /* widget creating functions */
62 static void prefs_custom_header_create  (void);
63
64 static void prefs_custom_header_set_dialog      (PrefsAccount *ac);
65 static void prefs_custom_header_set_list        (PrefsAccount *ac);
66 static gint prefs_custom_header_clist_set_row   (PrefsAccount *ac,
67                                                  gint          row);
68
69 /* callback functions */
70 static void prefs_custom_header_add_cb          (void);
71 static void prefs_custom_header_delete_cb       (void);
72 static void prefs_custom_header_up              (void);
73 static void prefs_custom_header_down            (void);
74 static void prefs_custom_header_select          (GtkCList       *clist,
75                                                  gint            row,
76                                                  gint            column,
77                                                  GdkEvent       *event);
78
79 static void prefs_custom_header_row_moved       (GtkCList       *clist,
80                                                  gint            source_row,
81                                                  gint            dest_row,
82                                                  gpointer        data);
83
84 static void prefs_custom_header_key_pressed     (GtkWidget      *widget,
85                                                  GdkEventKey    *event,
86                                                  gpointer        data);
87 static void prefs_custom_header_ok              (void);
88 static void prefs_custom_header_cancel          (void);
89 static gint prefs_custom_header_deleted         (GtkWidget      *widget,
90                                                  GdkEventAny    *event,
91                                                  gpointer        data);
92
93 static PrefsAccount *cur_ac = NULL;
94
95 void prefs_custom_header_open(PrefsAccount *ac)
96 {
97         if (!customhdr.window) {
98                 prefs_custom_header_create();
99         }
100
101         manage_window_set_transient(GTK_WINDOW(customhdr.window));
102         gtk_widget_grab_focus(customhdr.ok_btn);
103
104         prefs_custom_header_set_dialog(ac);
105
106         cur_ac = ac;
107
108         gtk_widget_show(customhdr.window);
109 }
110
111 static void prefs_custom_header_create(void)
112 {
113         GtkWidget *window;
114         GtkWidget *vbox;
115
116         GtkWidget *ok_btn;
117         GtkWidget *cancel_btn;
118
119         GtkWidget *confirm_area;
120
121         GtkWidget *vbox1;
122
123         GtkWidget *table1;
124         GtkWidget *hdr_label;
125         GtkWidget *hdr_combo;
126         GtkWidget *val_label;
127         GtkWidget *val_entry;
128
129         GtkWidget *reg_hbox;
130         GtkWidget *btn_hbox;
131         GtkWidget *arrow;
132         GtkWidget *add_btn;
133         GtkWidget *del_btn;
134
135         GtkWidget *ch_hbox;
136         GtkWidget *ch_scrolledwin;
137         GtkWidget *customhdr_clist;
138
139         GtkWidget *btn_vbox;
140         GtkWidget *up_btn;
141         GtkWidget *down_btn;
142
143         gchar *title[] = {_("Custom headers")};
144
145         debug_print(_("Creating custom header setting window...\n"));
146
147         window = gtk_window_new (GTK_WINDOW_DIALOG);
148         gtk_container_set_border_width (GTK_CONTAINER (window), 8);
149         gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
150         gtk_window_set_modal (GTK_WINDOW (window), TRUE);
151         gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE);
152
153         vbox = gtk_vbox_new (FALSE, 6);
154         gtk_widget_show (vbox);
155         gtk_container_add (GTK_CONTAINER (window), vbox);
156
157         gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
158                                 &cancel_btn, _("Cancel"), NULL, NULL);
159         gtk_widget_show (confirm_area);
160         gtk_box_pack_end (GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
161         gtk_widget_grab_default (ok_btn);
162
163         gtk_window_set_title (GTK_WINDOW(window), _("Custom header setting"));
164         gtk_signal_connect (GTK_OBJECT(window), "focus_in_event",
165                             GTK_SIGNAL_FUNC(manage_window_focus_in), NULL);
166         gtk_signal_connect (GTK_OBJECT(window), "focus_out_event",
167                             GTK_SIGNAL_FUNC(manage_window_focus_out), NULL);
168         gtk_signal_connect (GTK_OBJECT(window), "delete_event",
169                             GTK_SIGNAL_FUNC(prefs_custom_header_deleted),
170                             NULL);
171         gtk_signal_connect (GTK_OBJECT(window), "key_press_event",
172                             GTK_SIGNAL_FUNC(prefs_custom_header_key_pressed),
173                             NULL);
174         gtk_signal_connect (GTK_OBJECT(ok_btn), "clicked",
175                             GTK_SIGNAL_FUNC(prefs_custom_header_ok), NULL);
176         gtk_signal_connect (GTK_OBJECT(cancel_btn), "clicked",
177                             GTK_SIGNAL_FUNC(prefs_custom_header_cancel), NULL);
178
179         vbox1 = gtk_vbox_new (FALSE, VSPACING);
180         gtk_widget_show (vbox1);
181         gtk_box_pack_start (GTK_BOX (vbox), vbox1, TRUE, TRUE, 0);
182         gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
183
184         table1 = gtk_table_new (2, 2, FALSE);
185         gtk_widget_show (table1);
186         gtk_box_pack_start (GTK_BOX (vbox1), table1,
187                             FALSE, FALSE, 0);
188         gtk_table_set_row_spacings (GTK_TABLE (table1), 8);
189         gtk_table_set_col_spacings (GTK_TABLE (table1), 8);
190
191         hdr_label = gtk_label_new (_("Header"));
192         gtk_widget_show (hdr_label);
193         gtk_table_attach (GTK_TABLE (table1), hdr_label, 0, 1, 0, 1,
194                           GTK_EXPAND | GTK_SHRINK | GTK_FILL,
195                           0, 0, 0);
196         gtk_misc_set_alignment (GTK_MISC (hdr_label), 0, 0.5);
197         
198         hdr_combo = gtk_combo_new ();
199         gtk_widget_show (hdr_combo);
200         gtk_table_attach (GTK_TABLE (table1), hdr_combo, 0, 1, 1, 2,
201                           GTK_EXPAND | GTK_SHRINK | GTK_FILL,
202                           0, 0, 0);
203         gtk_widget_set_usize (hdr_combo, 150, -1);
204         gtkut_combo_set_items (GTK_COMBO (hdr_combo),
205                                "User-Agent", "X-Face", "X-Operating-System",
206                                NULL);
207
208         val_label = gtk_label_new (_("Value"));
209         gtk_widget_show (val_label);
210         gtk_table_attach (GTK_TABLE (table1), val_label, 1, 2, 0, 1,
211                           GTK_EXPAND | GTK_SHRINK | GTK_FILL,
212                           0, 0, 0);
213         gtk_misc_set_alignment (GTK_MISC (val_label), 0, 0.5);
214         
215         val_entry = gtk_entry_new ();
216         gtk_widget_show (val_entry);
217         gtk_table_attach (GTK_TABLE (table1), val_entry, 1, 2, 1, 2,
218                           GTK_EXPAND | GTK_SHRINK | GTK_FILL,
219                           0, 0, 0);
220         gtk_widget_set_usize (val_entry, 200, -1);
221
222         /* add / delete */
223
224         reg_hbox = gtk_hbox_new (FALSE, 4);
225         gtk_widget_show (reg_hbox);
226         gtk_box_pack_start (GTK_BOX (vbox1), reg_hbox, FALSE, FALSE, 0);
227
228         arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
229         gtk_widget_show (arrow);
230         gtk_box_pack_start (GTK_BOX (reg_hbox), arrow, FALSE, FALSE, 0);
231         gtk_widget_set_usize (arrow, -1, 16);
232
233         btn_hbox = gtk_hbox_new (TRUE, 4);
234         gtk_widget_show (btn_hbox);
235         gtk_box_pack_start (GTK_BOX (reg_hbox), btn_hbox, FALSE, FALSE, 0);
236
237         add_btn = gtk_button_new_with_label (_("Add"));
238         gtk_widget_show (add_btn);
239         gtk_box_pack_start (GTK_BOX (btn_hbox), add_btn, FALSE, TRUE, 0);
240         gtk_signal_connect (GTK_OBJECT (add_btn), "clicked",
241                             GTK_SIGNAL_FUNC (prefs_custom_header_add_cb),
242                             NULL);
243
244         del_btn = gtk_button_new_with_label (_(" Delete "));
245         gtk_widget_show (del_btn);
246         gtk_box_pack_start (GTK_BOX (btn_hbox), del_btn, FALSE, TRUE, 0);
247         gtk_signal_connect (GTK_OBJECT (del_btn), "clicked",
248                             GTK_SIGNAL_FUNC (prefs_custom_header_delete_cb),
249                             NULL);
250
251
252         ch_hbox = gtk_hbox_new (FALSE, 8);
253         gtk_widget_show (ch_hbox);
254         gtk_box_pack_start (GTK_BOX (vbox1), ch_hbox, TRUE, TRUE, 0);
255
256         ch_scrolledwin = gtk_scrolled_window_new (NULL, NULL);
257         gtk_widget_set_usize (ch_scrolledwin, -1, 200);
258         gtk_widget_show (ch_scrolledwin);
259         gtk_box_pack_start (GTK_BOX (ch_hbox), ch_scrolledwin, TRUE, TRUE, 0);
260         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ch_scrolledwin),
261                                         GTK_POLICY_AUTOMATIC,
262                                         GTK_POLICY_AUTOMATIC);
263
264         customhdr_clist = gtk_clist_new_with_titles(1, title);
265         gtk_widget_show (customhdr_clist);
266         gtk_container_add (GTK_CONTAINER (ch_scrolledwin), customhdr_clist);
267         gtk_clist_set_column_width (GTK_CLIST (customhdr_clist), 0, 80);
268         gtk_clist_set_selection_mode (GTK_CLIST (customhdr_clist),
269                                       GTK_SELECTION_BROWSE);
270         gtk_clist_set_reorderable (GTK_CLIST (customhdr_clist), TRUE);
271         gtk_clist_set_use_drag_icons (GTK_CLIST (customhdr_clist), FALSE);
272         GTK_WIDGET_UNSET_FLAGS (GTK_CLIST (customhdr_clist)->column[0].button,
273                                 GTK_CAN_FOCUS);
274         gtk_signal_connect (GTK_OBJECT (customhdr_clist), "select_row",
275                             GTK_SIGNAL_FUNC (prefs_custom_header_select),
276                             NULL);
277         gtk_signal_connect_after
278                 (GTK_OBJECT (customhdr_clist), "row_move",
279                  GTK_SIGNAL_FUNC (prefs_custom_header_row_moved), NULL);
280
281         btn_vbox = gtk_vbox_new (FALSE, 8);
282         gtk_widget_show (btn_vbox);
283         gtk_box_pack_start (GTK_BOX (ch_hbox), btn_vbox, FALSE, FALSE, 0);
284
285         up_btn = gtk_button_new_with_label (_("Up"));
286         gtk_widget_show (up_btn);
287         gtk_box_pack_start (GTK_BOX (btn_vbox), up_btn, FALSE, FALSE, 0);
288         gtk_signal_connect (GTK_OBJECT (up_btn), "clicked",
289                             GTK_SIGNAL_FUNC (prefs_custom_header_up), NULL);
290
291         down_btn = gtk_button_new_with_label (_("Down"));
292         gtk_widget_show (down_btn);
293         gtk_box_pack_start (GTK_BOX (btn_vbox), down_btn, FALSE, FALSE, 0);
294         gtk_signal_connect (GTK_OBJECT (down_btn), "clicked",
295                             GTK_SIGNAL_FUNC (prefs_custom_header_down), NULL);
296
297         gtk_widget_show_all(window);
298
299         customhdr.window     = window;
300         customhdr.ok_btn     = ok_btn;
301         customhdr.cancel_btn = cancel_btn;
302
303         customhdr.hdr_combo  = hdr_combo;
304         customhdr.hdr_entry  = GTK_COMBO (hdr_combo)->entry;
305         customhdr.val_entry  = val_entry;
306
307         customhdr.customhdr_clist   = customhdr_clist;
308 }
309
310 void prefs_custom_header_read_config(PrefsAccount *ac)
311 {
312         gchar *rcpath;
313         FILE *fp;
314         gchar buf[PREFSBUFSIZE];
315         CustomHeader *ch;
316
317         debug_print(_("Reading custom header configuration...\n"));
318
319         rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
320                              CUSTOM_HEADER_RC, NULL);
321         if ((fp = fopen(rcpath, "r")) == NULL) {
322                 if (ENOENT != errno) FILE_OP_ERROR(rcpath, "fopen");
323                 g_free(rcpath);
324                 ac->customhdr_list = NULL;
325                 return;
326         }
327         g_free(rcpath);
328
329         /* remove all previous headers list */
330         while (ac->customhdr_list != NULL) {
331                 ch = (CustomHeader *)ac->customhdr_list->data;
332                 custom_header_free(ch);
333                 ac->customhdr_list = g_slist_remove(ac->customhdr_list, ch);
334         }
335
336         while (fgets(buf, sizeof(buf), fp) != NULL) {
337                 g_strchomp(buf);
338                 ch = custom_header_read_str(buf);
339                 if (ch) {
340                         if (ch->account_id == ac->account_id) {
341                                 ac->customhdr_list =
342                                         g_slist_append(ac->customhdr_list, ch);
343                         } else
344                                 custom_header_free(ch);
345                 }
346         }
347
348         fclose(fp);
349 }
350
351 void prefs_custom_header_write_config(PrefsAccount *ac)
352 {
353         gchar *rcpath;
354         PrefFile *pfile;
355         GSList *cur;
356         gchar buf[PREFSBUFSIZE];
357         FILE * fp;
358         CustomHeader *ch;
359
360         GSList *all_hdrs = NULL;
361
362         debug_print(_("Writing custom header configuration...\n"));
363
364         rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
365                              CUSTOM_HEADER_RC, NULL);
366
367         if ((fp = fopen(rcpath, "r")) == NULL) {
368                 if (ENOENT != errno) FILE_OP_ERROR(rcpath, "fopen");
369         } else {
370                 all_hdrs = NULL;
371
372                 while (fgets(buf, sizeof(buf), fp) != NULL) {
373                         g_strchomp(buf);
374                         ch = custom_header_read_str(buf);
375                         if (ch) {
376                                 if (ch->account_id != ac->account_id)
377                                         all_hdrs =
378                                                 g_slist_append(all_hdrs, ch);
379                                 else
380                                         custom_header_free(ch);
381                         }
382                 }
383
384                 fclose(fp);
385         }
386
387         if ((pfile = prefs_write_open(rcpath)) == NULL) {
388                 g_warning(_("failed to write configuration to file\n"));
389                 g_free(rcpath);
390                 return;
391         }
392
393         for (cur = all_hdrs; cur != NULL; cur = cur->next) {
394                 CustomHeader *hdr = (CustomHeader *)cur->data;
395                 gchar *chstr;
396
397                 chstr = custom_header_get_str(hdr);
398                 if (fputs(chstr, pfile->fp) == EOF ||
399                     fputc('\n', pfile->fp) == EOF) {
400                         FILE_OP_ERROR(rcpath, "fputs || fputc");
401                         prefs_write_close_revert(pfile);
402                         g_free(rcpath);
403                         g_free(chstr);
404                         return;
405                 }
406                 g_free(chstr);
407         }
408
409         for (cur = ac->customhdr_list; cur != NULL; cur = cur->next) {
410                 CustomHeader *hdr = (CustomHeader *)cur->data;
411                 gchar *chstr;
412
413                 chstr = custom_header_get_str(hdr);
414                 if (fputs(chstr, pfile->fp) == EOF ||
415                     fputc('\n', pfile->fp) == EOF) {
416                         FILE_OP_ERROR(rcpath, "fputs || fputc");
417                         prefs_write_close_revert(pfile);
418                         g_free(rcpath);
419                         g_free(chstr);
420                         return;
421                 }
422                 g_free(chstr);
423         }
424
425         g_free(rcpath);
426
427         while (all_hdrs != NULL) {
428                 ch = (CustomHeader *)all_hdrs->data;
429                 custom_header_free(ch);
430                 all_hdrs = g_slist_remove(all_hdrs, ch);
431         }
432
433         if (prefs_write_close(pfile) < 0) {
434                 g_warning(_("failed to write configuration to file\n"));
435                 return;
436         }
437 }
438
439 static void prefs_custom_header_set_dialog(PrefsAccount *ac)
440 {
441         GtkCList *clist = GTK_CLIST(customhdr.customhdr_clist);
442         GSList *cur;
443         gchar *ch_str[1];
444         gint row;
445
446         gtk_clist_freeze(clist);
447         gtk_clist_clear(clist);
448
449         for (cur = ac->customhdr_list; cur != NULL; cur = cur->next) {
450                 CustomHeader *ch = (CustomHeader *)cur->data;
451
452                 ch_str[0] = g_strdup_printf("%s: %s", ch->name,
453                                             ch->value ? ch->value : "");
454                 row = gtk_clist_append(clist, ch_str);
455                 gtk_clist_set_row_data(clist, row, ch);
456
457                 g_free(ch_str[0]);
458         }
459
460         gtk_clist_thaw(clist);
461 }
462
463 static void prefs_custom_header_set_list(PrefsAccount *ac)
464 {
465         gint row = 0;
466         CustomHeader *ch;
467
468         g_slist_free(ac->customhdr_list);
469         ac->customhdr_list = NULL;
470
471         while ((ch = gtk_clist_get_row_data
472                 (GTK_CLIST(customhdr.customhdr_clist), row)) != NULL) {
473                 ac->customhdr_list = g_slist_append(ac->customhdr_list, ch);
474                 row++;
475         }
476 }
477
478 static gint prefs_custom_header_clist_set_row(PrefsAccount *ac, gint row)
479 {
480         GtkCList *clist = GTK_CLIST(customhdr.customhdr_clist);
481         CustomHeader *ch;
482         gchar *entry_text;
483         gchar *ch_str[1];
484
485         entry_text = gtk_entry_get_text(GTK_ENTRY(customhdr.hdr_entry));
486         if (entry_text[0] == '\0') {
487                 alertpanel_error(_("Header name is not set."));
488                 return -1;
489         }
490
491         ch = g_new0(CustomHeader, 1);
492
493         ch->account_id = ac->account_id;
494
495         ch->name = g_strdup(entry_text);
496         unfold_line(ch->name);
497
498         entry_text = gtk_entry_get_text(GTK_ENTRY(customhdr.val_entry));
499         if (entry_text[0] != '\0') {
500                 ch->value = g_strdup(entry_text);
501                 unfold_line(ch->value);
502         }
503
504         ch_str[0] = g_strdup_printf("%s: %s", ch->name,
505                                     ch->value ? ch->value : "");
506
507         if (row < 0)
508                 row = gtk_clist_append(clist, ch_str);
509         else {
510                 CustomHeader *tmp_ch;
511
512                 gtk_clist_set_text(clist, row, 0, ch_str[0]);
513                 tmp_ch = gtk_clist_get_row_data(clist, row);
514                 if (tmp_ch)
515                         custom_header_free(tmp_ch);
516         }
517
518         gtk_clist_set_row_data(clist, row, ch);
519
520         g_free(ch_str[0]);
521
522         prefs_custom_header_set_list(cur_ac);
523
524         return row;
525 }
526
527 static void prefs_custom_header_add_cb(void)
528 {
529         prefs_custom_header_clist_set_row(cur_ac, -1);
530 }
531
532 static void prefs_custom_header_delete_cb(void)
533 {
534         GtkCList *clist = GTK_CLIST(customhdr.customhdr_clist);
535         CustomHeader *ch;
536         gint row;
537
538         if (!clist->selection) return;
539         row = GPOINTER_TO_INT(clist->selection->data);
540
541         if (alertpanel(_("Delete header"),
542                        _("Do you really want to delete this header?"),
543                        _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
544                 return;
545
546         ch = gtk_clist_get_row_data(clist, row);
547         custom_header_free(ch);
548         gtk_clist_remove(clist, row);
549         cur_ac->customhdr_list = g_slist_remove(cur_ac->customhdr_list, ch);
550 }
551
552 static void prefs_custom_header_up(void)
553 {
554         GtkCList *clist = GTK_CLIST(customhdr.customhdr_clist);
555         gint row;
556
557         if (!clist->selection) return;
558
559         row = GPOINTER_TO_INT(clist->selection->data);
560         if (row > 0)
561                 gtk_clist_row_move(clist, row, row - 1);
562 }
563
564 static void prefs_custom_header_down(void)
565 {
566         GtkCList *clist = GTK_CLIST(customhdr.customhdr_clist);
567         gint row;
568
569         if (!clist->selection) return;
570
571         row = GPOINTER_TO_INT(clist->selection->data);
572         if (row >= 0 && row < clist->rows - 1)
573                 gtk_clist_row_move(clist, row, row + 1);
574 }
575
576 #define ENTRY_SET_TEXT(entry, str) \
577         gtk_entry_set_text(GTK_ENTRY(entry), str ? str : "")
578
579 static void prefs_custom_header_select(GtkCList *clist, gint row, gint column,
580                                        GdkEvent *event)
581 {
582         CustomHeader *ch;
583         CustomHeader default_ch = { 0, "", NULL };
584
585         ch = gtk_clist_get_row_data(clist, row);
586         if (!ch) ch = &default_ch;
587
588         ENTRY_SET_TEXT(customhdr.hdr_entry, ch->name);
589         ENTRY_SET_TEXT(customhdr.val_entry, ch->value);
590 }
591
592 #undef ENTRY_SET_TEXT
593
594 static void prefs_custom_header_row_moved(GtkCList *clist, gint source_row,
595                                           gint dest_row, gpointer data)
596 {
597         prefs_custom_header_set_list(cur_ac);
598 }
599
600 static void prefs_custom_header_key_pressed(GtkWidget *widget,
601                                             GdkEventKey *event,
602                                             gpointer data)
603 {
604         if (event && event->keyval == GDK_Escape)
605                 prefs_custom_header_cancel();
606 }
607
608 static void prefs_custom_header_ok(void)
609 {
610         prefs_custom_header_write_config(cur_ac);
611         gtk_widget_hide(customhdr.window);
612 }
613
614 static void prefs_custom_header_cancel(void)
615 {
616         prefs_custom_header_read_config(cur_ac); 
617         gtk_widget_hide(customhdr.window);
618 }
619
620 static gint prefs_custom_header_deleted(GtkWidget *widget, GdkEventAny *event,
621                                         gpointer data)
622 {
623         prefs_custom_header_cancel();
624         return TRUE;
625 }