2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2024 the Claws Mail team and Hiroyuki Yamamoto
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 3 of the License, or
8 * (at your option) any later version.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 /* alfons - all folder item specific settings should migrate into
20 * folderlist.xml!!! the old folderitemrc file will only serve for a few
21 * versions (for compatibility) */
25 #include "claws-features.h"
31 #include <glib/gi18n.h>
33 #include "alertpanel.h"
34 #include "prefs_folder_item.h"
35 #include "folderview.h"
36 #include "summaryview.h"
39 #include "prefs_gtk.h"
40 #include "manage_window.h"
42 #include "addr_compl.h"
43 #include "prefs_common.h"
45 #include "filtering.h"
46 #include "folder_item_prefs.h"
47 #include "string_match.h"
48 #include "quote_fmt.h"
50 #include "stock_pixmap.h"
51 #include "file-utils.h"
54 #include "gtkaspell.h"
57 #define ASSIGN_STRING(string, value) \
63 typedef struct _FolderItemGeneralPage FolderItemGeneralPage
;
64 typedef struct _FolderItemComposePage FolderItemComposePage
;
65 typedef struct _FolderItemTemplatesPage FolderItemTemplatesPage
;
66 static gboolean can_save
= TRUE
;
68 struct _FolderItemGeneralPage
75 GtkWidget
*no_save_warning
;
76 GtkWidget
*folder_type
;
77 GtkWidget
*checkbtn_simplify_subject
;
78 GtkWidget
*entry_simplify_subject
;
79 GtkWidget
*entry_regexp_test_string
;
80 GtkWidget
*entry_regexp_test_result
;
81 GtkWidget
*checkbtn_folder_chmod
;
82 GtkWidget
*entry_folder_chmod
;
83 GtkWidget
*folder_color_btn
;
84 GtkWidget
*checkbtn_enable_processing
;
85 GtkWidget
*checkbtn_enable_processing_when_opening
;
86 GtkWidget
*checkbtn_newmailcheck
;
87 GtkWidget
*checkbtn_skip_on_goto_unread_or_new
;
88 GtkWidget
*checkbtn_offlinesync
;
89 GtkWidget
*label_offlinesync
;
90 GtkWidget
*entry_offlinesync
;
91 GtkWidget
*label_end_offlinesync
;
92 GtkWidget
*checkbtn_remove_old_offlinesync
;
93 GtkWidget
*promote_html_part
;
95 /* apply to sub folders */
96 GtkWidget
*simplify_subject_rec_checkbtn
;
97 GtkWidget
*folder_chmod_rec_checkbtn
;
98 GtkWidget
*folder_color_rec_checkbtn
;
99 GtkWidget
*enable_processing_rec_checkbtn
;
100 GtkWidget
*enable_processing_when_opening_rec_checkbtn
;
101 GtkWidget
*newmailcheck_rec_checkbtn
;
102 GtkWidget
*skip_on_goto_unread_or_new_rec_checkbtn
;
103 GtkWidget
*offlinesync_rec_checkbtn
;
104 GtkWidget
*promote_html_part_rec_checkbtn
;
106 GdkRGBA folder_color
;
109 struct _FolderItemComposePage
117 GtkWidget
*no_save_warning
;
118 GtkWidget
*checkbtn_request_return_receipt
;
119 GtkWidget
*checkbtn_save_copy_to_folder
;
120 GtkWidget
*checkbtn_default_from
;
121 GtkWidget
*entry_default_from
;
122 GtkWidget
*checkbtn_default_to
;
123 GtkWidget
*entry_default_to
;
124 GtkWidget
*checkbtn_default_reply_to
;
125 GtkWidget
*entry_default_reply_to
;
126 GtkWidget
*checkbtn_default_cc
;
127 GtkWidget
*entry_default_cc
;
128 GtkWidget
*checkbtn_default_bcc
;
129 GtkWidget
*entry_default_bcc
;
130 GtkWidget
*checkbtn_default_replyto
;
131 GtkWidget
*entry_default_replyto
;
132 GtkWidget
*checkbtn_enable_default_account
;
133 GtkWidget
*optmenu_default_account
;
135 GtkWidget
*checkbtn_enable_default_dictionary
;
136 GtkWidget
*checkbtn_enable_default_alt_dictionary
;
137 GtkWidget
*combo_default_dictionary
;
138 GtkWidget
*combo_default_alt_dictionary
;
140 GtkWidget
*always_sign
;
141 GtkWidget
*always_encrypt
;
143 /* apply to sub folders */
144 GtkWidget
*request_return_receipt_rec_checkbtn
;
145 GtkWidget
*save_copy_to_folder_rec_checkbtn
;
146 GtkWidget
*default_from_rec_checkbtn
;
147 GtkWidget
*default_to_rec_checkbtn
;
148 GtkWidget
*default_reply_to_rec_checkbtn
;
149 GtkWidget
*default_cc_rec_checkbtn
;
150 GtkWidget
*default_bcc_rec_checkbtn
;
151 GtkWidget
*default_replyto_rec_checkbtn
;
152 GtkWidget
*default_account_rec_checkbtn
;
154 GtkWidget
*default_dictionary_rec_checkbtn
;
155 GtkWidget
*default_alt_dictionary_rec_checkbtn
;
157 GtkWidget
*always_sign_rec_checkbtn
;
158 GtkWidget
*always_encrypt_rec_checkbtn
;
161 struct _FolderItemTemplatesPage
169 GtkWidget
*checkbtn_compose_with_format
;
170 GtkWidget
*compose_override_from_format
;
171 GtkWidget
*compose_subject_format
;
172 GtkWidget
*compose_body_format
;
173 GtkWidget
*checkbtn_reply_with_format
;
174 GtkWidget
*reply_quotemark
;
175 GtkWidget
*reply_override_from_format
;
176 GtkWidget
*reply_body_format
;
177 GtkWidget
*checkbtn_forward_with_format
;
178 GtkWidget
*forward_quotemark
;
179 GtkWidget
*forward_override_from_format
;
180 GtkWidget
*forward_body_format
;
182 /* apply to sub folders */
183 GtkWidget
*new_msg_format_rec_checkbtn
;
184 GtkWidget
*reply_format_rec_checkbtn
;
185 GtkWidget
*forward_format_rec_checkbtn
;
189 static void general_save_folder_prefs(FolderItem
*folder
, FolderItemGeneralPage
*page
);
190 static void compose_save_folder_prefs(FolderItem
*folder
, FolderItemComposePage
*page
);
191 static void templates_save_folder_prefs(FolderItem
*folder
, FolderItemTemplatesPage
*page
);
193 static gboolean
general_save_recurse_func(GNode
*node
, gpointer data
);
194 static gboolean
compose_save_recurse_func(GNode
*node
, gpointer data
);
195 static gboolean
templates_save_recurse_func(GNode
*node
, gpointer data
);
197 static void clean_cache_cb(GtkWidget
*widget
, gpointer data
);
198 static void folder_regexp_test_cb(GtkWidget
*widget
, gpointer data
);
199 static void folder_regexp_set_subject_example_cb(GtkWidget
*widget
, gpointer data
);
201 #define SAFE_STRING(str) \
204 static GtkWidget
*prefs_folder_no_save_warning_create_widget() {
209 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
211 icon
= stock_pixmap_widget(STOCK_PIXMAP_NOTICE_WARN
);
212 gtk_box_pack_start(GTK_BOX(hbox
), icon
, FALSE
, FALSE
, 8);
214 label
= gtk_label_new(g_strconcat("<i>",
215 _("These preferences will not be saved as this folder "
216 "is a top-level folder.\nHowever, you can set them for the "
217 "whole mailbox tree by using \"Apply to subfolders\"."),
219 gtk_label_set_use_markup(GTK_LABEL(label
), TRUE
);
220 gtk_label_set_xalign(GTK_LABEL(label
), 0.0);
221 gtk_box_pack_start(GTK_BOX(hbox
), label
, TRUE
, TRUE
, 0);
226 static void prefs_folder_item_general_create_widget_func(PrefsPage
* page_
,
230 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*) page_
;
231 FolderItem
*item
= (FolderItem
*) data
;
235 GtkWidget
*hbox
, *hbox2
, *hbox_spc
;
236 GtkWidget
*box1
, *box2
;
239 GtkListStore
*folder_type_menu
;
240 GtkWidget
*folder_type
;
242 GtkWidget
*dummy_checkbtn
, *clean_cache_btn
;
243 SpecialFolderItemType type
;
244 GtkWidget
*no_save_warning
= NULL
;
246 GtkWidget
*checkbtn_simplify_subject
;
247 GtkWidget
*entry_simplify_subject
;
248 GtkWidget
*label_regexp_test
;
249 GtkWidget
*entry_regexp_test_string
;
250 GtkWidget
*label_regexp_result
;
251 GtkWidget
*entry_regexp_test_result
;
253 GtkWidget
*checkbtn_folder_chmod
;
254 GtkWidget
*entry_folder_chmod
;
255 GtkWidget
*folder_color
;
256 GtkWidget
*folder_color_btn
;
257 GtkWidget
*checkbtn_enable_processing
;
258 GtkWidget
*checkbtn_enable_processing_when_opening
;
259 GtkWidget
*checkbtn_newmailcheck
;
260 GtkWidget
*checkbtn_skip_on_goto_unread_or_new
;
261 GtkWidget
*checkbtn_offlinesync
;
262 GtkWidget
*label_offlinesync
;
263 GtkWidget
*entry_offlinesync
;
264 GtkWidget
*label_end_offlinesync
;
265 GtkWidget
*checkbtn_remove_old_offlinesync
;
266 GtkWidget
*promote_html_part
;
267 GtkListStore
*promote_html_part_menu
;
269 GtkWidget
*simplify_subject_rec_checkbtn
;
271 GtkWidget
*folder_chmod_rec_checkbtn
;
272 GtkWidget
*folder_color_rec_checkbtn
;
273 GtkWidget
*enable_processing_rec_checkbtn
;
274 GtkWidget
*enable_processing_when_opening_rec_checkbtn
;
275 GtkWidget
*newmailcheck_rec_checkbtn
;
276 GtkWidget
*skip_on_goto_unread_or_new_rec_checkbtn
;
277 GtkWidget
*offlinesync_rec_checkbtn
;
278 GtkWidget
*promote_html_part_rec_checkbtn
;
285 table
= gtk_grid_new();
286 gtk_container_set_border_width (GTK_CONTAINER (table
), VBOX_BORDER
);
287 gtk_grid_set_row_spacing(GTK_GRID(table
), 4);
288 gtk_grid_set_column_spacing(GTK_GRID(table
), 4);
293 no_save_warning
= prefs_folder_no_save_warning_create_widget();
294 gtk_grid_attach(GTK_GRID(table
), no_save_warning
, 0, rowcount
, 1, 1);
298 /* Apply to subfolders */
299 label
= gtk_label_new(_("Apply to\nsubfolders"));
300 gtk_grid_attach(GTK_GRID(table
), label
, 2, rowcount
, 1, 1);
304 folder_type
= gtkut_sc_combobox_create(NULL
, FALSE
);
305 gtk_widget_show (folder_type
);
308 if (item
->stype
== F_INBOX
)
310 else if (folder_has_parent_of_type(item
, F_OUTBOX
))
312 else if (folder_has_parent_of_type(item
, F_DRAFT
))
314 else if (folder_has_parent_of_type(item
, F_QUEUE
))
316 else if (folder_has_parent_of_type(item
, F_TRASH
))
319 folder_type_menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
320 GTK_COMBO_BOX(folder_type
)));
322 COMBOBOX_ADD (folder_type_menu
, _("Normal"), F_NORMAL
);
323 COMBOBOX_ADD (folder_type_menu
, _("Inbox"), F_INBOX
);
324 COMBOBOX_ADD (folder_type_menu
, _("Sent"), F_OUTBOX
);
325 COMBOBOX_ADD (folder_type_menu
, _("Drafts"), F_DRAFT
);
326 COMBOBOX_ADD (folder_type_menu
, _("Queue"), F_QUEUE
);
327 COMBOBOX_ADD (folder_type_menu
, _("Trash"), F_TRASH
);
329 combobox_select_by_data(GTK_COMBO_BOX(folder_type
), type
);
331 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
332 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
333 gtk_box_pack_start(GTK_BOX(box1
), box2
, FALSE
, FALSE
, 0);
335 label
= gtk_label_new(_("Folder type"));
336 gtk_label_set_xalign(GTK_LABEL(label
), 0.0);
337 gtk_box_pack_start(GTK_BOX(box2
), label
, FALSE
, FALSE
, 0);
338 gtk_box_pack_start(GTK_BOX(box2
), folder_type
, FALSE
, FALSE
, 0);
339 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
341 dummy_checkbtn
= gtk_check_button_new();
342 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dummy_checkbtn
), type
!= F_INBOX
);
343 gtk_widget_set_sensitive(dummy_checkbtn
, FALSE
);
345 if (type
== item
->stype
&& type
== F_NORMAL
)
346 gtk_widget_set_sensitive(folder_type
, TRUE
);
348 gtk_widget_set_sensitive(folder_type
, FALSE
);
350 gtk_grid_attach(GTK_GRID(table
), dummy_checkbtn
, 2, rowcount
, 1, 1);
354 /* Simplify Subject */
355 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
356 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
357 gtk_box_pack_start(GTK_BOX(box1
), box2
, TRUE
, TRUE
, 0);
359 checkbtn_simplify_subject
= gtk_check_button_new_with_label(_("Simplify Subject RegExp"));
360 gtk_box_pack_start(GTK_BOX(box2
), checkbtn_simplify_subject
, FALSE
, FALSE
, 0);
361 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_simplify_subject
),
362 item
->prefs
->enable_simplify_subject
);
363 g_signal_connect(G_OBJECT(checkbtn_simplify_subject
), "toggled",
364 G_CALLBACK(folder_regexp_set_subject_example_cb
), page
);
366 entry_simplify_subject
= gtk_entry_new();
367 gtk_box_pack_start(GTK_BOX(box2
), entry_simplify_subject
, TRUE
, TRUE
, 0);
368 SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject
, entry_simplify_subject
);
369 gtk_entry_set_text(GTK_ENTRY(entry_simplify_subject
),
370 SAFE_STRING(item
->prefs
->simplify_subject_regexp
));
372 g_signal_connect(G_OBJECT(entry_simplify_subject
), "changed",
373 G_CALLBACK(folder_regexp_test_cb
), page
);
375 simplify_subject_rec_checkbtn
= gtk_check_button_new();
376 gtk_grid_attach(GTK_GRID(table
), simplify_subject_rec_checkbtn
, 2, rowcount
, 1, 1);
377 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
382 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
383 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
384 gtk_box_pack_start(GTK_BOX(box1
), box2
, TRUE
, TRUE
, 0);
386 label_regexp_test
= gtk_label_new(_("Test string"));
387 gtk_box_pack_start(GTK_BOX(box2
), label_regexp_test
, FALSE
, FALSE
, 0);
388 gtk_label_set_xalign(GTK_LABEL(label_regexp_test
), 1);
389 SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject
, label_regexp_test
);
391 entry_regexp_test_string
= gtk_entry_new();
392 gtk_box_pack_start(GTK_BOX(box2
), entry_regexp_test_string
, TRUE
, TRUE
, 0);
393 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
395 SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject
, entry_regexp_test_string
);
397 g_signal_connect(G_OBJECT(entry_regexp_test_string
), "changed",
398 G_CALLBACK(folder_regexp_test_cb
), page
);
403 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
404 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
405 gtk_box_pack_start(GTK_BOX(box1
), box2
, TRUE
, TRUE
, 0);
407 label_regexp_result
= gtk_label_new(_("Result"));
408 gtk_box_pack_start(GTK_BOX(box2
), label_regexp_result
, FALSE
, FALSE
, 0);
409 gtk_label_set_xalign(GTK_LABEL(label_regexp_result
), 1);
410 SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject
, label_regexp_result
);
412 entry_regexp_test_result
= gtk_entry_new();
413 gtk_box_pack_start(GTK_BOX(box2
), entry_regexp_test_result
, TRUE
, TRUE
, 0);
414 SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject
, entry_regexp_test_result
);
415 gtk_editable_set_editable(GTK_EDITABLE(entry_regexp_test_result
), FALSE
);
416 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
421 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
422 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
423 gtk_box_pack_start(GTK_BOX(box1
), box2
, FALSE
, FALSE
, 0);
425 checkbtn_folder_chmod
= gtk_check_button_new_with_label(_("Folder chmod"));
426 gtk_box_pack_start(GTK_BOX(box2
), checkbtn_folder_chmod
, FALSE
, FALSE
, 0);
428 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_chmod
),
429 item
->prefs
->enable_folder_chmod
);
431 entry_folder_chmod
= gtk_entry_new();
432 gtk_box_pack_start(GTK_BOX(box2
), entry_folder_chmod
, FALSE
, FALSE
, 0);
433 SET_TOGGLE_SENSITIVITY(checkbtn_folder_chmod
, entry_folder_chmod
);
434 if (item
->prefs
->folder_chmod
) {
437 buf
= g_strdup_printf("%o", item
->prefs
->folder_chmod
);
438 gtk_entry_set_text(GTK_ENTRY(entry_folder_chmod
), buf
);
442 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
443 folder_chmod_rec_checkbtn
= gtk_check_button_new();
444 gtk_grid_attach(GTK_GRID(table
), folder_chmod_rec_checkbtn
, 2, rowcount
, 1, 1);
449 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
450 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
451 gtk_box_pack_start(GTK_BOX(box1
), box2
, FALSE
, FALSE
, 0);
453 folder_color
= gtk_label_new(_("Folder color"));
454 gtk_label_set_xalign(GTK_LABEL(folder_color
), 0.0);
455 gtk_box_pack_start(GTK_BOX(box2
), folder_color
, FALSE
, FALSE
, 0);
457 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
458 gtk_box_pack_start(GTK_BOX(box2
), hbox
, FALSE
, FALSE
, 0);
460 folder_color_btn
= gtk_color_button_new_with_rgba(
461 &item
->prefs
->color
);
462 gtk_color_button_set_title(GTK_COLOR_BUTTON(folder_color_btn
),
463 _("Pick color for folder"));
465 gtk_box_pack_start (GTK_BOX(hbox
), folder_color_btn
, FALSE
, FALSE
, 0);
466 CLAWS_SET_TIP(folder_color_btn
,
467 _("Pick color for folder"));
469 page
->folder_color
= item
->prefs
->color
;
471 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
472 folder_color_rec_checkbtn
= gtk_check_button_new();
473 gtk_grid_attach(GTK_GRID(table
), folder_color_rec_checkbtn
, 2, rowcount
, 1, 1);
477 /* Enable processing at startup */
478 checkbtn_enable_processing
=
479 gtk_check_button_new_with_label(_("Run Processing rules at start-up"));
480 gtk_grid_attach(GTK_GRID(table
), checkbtn_enable_processing
, 0, rowcount
, 1, 1);
482 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_processing
),
483 item
->prefs
->enable_processing
);
485 enable_processing_rec_checkbtn
= gtk_check_button_new();
486 gtk_grid_attach(GTK_GRID(table
), enable_processing_rec_checkbtn
, 2, rowcount
, 1, 1);
490 /* Enable processing rules when opening folder */
491 checkbtn_enable_processing_when_opening
=
492 gtk_check_button_new_with_label(_("Run Processing rules when opening"));
493 gtk_grid_attach(GTK_GRID(table
), checkbtn_enable_processing_when_opening
, 0, rowcount
, 1, 1);
495 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_processing_when_opening
),
496 item
->prefs
->enable_processing_when_opening
);
498 enable_processing_when_opening_rec_checkbtn
= gtk_check_button_new();
499 gtk_grid_attach(GTK_GRID(table
), enable_processing_when_opening_rec_checkbtn
, 2, rowcount
, 1, 1);
503 /* Check folder for new mail */
504 checkbtn_newmailcheck
= gtk_check_button_new_with_label(_("Scan for new mail"));
505 CLAWS_SET_TIP(checkbtn_newmailcheck
,
506 _("Turn this option on if mail is delivered directly "
507 "to this folder by server side filtering on IMAP or "
508 "by an external application"));
509 gtk_grid_attach(GTK_GRID(table
), checkbtn_newmailcheck
, 0, rowcount
, 1, 1);
511 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_newmailcheck
),
512 item
->prefs
->newmailcheck
);
513 newmailcheck_rec_checkbtn
= gtk_check_button_new();
514 gtk_grid_attach(GTK_GRID(table
), newmailcheck_rec_checkbtn
, 2, rowcount
, 1, 1);
518 /* Select HTML part by default? */
519 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, VSPACING_NARROW_2
);
520 gtk_box_set_spacing(GTK_BOX(hbox
), 8);
521 gtk_grid_attach(GTK_GRID(table
), hbox
, 0, rowcount
, 1, 1);
523 label
= gtk_label_new(_("Select the HTML part of multipart messages"));
524 gtk_box_pack_start (GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
526 promote_html_part
= gtkut_sc_combobox_create (NULL
, FALSE
);
527 gtk_box_pack_start (GTK_BOX(hbox
), promote_html_part
, FALSE
, FALSE
, 0);
529 promote_html_part_menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
530 GTK_COMBO_BOX(promote_html_part
)));
531 COMBOBOX_ADD (promote_html_part_menu
, _("Default"), HTML_PROMOTE_DEFAULT
);
532 COMBOBOX_ADD (promote_html_part_menu
, _("No"), HTML_PROMOTE_NEVER
);
533 COMBOBOX_ADD (promote_html_part_menu
, _("Yes"), HTML_PROMOTE_ALWAYS
);
535 combobox_select_by_data(GTK_COMBO_BOX(promote_html_part
),
536 item
->prefs
->promote_html_part
);
538 CLAWS_SET_TIP(hbox
, _("\"Default\" will follow global preference (found in /Preferences/"
539 "Message View/Text Options)"));
541 promote_html_part_rec_checkbtn
= gtk_check_button_new();
542 gtk_grid_attach(GTK_GRID(table
), promote_html_part_rec_checkbtn
, 2, rowcount
, 1, 1);
546 /* Skip folder on 'goto unread (or new) message' */
547 checkbtn_skip_on_goto_unread_or_new
= gtk_check_button_new_with_label(
548 _("Skip folder when searching for unread or new messages"));
549 CLAWS_SET_TIP(checkbtn_skip_on_goto_unread_or_new
,
550 _("Turn this option on if you want this folder to be ignored "
551 "when searching for unread or new messages"));
552 gtk_grid_attach(GTK_GRID(table
), checkbtn_skip_on_goto_unread_or_new
, 0, rowcount
, 1, 1);
553 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_skip_on_goto_unread_or_new
),
554 item
->prefs
->skip_on_goto_unread_or_new
);
556 skip_on_goto_unread_or_new_rec_checkbtn
= gtk_check_button_new();
557 gtk_grid_attach(GTK_GRID(table
), skip_on_goto_unread_or_new_rec_checkbtn
, 2, rowcount
, 1, 1);
561 /* Synchronise folder for offline use */
562 checkbtn_offlinesync
= gtk_check_button_new_with_label(_("Synchronise for offline use"));
563 gtk_grid_attach(GTK_GRID(table
), checkbtn_offlinesync
, 0, rowcount
, 1, 1);
565 offlinesync_rec_checkbtn
= gtk_check_button_new();
566 gtk_grid_attach(GTK_GRID(table
), offlinesync_rec_checkbtn
, 2, rowcount
, 1, 1);
570 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
571 gtk_grid_attach(GTK_GRID(table
), hbox
, 0, rowcount
, 1, 1);
572 gtk_widget_set_hexpand(hbox
, TRUE
);
573 gtk_widget_set_halign(hbox
, GTK_ALIGN_FILL
);
577 hbox_spc
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
578 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
579 gtk_widget_set_size_request (hbox_spc
, 12, -1);
581 label_offlinesync
= gtk_label_new(_("Fetch message bodies from the last"));
582 gtk_box_pack_start (GTK_BOX (hbox
), label_offlinesync
, FALSE
, FALSE
, 0);
584 entry_offlinesync
= gtk_entry_new();
585 gtk_widget_set_size_request (entry_offlinesync
, 64, -1);
586 CLAWS_SET_TIP(entry_offlinesync
, _("0: all bodies"));
587 gtk_box_pack_start (GTK_BOX (hbox
), entry_offlinesync
, FALSE
, FALSE
, 0);
589 label_end_offlinesync
= gtk_label_new(_("days"));
590 gtk_box_pack_start (GTK_BOX (hbox
), label_end_offlinesync
, FALSE
, FALSE
, 0);
592 checkbtn_remove_old_offlinesync
= gtk_check_button_new_with_label(
593 _("Remove older messages bodies"));
595 hbox2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
596 gtk_grid_attach(GTK_GRID(table
), hbox2
, 0, rowcount
, 1, 1);
597 gtk_widget_set_hexpand(hbox2
, TRUE
);
598 gtk_widget_set_halign(hbox2
, GTK_ALIGN_FILL
);
602 hbox_spc
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
603 gtk_box_pack_start (GTK_BOX (hbox2
), hbox_spc
, FALSE
, FALSE
, 0);
604 gtk_widget_set_size_request (hbox_spc
, 12, -1);
605 gtk_box_pack_start (GTK_BOX (hbox2
), checkbtn_remove_old_offlinesync
, FALSE
, FALSE
, 0);
607 SET_TOGGLE_SENSITIVITY (checkbtn_offlinesync
, hbox
);
608 SET_TOGGLE_SENSITIVITY (checkbtn_offlinesync
, hbox2
);
610 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
611 clean_cache_btn
= gtk_button_new_with_label(_("Discard folder cache"));
612 gtk_box_pack_start (GTK_BOX (hbox
), clean_cache_btn
, FALSE
, FALSE
, 0);
613 gtk_widget_set_hexpand(hbox
, FALSE
);
614 gtk_widget_set_halign(hbox
, GTK_ALIGN_FILL
);
615 gtk_grid_attach(GTK_GRID(table
), hbox
, 0, rowcount
, 1, 1);
616 g_signal_connect(G_OBJECT(clean_cache_btn
), "clicked",
617 G_CALLBACK(clean_cache_cb
),
620 gtk_widget_show_all(table
);
622 /* line few widgets up now that we know their display size */
623 gtk_widget_get_preferred_width(label_regexp_test
, &wreq1
, NULL
);
624 gtk_widget_get_preferred_width(label_regexp_result
, &wreq2
, NULL
);
625 gtk_widget_set_size_request(label_regexp_test
, MAX(100, MAX(wreq1
, wreq2
)), -1);
626 gtk_widget_set_size_request(label_regexp_result
, MAX(100, MAX(wreq1
, wreq2
)), -1);
628 if (item
->folder
&& (item
->folder
->klass
->type
!= F_IMAP
&&
629 item
->folder
->klass
->type
!= F_NEWS
)) {
630 item
->prefs
->offlinesync
= TRUE
;
631 item
->prefs
->offlinesync_days
= 0;
632 item
->prefs
->remove_old_bodies
= FALSE
;
634 gtk_widget_set_sensitive(GTK_WIDGET(checkbtn_offlinesync
),
636 gtk_widget_set_sensitive(GTK_WIDGET(offlinesync_rec_checkbtn
),
638 gtk_widget_hide(GTK_WIDGET(checkbtn_offlinesync
));
639 gtk_widget_hide(GTK_WIDGET(hbox
));
640 gtk_widget_hide(GTK_WIDGET(hbox2
));
641 gtk_widget_hide(GTK_WIDGET(offlinesync_rec_checkbtn
));
642 gtk_widget_hide(GTK_WIDGET(label_offlinesync
));
643 gtk_widget_hide(GTK_WIDGET(entry_offlinesync
));
644 gtk_widget_hide(GTK_WIDGET(label_end_offlinesync
));
645 gtk_widget_hide(GTK_WIDGET(checkbtn_remove_old_offlinesync
));
646 gtk_widget_hide(GTK_WIDGET(clean_cache_btn
));
649 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_offlinesync
),
650 item
->prefs
->offlinesync
);
651 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_remove_old_offlinesync
),
652 item
->prefs
->remove_old_bodies
);
653 gtk_entry_set_text(GTK_ENTRY(entry_offlinesync
), itos(item
->prefs
->offlinesync_days
));
656 page
->folder_type
= folder_type
;
657 page
->no_save_warning
= no_save_warning
;
659 page
->checkbtn_simplify_subject
= checkbtn_simplify_subject
;
660 page
->entry_simplify_subject
= entry_simplify_subject
;
661 page
->entry_regexp_test_string
= entry_regexp_test_string
;
662 page
->entry_regexp_test_result
= entry_regexp_test_result
;
664 page
->checkbtn_folder_chmod
= checkbtn_folder_chmod
;
665 page
->entry_folder_chmod
= entry_folder_chmod
;
666 page
->folder_color_btn
= folder_color_btn
;
667 page
->checkbtn_enable_processing
= checkbtn_enable_processing
;
668 page
->checkbtn_enable_processing_when_opening
= checkbtn_enable_processing_when_opening
;
669 page
->checkbtn_newmailcheck
= checkbtn_newmailcheck
;
670 page
->checkbtn_skip_on_goto_unread_or_new
= checkbtn_skip_on_goto_unread_or_new
;
671 page
->checkbtn_offlinesync
= checkbtn_offlinesync
;
672 page
->label_offlinesync
= label_offlinesync
;
673 page
->entry_offlinesync
= entry_offlinesync
;
674 page
->label_end_offlinesync
= label_end_offlinesync
;
675 page
->checkbtn_remove_old_offlinesync
= checkbtn_remove_old_offlinesync
;
676 page
->promote_html_part
= promote_html_part
;
678 page
->simplify_subject_rec_checkbtn
= simplify_subject_rec_checkbtn
;
680 page
->folder_chmod_rec_checkbtn
= folder_chmod_rec_checkbtn
;
681 page
->folder_color_rec_checkbtn
= folder_color_rec_checkbtn
;
682 page
->enable_processing_rec_checkbtn
= enable_processing_rec_checkbtn
;
683 page
->enable_processing_when_opening_rec_checkbtn
= enable_processing_when_opening_rec_checkbtn
;
684 page
->newmailcheck_rec_checkbtn
= newmailcheck_rec_checkbtn
;
685 page
->skip_on_goto_unread_or_new_rec_checkbtn
= skip_on_goto_unread_or_new_rec_checkbtn
;
686 page
->offlinesync_rec_checkbtn
= offlinesync_rec_checkbtn
;
687 page
->promote_html_part_rec_checkbtn
= promote_html_part_rec_checkbtn
;
689 page
->page
.widget
= table
;
691 folder_regexp_set_subject_example_cb(NULL
, page
);
694 static void prefs_folder_item_general_destroy_widget_func(PrefsPage
*page_
)
696 /* FolderItemGeneralPage *page = (FolderItemGeneralPage *) page_; */
699 /** \brief Save the prefs in page to folder.
701 * If the folder is not the one specified in page->item, then only those properties
702 * that have the relevant 'apply to sub folders' button checked are saved
704 static void general_save_folder_prefs(FolderItem
*folder
, FolderItemGeneralPage
*page
)
706 FolderItemPrefs
*prefs
= folder
->prefs
;
708 gboolean all
= FALSE
, summary_update_needed
= FALSE
;
709 SpecialFolderItemType type
= F_NORMAL
;
710 FolderView
*folderview
= mainwindow_get_mainwindow()->folderview
;
711 HTMLPromoteType promote_html_part
= HTML_PROMOTE_DEFAULT
;
713 if (folder
->path
== NULL
)
716 cm_return_if_fail(prefs
!= NULL
);
718 if (page
->item
== folder
)
721 type
= combobox_get_active_data(GTK_COMBO_BOX(page
->folder_type
));
722 if (all
&& folder
->stype
!= type
&& page
->item
->parent_stype
== F_NORMAL
) {
723 folder_item_change_type(folder
, type
);
724 summary_update_needed
= TRUE
;
728 combobox_get_active_data(GTK_COMBO_BOX(page
->promote_html_part
));
729 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->promote_html_part_rec_checkbtn
)))
730 prefs
->promote_html_part
= promote_html_part
;
732 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->simplify_subject_rec_checkbtn
))) {
733 gboolean old_simplify_subject
= prefs
->enable_simplify_subject
;
734 int regexp_diffs
= g_strcmp0(prefs
->simplify_subject_regexp
, gtk_editable_get_chars(
735 GTK_EDITABLE(page
->entry_simplify_subject
), 0, -1));
736 prefs
->enable_simplify_subject
=
737 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_simplify_subject
));
738 ASSIGN_STRING(prefs
->simplify_subject_regexp
,
739 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_simplify_subject
), 0, -1));
740 if (old_simplify_subject
!= prefs
->enable_simplify_subject
|| regexp_diffs
!= 0)
741 summary_update_needed
= TRUE
;
744 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->folder_chmod_rec_checkbtn
))) {
745 prefs
->enable_folder_chmod
=
746 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_folder_chmod
));
747 buf
= gtk_editable_get_chars(GTK_EDITABLE(page
->entry_folder_chmod
), 0, -1);
748 prefs
->folder_chmod
= prefs_chmod_mode(buf
);
752 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->folder_color_rec_checkbtn
))) {
753 GdkRGBA old_color
= prefs
->color
;
754 gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(page
->folder_color_btn
),
757 /* update folder view */
758 if (!gdk_rgba_equal(&prefs
->color
, &old_color
))
759 folder_item_update(folder
, F_ITEM_UPDATE_MSGCNT
);
762 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->enable_processing_rec_checkbtn
))) {
763 prefs
->enable_processing
=
764 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_enable_processing
));
767 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->enable_processing_when_opening_rec_checkbtn
))) {
768 prefs
->enable_processing_when_opening
=
769 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_enable_processing_when_opening
));
772 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->newmailcheck_rec_checkbtn
))) {
773 prefs
->newmailcheck
=
774 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_newmailcheck
));
777 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->skip_on_goto_unread_or_new_rec_checkbtn
))) {
778 prefs
->skip_on_goto_unread_or_new
=
779 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_skip_on_goto_unread_or_new
));
782 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->offlinesync_rec_checkbtn
))) {
784 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_offlinesync
));
785 prefs
->offlinesync_days
=
786 atoi(gtk_entry_get_text(GTK_ENTRY(page
->entry_offlinesync
)));
787 prefs
->remove_old_bodies
=
788 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_remove_old_offlinesync
));
791 folder_item_prefs_save_config(folder
);
793 if (folder
->opened
&& summary_update_needed
) {
794 summary_set_prefs_from_folderitem(folderview
->summaryview
, folder
);
795 summary_show(folderview
->summaryview
, folder
, FALSE
);
799 static gboolean
general_save_recurse_func(GNode
*node
, gpointer data
)
801 FolderItem
*item
= (FolderItem
*) node
->data
;
802 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*) data
;
804 cm_return_val_if_fail(item
!= NULL
, TRUE
);
805 cm_return_val_if_fail(page
!= NULL
, TRUE
);
807 general_save_folder_prefs(item
, page
);
809 /* optimise by not continuing if none of the 'apply to sub folders'
810 check boxes are selected - and optimise the checking by only doing
812 if ((node
== page
->item
->node
) &&
814 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->simplify_subject_rec_checkbtn
)) ||
815 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->folder_chmod_rec_checkbtn
)) ||
816 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->folder_color_rec_checkbtn
)) ||
817 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->enable_processing_rec_checkbtn
)) ||
818 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->enable_processing_when_opening_rec_checkbtn
)) ||
819 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->newmailcheck_rec_checkbtn
)) ||
820 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->offlinesync_rec_checkbtn
)) ||
821 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->skip_on_goto_unread_or_new_rec_checkbtn
)) ||
822 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->promote_html_part_rec_checkbtn
))
829 static void prefs_folder_item_general_save_func(PrefsPage
*page_
)
831 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*) page_
;
833 g_node_traverse(page
->item
->node
, G_PRE_ORDER
, G_TRAVERSE_ALL
,
834 -1, general_save_recurse_func
, page
);
836 main_window_set_menu_sensitive(mainwindow_get_mainwindow());
840 static RecvProtocol
item_protocol(FolderItem
*item
)
846 if (!item
->folder
->account
)
848 return item
->folder
->account
->protocol
;
851 static void prefs_folder_item_compose_create_widget_func(PrefsPage
* page_
,
855 FolderItemComposePage
*page
= (FolderItemComposePage
*) page_
;
856 FolderItem
*item
= (FolderItem
*) data
;
865 GtkWidget
*no_save_warning
= NULL
;
866 GtkWidget
*checkbtn_request_return_receipt
= NULL
;
867 GtkWidget
*checkbtn_save_copy_to_folder
= NULL
;
868 GtkWidget
*checkbtn_default_from
= NULL
;
869 GtkWidget
*entry_default_from
= NULL
;
870 GtkWidget
*checkbtn_default_to
= NULL
;
871 GtkWidget
*entry_default_to
= NULL
;
872 GtkWidget
*checkbtn_default_reply_to
= NULL
;
873 GtkWidget
*entry_default_reply_to
= NULL
;
874 GtkWidget
*checkbtn_default_cc
= NULL
;
875 GtkWidget
*entry_default_cc
= NULL
;
876 GtkWidget
*checkbtn_default_bcc
= NULL
;
877 GtkWidget
*entry_default_bcc
= NULL
;
878 GtkWidget
*checkbtn_default_replyto
= NULL
;
879 GtkWidget
*entry_default_replyto
= NULL
;
880 GtkWidget
*checkbtn_enable_default_account
= NULL
;
881 GtkWidget
*optmenu_default_account
= NULL
;
882 GtkListStore
*optmenu_default_account_menu
= NULL
;
885 GtkWidget
*checkbtn_enable_default_dictionary
= NULL
;
886 GtkWidget
*combo_default_dictionary
= NULL
;
887 GtkWidget
*checkbtn_enable_default_alt_dictionary
= NULL
;
888 GtkWidget
*combo_default_alt_dictionary
= NULL
;
889 GtkWidget
*default_dictionary_rec_checkbtn
= NULL
;
890 GtkWidget
*default_alt_dictionary_rec_checkbtn
= NULL
;
893 GtkWidget
*always_sign
;
894 GtkListStore
*always_sign_menu
;
895 GtkWidget
*always_encrypt
;
896 GtkListStore
*always_encrypt_menu
;
897 GtkWidget
*request_return_receipt_rec_checkbtn
= NULL
;
898 GtkWidget
*save_copy_to_folder_rec_checkbtn
= NULL
;
899 GtkWidget
*default_from_rec_checkbtn
= NULL
;
900 GtkWidget
*default_to_rec_checkbtn
= NULL
;
901 GtkWidget
*default_reply_to_rec_checkbtn
= NULL
;
902 GtkWidget
*default_cc_rec_checkbtn
= NULL
;
903 GtkWidget
*default_bcc_rec_checkbtn
= NULL
;
904 GtkWidget
*default_replyto_rec_checkbtn
= NULL
;
905 GtkWidget
*default_account_rec_checkbtn
= NULL
;
906 GtkWidget
*always_sign_rec_checkbtn
= NULL
;
907 GtkWidget
*always_encrypt_rec_checkbtn
= NULL
;
911 PrefsAccount
*ac_prefs
;
912 gboolean default_account_set
= FALSE
;
918 # define TABLEHEIGHT 7
920 # define TABLEHEIGHT 6
922 table
= gtk_grid_new();
923 gtk_container_set_border_width (GTK_CONTAINER (table
), VBOX_BORDER
);
924 gtk_grid_set_row_spacing(GTK_GRID(table
), 4);
925 gtk_grid_set_column_spacing(GTK_GRID(table
), 4);
929 no_save_warning
= prefs_folder_no_save_warning_create_widget();
930 gtk_grid_attach(GTK_GRID(table
), no_save_warning
, 0, rowcount
, 1, 1);
934 /* Apply to subfolders */
935 label
= gtk_label_new(_("Apply to\nsubfolders"));
936 gtk_grid_attach(GTK_GRID(table
), label
, 2, rowcount
, 1, 1);
939 if (item_protocol(item
) != A_NNTP
) {
940 /* Request Return Receipt */
941 checkbtn_request_return_receipt
= gtk_check_button_new_with_label
942 (_("Request Return Receipt"));
943 gtk_grid_attach(GTK_GRID(table
), checkbtn_request_return_receipt
, 0, rowcount
, 1, 1);
944 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_request_return_receipt
),
945 item
->ret_rcpt
? TRUE
: FALSE
);
947 request_return_receipt_rec_checkbtn
= gtk_check_button_new();
948 gtk_grid_attach(GTK_GRID(table
), request_return_receipt_rec_checkbtn
, 2, rowcount
, 1, 1);
951 /* Save Copy to Folder */
952 checkbtn_save_copy_to_folder
= gtk_check_button_new_with_label
953 (_("Save copy of outgoing messages to this folder instead of Sent"));
954 gtk_grid_attach(GTK_GRID(table
), checkbtn_save_copy_to_folder
, 0, rowcount
, 2, 1);
955 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_save_copy_to_folder
),
956 item
->prefs
->save_copy_to_folder
? TRUE
: FALSE
);
958 save_copy_to_folder_rec_checkbtn
= gtk_check_button_new();
959 gtk_grid_attach(GTK_GRID(table
), save_copy_to_folder_rec_checkbtn
, 2, rowcount
, 1, 1);
963 tr
= g_strdup(C_("folder properties: %s stands for a header name",
965 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("From:"));
966 checkbtn_default_from
= gtk_check_button_new_with_label(text
);
967 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_from
, 0, rowcount
, 1, 1);
968 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_from
),
969 item
->prefs
->enable_default_from
);
973 entry_default_from
= gtk_entry_new();
974 gtk_grid_attach(GTK_GRID(table
), entry_default_from
, 1, rowcount
, 1, 1);
975 gtk_widget_set_hexpand(entry_default_from
, TRUE
);
976 gtk_widget_set_halign(entry_default_from
, GTK_ALIGN_FILL
);
977 SET_TOGGLE_SENSITIVITY(checkbtn_default_from
, entry_default_from
);
978 gtk_entry_set_text(GTK_ENTRY(entry_default_from
), SAFE_STRING(item
->prefs
->default_from
));
979 address_completion_register_entry(GTK_ENTRY(entry_default_from
),
982 default_from_rec_checkbtn
= gtk_check_button_new();
983 gtk_grid_attach(GTK_GRID(table
), default_from_rec_checkbtn
, 2, rowcount
, 1, 1);
988 tr
= g_strdup(C_("folder properties: %s stands for a header name",
990 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("To:"));
991 checkbtn_default_to
= gtk_check_button_new_with_label(text
);
992 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_to
, 0, rowcount
, 1, 1);
993 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_to
),
994 item
->prefs
->enable_default_to
);
998 entry_default_to
= gtk_entry_new();
999 gtk_grid_attach(GTK_GRID(table
), entry_default_to
, 1, rowcount
, 1, 1);
1000 gtk_widget_set_hexpand(entry_default_to
, TRUE
);
1001 gtk_widget_set_halign(entry_default_to
, GTK_ALIGN_FILL
);
1002 SET_TOGGLE_SENSITIVITY(checkbtn_default_to
, entry_default_to
);
1003 gtk_entry_set_text(GTK_ENTRY(entry_default_to
), SAFE_STRING(item
->prefs
->default_to
));
1004 address_completion_register_entry(GTK_ENTRY(entry_default_to
),
1007 default_to_rec_checkbtn
= gtk_check_button_new();
1008 gtk_grid_attach(GTK_GRID(table
), default_to_rec_checkbtn
, 2, rowcount
, 1, 1);
1012 /* Default address to reply to */
1013 tr
= g_strdup(C_("folder properties: %s stands for a header name",
1014 "Default %s for replies"));
1015 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("To:"));
1016 checkbtn_default_reply_to
= gtk_check_button_new_with_label(text
);
1017 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_reply_to
, 0, rowcount
, 1, 1);
1018 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_reply_to
),
1019 item
->prefs
->enable_default_reply_to
);
1023 entry_default_reply_to
= gtk_entry_new();
1024 gtk_grid_attach(GTK_GRID(table
), entry_default_reply_to
, 1, rowcount
, 1, 1);
1025 gtk_widget_set_hexpand(entry_default_reply_to
, TRUE
);
1026 gtk_widget_set_halign(entry_default_reply_to
, GTK_ALIGN_FILL
);
1027 SET_TOGGLE_SENSITIVITY(checkbtn_default_reply_to
, entry_default_reply_to
);
1028 gtk_entry_set_text(GTK_ENTRY(entry_default_reply_to
), SAFE_STRING(item
->prefs
->default_reply_to
));
1029 address_completion_register_entry(
1030 GTK_ENTRY(entry_default_reply_to
), TRUE
);
1032 default_reply_to_rec_checkbtn
= gtk_check_button_new();
1033 gtk_grid_attach(GTK_GRID(table
), default_reply_to_rec_checkbtn
, 2, rowcount
, 1, 1);
1038 tr
= g_strdup(C_("folder properties: %s stands for a header name",
1040 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("Cc:"));
1041 checkbtn_default_cc
= gtk_check_button_new_with_label(text
);
1042 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_cc
, 0, rowcount
, 1, 1);
1043 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_cc
),
1044 item
->prefs
->enable_default_cc
);
1048 entry_default_cc
= gtk_entry_new();
1049 gtk_grid_attach(GTK_GRID(table
), entry_default_cc
, 1, rowcount
, 1, 1);
1050 gtk_widget_set_hexpand(entry_default_cc
, TRUE
);
1051 gtk_widget_set_halign(entry_default_cc
, GTK_ALIGN_FILL
);
1052 SET_TOGGLE_SENSITIVITY(checkbtn_default_cc
, entry_default_cc
);
1053 gtk_entry_set_text(GTK_ENTRY(entry_default_cc
), SAFE_STRING(item
->prefs
->default_cc
));
1054 address_completion_register_entry(GTK_ENTRY(entry_default_cc
),
1057 default_cc_rec_checkbtn
= gtk_check_button_new();
1058 gtk_grid_attach(GTK_GRID(table
), default_cc_rec_checkbtn
, 2, rowcount
, 1, 1);
1063 tr
= g_strdup(C_("folder properties: %s stands for a header name",
1065 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("Bcc:"));
1066 checkbtn_default_bcc
= gtk_check_button_new_with_label(text
);
1067 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_bcc
, 0, rowcount
, 1, 1);
1068 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_bcc
),
1069 item
->prefs
->enable_default_bcc
);
1073 entry_default_bcc
= gtk_entry_new();
1074 gtk_grid_attach(GTK_GRID(table
), entry_default_bcc
, 1, rowcount
, 1, 1);
1075 gtk_widget_set_hexpand(entry_default_bcc
, TRUE
);
1076 gtk_widget_set_halign(entry_default_bcc
, GTK_ALIGN_FILL
);
1077 SET_TOGGLE_SENSITIVITY(checkbtn_default_bcc
, entry_default_bcc
);
1078 gtk_entry_set_text(GTK_ENTRY(entry_default_bcc
), SAFE_STRING(item
->prefs
->default_bcc
));
1079 address_completion_register_entry(GTK_ENTRY(entry_default_bcc
),
1082 default_bcc_rec_checkbtn
= gtk_check_button_new();
1083 gtk_grid_attach(GTK_GRID(table
), default_bcc_rec_checkbtn
, 2, rowcount
, 1, 1);
1087 /* Default Reply-to */
1088 tr
= g_strdup(C_("folder properties: %s stands for a header name",
1090 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("Reply-To:"));
1091 checkbtn_default_replyto
= gtk_check_button_new_with_label(text
);
1092 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_replyto
, 0, rowcount
, 1, 1);
1093 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_replyto
),
1094 item
->prefs
->enable_default_replyto
);
1098 entry_default_replyto
= gtk_entry_new();
1099 gtk_grid_attach(GTK_GRID(table
), entry_default_replyto
, 1, rowcount
, 1, 1);
1100 gtk_widget_set_hexpand(entry_default_replyto
, TRUE
);
1101 gtk_widget_set_halign(entry_default_replyto
, GTK_ALIGN_FILL
);
1102 SET_TOGGLE_SENSITIVITY(checkbtn_default_replyto
, entry_default_replyto
);
1103 gtk_entry_set_text(GTK_ENTRY(entry_default_replyto
), SAFE_STRING(item
->prefs
->default_replyto
));
1104 address_completion_register_entry(GTK_ENTRY(entry_default_replyto
),
1107 default_replyto_rec_checkbtn
= gtk_check_button_new();
1108 gtk_grid_attach(GTK_GRID(table
), default_replyto_rec_checkbtn
, 2, rowcount
, 1, 1);
1112 /* Default account */
1113 checkbtn_enable_default_account
= gtk_check_button_new_with_label(_("Default account"));
1114 gtk_grid_attach(GTK_GRID(table
), checkbtn_enable_default_account
, 0, rowcount
, 1, 1);
1115 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_account
),
1116 item
->prefs
->enable_default_account
);
1118 optmenu_default_account
= gtkut_sc_combobox_create(NULL
, FALSE
);
1119 gtk_grid_attach(GTK_GRID(table
), optmenu_default_account
, 1, rowcount
, 1, 1);
1120 optmenu_default_account_menu
= GTK_LIST_STORE(
1121 gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu_default_account
)));
1123 account_list
= account_get_list();
1124 for (cur_ac
= account_list
; cur_ac
!= NULL
; cur_ac
= cur_ac
->next
) {
1125 ac_prefs
= (PrefsAccount
*)cur_ac
->data
;
1126 if (item
->folder
->account
&&
1127 ( (item_protocol(item
) == A_NNTP
&& ac_prefs
->protocol
!= A_NNTP
)
1128 ||(item_protocol(item
) != A_NNTP
&& ac_prefs
->protocol
== A_NNTP
)))
1131 if (item
->folder
->klass
->type
!= F_NEWS
&& ac_prefs
->protocol
== A_NNTP
)
1134 COMBOBOX_ADD_ESCAPED (optmenu_default_account_menu
,
1135 ac_prefs
->account_name
?ac_prefs
->account_name
: _("Untitled"),
1136 ac_prefs
->account_id
);
1138 /* Set combobox to current default account id */
1139 if (ac_prefs
->account_id
== item
->prefs
->default_account
) {
1140 combobox_select_by_data(GTK_COMBO_BOX(optmenu_default_account
),
1141 ac_prefs
->account_id
);
1142 default_account_set
= TRUE
;
1146 /* If nothing has been set (folder doesn't have a default account set),
1147 * pre-select global default account, since that's what actually used
1148 * anyway. We don't want nothing selected in combobox. */
1149 if( !default_account_set
)
1150 combobox_select_by_data(GTK_COMBO_BOX(optmenu_default_account
),
1151 account_get_default()->account_id
);
1153 SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_account
, optmenu_default_account
);
1155 default_account_rec_checkbtn
= gtk_check_button_new();
1156 gtk_grid_attach(GTK_GRID(table
), default_account_rec_checkbtn
, 2, rowcount
, 1, 1);
1160 /* Default dictionary */
1161 checkbtn_enable_default_dictionary
= gtk_check_button_new_with_label(_("Default dictionary"));
1162 gtk_grid_attach(GTK_GRID(table
), checkbtn_enable_default_dictionary
, 0, rowcount
, 1, 1);
1163 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_dictionary
),
1164 item
->prefs
->enable_default_dictionary
);
1166 combo_default_dictionary
= gtkaspell_dictionary_combo_new(TRUE
);
1167 gtk_grid_attach(GTK_GRID(table
), combo_default_dictionary
, 1, rowcount
, 1, 1);
1169 dictionary
= item
->prefs
->default_dictionary
;
1170 if (dictionary
&& strrchr(dictionary
, '/')) {
1171 gchar
*tmp
= g_strdup(strrchr(dictionary
, '/')+1);
1172 g_free(item
->prefs
->default_dictionary
);
1173 item
->prefs
->default_dictionary
= tmp
;
1174 dictionary
= item
->prefs
->default_dictionary
;
1176 if (item
->prefs
->default_dictionary
&&
1177 strchr(item
->prefs
->default_dictionary
, '-')) {
1178 *(strchr(item
->prefs
->default_dictionary
, '-')) = '\0';
1181 gtkaspell_set_dictionary_menu_active_item(
1182 GTK_COMBO_BOX(combo_default_dictionary
), dictionary
);
1184 SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_dictionary
, combo_default_dictionary
);
1186 default_dictionary_rec_checkbtn
= gtk_check_button_new();
1187 gtk_grid_attach(GTK_GRID(table
), default_dictionary_rec_checkbtn
, 2, rowcount
, 1, 1);
1191 /* Default alternate dictionary */
1192 checkbtn_enable_default_alt_dictionary
= gtk_check_button_new_with_label(_("Default alternate dictionary"));
1193 gtk_grid_attach(GTK_GRID(table
), checkbtn_enable_default_alt_dictionary
, 0, rowcount
, 1, 1);
1194 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_alt_dictionary
),
1195 item
->prefs
->enable_default_alt_dictionary
);
1197 combo_default_alt_dictionary
= gtkaspell_dictionary_combo_new(FALSE
);
1198 gtk_grid_attach(GTK_GRID(table
), combo_default_alt_dictionary
, 1, rowcount
, 1, 1);
1200 dictionary
= item
->prefs
->default_alt_dictionary
;
1201 if (dictionary
&& strrchr(dictionary
, '/')) {
1202 gchar
*tmp
= g_strdup(strrchr(dictionary
, '/')+1);
1203 g_free(item
->prefs
->default_alt_dictionary
);
1204 item
->prefs
->default_alt_dictionary
= tmp
;
1205 dictionary
= item
->prefs
->default_alt_dictionary
;
1207 if (item
->prefs
->default_alt_dictionary
&&
1208 strchr(item
->prefs
->default_alt_dictionary
, '-')) {
1209 *(strchr(item
->prefs
->default_alt_dictionary
, '-')) = '\0';
1212 gtkaspell_set_dictionary_menu_active_item(
1213 GTK_COMBO_BOX(combo_default_alt_dictionary
), dictionary
);
1215 SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_alt_dictionary
, combo_default_alt_dictionary
);
1217 default_alt_dictionary_rec_checkbtn
= gtk_check_button_new();
1218 gtk_grid_attach(GTK_GRID(table
), default_alt_dictionary_rec_checkbtn
, 2, rowcount
, 1, 1);
1224 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 2);
1225 gtk_box_set_spacing(GTK_BOX(hbox
), 8);
1226 gtk_widget_show (hbox
);
1227 gtk_grid_attach(GTK_GRID(table
), hbox
, 0, rowcount
, 1, 1);
1229 label
= gtk_label_new(_("Always sign messages"));
1230 gtk_widget_show (label
);
1231 gtk_box_pack_start (GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
1233 always_sign
= gtkut_sc_combobox_create (NULL
, FALSE
);
1234 gtk_widget_show (always_sign
);
1235 gtk_box_pack_start (GTK_BOX(hbox
), always_sign
, FALSE
, FALSE
, 0);
1237 always_sign_menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
1238 GTK_COMBO_BOX(always_sign
)));
1239 COMBOBOX_ADD (always_sign_menu
, _("Default"), SIGN_OR_ENCRYPT_DEFAULT
);
1240 COMBOBOX_ADD (always_sign_menu
, _("No"), SIGN_OR_ENCRYPT_NEVER
);
1241 COMBOBOX_ADD (always_sign_menu
, _("Yes"), SIGN_OR_ENCRYPT_ALWAYS
);
1243 combobox_select_by_data(GTK_COMBO_BOX(always_sign
),
1244 item
->prefs
->always_sign
);
1246 CLAWS_SET_TIP(hbox
, _("\"Default\" will follow the applicable account preference"));
1248 always_sign_rec_checkbtn
= gtk_check_button_new();
1249 gtk_widget_show (always_sign_rec_checkbtn
);
1250 gtk_grid_attach(GTK_GRID(table
), always_sign_rec_checkbtn
, 2, rowcount
, 1, 1);
1255 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 2);
1256 gtk_box_set_spacing(GTK_BOX(hbox
), 8);
1257 gtk_widget_show (hbox
);
1258 gtk_grid_attach(GTK_GRID(table
), hbox
, 0, rowcount
, 1, 1);
1260 label
= gtk_label_new(_("Always encrypt messages"));
1261 gtk_widget_show (label
);
1262 gtk_box_pack_start (GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
1264 always_encrypt
= gtkut_sc_combobox_create (NULL
, FALSE
);
1265 gtk_widget_show (always_encrypt
);
1266 gtk_box_pack_start (GTK_BOX(hbox
), always_encrypt
, FALSE
, FALSE
, 0);
1268 always_encrypt_menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
1269 GTK_COMBO_BOX(always_encrypt
)));
1270 COMBOBOX_ADD (always_encrypt_menu
, _("Default"), SIGN_OR_ENCRYPT_DEFAULT
);
1271 COMBOBOX_ADD (always_encrypt_menu
, _("No"), SIGN_OR_ENCRYPT_NEVER
);
1272 COMBOBOX_ADD (always_encrypt_menu
, _("Yes"), SIGN_OR_ENCRYPT_ALWAYS
);
1274 combobox_select_by_data(GTK_COMBO_BOX(always_encrypt
),
1275 item
->prefs
->always_encrypt
);
1277 CLAWS_SET_TIP(hbox
, _("\"Default\" will follow the applicable account preference"));
1279 always_encrypt_rec_checkbtn
= gtk_check_button_new();
1280 gtk_widget_show (always_encrypt_rec_checkbtn
);
1281 gtk_grid_attach(GTK_GRID(table
), always_encrypt_rec_checkbtn
, 2, rowcount
, 1, 1);
1285 gtk_widget_show_all(table
);
1287 page
->window
= GTK_WIDGET(window
);
1288 page
->table
= table
;
1289 page
->no_save_warning
= no_save_warning
;
1290 page
->checkbtn_request_return_receipt
= checkbtn_request_return_receipt
;
1291 page
->checkbtn_save_copy_to_folder
= checkbtn_save_copy_to_folder
;
1292 page
->checkbtn_default_from
= checkbtn_default_from
;
1293 page
->entry_default_from
= entry_default_from
;
1294 page
->checkbtn_default_to
= checkbtn_default_to
;
1295 page
->entry_default_to
= entry_default_to
;
1296 page
->checkbtn_default_reply_to
= checkbtn_default_reply_to
;
1297 page
->entry_default_reply_to
= entry_default_reply_to
;
1298 page
->checkbtn_default_cc
= checkbtn_default_cc
;
1299 page
->entry_default_cc
= entry_default_cc
;
1300 page
->checkbtn_default_bcc
= checkbtn_default_bcc
;
1301 page
->entry_default_bcc
= entry_default_bcc
;
1302 page
->checkbtn_default_replyto
= checkbtn_default_replyto
;
1303 page
->entry_default_replyto
= entry_default_replyto
;
1304 page
->checkbtn_enable_default_account
= checkbtn_enable_default_account
;
1305 page
->optmenu_default_account
= optmenu_default_account
;
1307 page
->checkbtn_enable_default_dictionary
= checkbtn_enable_default_dictionary
;
1308 page
->combo_default_dictionary
= combo_default_dictionary
;
1309 page
->checkbtn_enable_default_alt_dictionary
= checkbtn_enable_default_alt_dictionary
;
1310 page
->combo_default_alt_dictionary
= combo_default_alt_dictionary
;
1312 page
->always_sign
= always_sign
;
1313 page
->always_encrypt
= always_encrypt
;
1315 page
->request_return_receipt_rec_checkbtn
= request_return_receipt_rec_checkbtn
;
1316 page
->save_copy_to_folder_rec_checkbtn
= save_copy_to_folder_rec_checkbtn
;
1317 page
->default_from_rec_checkbtn
= default_from_rec_checkbtn
;
1318 page
->default_to_rec_checkbtn
= default_to_rec_checkbtn
;
1319 page
->default_reply_to_rec_checkbtn
= default_reply_to_rec_checkbtn
;
1320 page
->default_cc_rec_checkbtn
= default_cc_rec_checkbtn
;
1321 page
->default_bcc_rec_checkbtn
= default_bcc_rec_checkbtn
;
1322 page
->default_replyto_rec_checkbtn
= default_replyto_rec_checkbtn
;
1323 page
->default_account_rec_checkbtn
= default_account_rec_checkbtn
;
1325 page
->default_dictionary_rec_checkbtn
= default_dictionary_rec_checkbtn
;
1326 page
->default_alt_dictionary_rec_checkbtn
= default_alt_dictionary_rec_checkbtn
;
1328 page
->always_sign_rec_checkbtn
= always_sign_rec_checkbtn
;
1329 page
->always_encrypt_rec_checkbtn
= always_encrypt_rec_checkbtn
;
1331 page
->page
.widget
= table
;
1334 static void prefs_folder_item_compose_destroy_widget_func(PrefsPage
*page_
)
1336 FolderItemComposePage
*page
= (FolderItemComposePage
*) page_
;
1338 if (page
->entry_default_from
)
1339 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_from
));
1340 if (page
->entry_default_to
)
1341 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_to
));
1342 if (page
->entry_default_reply_to
)
1343 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_reply_to
));
1344 if (page
->entry_default_cc
)
1345 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_cc
));
1346 if (page
->entry_default_bcc
)
1347 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_bcc
));
1348 if (page
->entry_default_replyto
)
1349 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_replyto
));
1352 /** \brief Save the prefs in page to folder.
1354 * If the folder is not the one specified in page->item, then only those properties
1355 * that have the relevant 'apply to sub folders' button checked are saved
1357 static void compose_save_folder_prefs(FolderItem
*folder
, FolderItemComposePage
*page
)
1359 FolderItemPrefs
*prefs
= folder
->prefs
;
1361 gboolean all
= FALSE
;
1363 if (folder
->path
== NULL
)
1366 if (page
->item
== folder
)
1369 cm_return_if_fail(prefs
!= NULL
);
1371 if (item_protocol(folder
) != A_NNTP
) {
1372 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->request_return_receipt_rec_checkbtn
))) {
1373 prefs
->request_return_receipt
=
1374 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_request_return_receipt
));
1376 folder
->ret_rcpt
= prefs
->request_return_receipt
;
1379 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->save_copy_to_folder_rec_checkbtn
))) {
1380 prefs
->save_copy_to_folder
=
1381 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_save_copy_to_folder
));
1384 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_from_rec_checkbtn
))) {
1385 prefs
->enable_default_from
=
1386 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_from
));
1387 ASSIGN_STRING(prefs
->default_from
,
1388 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_from
), 0, -1));
1391 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_to_rec_checkbtn
))) {
1392 prefs
->enable_default_to
=
1393 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_to
));
1394 ASSIGN_STRING(prefs
->default_to
,
1395 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_to
), 0, -1));
1398 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_reply_to_rec_checkbtn
))) {
1399 prefs
->enable_default_reply_to
=
1400 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_reply_to
));
1401 ASSIGN_STRING(prefs
->default_reply_to
,
1402 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_reply_to
), 0, -1));
1405 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_cc_rec_checkbtn
))) {
1407 prefs
->enable_default_cc
=
1408 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_cc
));
1409 ASSIGN_STRING(prefs
->default_cc
,
1410 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_cc
), 0, -1));
1413 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_bcc_rec_checkbtn
))) {
1415 prefs
->enable_default_bcc
=
1416 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_bcc
));
1417 ASSIGN_STRING(prefs
->default_bcc
,
1418 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_bcc
), 0, -1));
1421 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_replyto_rec_checkbtn
))) {
1423 prefs
->enable_default_replyto
=
1424 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_replyto
));
1425 ASSIGN_STRING(prefs
->default_replyto
,
1426 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_replyto
), 0, -1));
1430 prefs
->request_return_receipt
= FALSE
;
1431 prefs
->save_copy_to_folder
= FALSE
;
1432 prefs
->enable_default_from
= FALSE
;
1433 prefs
->enable_default_to
= FALSE
;
1434 prefs
->enable_default_reply_to
= FALSE
;
1435 prefs
->enable_default_cc
= FALSE
;
1436 prefs
->enable_default_bcc
= FALSE
;
1437 prefs
->enable_default_replyto
= FALSE
;
1440 if (all
|| gtk_toggle_button_get_active(
1441 GTK_TOGGLE_BUTTON(page
->default_account_rec_checkbtn
))) {
1442 prefs
->enable_default_account
=
1443 gtk_toggle_button_get_active(
1444 GTK_TOGGLE_BUTTON(page
->checkbtn_enable_default_account
));
1445 prefs
->default_account
= combobox_get_active_data(
1446 GTK_COMBO_BOX(page
->optmenu_default_account
));
1450 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_dictionary_rec_checkbtn
))) {
1451 prefs
->enable_default_dictionary
=
1452 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_enable_default_dictionary
));
1453 ASSIGN_STRING(prefs
->default_dictionary
,
1454 gtkaspell_get_dictionary_menu_active_item(
1455 GTK_COMBO_BOX(page
->combo_default_dictionary
)));
1457 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_alt_dictionary_rec_checkbtn
))) {
1458 prefs
->enable_default_alt_dictionary
=
1459 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_enable_default_alt_dictionary
));
1460 ASSIGN_STRING(prefs
->default_alt_dictionary
,
1461 gtkaspell_get_dictionary_menu_active_item(
1462 GTK_COMBO_BOX(page
->combo_default_alt_dictionary
)));
1465 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_sign_rec_checkbtn
))) {
1466 prefs
->always_sign
=
1467 combobox_get_active_data(GTK_COMBO_BOX(page
->always_sign
));
1469 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_encrypt_rec_checkbtn
))) {
1470 prefs
->always_encrypt
=
1471 combobox_get_active_data(GTK_COMBO_BOX(page
->always_encrypt
));
1474 folder_item_prefs_save_config(folder
);
1477 static gboolean
compose_save_recurse_func(GNode
*node
, gpointer data
)
1479 FolderItem
*item
= (FolderItem
*) node
->data
;
1480 FolderItemComposePage
*page
= (FolderItemComposePage
*) data
;
1482 cm_return_val_if_fail(item
!= NULL
, TRUE
);
1483 cm_return_val_if_fail(page
!= NULL
, TRUE
);
1485 compose_save_folder_prefs(item
, page
);
1487 /* optimise by not continuing if none of the 'apply to sub folders'
1488 check boxes are selected - and optimise the checking by only doing
1490 if ((node
== page
->item
->node
) && item_protocol(item
) != A_NNTP
&&
1491 !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->request_return_receipt_rec_checkbtn
)) ||
1492 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->save_copy_to_folder_rec_checkbtn
)) ||
1493 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_from_rec_checkbtn
)) ||
1494 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_to_rec_checkbtn
)) ||
1495 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_account_rec_checkbtn
)) ||
1496 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_cc_rec_checkbtn
)) ||
1497 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_bcc_rec_checkbtn
)) ||
1498 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_replyto_rec_checkbtn
)) ||
1500 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_dictionary_rec_checkbtn
)) ||
1501 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_alt_dictionary_rec_checkbtn
)) ||
1503 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_sign_rec_checkbtn
)) ||
1504 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_encrypt_rec_checkbtn
)) ||
1505 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_reply_to_rec_checkbtn
))
1508 else if ((node
== page
->item
->node
) && item_protocol(item
) == A_NNTP
&&
1509 !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_account_rec_checkbtn
))
1511 || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_dictionary_rec_checkbtn
))
1512 || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_alt_dictionary_rec_checkbtn
))
1514 || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_sign_rec_checkbtn
))
1515 || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_encrypt_rec_checkbtn
))
1522 static void prefs_folder_item_compose_save_func(PrefsPage
*page_
)
1524 FolderItemComposePage
*page
= (FolderItemComposePage
*) page_
;
1526 g_node_traverse(page
->item
->node
, G_PRE_ORDER
, G_TRAVERSE_ALL
,
1527 -1, compose_save_recurse_func
, page
);
1531 static void prefs_folder_item_templates_create_widget_func(PrefsPage
* page_
,
1535 FolderItemTemplatesPage
*page
= (FolderItemTemplatesPage
*) page_
;
1536 FolderItem
*item
= (FolderItem
*) data
;
1538 GtkWidget
*notebook
;
1540 GtkWidget
*page_vbox
;
1541 GtkWidget
*no_save_warning
;
1542 GtkWidget
*new_msg_format_rec_checkbtn
;
1543 GtkWidget
*reply_format_rec_checkbtn
;
1544 GtkWidget
*forward_format_rec_checkbtn
;
1546 GtkWidget
*vbox_format
;
1550 page_vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, 0);
1551 gtk_container_set_border_width (GTK_CONTAINER (page_vbox
), VBOX_BORDER
);
1552 gtk_widget_show (page_vbox
);
1555 no_save_warning
= prefs_folder_no_save_warning_create_widget();
1556 gtk_box_pack_start(GTK_BOX(page_vbox
),
1557 no_save_warning
, FALSE
, FALSE
, 0);
1561 notebook
= gtk_notebook_new();
1562 gtk_widget_show(notebook
);
1563 gtk_box_pack_start(GTK_BOX(page_vbox
), notebook
, TRUE
, TRUE
, 4);
1565 /* compose format */
1566 vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
1567 gtk_widget_show (vbox
);
1568 gtk_container_set_border_width (GTK_CONTAINER (vbox
), VBOX_BORDER
);
1570 quotefmt_create_new_msg_fmt_widgets(
1573 &page
->checkbtn_compose_with_format
,
1574 &page
->compose_override_from_format
,
1575 &page
->compose_subject_format
,
1576 &page
->compose_body_format
,
1578 address_completion_register_entry(GTK_ENTRY(page
->compose_override_from_format
),
1581 vbox_format
= gtk_widget_get_parent(
1582 gtk_widget_get_parent(page
->compose_body_format
));
1584 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
1585 gtk_box_pack_end (GTK_BOX(vbox_format
), hbox
, FALSE
, FALSE
, 0);
1586 quotefmt_add_info_button(window
, hbox
);
1588 new_msg_format_rec_checkbtn
= gtk_check_button_new_with_label(
1589 _("Apply to subfolders"));
1590 gtk_box_pack_end (GTK_BOX(hbox
), new_msg_format_rec_checkbtn
, FALSE
, FALSE
, 0);
1591 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox
, gtk_label_new(_("Compose")));
1594 vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
1595 gtk_widget_show (vbox
);
1596 gtk_container_set_border_width (GTK_CONTAINER (vbox
), VBOX_BORDER
);
1598 quotefmt_create_reply_fmt_widgets(
1601 &page
->checkbtn_reply_with_format
,
1602 &page
->reply_override_from_format
,
1603 &page
->reply_quotemark
,
1604 &page
->reply_body_format
,
1606 address_completion_register_entry(GTK_ENTRY(page
->reply_override_from_format
),
1609 vbox_format
= gtk_widget_get_parent(
1610 gtk_widget_get_parent(page
->reply_body_format
));
1612 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
1613 gtk_box_pack_end (GTK_BOX(vbox_format
), hbox
, FALSE
, FALSE
, 0);
1614 quotefmt_add_info_button(window
, hbox
);
1616 reply_format_rec_checkbtn
= gtk_check_button_new_with_label(
1617 _("Apply to subfolders"));
1618 gtk_box_pack_end (GTK_BOX(hbox
), reply_format_rec_checkbtn
, FALSE
, FALSE
, 0);
1619 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox
, gtk_label_new(_("Reply")));
1621 /* forward format */
1622 vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
1623 gtk_widget_show (vbox
);
1624 gtk_container_set_border_width (GTK_CONTAINER (vbox
), VBOX_BORDER
);
1626 quotefmt_create_forward_fmt_widgets(
1629 &page
->checkbtn_forward_with_format
,
1630 &page
->forward_override_from_format
,
1631 &page
->forward_quotemark
,
1632 &page
->forward_body_format
,
1634 address_completion_register_entry(GTK_ENTRY(page
->forward_override_from_format
),
1637 vbox_format
= gtk_widget_get_parent(
1638 gtk_widget_get_parent(page
->forward_body_format
));
1640 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
1641 gtk_box_pack_end (GTK_BOX(vbox_format
), hbox
, FALSE
, FALSE
, 0);
1642 quotefmt_add_info_button(window
, hbox
);
1644 forward_format_rec_checkbtn
= gtk_check_button_new_with_label(
1645 _("Apply to subfolders"));
1646 gtk_box_pack_end (GTK_BOX(hbox
), forward_format_rec_checkbtn
, FALSE
, FALSE
, 0);
1647 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox
, gtk_label_new(_("Forward")));
1649 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(page
->checkbtn_compose_with_format
),
1650 item
->prefs
->compose_with_format
);
1651 pref_set_entry_from_pref(GTK_ENTRY(page
->compose_override_from_format
),
1652 item
->prefs
->compose_override_from_format
);
1653 pref_set_entry_from_pref(GTK_ENTRY(page
->compose_subject_format
),
1654 item
->prefs
->compose_subject_format
);
1655 pref_set_textview_from_pref(GTK_TEXT_VIEW(page
->compose_body_format
),
1656 item
->prefs
->compose_body_format
);
1658 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(page
->checkbtn_reply_with_format
),
1659 item
->prefs
->reply_with_format
);
1660 pref_set_entry_from_pref(GTK_ENTRY(page
->reply_quotemark
),
1661 item
->prefs
->reply_quotemark
);
1662 pref_set_entry_from_pref(GTK_ENTRY(page
->reply_override_from_format
),
1663 item
->prefs
->reply_override_from_format
);
1664 pref_set_textview_from_pref(GTK_TEXT_VIEW(page
->reply_body_format
),
1665 item
->prefs
->reply_body_format
);
1667 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(page
->checkbtn_forward_with_format
),
1668 item
->prefs
->forward_with_format
);
1669 pref_set_entry_from_pref(GTK_ENTRY(page
->forward_quotemark
),
1670 item
->prefs
->forward_quotemark
);
1671 pref_set_entry_from_pref(GTK_ENTRY(page
->forward_override_from_format
),
1672 item
->prefs
->forward_override_from_format
);
1673 pref_set_textview_from_pref(GTK_TEXT_VIEW(page
->forward_body_format
),
1674 item
->prefs
->forward_body_format
);
1676 gtk_widget_show_all(page_vbox
);
1678 page
->window
= GTK_WIDGET(window
);
1680 page
->new_msg_format_rec_checkbtn
= new_msg_format_rec_checkbtn
;
1681 page
->reply_format_rec_checkbtn
= reply_format_rec_checkbtn
;
1682 page
->forward_format_rec_checkbtn
= forward_format_rec_checkbtn
;
1684 page
->page
.widget
= page_vbox
;
1687 static void prefs_folder_item_templates_destroy_widget_func(PrefsPage
*page_
)
1689 FolderItemTemplatesPage
*page
= (FolderItemTemplatesPage
*) page_
;
1691 if (page
->compose_override_from_format
)
1692 address_completion_unregister_entry(GTK_ENTRY(page
->compose_override_from_format
));
1693 if (page
->reply_override_from_format
)
1694 address_completion_unregister_entry(GTK_ENTRY(page
->reply_override_from_format
));
1695 if (page
->forward_override_from_format
)
1696 address_completion_unregister_entry(GTK_ENTRY(page
->forward_override_from_format
));
1699 /** \brief Save the prefs in page to folder.
1701 * If the folder is not the one specified in page->item, then only those properties
1702 * that have the relevant 'apply to sub folders' button checked are saved
1704 static void templates_save_folder_prefs(FolderItem
*folder
, FolderItemTemplatesPage
*page
)
1706 FolderItemPrefs
*prefs
= folder
->prefs
;
1707 gboolean all
= FALSE
;
1709 if (folder
->path
== NULL
)
1712 if (page
->item
== folder
)
1715 cm_return_if_fail(prefs
!= NULL
);
1717 /* save and check formats */
1719 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->new_msg_format_rec_checkbtn
))) {
1721 prefs
->compose_with_format
=
1722 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_compose_with_format
));
1723 prefs
->compose_override_from_format
= pref_get_pref_from_entry(
1724 GTK_ENTRY(page
->compose_override_from_format
));
1725 prefs
->compose_subject_format
= pref_get_pref_from_entry(
1726 GTK_ENTRY(page
->compose_subject_format
));
1727 prefs
->compose_body_format
= pref_get_pref_from_textview(
1728 GTK_TEXT_VIEW(page
->compose_body_format
));
1729 quotefmt_check_new_msg_formats(prefs
->compose_with_format
,
1730 prefs
->compose_override_from_format
,
1731 prefs
->compose_subject_format
,
1732 prefs
->compose_body_format
);
1735 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->reply_format_rec_checkbtn
))) {
1736 prefs
->reply_with_format
=
1737 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_reply_with_format
));
1738 prefs
->reply_quotemark
= gtk_editable_get_chars(
1739 GTK_EDITABLE(page
->reply_quotemark
), 0, -1);
1740 prefs
->reply_override_from_format
= pref_get_pref_from_entry(
1741 GTK_ENTRY(page
->reply_override_from_format
));
1742 prefs
->reply_body_format
= pref_get_pref_from_textview(
1743 GTK_TEXT_VIEW(page
->reply_body_format
));
1744 quotefmt_check_reply_formats(prefs
->reply_with_format
,
1745 prefs
->reply_override_from_format
,
1746 prefs
->reply_quotemark
,
1747 prefs
->reply_body_format
);
1750 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->forward_format_rec_checkbtn
))) {
1751 prefs
->forward_with_format
=
1752 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_forward_with_format
));
1753 prefs
->forward_quotemark
= gtk_editable_get_chars(
1754 GTK_EDITABLE(page
->forward_quotemark
), 0, -1);
1755 prefs
->forward_override_from_format
= pref_get_pref_from_entry(
1756 GTK_ENTRY(page
->forward_override_from_format
));
1757 prefs
->forward_body_format
= pref_get_pref_from_textview(
1758 GTK_TEXT_VIEW(page
->forward_body_format
));
1759 quotefmt_check_forward_formats(prefs
->forward_with_format
,
1760 prefs
->forward_override_from_format
,
1761 prefs
->forward_quotemark
,
1762 prefs
->forward_body_format
);
1765 folder_item_prefs_save_config(folder
);
1768 static gboolean
templates_save_recurse_func(GNode
*node
, gpointer data
)
1770 FolderItem
*item
= (FolderItem
*) node
->data
;
1771 FolderItemTemplatesPage
*page
= (FolderItemTemplatesPage
*) data
;
1773 cm_return_val_if_fail(item
!= NULL
, TRUE
);
1774 cm_return_val_if_fail(page
!= NULL
, TRUE
);
1776 templates_save_folder_prefs(item
, page
);
1778 /* optimise by not continuing if none of the 'apply to sub folders'
1779 check boxes are selected - and optimise the checking by only doing
1781 if ((node
== page
->item
->node
) &&
1782 !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->new_msg_format_rec_checkbtn
)) ||
1783 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->reply_format_rec_checkbtn
)) ||
1784 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->forward_format_rec_checkbtn
))))
1792 static void prefs_folder_item_templates_save_func(PrefsPage
*page_
)
1794 FolderItemTemplatesPage
*page
= (FolderItemTemplatesPage
*) page_
;
1796 g_node_traverse(page
->item
->node
, G_PRE_ORDER
, G_TRAVERSE_ALL
,
1797 -1, templates_save_recurse_func
, page
);
1801 static void clean_cache_cb(GtkWidget
*widget
, gpointer data
)
1803 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*) data
;
1804 FolderItem
*item
= page
->item
;
1805 gboolean was_open
= FALSE
;
1806 FolderView
*folderview
= NULL
;
1808 if (alertpanel_full(_("Discard cache"),
1809 _("Do you really want to discard the local cached "
1810 "data for this folder?"),
1811 NULL
, _("_Cancel"), NULL
, _("Discard"), NULL
, NULL
,
1812 ALERTFOCUS_SECOND
, FALSE
, NULL
, ALERT_WARNING
)
1813 != G_ALERTALTERNATE
)
1816 if (mainwindow_get_mainwindow())
1817 folderview
= mainwindow_get_mainwindow()->folderview
;
1819 if (folderview
&& item
->opened
) {
1820 folderview_close_opened(folderview
, FALSE
);
1823 folder_item_discard_cache(item
);
1825 folderview_select(folderview
,item
);
1828 static regex_t
*summary_compile_simplify_regexp(gchar
*simplify_subject_regexp
)
1831 gchar buf
[BUFFSIZE
];
1832 regex_t
*preg
= NULL
;
1834 preg
= g_new0(regex_t
, 1);
1836 err
= regcomp(preg
, simplify_subject_regexp
, REG_EXTENDED
);
1838 regerror(err
, preg
, buf
, BUFFSIZE
);
1847 static void folder_regexp_test_cb(GtkWidget
*widget
, gpointer data
)
1849 GdkColor red
= { (guint32
)0, (guint16
)0xff, (guint16
)0x70, (guint16
)0x70 };
1850 static gchar buf
[BUFFSIZE
];
1851 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*)data
;
1852 gchar
*test_string
, *regexp
;
1855 regexp
= g_strdup(gtk_entry_get_text(GTK_ENTRY(page
->entry_simplify_subject
)));
1856 test_string
= g_strdup(gtk_entry_get_text(GTK_ENTRY(page
->entry_regexp_test_string
)));
1858 if (!regexp
|| !regexp
[0]) {
1859 gtk_widget_modify_base(page
->entry_simplify_subject
,
1860 GTK_STATE_NORMAL
, NULL
);
1862 gtk_entry_set_text(GTK_ENTRY(page
->entry_regexp_test_result
), test_string
);
1864 g_free(test_string
);
1869 if (!test_string
|| !test_string
[0]) {
1870 g_free(test_string
);
1875 preg
= summary_compile_simplify_regexp(regexp
);
1877 gtk_widget_modify_base(page
->entry_simplify_subject
,
1878 GTK_STATE_NORMAL
, preg
? NULL
: &red
);
1881 string_remove_match(buf
, BUFFSIZE
, test_string
, preg
);
1883 gtk_entry_set_text(GTK_ENTRY(page
->entry_regexp_test_result
), buf
);
1889 g_free(test_string
);
1893 static gchar
*folder_regexp_get_subject_example(void)
1895 MsgInfo
*msginfo_selected
;
1896 SummaryView
*summaryview
= NULL
;
1898 if (!mainwindow_get_mainwindow())
1900 summaryview
= mainwindow_get_mainwindow()->summaryview
;
1902 msginfo_selected
= summary_get_selected_msg(summaryview
);
1903 return msginfo_selected
? g_strdup(msginfo_selected
->subject
) : NULL
;
1906 static void folder_regexp_set_subject_example_cb(GtkWidget
*widget
, gpointer data
)
1908 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*)data
;
1910 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_simplify_subject
))) {
1911 gchar
*subject
= folder_regexp_get_subject_example();
1913 gtk_entry_set_text(GTK_ENTRY(page
->entry_regexp_test_string
), subject
);
1919 static void register_general_page()
1921 static gchar
*pfi_general_path
[2];
1922 static FolderItemGeneralPage folder_item_general_page
;
1924 pfi_general_path
[0] = _("General");
1925 pfi_general_path
[1] = NULL
;
1927 folder_item_general_page
.page
.path
= pfi_general_path
;
1928 folder_item_general_page
.page
.create_widget
= prefs_folder_item_general_create_widget_func
;
1929 folder_item_general_page
.page
.destroy_widget
= prefs_folder_item_general_destroy_widget_func
;
1930 folder_item_general_page
.page
.save_page
= prefs_folder_item_general_save_func
;
1932 prefs_folder_item_register_page((PrefsPage
*) &folder_item_general_page
, NULL
);
1936 static void register_compose_page(void)
1938 static gchar
*pfi_compose_path
[2];
1939 static FolderItemComposePage folder_item_compose_page
;
1941 pfi_compose_path
[0] = _("Compose");
1942 pfi_compose_path
[1] = NULL
;
1944 folder_item_compose_page
.page
.path
= pfi_compose_path
;
1945 folder_item_compose_page
.page
.create_widget
= prefs_folder_item_compose_create_widget_func
;
1946 folder_item_compose_page
.page
.destroy_widget
= prefs_folder_item_compose_destroy_widget_func
;
1947 folder_item_compose_page
.page
.save_page
= prefs_folder_item_compose_save_func
;
1949 prefs_folder_item_register_page((PrefsPage
*) &folder_item_compose_page
, NULL
);
1952 static void register_templates_page(void)
1954 static gchar
*pfi_templates_path
[2];
1955 static FolderItemTemplatesPage folder_item_templates_page
;
1957 pfi_templates_path
[0] = _("Templates");
1958 pfi_templates_path
[1] = NULL
;
1960 folder_item_templates_page
.page
.path
= pfi_templates_path
;
1961 folder_item_templates_page
.page
.create_widget
= prefs_folder_item_templates_create_widget_func
;
1962 folder_item_templates_page
.page
.destroy_widget
= prefs_folder_item_templates_destroy_widget_func
;
1963 folder_item_templates_page
.page
.save_page
= prefs_folder_item_templates_save_func
;
1965 prefs_folder_item_register_page((PrefsPage
*) &folder_item_templates_page
, NULL
);
1968 static GSList
*prefs_pages
= NULL
;
1970 static void prefs_folder_item_address_completion_start(PrefsWindow
*window
)
1972 address_completion_start(window
->window
);
1975 static void prefs_folder_item_address_completion_end(PrefsWindow
*window
)
1977 address_completion_end(window
->window
);
1980 void prefs_folder_item_open(FolderItem
*item
)
1985 if (prefs_pages
== NULL
) {
1986 register_general_page();
1987 register_compose_page();
1988 register_templates_page();
1992 id
= folder_item_get_identifier (item
);
1995 id
= g_strdup(item
->name
);
1999 pages
= g_slist_concat(
2000 g_slist_copy(prefs_pages
),
2001 g_slist_copy(item
->folder
->klass
->prefs_pages
));
2003 title
= g_strdup_printf (_("Properties for folder %s"), id
);
2005 prefswindow_open(title
, pages
, item
,
2006 &prefs_common
.folderitemwin_width
, &prefs_common
.folderitemwin_height
,
2007 prefs_folder_item_address_completion_start
,
2009 prefs_folder_item_address_completion_end
);
2011 g_slist_free(pages
);
2015 void prefs_folder_item_register_page(PrefsPage
*page
, FolderClass
*klass
)
2018 klass
->prefs_pages
= g_slist_append(klass
->prefs_pages
, page
);
2020 prefs_pages
= g_slist_append(prefs_pages
, page
);
2023 void prefs_folder_item_unregister_page(PrefsPage
*page
, FolderClass
*klass
)
2026 klass
->prefs_pages
= g_slist_remove(klass
->prefs_pages
, page
);
2028 prefs_pages
= g_slist_remove(prefs_pages
, page
);