2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2022 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"
53 #include "gtkaspell.h"
56 #define ASSIGN_STRING(string, value) \
62 typedef struct _FolderItemGeneralPage FolderItemGeneralPage
;
63 typedef struct _FolderItemComposePage FolderItemComposePage
;
64 typedef struct _FolderItemTemplatesPage FolderItemTemplatesPage
;
65 static gboolean can_save
= TRUE
;
67 struct _FolderItemGeneralPage
74 GtkWidget
*no_save_warning
;
75 GtkWidget
*folder_type
;
76 GtkWidget
*checkbtn_simplify_subject
;
77 GtkWidget
*entry_simplify_subject
;
78 GtkWidget
*entry_regexp_test_string
;
79 GtkWidget
*entry_regexp_test_result
;
80 GtkWidget
*checkbtn_folder_chmod
;
81 GtkWidget
*entry_folder_chmod
;
82 GtkWidget
*folder_color_btn
;
83 GtkWidget
*checkbtn_enable_processing
;
84 GtkWidget
*checkbtn_enable_processing_when_opening
;
85 GtkWidget
*checkbtn_newmailcheck
;
86 GtkWidget
*checkbtn_skip_on_goto_unread_or_new
;
87 GtkWidget
*checkbtn_offlinesync
;
88 GtkWidget
*label_offlinesync
;
89 GtkWidget
*entry_offlinesync
;
90 GtkWidget
*label_end_offlinesync
;
91 GtkWidget
*checkbtn_remove_old_offlinesync
;
92 GtkWidget
*promote_html_part
;
94 /* apply to sub folders */
95 GtkWidget
*simplify_subject_rec_checkbtn
;
96 GtkWidget
*folder_chmod_rec_checkbtn
;
97 GtkWidget
*folder_color_rec_checkbtn
;
98 GtkWidget
*enable_processing_rec_checkbtn
;
99 GtkWidget
*enable_processing_when_opening_rec_checkbtn
;
100 GtkWidget
*newmailcheck_rec_checkbtn
;
101 GtkWidget
*skip_on_goto_unread_or_new_rec_checkbtn
;
102 GtkWidget
*offlinesync_rec_checkbtn
;
103 GtkWidget
*promote_html_part_rec_checkbtn
;
105 GdkRGBA folder_color
;
108 struct _FolderItemComposePage
116 GtkWidget
*no_save_warning
;
117 GtkWidget
*checkbtn_request_return_receipt
;
118 GtkWidget
*checkbtn_save_copy_to_folder
;
119 GtkWidget
*checkbtn_default_from
;
120 GtkWidget
*entry_default_from
;
121 GtkWidget
*checkbtn_default_to
;
122 GtkWidget
*entry_default_to
;
123 GtkWidget
*checkbtn_default_reply_to
;
124 GtkWidget
*entry_default_reply_to
;
125 GtkWidget
*checkbtn_default_cc
;
126 GtkWidget
*entry_default_cc
;
127 GtkWidget
*checkbtn_default_bcc
;
128 GtkWidget
*entry_default_bcc
;
129 GtkWidget
*checkbtn_default_replyto
;
130 GtkWidget
*entry_default_replyto
;
131 GtkWidget
*checkbtn_enable_default_account
;
132 GtkWidget
*optmenu_default_account
;
134 GtkWidget
*checkbtn_enable_default_dictionary
;
135 GtkWidget
*checkbtn_enable_default_alt_dictionary
;
136 GtkWidget
*combo_default_dictionary
;
137 GtkWidget
*combo_default_alt_dictionary
;
139 GtkWidget
*always_sign
;
140 GtkWidget
*always_encrypt
;
142 /* apply to sub folders */
143 GtkWidget
*request_return_receipt_rec_checkbtn
;
144 GtkWidget
*save_copy_to_folder_rec_checkbtn
;
145 GtkWidget
*default_from_rec_checkbtn
;
146 GtkWidget
*default_to_rec_checkbtn
;
147 GtkWidget
*default_reply_to_rec_checkbtn
;
148 GtkWidget
*default_cc_rec_checkbtn
;
149 GtkWidget
*default_bcc_rec_checkbtn
;
150 GtkWidget
*default_replyto_rec_checkbtn
;
151 GtkWidget
*default_account_rec_checkbtn
;
153 GtkWidget
*default_dictionary_rec_checkbtn
;
154 GtkWidget
*default_alt_dictionary_rec_checkbtn
;
156 GtkWidget
*always_sign_rec_checkbtn
;
157 GtkWidget
*always_encrypt_rec_checkbtn
;
160 struct _FolderItemTemplatesPage
168 GtkWidget
*checkbtn_compose_with_format
;
169 GtkWidget
*compose_override_from_format
;
170 GtkWidget
*compose_subject_format
;
171 GtkWidget
*compose_body_format
;
172 GtkWidget
*checkbtn_reply_with_format
;
173 GtkWidget
*reply_quotemark
;
174 GtkWidget
*reply_override_from_format
;
175 GtkWidget
*reply_body_format
;
176 GtkWidget
*checkbtn_forward_with_format
;
177 GtkWidget
*forward_quotemark
;
178 GtkWidget
*forward_override_from_format
;
179 GtkWidget
*forward_body_format
;
181 /* apply to sub folders */
182 GtkWidget
*new_msg_format_rec_checkbtn
;
183 GtkWidget
*reply_format_rec_checkbtn
;
184 GtkWidget
*forward_format_rec_checkbtn
;
188 static void general_save_folder_prefs(FolderItem
*folder
, FolderItemGeneralPage
*page
);
189 static void compose_save_folder_prefs(FolderItem
*folder
, FolderItemComposePage
*page
);
190 static void templates_save_folder_prefs(FolderItem
*folder
, FolderItemTemplatesPage
*page
);
192 static gboolean
general_save_recurse_func(GNode
*node
, gpointer data
);
193 static gboolean
compose_save_recurse_func(GNode
*node
, gpointer data
);
194 static gboolean
templates_save_recurse_func(GNode
*node
, gpointer data
);
196 static gint
prefs_folder_item_chmod_mode (gchar
*folder_chmod
);
198 static void clean_cache_cb(GtkWidget
*widget
, gpointer data
);
199 static void folder_regexp_test_cb(GtkWidget
*widget
, gpointer data
);
200 static void folder_regexp_set_subject_example_cb(GtkWidget
*widget
, gpointer data
);
202 #define SAFE_STRING(str) \
205 static GtkWidget
*prefs_folder_no_save_warning_create_widget() {
210 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
212 icon
= stock_pixmap_widget(STOCK_PIXMAP_NOTICE_WARN
);
213 gtk_box_pack_start(GTK_BOX(hbox
), icon
, FALSE
, FALSE
, 8);
215 label
= gtk_label_new(g_strconcat("<i>",
216 _("These preferences will not be saved as this folder "
217 "is a top-level folder.\nHowever, you can set them for the "
218 "whole mailbox tree by using \"Apply to subfolders\"."),
220 gtk_label_set_use_markup(GTK_LABEL(label
), TRUE
);
221 gtk_label_set_xalign(GTK_LABEL(label
), 0.0);
222 gtk_box_pack_start(GTK_BOX(hbox
), label
, TRUE
, TRUE
, 0);
227 static void prefs_folder_item_general_create_widget_func(PrefsPage
* page_
,
231 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*) page_
;
232 FolderItem
*item
= (FolderItem
*) data
;
236 GtkWidget
*hbox
, *hbox2
, *hbox_spc
;
237 GtkWidget
*box1
, *box2
;
240 GtkListStore
*folder_type_menu
;
241 GtkWidget
*folder_type
;
243 GtkWidget
*dummy_checkbtn
, *clean_cache_btn
;
244 SpecialFolderItemType type
;
245 GtkWidget
*no_save_warning
= NULL
;
247 GtkWidget
*checkbtn_simplify_subject
;
248 GtkWidget
*entry_simplify_subject
;
249 GtkWidget
*label_regexp_test
;
250 GtkWidget
*entry_regexp_test_string
;
251 GtkWidget
*label_regexp_result
;
252 GtkWidget
*entry_regexp_test_result
;
254 GtkWidget
*checkbtn_folder_chmod
;
255 GtkWidget
*entry_folder_chmod
;
256 GtkWidget
*folder_color
;
257 GtkWidget
*folder_color_btn
;
258 GtkWidget
*checkbtn_enable_processing
;
259 GtkWidget
*checkbtn_enable_processing_when_opening
;
260 GtkWidget
*checkbtn_newmailcheck
;
261 GtkWidget
*checkbtn_skip_on_goto_unread_or_new
;
262 GtkWidget
*checkbtn_offlinesync
;
263 GtkWidget
*label_offlinesync
;
264 GtkWidget
*entry_offlinesync
;
265 GtkWidget
*label_end_offlinesync
;
266 GtkWidget
*checkbtn_remove_old_offlinesync
;
267 GtkWidget
*promote_html_part
;
268 GtkListStore
*promote_html_part_menu
;
270 GtkWidget
*simplify_subject_rec_checkbtn
;
272 GtkWidget
*folder_chmod_rec_checkbtn
;
273 GtkWidget
*folder_color_rec_checkbtn
;
274 GtkWidget
*enable_processing_rec_checkbtn
;
275 GtkWidget
*enable_processing_when_opening_rec_checkbtn
;
276 GtkWidget
*newmailcheck_rec_checkbtn
;
277 GtkWidget
*skip_on_goto_unread_or_new_rec_checkbtn
;
278 GtkWidget
*offlinesync_rec_checkbtn
;
279 GtkWidget
*promote_html_part_rec_checkbtn
;
286 table
= gtk_grid_new();
287 gtk_container_set_border_width (GTK_CONTAINER (table
), VBOX_BORDER
);
288 gtk_grid_set_row_spacing(GTK_GRID(table
), 4);
289 gtk_grid_set_column_spacing(GTK_GRID(table
), 4);
294 no_save_warning
= prefs_folder_no_save_warning_create_widget();
295 gtk_grid_attach(GTK_GRID(table
), no_save_warning
, 0, rowcount
, 1, 1);
299 /* Apply to subfolders */
300 label
= gtk_label_new(_("Apply to\nsubfolders"));
301 gtk_grid_attach(GTK_GRID(table
), label
, 2, rowcount
, 1, 1);
305 folder_type
= gtkut_sc_combobox_create(NULL
, FALSE
);
306 gtk_widget_show (folder_type
);
309 if (item
->stype
== F_INBOX
)
311 else if (folder_has_parent_of_type(item
, F_OUTBOX
))
313 else if (folder_has_parent_of_type(item
, F_DRAFT
))
315 else if (folder_has_parent_of_type(item
, F_QUEUE
))
317 else if (folder_has_parent_of_type(item
, F_TRASH
))
320 folder_type_menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
321 GTK_COMBO_BOX(folder_type
)));
323 COMBOBOX_ADD (folder_type_menu
, _("Normal"), F_NORMAL
);
324 COMBOBOX_ADD (folder_type_menu
, _("Inbox"), F_INBOX
);
325 COMBOBOX_ADD (folder_type_menu
, _("Outbox"), F_OUTBOX
);
326 COMBOBOX_ADD (folder_type_menu
, _("Drafts"), F_DRAFT
);
327 COMBOBOX_ADD (folder_type_menu
, _("Queue"), F_QUEUE
);
328 COMBOBOX_ADD (folder_type_menu
, _("Trash"), F_TRASH
);
330 combobox_select_by_data(GTK_COMBO_BOX(folder_type
), type
);
332 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
333 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
334 gtk_box_pack_start(GTK_BOX(box1
), box2
, FALSE
, FALSE
, 0);
336 label
= gtk_label_new(_("Folder type"));
337 gtk_label_set_xalign(GTK_LABEL(label
), 0.0);
338 gtk_box_pack_start(GTK_BOX(box2
), label
, FALSE
, FALSE
, 0);
339 gtk_box_pack_start(GTK_BOX(box2
), folder_type
, FALSE
, FALSE
, 0);
340 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
342 dummy_checkbtn
= gtk_check_button_new();
343 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dummy_checkbtn
), type
!= F_INBOX
);
344 gtk_widget_set_sensitive(dummy_checkbtn
, FALSE
);
346 if (type
== item
->stype
&& type
== F_NORMAL
)
347 gtk_widget_set_sensitive(folder_type
, TRUE
);
349 gtk_widget_set_sensitive(folder_type
, FALSE
);
351 gtk_grid_attach(GTK_GRID(table
), dummy_checkbtn
, 2, rowcount
, 1, 1);
355 /* Simplify Subject */
356 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
357 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
358 gtk_box_pack_start(GTK_BOX(box1
), box2
, TRUE
, TRUE
, 0);
360 checkbtn_simplify_subject
= gtk_check_button_new_with_label(_("Simplify Subject RegExp"));
361 gtk_box_pack_start(GTK_BOX(box2
), checkbtn_simplify_subject
, FALSE
, FALSE
, 0);
362 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_simplify_subject
),
363 item
->prefs
->enable_simplify_subject
);
364 g_signal_connect(G_OBJECT(checkbtn_simplify_subject
), "toggled",
365 G_CALLBACK(folder_regexp_set_subject_example_cb
), page
);
367 entry_simplify_subject
= gtk_entry_new();
368 gtk_box_pack_start(GTK_BOX(box2
), entry_simplify_subject
, TRUE
, TRUE
, 0);
369 SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject
, entry_simplify_subject
);
370 gtk_entry_set_text(GTK_ENTRY(entry_simplify_subject
),
371 SAFE_STRING(item
->prefs
->simplify_subject_regexp
));
373 g_signal_connect(G_OBJECT(entry_simplify_subject
), "changed",
374 G_CALLBACK(folder_regexp_test_cb
), page
);
376 simplify_subject_rec_checkbtn
= gtk_check_button_new();
377 gtk_grid_attach(GTK_GRID(table
), simplify_subject_rec_checkbtn
, 2, rowcount
, 1, 1);
378 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
383 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
384 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
385 gtk_box_pack_start(GTK_BOX(box1
), box2
, TRUE
, TRUE
, 0);
387 label_regexp_test
= gtk_label_new(_("Test string"));
388 gtk_box_pack_start(GTK_BOX(box2
), label_regexp_test
, FALSE
, FALSE
, 0);
389 gtk_label_set_xalign(GTK_LABEL(label_regexp_test
), 1);
390 SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject
, label_regexp_test
);
392 entry_regexp_test_string
= gtk_entry_new();
393 gtk_box_pack_start(GTK_BOX(box2
), entry_regexp_test_string
, TRUE
, TRUE
, 0);
394 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
396 SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject
, entry_regexp_test_string
);
398 g_signal_connect(G_OBJECT(entry_regexp_test_string
), "changed",
399 G_CALLBACK(folder_regexp_test_cb
), page
);
404 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
405 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
406 gtk_box_pack_start(GTK_BOX(box1
), box2
, TRUE
, TRUE
, 0);
408 label_regexp_result
= gtk_label_new(_("Result"));
409 gtk_box_pack_start(GTK_BOX(box2
), label_regexp_result
, FALSE
, FALSE
, 0);
410 gtk_label_set_xalign(GTK_LABEL(label_regexp_result
), 1);
411 SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject
, label_regexp_result
);
413 entry_regexp_test_result
= gtk_entry_new();
414 gtk_box_pack_start(GTK_BOX(box2
), entry_regexp_test_result
, TRUE
, TRUE
, 0);
415 SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject
, entry_regexp_test_result
);
416 gtk_editable_set_editable(GTK_EDITABLE(entry_regexp_test_result
), FALSE
);
417 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
422 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
423 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
424 gtk_box_pack_start(GTK_BOX(box1
), box2
, FALSE
, FALSE
, 0);
426 checkbtn_folder_chmod
= gtk_check_button_new_with_label(_("Folder chmod"));
427 gtk_box_pack_start(GTK_BOX(box2
), checkbtn_folder_chmod
, FALSE
, FALSE
, 0);
429 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_chmod
),
430 item
->prefs
->enable_folder_chmod
);
432 entry_folder_chmod
= gtk_entry_new();
433 gtk_box_pack_start(GTK_BOX(box2
), entry_folder_chmod
, FALSE
, FALSE
, 0);
434 SET_TOGGLE_SENSITIVITY(checkbtn_folder_chmod
, entry_folder_chmod
);
435 if (item
->prefs
->folder_chmod
) {
438 buf
= g_strdup_printf("%o", item
->prefs
->folder_chmod
);
439 gtk_entry_set_text(GTK_ENTRY(entry_folder_chmod
), buf
);
443 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
444 folder_chmod_rec_checkbtn
= gtk_check_button_new();
445 gtk_grid_attach(GTK_GRID(table
), folder_chmod_rec_checkbtn
, 2, rowcount
, 1, 1);
450 box1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
451 box2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
452 gtk_box_pack_start(GTK_BOX(box1
), box2
, FALSE
, FALSE
, 0);
454 folder_color
= gtk_label_new(_("Folder color"));
455 gtk_label_set_xalign(GTK_LABEL(folder_color
), 0.0);
456 gtk_box_pack_start(GTK_BOX(box2
), folder_color
, FALSE
, FALSE
, 0);
458 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
459 gtk_box_pack_start(GTK_BOX(box2
), hbox
, FALSE
, FALSE
, 0);
461 folder_color_btn
= gtk_color_button_new_with_rgba(
462 &item
->prefs
->color
);
463 gtk_color_button_set_title(GTK_COLOR_BUTTON(folder_color_btn
),
464 _("Pick color for folder"));
466 gtk_box_pack_start (GTK_BOX(hbox
), folder_color_btn
, FALSE
, FALSE
, 0);
467 CLAWS_SET_TIP(folder_color_btn
,
468 _("Pick color for folder"));
470 page
->folder_color
= item
->prefs
->color
;
472 gtk_grid_attach(GTK_GRID(table
), box1
, 0, rowcount
, 1, 1);
473 folder_color_rec_checkbtn
= gtk_check_button_new();
474 gtk_grid_attach(GTK_GRID(table
), folder_color_rec_checkbtn
, 2, rowcount
, 1, 1);
478 /* Enable processing at startup */
479 checkbtn_enable_processing
=
480 gtk_check_button_new_with_label(_("Run Processing rules at start-up"));
481 gtk_grid_attach(GTK_GRID(table
), checkbtn_enable_processing
, 0, rowcount
, 1, 1);
483 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_processing
),
484 item
->prefs
->enable_processing
);
486 enable_processing_rec_checkbtn
= gtk_check_button_new();
487 gtk_grid_attach(GTK_GRID(table
), enable_processing_rec_checkbtn
, 2, rowcount
, 1, 1);
491 /* Enable processing rules when opening folder */
492 checkbtn_enable_processing_when_opening
=
493 gtk_check_button_new_with_label(_("Run Processing rules when opening"));
494 gtk_grid_attach(GTK_GRID(table
), checkbtn_enable_processing_when_opening
, 0, rowcount
, 1, 1);
496 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_processing_when_opening
),
497 item
->prefs
->enable_processing_when_opening
);
499 enable_processing_when_opening_rec_checkbtn
= gtk_check_button_new();
500 gtk_grid_attach(GTK_GRID(table
), enable_processing_when_opening_rec_checkbtn
, 2, rowcount
, 1, 1);
504 /* Check folder for new mail */
505 checkbtn_newmailcheck
= gtk_check_button_new_with_label(_("Scan for new mail"));
506 CLAWS_SET_TIP(checkbtn_newmailcheck
,
507 _("Turn this option on if mail is delivered directly "
508 "to this folder by server side filtering on IMAP or "
509 "by an external application"));
510 gtk_grid_attach(GTK_GRID(table
), checkbtn_newmailcheck
, 0, rowcount
, 1, 1);
512 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_newmailcheck
),
513 item
->prefs
->newmailcheck
);
514 newmailcheck_rec_checkbtn
= gtk_check_button_new();
515 gtk_grid_attach(GTK_GRID(table
), newmailcheck_rec_checkbtn
, 2, rowcount
, 1, 1);
519 /* Select HTML part by default? */
520 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, VSPACING_NARROW_2
);
521 gtk_box_set_spacing(GTK_BOX(hbox
), 8);
522 gtk_grid_attach(GTK_GRID(table
), hbox
, 0, rowcount
, 1, 1);
524 label
= gtk_label_new(_("Select the HTML part of multipart messages"));
525 gtk_box_pack_start (GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
527 promote_html_part
= gtkut_sc_combobox_create (NULL
, FALSE
);
528 gtk_box_pack_start (GTK_BOX(hbox
), promote_html_part
, FALSE
, FALSE
, 0);
530 promote_html_part_menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
531 GTK_COMBO_BOX(promote_html_part
)));
532 COMBOBOX_ADD (promote_html_part_menu
, _("Default"), HTML_PROMOTE_DEFAULT
);
533 COMBOBOX_ADD (promote_html_part_menu
, _("No"), HTML_PROMOTE_NEVER
);
534 COMBOBOX_ADD (promote_html_part_menu
, _("Yes"), HTML_PROMOTE_ALWAYS
);
536 combobox_select_by_data(GTK_COMBO_BOX(promote_html_part
),
537 item
->prefs
->promote_html_part
);
539 CLAWS_SET_TIP(hbox
, _("\"Default\" will follow global preference (found in /Preferences/"
540 "Message View/Text Options)"));
542 promote_html_part_rec_checkbtn
= gtk_check_button_new();
543 gtk_grid_attach(GTK_GRID(table
), promote_html_part_rec_checkbtn
, 2, rowcount
, 1, 1);
547 /* Skip folder on 'goto unread (or new) message' */
548 checkbtn_skip_on_goto_unread_or_new
= gtk_check_button_new_with_label(
549 _("Skip folder when searching for unread or new messages"));
550 CLAWS_SET_TIP(checkbtn_skip_on_goto_unread_or_new
,
551 _("Turn this option on if you want this folder to be ignored "
552 "when searching for unread or new messages"));
553 gtk_grid_attach(GTK_GRID(table
), checkbtn_skip_on_goto_unread_or_new
, 0, rowcount
, 1, 1);
554 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_skip_on_goto_unread_or_new
),
555 item
->prefs
->skip_on_goto_unread_or_new
);
557 skip_on_goto_unread_or_new_rec_checkbtn
= gtk_check_button_new();
558 gtk_grid_attach(GTK_GRID(table
), skip_on_goto_unread_or_new_rec_checkbtn
, 2, rowcount
, 1, 1);
562 /* Synchronise folder for offline use */
563 checkbtn_offlinesync
= gtk_check_button_new_with_label(_("Synchronise for offline use"));
564 gtk_grid_attach(GTK_GRID(table
), checkbtn_offlinesync
, 0, rowcount
, 1, 1);
566 offlinesync_rec_checkbtn
= gtk_check_button_new();
567 gtk_grid_attach(GTK_GRID(table
), offlinesync_rec_checkbtn
, 2, rowcount
, 1, 1);
571 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
572 gtk_grid_attach(GTK_GRID(table
), hbox
, 0, rowcount
, 1, 1);
573 gtk_widget_set_hexpand(hbox
, TRUE
);
574 gtk_widget_set_halign(hbox
, GTK_ALIGN_FILL
);
578 hbox_spc
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
579 gtk_box_pack_start (GTK_BOX (hbox
), hbox_spc
, FALSE
, FALSE
, 0);
580 gtk_widget_set_size_request (hbox_spc
, 12, -1);
582 label_offlinesync
= gtk_label_new(_("Fetch message bodies from the last"));
583 gtk_box_pack_start (GTK_BOX (hbox
), label_offlinesync
, FALSE
, FALSE
, 0);
585 entry_offlinesync
= gtk_entry_new();
586 gtk_widget_set_size_request (entry_offlinesync
, 64, -1);
587 CLAWS_SET_TIP(entry_offlinesync
, _("0: all bodies"));
588 gtk_box_pack_start (GTK_BOX (hbox
), entry_offlinesync
, FALSE
, FALSE
, 0);
590 label_end_offlinesync
= gtk_label_new(_("days"));
591 gtk_box_pack_start (GTK_BOX (hbox
), label_end_offlinesync
, FALSE
, FALSE
, 0);
593 checkbtn_remove_old_offlinesync
= gtk_check_button_new_with_label(
594 _("Remove older messages bodies"));
596 hbox2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
597 gtk_grid_attach(GTK_GRID(table
), hbox2
, 0, rowcount
, 1, 1);
598 gtk_widget_set_hexpand(hbox2
, TRUE
);
599 gtk_widget_set_halign(hbox2
, GTK_ALIGN_FILL
);
603 hbox_spc
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
604 gtk_box_pack_start (GTK_BOX (hbox2
), hbox_spc
, FALSE
, FALSE
, 0);
605 gtk_widget_set_size_request (hbox_spc
, 12, -1);
606 gtk_box_pack_start (GTK_BOX (hbox2
), checkbtn_remove_old_offlinesync
, FALSE
, FALSE
, 0);
608 SET_TOGGLE_SENSITIVITY (checkbtn_offlinesync
, hbox
);
609 SET_TOGGLE_SENSITIVITY (checkbtn_offlinesync
, hbox2
);
611 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
612 clean_cache_btn
= gtk_button_new_with_label(_("Discard folder cache"));
613 gtk_box_pack_start (GTK_BOX (hbox
), clean_cache_btn
, FALSE
, FALSE
, 0);
614 gtk_widget_set_hexpand(hbox
, FALSE
);
615 gtk_widget_set_halign(hbox
, GTK_ALIGN_FILL
);
616 gtk_grid_attach(GTK_GRID(table
), hbox
, 0, rowcount
, 1, 1);
617 g_signal_connect(G_OBJECT(clean_cache_btn
), "clicked",
618 G_CALLBACK(clean_cache_cb
),
621 gtk_widget_show_all(table
);
623 /* line few widgets up now that we know their display size */
624 gtk_widget_get_preferred_width(label_regexp_test
, &wreq1
, NULL
);
625 gtk_widget_get_preferred_width(label_regexp_result
, &wreq2
, NULL
);
626 gtk_widget_set_size_request(label_regexp_test
, MAX(100, MAX(wreq1
, wreq2
)), -1);
627 gtk_widget_set_size_request(label_regexp_result
, MAX(100, MAX(wreq1
, wreq2
)), -1);
629 if (item
->folder
&& (item
->folder
->klass
->type
!= F_IMAP
&&
630 item
->folder
->klass
->type
!= F_NEWS
)) {
631 item
->prefs
->offlinesync
= TRUE
;
632 item
->prefs
->offlinesync_days
= 0;
633 item
->prefs
->remove_old_bodies
= FALSE
;
635 gtk_widget_set_sensitive(GTK_WIDGET(checkbtn_offlinesync
),
637 gtk_widget_set_sensitive(GTK_WIDGET(offlinesync_rec_checkbtn
),
639 gtk_widget_hide(GTK_WIDGET(checkbtn_offlinesync
));
640 gtk_widget_hide(GTK_WIDGET(hbox
));
641 gtk_widget_hide(GTK_WIDGET(hbox2
));
642 gtk_widget_hide(GTK_WIDGET(offlinesync_rec_checkbtn
));
643 gtk_widget_hide(GTK_WIDGET(label_offlinesync
));
644 gtk_widget_hide(GTK_WIDGET(entry_offlinesync
));
645 gtk_widget_hide(GTK_WIDGET(label_end_offlinesync
));
646 gtk_widget_hide(GTK_WIDGET(checkbtn_remove_old_offlinesync
));
647 gtk_widget_hide(GTK_WIDGET(clean_cache_btn
));
650 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_offlinesync
),
651 item
->prefs
->offlinesync
);
652 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_remove_old_offlinesync
),
653 item
->prefs
->remove_old_bodies
);
654 gtk_entry_set_text(GTK_ENTRY(entry_offlinesync
), itos(item
->prefs
->offlinesync_days
));
657 page
->folder_type
= folder_type
;
658 page
->no_save_warning
= no_save_warning
;
660 page
->checkbtn_simplify_subject
= checkbtn_simplify_subject
;
661 page
->entry_simplify_subject
= entry_simplify_subject
;
662 page
->entry_regexp_test_string
= entry_regexp_test_string
;
663 page
->entry_regexp_test_result
= entry_regexp_test_result
;
665 page
->checkbtn_folder_chmod
= checkbtn_folder_chmod
;
666 page
->entry_folder_chmod
= entry_folder_chmod
;
667 page
->folder_color_btn
= folder_color_btn
;
668 page
->checkbtn_enable_processing
= checkbtn_enable_processing
;
669 page
->checkbtn_enable_processing_when_opening
= checkbtn_enable_processing_when_opening
;
670 page
->checkbtn_newmailcheck
= checkbtn_newmailcheck
;
671 page
->checkbtn_skip_on_goto_unread_or_new
= checkbtn_skip_on_goto_unread_or_new
;
672 page
->checkbtn_offlinesync
= checkbtn_offlinesync
;
673 page
->label_offlinesync
= label_offlinesync
;
674 page
->entry_offlinesync
= entry_offlinesync
;
675 page
->label_end_offlinesync
= label_end_offlinesync
;
676 page
->checkbtn_remove_old_offlinesync
= checkbtn_remove_old_offlinesync
;
677 page
->promote_html_part
= promote_html_part
;
679 page
->simplify_subject_rec_checkbtn
= simplify_subject_rec_checkbtn
;
681 page
->folder_chmod_rec_checkbtn
= folder_chmod_rec_checkbtn
;
682 page
->folder_color_rec_checkbtn
= folder_color_rec_checkbtn
;
683 page
->enable_processing_rec_checkbtn
= enable_processing_rec_checkbtn
;
684 page
->enable_processing_when_opening_rec_checkbtn
= enable_processing_when_opening_rec_checkbtn
;
685 page
->newmailcheck_rec_checkbtn
= newmailcheck_rec_checkbtn
;
686 page
->skip_on_goto_unread_or_new_rec_checkbtn
= skip_on_goto_unread_or_new_rec_checkbtn
;
687 page
->offlinesync_rec_checkbtn
= offlinesync_rec_checkbtn
;
688 page
->promote_html_part_rec_checkbtn
= promote_html_part_rec_checkbtn
;
690 page
->page
.widget
= table
;
692 folder_regexp_set_subject_example_cb(NULL
, page
);
695 static void prefs_folder_item_general_destroy_widget_func(PrefsPage
*page_
)
697 /* FolderItemGeneralPage *page = (FolderItemGeneralPage *) page_; */
700 /** \brief Save the prefs in page to folder.
702 * If the folder is not the one specified in page->item, then only those properties
703 * that have the relevant 'apply to sub folders' button checked are saved
705 static void general_save_folder_prefs(FolderItem
*folder
, FolderItemGeneralPage
*page
)
707 FolderItemPrefs
*prefs
= folder
->prefs
;
709 gboolean all
= FALSE
, summary_update_needed
= FALSE
;
710 SpecialFolderItemType type
= F_NORMAL
;
711 FolderView
*folderview
= mainwindow_get_mainwindow()->folderview
;
712 HTMLPromoteType promote_html_part
= HTML_PROMOTE_DEFAULT
;
714 if (folder
->path
== NULL
)
717 cm_return_if_fail(prefs
!= NULL
);
719 if (page
->item
== folder
)
722 type
= combobox_get_active_data(GTK_COMBO_BOX(page
->folder_type
));
723 if (all
&& folder
->stype
!= type
&& page
->item
->parent_stype
== F_NORMAL
) {
724 folder_item_change_type(folder
, type
);
725 summary_update_needed
= TRUE
;
729 combobox_get_active_data(GTK_COMBO_BOX(page
->promote_html_part
));
730 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->promote_html_part_rec_checkbtn
)))
731 prefs
->promote_html_part
= promote_html_part
;
733 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->simplify_subject_rec_checkbtn
))) {
734 gboolean old_simplify_subject
= prefs
->enable_simplify_subject
;
735 int regexp_diffs
= g_strcmp0(prefs
->simplify_subject_regexp
, gtk_editable_get_chars(
736 GTK_EDITABLE(page
->entry_simplify_subject
), 0, -1));
737 prefs
->enable_simplify_subject
=
738 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_simplify_subject
));
739 ASSIGN_STRING(prefs
->simplify_subject_regexp
,
740 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_simplify_subject
), 0, -1));
741 if (old_simplify_subject
!= prefs
->enable_simplify_subject
|| regexp_diffs
!= 0)
742 summary_update_needed
= TRUE
;
745 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->folder_chmod_rec_checkbtn
))) {
746 prefs
->enable_folder_chmod
=
747 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_folder_chmod
));
748 buf
= gtk_editable_get_chars(GTK_EDITABLE(page
->entry_folder_chmod
), 0, -1);
749 prefs
->folder_chmod
= prefs_folder_item_chmod_mode(buf
);
753 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->folder_color_rec_checkbtn
))) {
754 GdkRGBA old_color
= prefs
->color
;
755 gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(page
->folder_color_btn
),
758 /* update folder view */
759 if (!gdk_rgba_equal(&prefs
->color
, &old_color
))
760 folder_item_update(folder
, F_ITEM_UPDATE_MSGCNT
);
763 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->enable_processing_rec_checkbtn
))) {
764 prefs
->enable_processing
=
765 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_enable_processing
));
768 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->enable_processing_when_opening_rec_checkbtn
))) {
769 prefs
->enable_processing_when_opening
=
770 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_enable_processing_when_opening
));
773 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->newmailcheck_rec_checkbtn
))) {
774 prefs
->newmailcheck
=
775 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_newmailcheck
));
778 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->skip_on_goto_unread_or_new_rec_checkbtn
))) {
779 prefs
->skip_on_goto_unread_or_new
=
780 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_skip_on_goto_unread_or_new
));
783 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->offlinesync_rec_checkbtn
))) {
785 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_offlinesync
));
786 prefs
->offlinesync_days
=
787 atoi(gtk_entry_get_text(GTK_ENTRY(page
->entry_offlinesync
)));
788 prefs
->remove_old_bodies
=
789 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_remove_old_offlinesync
));
792 folder_item_prefs_save_config(folder
);
794 if (folder
->opened
&& summary_update_needed
) {
795 summary_set_prefs_from_folderitem(folderview
->summaryview
, folder
);
796 summary_show(folderview
->summaryview
, folder
, FALSE
);
800 static gboolean
general_save_recurse_func(GNode
*node
, gpointer data
)
802 FolderItem
*item
= (FolderItem
*) node
->data
;
803 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*) data
;
805 cm_return_val_if_fail(item
!= NULL
, TRUE
);
806 cm_return_val_if_fail(page
!= NULL
, TRUE
);
808 general_save_folder_prefs(item
, page
);
810 /* optimise by not continuing if none of the 'apply to sub folders'
811 check boxes are selected - and optimise the checking by only doing
813 if ((node
== page
->item
->node
) &&
815 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->simplify_subject_rec_checkbtn
)) ||
816 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->folder_chmod_rec_checkbtn
)) ||
817 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->folder_color_rec_checkbtn
)) ||
818 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->enable_processing_rec_checkbtn
)) ||
819 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->enable_processing_when_opening_rec_checkbtn
)) ||
820 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->newmailcheck_rec_checkbtn
)) ||
821 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->offlinesync_rec_checkbtn
)) ||
822 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->skip_on_goto_unread_or_new_rec_checkbtn
)) ||
823 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->promote_html_part_rec_checkbtn
))
830 static void prefs_folder_item_general_save_func(PrefsPage
*page_
)
832 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*) page_
;
834 g_node_traverse(page
->item
->node
, G_PRE_ORDER
, G_TRAVERSE_ALL
,
835 -1, general_save_recurse_func
, page
);
837 main_window_set_menu_sensitive(mainwindow_get_mainwindow());
841 static RecvProtocol
item_protocol(FolderItem
*item
)
847 if (!item
->folder
->account
)
849 return item
->folder
->account
->protocol
;
852 static void prefs_folder_item_compose_create_widget_func(PrefsPage
* page_
,
856 FolderItemComposePage
*page
= (FolderItemComposePage
*) page_
;
857 FolderItem
*item
= (FolderItem
*) data
;
866 GtkWidget
*no_save_warning
= NULL
;
867 GtkWidget
*checkbtn_request_return_receipt
= NULL
;
868 GtkWidget
*checkbtn_save_copy_to_folder
= NULL
;
869 GtkWidget
*checkbtn_default_from
= NULL
;
870 GtkWidget
*entry_default_from
= NULL
;
871 GtkWidget
*checkbtn_default_to
= NULL
;
872 GtkWidget
*entry_default_to
= NULL
;
873 GtkWidget
*checkbtn_default_reply_to
= NULL
;
874 GtkWidget
*entry_default_reply_to
= NULL
;
875 GtkWidget
*checkbtn_default_cc
= NULL
;
876 GtkWidget
*entry_default_cc
= NULL
;
877 GtkWidget
*checkbtn_default_bcc
= NULL
;
878 GtkWidget
*entry_default_bcc
= NULL
;
879 GtkWidget
*checkbtn_default_replyto
= NULL
;
880 GtkWidget
*entry_default_replyto
= NULL
;
881 GtkWidget
*checkbtn_enable_default_account
= NULL
;
882 GtkWidget
*optmenu_default_account
= NULL
;
883 GtkListStore
*optmenu_default_account_menu
= NULL
;
886 GtkWidget
*checkbtn_enable_default_dictionary
= NULL
;
887 GtkWidget
*combo_default_dictionary
= NULL
;
888 GtkWidget
*checkbtn_enable_default_alt_dictionary
= NULL
;
889 GtkWidget
*combo_default_alt_dictionary
= NULL
;
890 GtkWidget
*default_dictionary_rec_checkbtn
= NULL
;
891 GtkWidget
*default_alt_dictionary_rec_checkbtn
= NULL
;
894 GtkWidget
*always_sign
;
895 GtkListStore
*always_sign_menu
;
896 GtkWidget
*always_encrypt
;
897 GtkListStore
*always_encrypt_menu
;
898 GtkWidget
*request_return_receipt_rec_checkbtn
= NULL
;
899 GtkWidget
*save_copy_to_folder_rec_checkbtn
= NULL
;
900 GtkWidget
*default_from_rec_checkbtn
= NULL
;
901 GtkWidget
*default_to_rec_checkbtn
= NULL
;
902 GtkWidget
*default_reply_to_rec_checkbtn
= NULL
;
903 GtkWidget
*default_cc_rec_checkbtn
= NULL
;
904 GtkWidget
*default_bcc_rec_checkbtn
= NULL
;
905 GtkWidget
*default_replyto_rec_checkbtn
= NULL
;
906 GtkWidget
*default_account_rec_checkbtn
= NULL
;
907 GtkWidget
*always_sign_rec_checkbtn
= NULL
;
908 GtkWidget
*always_encrypt_rec_checkbtn
= NULL
;
912 PrefsAccount
*ac_prefs
;
913 gboolean default_account_set
= FALSE
;
919 # define TABLEHEIGHT 7
921 # define TABLEHEIGHT 6
923 table
= gtk_grid_new();
924 gtk_container_set_border_width (GTK_CONTAINER (table
), VBOX_BORDER
);
925 gtk_grid_set_row_spacing(GTK_GRID(table
), 4);
926 gtk_grid_set_column_spacing(GTK_GRID(table
), 4);
930 no_save_warning
= prefs_folder_no_save_warning_create_widget();
931 gtk_grid_attach(GTK_GRID(table
), no_save_warning
, 0, rowcount
, 1, 1);
935 /* Apply to subfolders */
936 label
= gtk_label_new(_("Apply to\nsubfolders"));
937 gtk_grid_attach(GTK_GRID(table
), label
, 2, rowcount
, 1, 1);
940 if (item_protocol(item
) != A_NNTP
) {
941 /* Request Return Receipt */
942 checkbtn_request_return_receipt
= gtk_check_button_new_with_label
943 (_("Request Return Receipt"));
944 gtk_grid_attach(GTK_GRID(table
), checkbtn_request_return_receipt
, 0, rowcount
, 1, 1);
945 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_request_return_receipt
),
946 item
->ret_rcpt
? TRUE
: FALSE
);
948 request_return_receipt_rec_checkbtn
= gtk_check_button_new();
949 gtk_grid_attach(GTK_GRID(table
), request_return_receipt_rec_checkbtn
, 2, rowcount
, 1, 1);
952 /* Save Copy to Folder */
953 checkbtn_save_copy_to_folder
= gtk_check_button_new_with_label
954 (_("Save copy of outgoing messages to this folder instead of Sent"));
955 gtk_grid_attach(GTK_GRID(table
), checkbtn_save_copy_to_folder
, 0, rowcount
, 2, 1);
956 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_save_copy_to_folder
),
957 item
->prefs
->save_copy_to_folder
? TRUE
: FALSE
);
959 save_copy_to_folder_rec_checkbtn
= gtk_check_button_new();
960 gtk_grid_attach(GTK_GRID(table
), save_copy_to_folder_rec_checkbtn
, 2, rowcount
, 1, 1);
964 tr
= g_strdup(C_("folder properties: %s stands for a header name",
966 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("From:"));
967 checkbtn_default_from
= gtk_check_button_new_with_label(text
);
968 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_from
, 0, rowcount
, 1, 1);
969 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_from
),
970 item
->prefs
->enable_default_from
);
974 entry_default_from
= gtk_entry_new();
975 gtk_grid_attach(GTK_GRID(table
), entry_default_from
, 1, rowcount
, 1, 1);
976 gtk_widget_set_hexpand(entry_default_from
, TRUE
);
977 gtk_widget_set_halign(entry_default_from
, GTK_ALIGN_FILL
);
978 SET_TOGGLE_SENSITIVITY(checkbtn_default_from
, entry_default_from
);
979 gtk_entry_set_text(GTK_ENTRY(entry_default_from
), SAFE_STRING(item
->prefs
->default_from
));
980 address_completion_register_entry(GTK_ENTRY(entry_default_from
),
983 default_from_rec_checkbtn
= gtk_check_button_new();
984 gtk_grid_attach(GTK_GRID(table
), default_from_rec_checkbtn
, 2, rowcount
, 1, 1);
989 tr
= g_strdup(C_("folder properties: %s stands for a header name",
991 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("To:"));
992 checkbtn_default_to
= gtk_check_button_new_with_label(text
);
993 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_to
, 0, rowcount
, 1, 1);
994 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_to
),
995 item
->prefs
->enable_default_to
);
999 entry_default_to
= gtk_entry_new();
1000 gtk_grid_attach(GTK_GRID(table
), entry_default_to
, 1, rowcount
, 1, 1);
1001 gtk_widget_set_hexpand(entry_default_to
, TRUE
);
1002 gtk_widget_set_halign(entry_default_to
, GTK_ALIGN_FILL
);
1003 SET_TOGGLE_SENSITIVITY(checkbtn_default_to
, entry_default_to
);
1004 gtk_entry_set_text(GTK_ENTRY(entry_default_to
), SAFE_STRING(item
->prefs
->default_to
));
1005 address_completion_register_entry(GTK_ENTRY(entry_default_to
),
1008 default_to_rec_checkbtn
= gtk_check_button_new();
1009 gtk_grid_attach(GTK_GRID(table
), default_to_rec_checkbtn
, 2, rowcount
, 1, 1);
1013 /* Default address to reply to */
1014 tr
= g_strdup(C_("folder properties: %s stands for a header name",
1015 "Default %s for replies"));
1016 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("To:"));
1017 checkbtn_default_reply_to
= gtk_check_button_new_with_label(text
);
1018 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_reply_to
, 0, rowcount
, 1, 1);
1019 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_reply_to
),
1020 item
->prefs
->enable_default_reply_to
);
1024 entry_default_reply_to
= gtk_entry_new();
1025 gtk_grid_attach(GTK_GRID(table
), entry_default_reply_to
, 1, rowcount
, 1, 1);
1026 gtk_widget_set_hexpand(entry_default_reply_to
, TRUE
);
1027 gtk_widget_set_halign(entry_default_reply_to
, GTK_ALIGN_FILL
);
1028 SET_TOGGLE_SENSITIVITY(checkbtn_default_reply_to
, entry_default_reply_to
);
1029 gtk_entry_set_text(GTK_ENTRY(entry_default_reply_to
), SAFE_STRING(item
->prefs
->default_reply_to
));
1030 address_completion_register_entry(
1031 GTK_ENTRY(entry_default_reply_to
), TRUE
);
1033 default_reply_to_rec_checkbtn
= gtk_check_button_new();
1034 gtk_grid_attach(GTK_GRID(table
), default_reply_to_rec_checkbtn
, 2, rowcount
, 1, 1);
1039 tr
= g_strdup(C_("folder properties: %s stands for a header name",
1041 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("Cc:"));
1042 checkbtn_default_cc
= gtk_check_button_new_with_label(text
);
1043 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_cc
, 0, rowcount
, 1, 1);
1044 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_cc
),
1045 item
->prefs
->enable_default_cc
);
1049 entry_default_cc
= gtk_entry_new();
1050 gtk_grid_attach(GTK_GRID(table
), entry_default_cc
, 1, rowcount
, 1, 1);
1051 gtk_widget_set_hexpand(entry_default_cc
, TRUE
);
1052 gtk_widget_set_halign(entry_default_cc
, GTK_ALIGN_FILL
);
1053 SET_TOGGLE_SENSITIVITY(checkbtn_default_cc
, entry_default_cc
);
1054 gtk_entry_set_text(GTK_ENTRY(entry_default_cc
), SAFE_STRING(item
->prefs
->default_cc
));
1055 address_completion_register_entry(GTK_ENTRY(entry_default_cc
),
1058 default_cc_rec_checkbtn
= gtk_check_button_new();
1059 gtk_grid_attach(GTK_GRID(table
), default_cc_rec_checkbtn
, 2, rowcount
, 1, 1);
1064 tr
= g_strdup(C_("folder properties: %s stands for a header name",
1066 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("Bcc:"));
1067 checkbtn_default_bcc
= gtk_check_button_new_with_label(text
);
1068 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_bcc
, 0, rowcount
, 1, 1);
1069 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_bcc
),
1070 item
->prefs
->enable_default_bcc
);
1074 entry_default_bcc
= gtk_entry_new();
1075 gtk_grid_attach(GTK_GRID(table
), entry_default_bcc
, 1, rowcount
, 1, 1);
1076 gtk_widget_set_hexpand(entry_default_bcc
, TRUE
);
1077 gtk_widget_set_halign(entry_default_bcc
, GTK_ALIGN_FILL
);
1078 SET_TOGGLE_SENSITIVITY(checkbtn_default_bcc
, entry_default_bcc
);
1079 gtk_entry_set_text(GTK_ENTRY(entry_default_bcc
), SAFE_STRING(item
->prefs
->default_bcc
));
1080 address_completion_register_entry(GTK_ENTRY(entry_default_bcc
),
1083 default_bcc_rec_checkbtn
= gtk_check_button_new();
1084 gtk_grid_attach(GTK_GRID(table
), default_bcc_rec_checkbtn
, 2, rowcount
, 1, 1);
1088 /* Default Reply-to */
1089 tr
= g_strdup(C_("folder properties: %s stands for a header name",
1091 text
= g_strdup_printf(tr
, prefs_common_translated_header_name("Reply-To:"));
1092 checkbtn_default_replyto
= gtk_check_button_new_with_label(text
);
1093 gtk_grid_attach(GTK_GRID(table
), checkbtn_default_replyto
, 0, rowcount
, 1, 1);
1094 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_replyto
),
1095 item
->prefs
->enable_default_replyto
);
1099 entry_default_replyto
= gtk_entry_new();
1100 gtk_grid_attach(GTK_GRID(table
), entry_default_replyto
, 1, rowcount
, 1, 1);
1101 gtk_widget_set_hexpand(entry_default_replyto
, TRUE
);
1102 gtk_widget_set_halign(entry_default_replyto
, GTK_ALIGN_FILL
);
1103 SET_TOGGLE_SENSITIVITY(checkbtn_default_replyto
, entry_default_replyto
);
1104 gtk_entry_set_text(GTK_ENTRY(entry_default_replyto
), SAFE_STRING(item
->prefs
->default_replyto
));
1105 address_completion_register_entry(GTK_ENTRY(entry_default_replyto
),
1108 default_replyto_rec_checkbtn
= gtk_check_button_new();
1109 gtk_grid_attach(GTK_GRID(table
), default_replyto_rec_checkbtn
, 2, rowcount
, 1, 1);
1113 /* Default account */
1114 checkbtn_enable_default_account
= gtk_check_button_new_with_label(_("Default account"));
1115 gtk_grid_attach(GTK_GRID(table
), checkbtn_enable_default_account
, 0, rowcount
, 1, 1);
1116 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_account
),
1117 item
->prefs
->enable_default_account
);
1119 optmenu_default_account
= gtkut_sc_combobox_create(NULL
, FALSE
);
1120 gtk_grid_attach(GTK_GRID(table
), optmenu_default_account
, 1, rowcount
, 1, 1);
1121 optmenu_default_account_menu
= GTK_LIST_STORE(
1122 gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu_default_account
)));
1124 account_list
= account_get_list();
1125 for (cur_ac
= account_list
; cur_ac
!= NULL
; cur_ac
= cur_ac
->next
) {
1126 ac_prefs
= (PrefsAccount
*)cur_ac
->data
;
1127 if (item
->folder
->account
&&
1128 ( (item_protocol(item
) == A_NNTP
&& ac_prefs
->protocol
!= A_NNTP
)
1129 ||(item_protocol(item
) != A_NNTP
&& ac_prefs
->protocol
== A_NNTP
)))
1132 if (item
->folder
->klass
->type
!= F_NEWS
&& ac_prefs
->protocol
== A_NNTP
)
1135 COMBOBOX_ADD_ESCAPED (optmenu_default_account_menu
,
1136 ac_prefs
->account_name
?ac_prefs
->account_name
: _("Untitled"),
1137 ac_prefs
->account_id
);
1139 /* Set combobox to current default account id */
1140 if (ac_prefs
->account_id
== item
->prefs
->default_account
) {
1141 combobox_select_by_data(GTK_COMBO_BOX(optmenu_default_account
),
1142 ac_prefs
->account_id
);
1143 default_account_set
= TRUE
;
1147 /* If nothing has been set (folder doesn't have a default account set),
1148 * pre-select global default account, since that's what actually used
1149 * anyway. We don't want nothing selected in combobox. */
1150 if( !default_account_set
)
1151 combobox_select_by_data(GTK_COMBO_BOX(optmenu_default_account
),
1152 account_get_default()->account_id
);
1154 SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_account
, optmenu_default_account
);
1156 default_account_rec_checkbtn
= gtk_check_button_new();
1157 gtk_grid_attach(GTK_GRID(table
), default_account_rec_checkbtn
, 2, rowcount
, 1, 1);
1161 /* Default dictionary */
1162 checkbtn_enable_default_dictionary
= gtk_check_button_new_with_label(_("Default dictionary"));
1163 gtk_grid_attach(GTK_GRID(table
), checkbtn_enable_default_dictionary
, 0, rowcount
, 1, 1);
1164 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_dictionary
),
1165 item
->prefs
->enable_default_dictionary
);
1167 combo_default_dictionary
= gtkaspell_dictionary_combo_new(TRUE
);
1168 gtk_grid_attach(GTK_GRID(table
), combo_default_dictionary
, 1, rowcount
, 1, 1);
1170 dictionary
= item
->prefs
->default_dictionary
;
1171 if (dictionary
&& strrchr(dictionary
, '/')) {
1172 gchar
*tmp
= g_strdup(strrchr(dictionary
, '/')+1);
1173 g_free(item
->prefs
->default_dictionary
);
1174 item
->prefs
->default_dictionary
= tmp
;
1175 dictionary
= item
->prefs
->default_dictionary
;
1177 if (item
->prefs
->default_dictionary
&&
1178 strchr(item
->prefs
->default_dictionary
, '-')) {
1179 *(strchr(item
->prefs
->default_dictionary
, '-')) = '\0';
1182 gtkaspell_set_dictionary_menu_active_item(
1183 GTK_COMBO_BOX(combo_default_dictionary
), dictionary
);
1185 SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_dictionary
, combo_default_dictionary
);
1187 default_dictionary_rec_checkbtn
= gtk_check_button_new();
1188 gtk_grid_attach(GTK_GRID(table
), default_dictionary_rec_checkbtn
, 2, rowcount
, 1, 1);
1192 /* Default alternate dictionary */
1193 checkbtn_enable_default_alt_dictionary
= gtk_check_button_new_with_label(_("Default alternate dictionary"));
1194 gtk_grid_attach(GTK_GRID(table
), checkbtn_enable_default_alt_dictionary
, 0, rowcount
, 1, 1);
1195 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_alt_dictionary
),
1196 item
->prefs
->enable_default_alt_dictionary
);
1198 combo_default_alt_dictionary
= gtkaspell_dictionary_combo_new(FALSE
);
1199 gtk_grid_attach(GTK_GRID(table
), combo_default_alt_dictionary
, 1, rowcount
, 1, 1);
1201 dictionary
= item
->prefs
->default_alt_dictionary
;
1202 if (dictionary
&& strrchr(dictionary
, '/')) {
1203 gchar
*tmp
= g_strdup(strrchr(dictionary
, '/')+1);
1204 g_free(item
->prefs
->default_alt_dictionary
);
1205 item
->prefs
->default_alt_dictionary
= tmp
;
1206 dictionary
= item
->prefs
->default_alt_dictionary
;
1208 if (item
->prefs
->default_alt_dictionary
&&
1209 strchr(item
->prefs
->default_alt_dictionary
, '-')) {
1210 *(strchr(item
->prefs
->default_alt_dictionary
, '-')) = '\0';
1213 gtkaspell_set_dictionary_menu_active_item(
1214 GTK_COMBO_BOX(combo_default_alt_dictionary
), dictionary
);
1216 SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_alt_dictionary
, combo_default_alt_dictionary
);
1218 default_alt_dictionary_rec_checkbtn
= gtk_check_button_new();
1219 gtk_grid_attach(GTK_GRID(table
), default_alt_dictionary_rec_checkbtn
, 2, rowcount
, 1, 1);
1225 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 2);
1226 gtk_box_set_spacing(GTK_BOX(hbox
), 8);
1227 gtk_widget_show (hbox
);
1228 gtk_grid_attach(GTK_GRID(table
), hbox
, 0, rowcount
, 1, 1);
1230 label
= gtk_label_new(_("Always sign messages"));
1231 gtk_widget_show (label
);
1232 gtk_box_pack_start (GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
1234 always_sign
= gtkut_sc_combobox_create (NULL
, FALSE
);
1235 gtk_widget_show (always_sign
);
1236 gtk_box_pack_start (GTK_BOX(hbox
), always_sign
, FALSE
, FALSE
, 0);
1238 always_sign_menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
1239 GTK_COMBO_BOX(always_sign
)));
1240 COMBOBOX_ADD (always_sign_menu
, _("Default"), SIGN_OR_ENCRYPT_DEFAULT
);
1241 COMBOBOX_ADD (always_sign_menu
, _("No"), SIGN_OR_ENCRYPT_NEVER
);
1242 COMBOBOX_ADD (always_sign_menu
, _("Yes"), SIGN_OR_ENCRYPT_ALWAYS
);
1244 combobox_select_by_data(GTK_COMBO_BOX(always_sign
),
1245 item
->prefs
->always_sign
);
1247 CLAWS_SET_TIP(hbox
, _("\"Default\" will follow the applicable account preference"));
1249 always_sign_rec_checkbtn
= gtk_check_button_new();
1250 gtk_widget_show (always_sign_rec_checkbtn
);
1251 gtk_grid_attach(GTK_GRID(table
), always_sign_rec_checkbtn
, 2, rowcount
, 1, 1);
1256 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 2);
1257 gtk_box_set_spacing(GTK_BOX(hbox
), 8);
1258 gtk_widget_show (hbox
);
1259 gtk_grid_attach(GTK_GRID(table
), hbox
, 0, rowcount
, 1, 1);
1261 label
= gtk_label_new(_("Always encrypt messages"));
1262 gtk_widget_show (label
);
1263 gtk_box_pack_start (GTK_BOX(hbox
), label
, FALSE
, FALSE
, 0);
1265 always_encrypt
= gtkut_sc_combobox_create (NULL
, FALSE
);
1266 gtk_widget_show (always_encrypt
);
1267 gtk_box_pack_start (GTK_BOX(hbox
), always_encrypt
, FALSE
, FALSE
, 0);
1269 always_encrypt_menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
1270 GTK_COMBO_BOX(always_encrypt
)));
1271 COMBOBOX_ADD (always_encrypt_menu
, _("Default"), SIGN_OR_ENCRYPT_DEFAULT
);
1272 COMBOBOX_ADD (always_encrypt_menu
, _("No"), SIGN_OR_ENCRYPT_NEVER
);
1273 COMBOBOX_ADD (always_encrypt_menu
, _("Yes"), SIGN_OR_ENCRYPT_ALWAYS
);
1275 combobox_select_by_data(GTK_COMBO_BOX(always_encrypt
),
1276 item
->prefs
->always_encrypt
);
1278 CLAWS_SET_TIP(hbox
, _("\"Default\" will follow the applicable account preference"));
1280 always_encrypt_rec_checkbtn
= gtk_check_button_new();
1281 gtk_widget_show (always_encrypt_rec_checkbtn
);
1282 gtk_grid_attach(GTK_GRID(table
), always_encrypt_rec_checkbtn
, 2, rowcount
, 1, 1);
1286 gtk_widget_show_all(table
);
1288 page
->window
= GTK_WIDGET(window
);
1289 page
->table
= table
;
1290 page
->no_save_warning
= no_save_warning
;
1291 page
->checkbtn_request_return_receipt
= checkbtn_request_return_receipt
;
1292 page
->checkbtn_save_copy_to_folder
= checkbtn_save_copy_to_folder
;
1293 page
->checkbtn_default_from
= checkbtn_default_from
;
1294 page
->entry_default_from
= entry_default_from
;
1295 page
->checkbtn_default_to
= checkbtn_default_to
;
1296 page
->entry_default_to
= entry_default_to
;
1297 page
->checkbtn_default_reply_to
= checkbtn_default_reply_to
;
1298 page
->entry_default_reply_to
= entry_default_reply_to
;
1299 page
->checkbtn_default_cc
= checkbtn_default_cc
;
1300 page
->entry_default_cc
= entry_default_cc
;
1301 page
->checkbtn_default_bcc
= checkbtn_default_bcc
;
1302 page
->entry_default_bcc
= entry_default_bcc
;
1303 page
->checkbtn_default_replyto
= checkbtn_default_replyto
;
1304 page
->entry_default_replyto
= entry_default_replyto
;
1305 page
->checkbtn_enable_default_account
= checkbtn_enable_default_account
;
1306 page
->optmenu_default_account
= optmenu_default_account
;
1308 page
->checkbtn_enable_default_dictionary
= checkbtn_enable_default_dictionary
;
1309 page
->combo_default_dictionary
= combo_default_dictionary
;
1310 page
->checkbtn_enable_default_alt_dictionary
= checkbtn_enable_default_alt_dictionary
;
1311 page
->combo_default_alt_dictionary
= combo_default_alt_dictionary
;
1313 page
->always_sign
= always_sign
;
1314 page
->always_encrypt
= always_encrypt
;
1316 page
->request_return_receipt_rec_checkbtn
= request_return_receipt_rec_checkbtn
;
1317 page
->save_copy_to_folder_rec_checkbtn
= save_copy_to_folder_rec_checkbtn
;
1318 page
->default_from_rec_checkbtn
= default_from_rec_checkbtn
;
1319 page
->default_to_rec_checkbtn
= default_to_rec_checkbtn
;
1320 page
->default_reply_to_rec_checkbtn
= default_reply_to_rec_checkbtn
;
1321 page
->default_cc_rec_checkbtn
= default_cc_rec_checkbtn
;
1322 page
->default_bcc_rec_checkbtn
= default_bcc_rec_checkbtn
;
1323 page
->default_replyto_rec_checkbtn
= default_replyto_rec_checkbtn
;
1324 page
->default_account_rec_checkbtn
= default_account_rec_checkbtn
;
1326 page
->default_dictionary_rec_checkbtn
= default_dictionary_rec_checkbtn
;
1327 page
->default_alt_dictionary_rec_checkbtn
= default_alt_dictionary_rec_checkbtn
;
1329 page
->always_sign_rec_checkbtn
= always_sign_rec_checkbtn
;
1330 page
->always_encrypt_rec_checkbtn
= always_encrypt_rec_checkbtn
;
1332 page
->page
.widget
= table
;
1335 static void prefs_folder_item_compose_destroy_widget_func(PrefsPage
*page_
)
1337 FolderItemComposePage
*page
= (FolderItemComposePage
*) page_
;
1339 if (page
->entry_default_from
)
1340 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_from
));
1341 if (page
->entry_default_to
)
1342 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_to
));
1343 if (page
->entry_default_reply_to
)
1344 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_reply_to
));
1345 if (page
->entry_default_cc
)
1346 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_cc
));
1347 if (page
->entry_default_bcc
)
1348 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_bcc
));
1349 if (page
->entry_default_replyto
)
1350 address_completion_unregister_entry(GTK_ENTRY(page
->entry_default_replyto
));
1353 /** \brief Save the prefs in page to folder.
1355 * If the folder is not the one specified in page->item, then only those properties
1356 * that have the relevant 'apply to sub folders' button checked are saved
1358 static void compose_save_folder_prefs(FolderItem
*folder
, FolderItemComposePage
*page
)
1360 FolderItemPrefs
*prefs
= folder
->prefs
;
1362 gboolean all
= FALSE
;
1364 if (folder
->path
== NULL
)
1367 if (page
->item
== folder
)
1370 cm_return_if_fail(prefs
!= NULL
);
1372 if (item_protocol(folder
) != A_NNTP
) {
1373 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->request_return_receipt_rec_checkbtn
))) {
1374 prefs
->request_return_receipt
=
1375 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_request_return_receipt
));
1377 folder
->ret_rcpt
= prefs
->request_return_receipt
;
1380 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->save_copy_to_folder_rec_checkbtn
))) {
1381 prefs
->save_copy_to_folder
=
1382 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_save_copy_to_folder
));
1385 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_from_rec_checkbtn
))) {
1386 prefs
->enable_default_from
=
1387 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_from
));
1388 ASSIGN_STRING(prefs
->default_from
,
1389 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_from
), 0, -1));
1392 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_to_rec_checkbtn
))) {
1393 prefs
->enable_default_to
=
1394 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_to
));
1395 ASSIGN_STRING(prefs
->default_to
,
1396 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_to
), 0, -1));
1399 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_reply_to_rec_checkbtn
))) {
1400 prefs
->enable_default_reply_to
=
1401 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_reply_to
));
1402 ASSIGN_STRING(prefs
->default_reply_to
,
1403 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_reply_to
), 0, -1));
1406 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_cc_rec_checkbtn
))) {
1408 prefs
->enable_default_cc
=
1409 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_cc
));
1410 ASSIGN_STRING(prefs
->default_cc
,
1411 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_cc
), 0, -1));
1414 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_bcc_rec_checkbtn
))) {
1416 prefs
->enable_default_bcc
=
1417 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_bcc
));
1418 ASSIGN_STRING(prefs
->default_bcc
,
1419 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_bcc
), 0, -1));
1422 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_replyto_rec_checkbtn
))) {
1424 prefs
->enable_default_replyto
=
1425 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_default_replyto
));
1426 ASSIGN_STRING(prefs
->default_replyto
,
1427 gtk_editable_get_chars(GTK_EDITABLE(page
->entry_default_replyto
), 0, -1));
1431 prefs
->request_return_receipt
= FALSE
;
1432 prefs
->save_copy_to_folder
= FALSE
;
1433 prefs
->enable_default_from
= FALSE
;
1434 prefs
->enable_default_to
= FALSE
;
1435 prefs
->enable_default_reply_to
= FALSE
;
1436 prefs
->enable_default_cc
= FALSE
;
1437 prefs
->enable_default_bcc
= FALSE
;
1438 prefs
->enable_default_replyto
= FALSE
;
1441 if (all
|| gtk_toggle_button_get_active(
1442 GTK_TOGGLE_BUTTON(page
->default_account_rec_checkbtn
))) {
1443 prefs
->enable_default_account
=
1444 gtk_toggle_button_get_active(
1445 GTK_TOGGLE_BUTTON(page
->checkbtn_enable_default_account
));
1446 prefs
->default_account
= combobox_get_active_data(
1447 GTK_COMBO_BOX(page
->optmenu_default_account
));
1451 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_dictionary_rec_checkbtn
))) {
1452 prefs
->enable_default_dictionary
=
1453 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_enable_default_dictionary
));
1454 ASSIGN_STRING(prefs
->default_dictionary
,
1455 gtkaspell_get_dictionary_menu_active_item(
1456 GTK_COMBO_BOX(page
->combo_default_dictionary
)));
1458 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_alt_dictionary_rec_checkbtn
))) {
1459 prefs
->enable_default_alt_dictionary
=
1460 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_enable_default_alt_dictionary
));
1461 ASSIGN_STRING(prefs
->default_alt_dictionary
,
1462 gtkaspell_get_dictionary_menu_active_item(
1463 GTK_COMBO_BOX(page
->combo_default_alt_dictionary
)));
1466 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_sign_rec_checkbtn
))) {
1467 prefs
->always_sign
=
1468 combobox_get_active_data(GTK_COMBO_BOX(page
->always_sign
));
1470 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_encrypt_rec_checkbtn
))) {
1471 prefs
->always_encrypt
=
1472 combobox_get_active_data(GTK_COMBO_BOX(page
->always_encrypt
));
1475 folder_item_prefs_save_config(folder
);
1478 static gboolean
compose_save_recurse_func(GNode
*node
, gpointer data
)
1480 FolderItem
*item
= (FolderItem
*) node
->data
;
1481 FolderItemComposePage
*page
= (FolderItemComposePage
*) data
;
1483 cm_return_val_if_fail(item
!= NULL
, TRUE
);
1484 cm_return_val_if_fail(page
!= NULL
, TRUE
);
1486 compose_save_folder_prefs(item
, page
);
1488 /* optimise by not continuing if none of the 'apply to sub folders'
1489 check boxes are selected - and optimise the checking by only doing
1491 if ((node
== page
->item
->node
) && item_protocol(item
) != A_NNTP
&&
1492 !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->request_return_receipt_rec_checkbtn
)) ||
1493 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->save_copy_to_folder_rec_checkbtn
)) ||
1494 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_from_rec_checkbtn
)) ||
1495 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_to_rec_checkbtn
)) ||
1496 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_account_rec_checkbtn
)) ||
1497 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_cc_rec_checkbtn
)) ||
1498 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_bcc_rec_checkbtn
)) ||
1499 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_replyto_rec_checkbtn
)) ||
1501 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_dictionary_rec_checkbtn
)) ||
1502 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_alt_dictionary_rec_checkbtn
)) ||
1504 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_sign_rec_checkbtn
)) ||
1505 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_encrypt_rec_checkbtn
)) ||
1506 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_reply_to_rec_checkbtn
))
1509 else if ((node
== page
->item
->node
) && item_protocol(item
) == A_NNTP
&&
1510 !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_account_rec_checkbtn
))
1512 || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_dictionary_rec_checkbtn
))
1513 || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->default_alt_dictionary_rec_checkbtn
))
1515 || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_sign_rec_checkbtn
))
1516 || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->always_encrypt_rec_checkbtn
))
1523 static void prefs_folder_item_compose_save_func(PrefsPage
*page_
)
1525 FolderItemComposePage
*page
= (FolderItemComposePage
*) page_
;
1527 g_node_traverse(page
->item
->node
, G_PRE_ORDER
, G_TRAVERSE_ALL
,
1528 -1, compose_save_recurse_func
, page
);
1532 static void prefs_folder_item_templates_create_widget_func(PrefsPage
* page_
,
1536 FolderItemTemplatesPage
*page
= (FolderItemTemplatesPage
*) page_
;
1537 FolderItem
*item
= (FolderItem
*) data
;
1539 GtkWidget
*notebook
;
1541 GtkWidget
*page_vbox
;
1542 GtkWidget
*no_save_warning
;
1543 GtkWidget
*new_msg_format_rec_checkbtn
;
1544 GtkWidget
*reply_format_rec_checkbtn
;
1545 GtkWidget
*forward_format_rec_checkbtn
;
1547 GtkWidget
*vbox_format
;
1551 page_vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, 0);
1552 gtk_container_set_border_width (GTK_CONTAINER (page_vbox
), VBOX_BORDER
);
1553 gtk_widget_show (page_vbox
);
1556 no_save_warning
= prefs_folder_no_save_warning_create_widget();
1557 gtk_box_pack_start(GTK_BOX(page_vbox
),
1558 no_save_warning
, FALSE
, FALSE
, 0);
1562 notebook
= gtk_notebook_new();
1563 gtk_widget_show(notebook
);
1564 gtk_box_pack_start(GTK_BOX(page_vbox
), notebook
, TRUE
, TRUE
, 4);
1566 /* compose format */
1567 vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
1568 gtk_widget_show (vbox
);
1569 gtk_container_set_border_width (GTK_CONTAINER (vbox
), VBOX_BORDER
);
1571 quotefmt_create_new_msg_fmt_widgets(
1574 &page
->checkbtn_compose_with_format
,
1575 &page
->compose_override_from_format
,
1576 &page
->compose_subject_format
,
1577 &page
->compose_body_format
,
1579 address_completion_register_entry(GTK_ENTRY(page
->compose_override_from_format
),
1582 vbox_format
= gtk_widget_get_parent(
1583 gtk_widget_get_parent(page
->compose_body_format
));
1585 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
1586 gtk_box_pack_end (GTK_BOX(vbox_format
), hbox
, FALSE
, FALSE
, 0);
1587 quotefmt_add_info_button(window
, hbox
);
1589 new_msg_format_rec_checkbtn
= gtk_check_button_new_with_label(
1590 _("Apply to subfolders"));
1591 gtk_box_pack_end (GTK_BOX(hbox
), new_msg_format_rec_checkbtn
, FALSE
, FALSE
, 0);
1592 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox
, gtk_label_new(_("Compose")));
1595 vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
1596 gtk_widget_show (vbox
);
1597 gtk_container_set_border_width (GTK_CONTAINER (vbox
), VBOX_BORDER
);
1599 quotefmt_create_reply_fmt_widgets(
1602 &page
->checkbtn_reply_with_format
,
1603 &page
->reply_override_from_format
,
1604 &page
->reply_quotemark
,
1605 &page
->reply_body_format
,
1607 address_completion_register_entry(GTK_ENTRY(page
->reply_override_from_format
),
1610 vbox_format
= gtk_widget_get_parent(
1611 gtk_widget_get_parent(page
->reply_body_format
));
1613 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
1614 gtk_box_pack_end (GTK_BOX(vbox_format
), hbox
, FALSE
, FALSE
, 0);
1615 quotefmt_add_info_button(window
, hbox
);
1617 reply_format_rec_checkbtn
= gtk_check_button_new_with_label(
1618 _("Apply to subfolders"));
1619 gtk_box_pack_end (GTK_BOX(hbox
), reply_format_rec_checkbtn
, FALSE
, FALSE
, 0);
1620 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox
, gtk_label_new(_("Reply")));
1622 /* forward format */
1623 vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
1624 gtk_widget_show (vbox
);
1625 gtk_container_set_border_width (GTK_CONTAINER (vbox
), VBOX_BORDER
);
1627 quotefmt_create_forward_fmt_widgets(
1630 &page
->checkbtn_forward_with_format
,
1631 &page
->forward_override_from_format
,
1632 &page
->forward_quotemark
,
1633 &page
->forward_body_format
,
1635 address_completion_register_entry(GTK_ENTRY(page
->forward_override_from_format
),
1638 vbox_format
= gtk_widget_get_parent(
1639 gtk_widget_get_parent(page
->forward_body_format
));
1641 hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 0);
1642 gtk_box_pack_end (GTK_BOX(vbox_format
), hbox
, FALSE
, FALSE
, 0);
1643 quotefmt_add_info_button(window
, hbox
);
1645 forward_format_rec_checkbtn
= gtk_check_button_new_with_label(
1646 _("Apply to subfolders"));
1647 gtk_box_pack_end (GTK_BOX(hbox
), forward_format_rec_checkbtn
, FALSE
, FALSE
, 0);
1648 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox
, gtk_label_new(_("Forward")));
1650 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(page
->checkbtn_compose_with_format
),
1651 item
->prefs
->compose_with_format
);
1652 pref_set_entry_from_pref(GTK_ENTRY(page
->compose_override_from_format
),
1653 item
->prefs
->compose_override_from_format
);
1654 pref_set_entry_from_pref(GTK_ENTRY(page
->compose_subject_format
),
1655 item
->prefs
->compose_subject_format
);
1656 pref_set_textview_from_pref(GTK_TEXT_VIEW(page
->compose_body_format
),
1657 item
->prefs
->compose_body_format
);
1659 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(page
->checkbtn_reply_with_format
),
1660 item
->prefs
->reply_with_format
);
1661 pref_set_entry_from_pref(GTK_ENTRY(page
->reply_quotemark
),
1662 item
->prefs
->reply_quotemark
);
1663 pref_set_entry_from_pref(GTK_ENTRY(page
->reply_override_from_format
),
1664 item
->prefs
->reply_override_from_format
);
1665 pref_set_textview_from_pref(GTK_TEXT_VIEW(page
->reply_body_format
),
1666 item
->prefs
->reply_body_format
);
1668 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(page
->checkbtn_forward_with_format
),
1669 item
->prefs
->forward_with_format
);
1670 pref_set_entry_from_pref(GTK_ENTRY(page
->forward_quotemark
),
1671 item
->prefs
->forward_quotemark
);
1672 pref_set_entry_from_pref(GTK_ENTRY(page
->forward_override_from_format
),
1673 item
->prefs
->forward_override_from_format
);
1674 pref_set_textview_from_pref(GTK_TEXT_VIEW(page
->forward_body_format
),
1675 item
->prefs
->forward_body_format
);
1677 gtk_widget_show_all(page_vbox
);
1679 page
->window
= GTK_WIDGET(window
);
1681 page
->new_msg_format_rec_checkbtn
= new_msg_format_rec_checkbtn
;
1682 page
->reply_format_rec_checkbtn
= reply_format_rec_checkbtn
;
1683 page
->forward_format_rec_checkbtn
= forward_format_rec_checkbtn
;
1685 page
->page
.widget
= page_vbox
;
1688 static void prefs_folder_item_templates_destroy_widget_func(PrefsPage
*page_
)
1690 FolderItemTemplatesPage
*page
= (FolderItemTemplatesPage
*) page_
;
1692 if (page
->compose_override_from_format
)
1693 address_completion_unregister_entry(GTK_ENTRY(page
->compose_override_from_format
));
1694 if (page
->reply_override_from_format
)
1695 address_completion_unregister_entry(GTK_ENTRY(page
->reply_override_from_format
));
1696 if (page
->forward_override_from_format
)
1697 address_completion_unregister_entry(GTK_ENTRY(page
->forward_override_from_format
));
1700 /** \brief Save the prefs in page to folder.
1702 * If the folder is not the one specified in page->item, then only those properties
1703 * that have the relevant 'apply to sub folders' button checked are saved
1705 static void templates_save_folder_prefs(FolderItem
*folder
, FolderItemTemplatesPage
*page
)
1707 FolderItemPrefs
*prefs
= folder
->prefs
;
1708 gboolean all
= FALSE
;
1710 if (folder
->path
== NULL
)
1713 if (page
->item
== folder
)
1716 cm_return_if_fail(prefs
!= NULL
);
1718 /* save and check formats */
1720 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->new_msg_format_rec_checkbtn
))) {
1722 prefs
->compose_with_format
=
1723 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_compose_with_format
));
1724 prefs
->compose_override_from_format
= pref_get_pref_from_entry(
1725 GTK_ENTRY(page
->compose_override_from_format
));
1726 prefs
->compose_subject_format
= pref_get_pref_from_entry(
1727 GTK_ENTRY(page
->compose_subject_format
));
1728 prefs
->compose_body_format
= pref_get_pref_from_textview(
1729 GTK_TEXT_VIEW(page
->compose_body_format
));
1730 quotefmt_check_new_msg_formats(prefs
->compose_with_format
,
1731 prefs
->compose_override_from_format
,
1732 prefs
->compose_subject_format
,
1733 prefs
->compose_body_format
);
1736 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->reply_format_rec_checkbtn
))) {
1737 prefs
->reply_with_format
=
1738 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_reply_with_format
));
1739 prefs
->reply_quotemark
= gtk_editable_get_chars(
1740 GTK_EDITABLE(page
->reply_quotemark
), 0, -1);
1741 prefs
->reply_override_from_format
= pref_get_pref_from_entry(
1742 GTK_ENTRY(page
->reply_override_from_format
));
1743 prefs
->reply_body_format
= pref_get_pref_from_textview(
1744 GTK_TEXT_VIEW(page
->reply_body_format
));
1745 quotefmt_check_reply_formats(prefs
->reply_with_format
,
1746 prefs
->reply_override_from_format
,
1747 prefs
->reply_quotemark
,
1748 prefs
->reply_body_format
);
1751 if (all
|| gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->forward_format_rec_checkbtn
))) {
1752 prefs
->forward_with_format
=
1753 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_forward_with_format
));
1754 prefs
->forward_quotemark
= gtk_editable_get_chars(
1755 GTK_EDITABLE(page
->forward_quotemark
), 0, -1);
1756 prefs
->forward_override_from_format
= pref_get_pref_from_entry(
1757 GTK_ENTRY(page
->forward_override_from_format
));
1758 prefs
->forward_body_format
= pref_get_pref_from_textview(
1759 GTK_TEXT_VIEW(page
->forward_body_format
));
1760 quotefmt_check_forward_formats(prefs
->forward_with_format
,
1761 prefs
->forward_override_from_format
,
1762 prefs
->forward_quotemark
,
1763 prefs
->forward_body_format
);
1766 folder_item_prefs_save_config(folder
);
1769 static gboolean
templates_save_recurse_func(GNode
*node
, gpointer data
)
1771 FolderItem
*item
= (FolderItem
*) node
->data
;
1772 FolderItemTemplatesPage
*page
= (FolderItemTemplatesPage
*) data
;
1774 cm_return_val_if_fail(item
!= NULL
, TRUE
);
1775 cm_return_val_if_fail(page
!= NULL
, TRUE
);
1777 templates_save_folder_prefs(item
, page
);
1779 /* optimise by not continuing if none of the 'apply to sub folders'
1780 check boxes are selected - and optimise the checking by only doing
1782 if ((node
== page
->item
->node
) &&
1783 !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->new_msg_format_rec_checkbtn
)) ||
1784 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->reply_format_rec_checkbtn
)) ||
1785 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->forward_format_rec_checkbtn
))))
1793 static void prefs_folder_item_templates_save_func(PrefsPage
*page_
)
1795 FolderItemTemplatesPage
*page
= (FolderItemTemplatesPage
*) page_
;
1797 g_node_traverse(page
->item
->node
, G_PRE_ORDER
, G_TRAVERSE_ALL
,
1798 -1, templates_save_recurse_func
, page
);
1802 static gint
prefs_folder_item_chmod_mode(gchar
*folder_chmod
)
1808 newmode
= strtol(folder_chmod
, &tmp
, 8);
1809 if (!(*(folder_chmod
) && !(*tmp
)))
1817 static void clean_cache_cb(GtkWidget
*widget
, gpointer data
)
1819 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*) data
;
1820 FolderItem
*item
= page
->item
;
1821 gboolean was_open
= FALSE
;
1822 FolderView
*folderview
= NULL
;
1824 if (alertpanel_full(_("Discard cache"),
1825 _("Do you really want to discard the local cached "
1826 "data for this folder?"),
1827 NULL
, _("_Cancel"), NULL
, _("Discard"), NULL
, NULL
,
1828 ALERTFOCUS_SECOND
, FALSE
, NULL
, ALERT_WARNING
)
1829 != G_ALERTALTERNATE
)
1832 if (mainwindow_get_mainwindow())
1833 folderview
= mainwindow_get_mainwindow()->folderview
;
1835 if (folderview
&& item
->opened
) {
1836 folderview_close_opened(folderview
, FALSE
);
1839 folder_item_discard_cache(item
);
1841 folderview_select(folderview
,item
);
1844 static regex_t
*summary_compile_simplify_regexp(gchar
*simplify_subject_regexp
)
1847 gchar buf
[BUFFSIZE
];
1848 regex_t
*preg
= NULL
;
1850 preg
= g_new0(regex_t
, 1);
1852 err
= regcomp(preg
, simplify_subject_regexp
, REG_EXTENDED
);
1854 regerror(err
, preg
, buf
, BUFFSIZE
);
1862 static void folder_regexp_test_cb(GtkWidget
*widget
, gpointer data
)
1864 GdkColor red
= { (guint32
)0, (guint16
)0xff, (guint16
)0x70, (guint16
)0x70 };
1865 static gchar buf
[BUFFSIZE
];
1866 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*)data
;
1867 gchar
*test_string
, *regexp
;
1870 regexp
= g_strdup(gtk_entry_get_text(GTK_ENTRY(page
->entry_simplify_subject
)));
1871 test_string
= g_strdup(gtk_entry_get_text(GTK_ENTRY(page
->entry_regexp_test_string
)));
1873 if (!regexp
|| !regexp
[0]) {
1874 gtk_widget_modify_base(page
->entry_simplify_subject
,
1875 GTK_STATE_NORMAL
, NULL
);
1877 gtk_entry_set_text(GTK_ENTRY(page
->entry_regexp_test_result
), test_string
);
1879 g_free(test_string
);
1884 if (!test_string
|| !test_string
[0]) {
1885 g_free(test_string
);
1890 preg
= summary_compile_simplify_regexp(regexp
);
1892 gtk_widget_modify_base(page
->entry_simplify_subject
,
1893 GTK_STATE_NORMAL
, preg
? NULL
: &red
);
1896 string_remove_match(buf
, BUFFSIZE
, test_string
, preg
);
1898 gtk_entry_set_text(GTK_ENTRY(page
->entry_regexp_test_result
), buf
);
1904 g_free(test_string
);
1908 static gchar
*folder_regexp_get_subject_example(void)
1910 MsgInfo
*msginfo_selected
;
1911 SummaryView
*summaryview
= NULL
;
1913 if (!mainwindow_get_mainwindow())
1915 summaryview
= mainwindow_get_mainwindow()->summaryview
;
1917 msginfo_selected
= summary_get_selected_msg(summaryview
);
1918 return msginfo_selected
? g_strdup(msginfo_selected
->subject
) : NULL
;
1921 static void folder_regexp_set_subject_example_cb(GtkWidget
*widget
, gpointer data
)
1923 FolderItemGeneralPage
*page
= (FolderItemGeneralPage
*)data
;
1925 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page
->checkbtn_simplify_subject
))) {
1926 gchar
*subject
= folder_regexp_get_subject_example();
1928 gtk_entry_set_text(GTK_ENTRY(page
->entry_regexp_test_string
), subject
);
1934 static void register_general_page()
1936 static gchar
*pfi_general_path
[2];
1937 static FolderItemGeneralPage folder_item_general_page
;
1939 pfi_general_path
[0] = _("General");
1940 pfi_general_path
[1] = NULL
;
1942 folder_item_general_page
.page
.path
= pfi_general_path
;
1943 folder_item_general_page
.page
.create_widget
= prefs_folder_item_general_create_widget_func
;
1944 folder_item_general_page
.page
.destroy_widget
= prefs_folder_item_general_destroy_widget_func
;
1945 folder_item_general_page
.page
.save_page
= prefs_folder_item_general_save_func
;
1947 prefs_folder_item_register_page((PrefsPage
*) &folder_item_general_page
, NULL
);
1951 static void register_compose_page(void)
1953 static gchar
*pfi_compose_path
[2];
1954 static FolderItemComposePage folder_item_compose_page
;
1956 pfi_compose_path
[0] = _("Compose");
1957 pfi_compose_path
[1] = NULL
;
1959 folder_item_compose_page
.page
.path
= pfi_compose_path
;
1960 folder_item_compose_page
.page
.create_widget
= prefs_folder_item_compose_create_widget_func
;
1961 folder_item_compose_page
.page
.destroy_widget
= prefs_folder_item_compose_destroy_widget_func
;
1962 folder_item_compose_page
.page
.save_page
= prefs_folder_item_compose_save_func
;
1964 prefs_folder_item_register_page((PrefsPage
*) &folder_item_compose_page
, NULL
);
1967 static void register_templates_page(void)
1969 static gchar
*pfi_templates_path
[2];
1970 static FolderItemTemplatesPage folder_item_templates_page
;
1972 pfi_templates_path
[0] = _("Templates");
1973 pfi_templates_path
[1] = NULL
;
1975 folder_item_templates_page
.page
.path
= pfi_templates_path
;
1976 folder_item_templates_page
.page
.create_widget
= prefs_folder_item_templates_create_widget_func
;
1977 folder_item_templates_page
.page
.destroy_widget
= prefs_folder_item_templates_destroy_widget_func
;
1978 folder_item_templates_page
.page
.save_page
= prefs_folder_item_templates_save_func
;
1980 prefs_folder_item_register_page((PrefsPage
*) &folder_item_templates_page
, NULL
);
1983 static GSList
*prefs_pages
= NULL
;
1985 static void prefs_folder_item_address_completion_start(PrefsWindow
*window
)
1987 address_completion_start(window
->window
);
1990 static void prefs_folder_item_address_completion_end(PrefsWindow
*window
)
1992 address_completion_end(window
->window
);
1995 void prefs_folder_item_open(FolderItem
*item
)
2000 if (prefs_pages
== NULL
) {
2001 register_general_page();
2002 register_compose_page();
2003 register_templates_page();
2007 id
= folder_item_get_identifier (item
);
2010 id
= g_strdup(item
->name
);
2014 pages
= g_slist_concat(
2015 g_slist_copy(prefs_pages
),
2016 g_slist_copy(item
->folder
->klass
->prefs_pages
));
2018 title
= g_strdup_printf (_("Properties for folder %s"), id
);
2020 prefswindow_open(title
, pages
, item
,
2021 &prefs_common
.folderitemwin_width
, &prefs_common
.folderitemwin_height
,
2022 prefs_folder_item_address_completion_start
,
2024 prefs_folder_item_address_completion_end
);
2026 g_slist_free(pages
);
2030 void prefs_folder_item_register_page(PrefsPage
*page
, FolderClass
*klass
)
2033 klass
->prefs_pages
= g_slist_append(klass
->prefs_pages
, page
);
2035 prefs_pages
= g_slist_append(prefs_pages
, page
);
2038 void prefs_folder_item_unregister_page(PrefsPage
*page
, FolderClass
*klass
)
2041 klass
->prefs_pages
= g_slist_remove(klass
->prefs_pages
, page
);
2043 prefs_pages
= g_slist_remove(prefs_pages
, page
);