/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
/* alfons - all folder item specific settings should migrate into
# include "config.h"
#endif
-#include "intl.h"
#include "defs.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
#include "folder.h"
+#include "alertpanel.h"
#include "prefs_folder_item.h"
#include "folderview.h"
+#include "folder.h"
#include "summaryview.h"
#include "menu.h"
#include "account.h"
-#include "prefs.h"
+#include "prefs_gtk.h"
#include "manage_window.h"
#include "utils.h"
#include "addr_compl.h"
-#include "prefs_scoring.h"
+#include "prefs_common.h"
#include "gtkutils.h"
+#include "filtering.h"
+#include "folder_item_prefs.h"
+#include "gtk/colorsel.h"
+#include "string_match.h"
+#include "quote_fmt.h"
+#include "combobox.h"
+
+#if USE_ENCHANT
+#include "gtkaspell.h"
+#endif
+
+#define ASSIGN_STRING(string, value) \
+ { \
+ g_free(string); \
+ string = (value); \
+ }
+
+static void prefs_folder_item_register_page (PrefsPage *page);
+static void prefs_folder_item_unregister_page (PrefsPage *page);
-PrefsFolderItem tmp_prefs;
+typedef struct _FolderItemGeneralPage FolderItemGeneralPage;
+typedef struct _FolderItemComposePage FolderItemComposePage;
+typedef struct _FolderItemTemplatesPage FolderItemTemplatesPage;
+static gboolean can_save = TRUE;
-struct PrefsFolderItemDialog
+struct _FolderItemGeneralPage
{
- FolderView *folderview;
+ PrefsPage page;
+
FolderItem *item;
+
+ GtkWidget *table;
+ GtkWidget *no_save_warning;
+ GtkWidget *folder_type;
+ GtkWidget *checkbtn_simplify_subject;
+ GtkWidget *entry_simplify_subject;
+ GtkWidget *entry_regexp_test_string;
+ GtkWidget *entry_regexp_test_result;
+ GtkWidget *checkbtn_folder_chmod;
+ GtkWidget *entry_folder_chmod;
+ GtkWidget *folder_color_btn;
+ GtkWidget *checkbtn_enable_processing;
+ GtkWidget *checkbtn_enable_processing_when_opening;
+ GtkWidget *checkbtn_newmailcheck;
+ GtkWidget *checkbtn_offlinesync;
+ GtkWidget *label_offlinesync;
+ GtkWidget *entry_offlinesync;
+ GtkWidget *label_end_offlinesync;
+ GtkWidget *checkbtn_remove_old_offlinesync;
+
+ /* apply to sub folders */
+ GtkWidget *simplify_subject_rec_checkbtn;
+ GtkWidget *folder_chmod_rec_checkbtn;
+ GtkWidget *folder_color_rec_checkbtn;
+ GtkWidget *enable_processing_rec_checkbtn;
+ GtkWidget *enable_processing_when_opening_rec_checkbtn;
+ GtkWidget *newmailcheck_rec_checkbtn;
+ GtkWidget *offlinesync_rec_checkbtn;
+
+ gint folder_color;
+};
+
+struct _FolderItemComposePage
+{
+ PrefsPage page;
+
+ FolderItem *item;
+
GtkWidget *window;
+ GtkWidget *table;
+ GtkWidget *no_save_warning;
GtkWidget *checkbtn_request_return_receipt;
GtkWidget *checkbtn_save_copy_to_folder;
GtkWidget *checkbtn_default_to;
GtkWidget *entry_default_to;
- GtkWidget *checkbtn_simplify_subject;
- GtkWidget *entry_simplify_subject;
- GtkWidget *checkbtn_folder_chmod;
- GtkWidget *entry_folder_chmod;
+ GtkWidget *checkbtn_default_reply_to;
+ GtkWidget *entry_default_reply_to;
GtkWidget *checkbtn_enable_default_account;
GtkWidget *optmenu_default_account;
-};
+#if USE_ENCHANT
+ GtkWidget *checkbtn_enable_default_dictionary;
+ GtkWidget *checkbtn_enable_default_alt_dictionary;
+ GtkWidget *combo_default_dictionary;
+ GtkWidget *combo_default_alt_dictionary;
+#endif
-static PrefParam param[] = {
- {"sort_by_number", "FALSE", &tmp_prefs.sort_by_number, P_BOOL,
- NULL, NULL, NULL},
- {"sort_by_size", "FALSE", &tmp_prefs.sort_by_size, P_BOOL,
- NULL, NULL, NULL},
- {"sort_by_date", "FALSE", &tmp_prefs.sort_by_date, P_BOOL,
- NULL, NULL, NULL},
- {"sort_by_from", "FALSE", &tmp_prefs.sort_by_from, P_BOOL,
- NULL, NULL, NULL},
- {"sort_by_subject", "FALSE", &tmp_prefs.sort_by_subject, P_BOOL,
- NULL, NULL, NULL},
- {"sort_by_score", "FALSE", &tmp_prefs.sort_by_score, P_BOOL,
- NULL, NULL, NULL},
- {"sort_descending", "FALSE", &tmp_prefs.sort_descending, P_BOOL,
- NULL, NULL, NULL},
- /*{"enable_thread", "TRUE", &tmp_prefs.enable_thread, P_BOOL,
- NULL, NULL, NULL},*/
- {"kill_score", "-9999", &tmp_prefs.kill_score, P_INT,
- NULL, NULL, NULL},
- {"important_score", "1", &tmp_prefs.important_score, P_INT,
- NULL, NULL, NULL},
- /* MIGRATION */
- {"request_return_receipt", "", &tmp_prefs.request_return_receipt, P_BOOL,
- NULL, NULL, NULL},
- {"enable_default_to", "", &tmp_prefs.enable_default_to, P_BOOL,
- NULL, NULL, NULL},
- {"default_to", "", &tmp_prefs.default_to, P_STRING,
- NULL, NULL, NULL},
- {"enable_simplify_subject", "", &tmp_prefs.enable_simplify_subject, P_BOOL,
- NULL, NULL, NULL},
- {"simplify_subject_regexp", "", &tmp_prefs.simplify_subject_regexp, P_STRING,
- NULL, NULL, NULL},
- {"enable_folder_chmod", "", &tmp_prefs.enable_folder_chmod, P_BOOL,
- NULL, NULL, NULL},
- {"folder_chmod", "", &tmp_prefs.folder_chmod, P_INT,
- NULL, NULL, NULL},
- {"enable_default_account", "", &tmp_prefs.enable_default_account, P_BOOL,
- NULL, NULL, NULL},
- {"default_account", NULL, &tmp_prefs.default_account, P_INT,
- NULL, NULL, NULL},
- {"save_copy_to_folder", NULL, &tmp_prefs.save_copy_to_folder, P_BOOL,
- NULL, NULL, NULL},
- {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
+ /* apply to sub folders */
+ GtkWidget *request_return_receipt_rec_checkbtn;
+ GtkWidget *save_copy_to_folder_rec_checkbtn;
+ GtkWidget *default_to_rec_checkbtn;
+ GtkWidget *default_reply_to_rec_checkbtn;
+ GtkWidget *default_account_rec_checkbtn;
+#if USE_ENCHANT
+ GtkWidget *default_dictionary_rec_checkbtn;
+ GtkWidget *default_alt_dictionary_rec_checkbtn;
+#endif
};
-void prefs_folder_item_delete_cb (GtkWidget *widget, GdkEventAny *event,
- struct PrefsFolderItemDialog *dialog);
-void prefs_folder_item_cancel_cb (GtkWidget *widget,
- struct PrefsFolderItemDialog *dialog);
-void prefs_folder_item_ok_cb (GtkWidget *widget,
- struct PrefsFolderItemDialog *dialog);
-gint prefs_folder_item_chmod_mode (gchar *folder_chmod);
-
-
-void prefs_folder_item_read_config(FolderItem * item)
-{
- gchar * id;
-
- id = folder_item_get_identifier(item);
-
- tmp_prefs.scoring = NULL;
- tmp_prefs.processing = NULL;
- prefs_read_config(param, id, FOLDERITEM_RC);
- g_free(id);
-
- *item->prefs = tmp_prefs;
-
- /*
- * MIGRATION: next lines are migration code. the idea is that
- * if used regularly, claws folder config ends up
- * in the same file as sylpheed-main
- */
-
- item->ret_rcpt = tmp_prefs.request_return_receipt ? TRUE : FALSE;
-
- /* MIGRATION: 0.7.8main+ has persistent sort order. claws had the sort
- * order in different members, which is ofcourse a little
- * bit phoney. */
- if (item->sort_key == SORT_BY_NONE) {
- item->sort_key = (tmp_prefs.sort_by_number ? SORT_BY_NUMBER :
- tmp_prefs.sort_by_size ? SORT_BY_SIZE :
- tmp_prefs.sort_by_date ? SORT_BY_DATE :
- tmp_prefs.sort_by_from ? SORT_BY_FROM :
- tmp_prefs.sort_by_subject ? SORT_BY_SUBJECT :
- tmp_prefs.sort_by_score ? SORT_BY_SCORE :
- SORT_BY_NONE);
- item->sort_type = tmp_prefs.sort_descending ? SORT_DESCENDING : SORT_ASCENDING;
- }
-}
-
-void prefs_folder_item_save_config(FolderItem * item)
-{
- gchar * id;
+struct _FolderItemTemplatesPage
+{
+ PrefsPage page;
- tmp_prefs = * item->prefs;
+ FolderItem *item;
- id = folder_item_get_identifier(item);
+ GtkWidget *window;
+ GtkWidget *table;
+ GtkWidget *checkbtn_compose_with_format;
+ GtkWidget *compose_override_from_format;
+ GtkWidget *compose_subject_format;
+ GtkWidget *compose_body_format;
+ GtkWidget *checkbtn_reply_with_format;
+ GtkWidget *reply_quotemark;
+ GtkWidget *reply_override_from_format;
+ GtkWidget *reply_body_format;
+ GtkWidget *checkbtn_forward_with_format;
+ GtkWidget *forward_quotemark;
+ GtkWidget *forward_override_from_format;
+ GtkWidget *forward_body_format;
+
+ /* apply to sub folders */
+ GtkWidget *new_msg_format_rec_checkbtn;
+ GtkWidget *reply_format_rec_checkbtn;
+ GtkWidget *forward_format_rec_checkbtn;
+};
- prefs_save_config(param, id, FOLDERITEM_RC);
- g_free(id);
- /* MIGRATION: make sure migrated items are not saved
- */
-}
+static void general_save_folder_prefs(FolderItem *folder, FolderItemGeneralPage *page);
+static void compose_save_folder_prefs(FolderItem *folder, FolderItemComposePage *page);
+static void templates_save_folder_prefs(FolderItem *folder, FolderItemTemplatesPage *page);
-void prefs_folder_item_set_config(FolderItem * item,
- int sort_type, gint sort_mode)
-{
- g_assert(item);
- g_warning("prefs_folder_item_set_config() should never be called\n");
- item->sort_key = sort_type;
- item->sort_type = sort_mode;
-}
+static gboolean general_save_recurse_func(GNode *node, gpointer data);
+static gboolean compose_save_recurse_func(GNode *node, gpointer data);
+static gboolean templates_save_recurse_func(GNode *node, gpointer data);
-PrefsFolderItem * prefs_folder_item_new(void)
-{
- PrefsFolderItem * prefs;
-
- prefs = g_new0(PrefsFolderItem, 1);
-
- tmp_prefs.sort_by_number = FALSE;
- tmp_prefs.sort_by_size = FALSE;
- tmp_prefs.sort_by_date = FALSE;
- tmp_prefs.sort_by_from = FALSE;
- tmp_prefs.sort_by_subject = FALSE;
- tmp_prefs.sort_by_score = FALSE;
- tmp_prefs.sort_descending = FALSE;
- tmp_prefs.kill_score = -9999;
- tmp_prefs.important_score = 9999;
-
- tmp_prefs.request_return_receipt = FALSE;
- tmp_prefs.enable_default_to = FALSE;
- tmp_prefs.default_to = NULL;
- tmp_prefs.enable_simplify_subject = FALSE;
- tmp_prefs.simplify_subject_regexp = NULL;
- tmp_prefs.enable_folder_chmod = FALSE;
- tmp_prefs.folder_chmod = 0;
- tmp_prefs.enable_default_account = FALSE;
- tmp_prefs.default_account = 0;
- tmp_prefs.save_copy_to_folder = FALSE;
-
- tmp_prefs.scoring = NULL;
- tmp_prefs.processing = NULL;
-
- * prefs = tmp_prefs;
-
- return prefs;
-}
+static gint prefs_folder_item_chmod_mode (gchar *folder_chmod);
-void prefs_folder_item_free(PrefsFolderItem * prefs)
-{
- if (prefs->default_to)
- g_free(prefs->default_to);
- if (prefs->scoring != NULL)
- prefs_scoring_free(prefs->scoring);
- g_free(prefs);
-}
-
-gint prefs_folder_item_get_sort_mode(FolderItem * item)
-{
- g_assert(item != NULL);
- g_warning("prefs_folder_item_get_sort_mode() should never be called\n");
- return item->sort_key;
-}
-
-gint prefs_folder_item_get_sort_type(FolderItem * item)
-{
- g_assert(item != NULL);
- g_warning("prefs_folder_item_get_sort_type() should never be called\n");
- return item->sort_type;
-}
+static void folder_color_set_dialog(GtkWidget *widget, gpointer data);
+static void clean_cache_cb(GtkWidget *widget, gpointer data);
+static void folder_regexp_test_cb(GtkWidget *widget, gpointer data);
+static void folder_regexp_set_subject_example_cb(GtkWidget *widget, gpointer data);
#define SAFE_STRING(str) \
(str) ? (str) : ""
-void prefs_folder_item_create(void *folderview, FolderItem *item)
+static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
+ GtkWindow * window,
+ gpointer data)
{
- struct PrefsFolderItemDialog *dialog;
+ FolderItemGeneralPage *page = (FolderItemGeneralPage *) page_;
+ FolderItem *item = (FolderItem *) data;
guint rowcount;
- gchar *folder_identifier, *infotext;
- GtkWidget *window;
GtkWidget *table;
- GtkWidget *infolabel;
- GtkWidget *ok_btn;
- GtkWidget *cancel_btn;
- GtkWidget *confirm_area;
+ GtkWidget *hbox, *hbox2, *hbox_spc;
+ GtkWidget *label;
- GtkWidget *checkbtn_request_return_receipt;
- GtkWidget *checkbtn_save_copy_to_folder;
- GtkWidget *checkbtn_default_to;
- GtkWidget *entry_default_to;
+ GtkListStore *folder_type_menu;
+ GtkWidget *folder_type;
+ GtkTreeIter iter;
+ GtkWidget *dummy_checkbtn, *clean_cache_btn;
+ SpecialFolderItemType type;
+
+ GtkWidget *no_save_warning = NULL;
GtkWidget *checkbtn_simplify_subject;
GtkWidget *entry_simplify_subject;
+ GtkWidget *hbox_regexp;
+ GtkWidget *label_regexp_test;
+ GtkWidget *entry_regexp_test_string;
+ GtkWidget *left_arrow;
+ GtkWidget *entry_regexp_test_result;
+
GtkWidget *checkbtn_folder_chmod;
GtkWidget *entry_folder_chmod;
- GtkWidget *checkbtn_enable_default_account;
- GtkWidget *optmenu_default_account;
- GtkWidget *optmenu_default_account_menu;
- GtkWidget *optmenu_default_account_menuitem;
- GList *cur_ac;
- GList *account_list;
- PrefsAccount *ac_prefs;
- GtkOptionMenu *optmenu;
- GtkWidget *menu;
- GtkWidget *menuitem;
- gint account_index, index;
-
- dialog = g_new0(struct PrefsFolderItemDialog, 1);
- dialog->folderview = folderview;
- dialog->item = item;
-
- /* Window */
- window = gtk_window_new (GTK_WINDOW_DIALOG);
- gtk_window_set_title (GTK_WINDOW(window),
- _("Folder Property"));
- gtk_container_set_border_width (GTK_CONTAINER (window), 8);
- gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
- gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE);
- gtk_signal_connect (GTK_OBJECT(window), "delete_event",
- GTK_SIGNAL_FUNC(prefs_folder_item_delete_cb), dialog);
- MANAGE_WINDOW_SIGNALS_CONNECT (window);
+ GtkWidget *folder_color;
+ GtkWidget *folder_color_btn;
+ GtkWidget *checkbtn_enable_processing;
+ GtkWidget *checkbtn_enable_processing_when_opening;
+ GtkWidget *checkbtn_newmailcheck;
+ GtkWidget *checkbtn_offlinesync;
+ GtkWidget *label_offlinesync;
+ GtkWidget *entry_offlinesync;
+ GtkWidget *label_end_offlinesync;
+ GtkWidget *checkbtn_remove_old_offlinesync;
+
+ GtkWidget *simplify_subject_rec_checkbtn;
+ GtkWidget *folder_chmod_rec_checkbtn;
+ GtkWidget *folder_color_rec_checkbtn;
+ GtkWidget *enable_processing_rec_checkbtn;
+ GtkWidget *enable_processing_when_opening_rec_checkbtn;
+ GtkWidget *newmailcheck_rec_checkbtn;
+ GtkWidget *offlinesync_rec_checkbtn;
+ CLAWS_TIP_DECL();
+
+ page->item = item;
/* Table */
- table = gtk_table_new(4, 2, FALSE);
- gtk_widget_show(table);
- gtk_table_set_row_spacings(GTK_TABLE(table), VSPACING_NARROW);
- gtk_container_add(GTK_CONTAINER (window), table);
+ table = gtk_table_new(11, 4, FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (table), VBOX_BORDER);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 4);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 4);
rowcount = 0;
- /* Label */
- folder_identifier = folder_item_get_identifier(item);
- infotext = g_strconcat(_("Folder Property for "), folder_identifier, NULL);
- infolabel = gtk_label_new(infotext);
- gtk_table_attach(GTK_TABLE(table), infolabel, 0, 2, rowcount,
- rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
- gtk_widget_show(infolabel);
- rowcount++;
-
- /* Request Return Receipt */
- checkbtn_request_return_receipt = gtk_check_button_new_with_label
- (_("Request Return Receipt"));
- gtk_widget_show(checkbtn_request_return_receipt);
- gtk_table_attach(GTK_TABLE(table), checkbtn_request_return_receipt,
- 0, 2, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL,
- GTK_SHRINK, 0, 0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_request_return_receipt),
- item->ret_rcpt ? TRUE : FALSE);
-
- rowcount++;
-
- /* Save Copy to Folder */
- checkbtn_save_copy_to_folder = gtk_check_button_new_with_label
- (_("Save copy of outgoing messages to this folder instead of Sent"));
- gtk_widget_show(checkbtn_save_copy_to_folder);
- gtk_table_attach(GTK_TABLE(table), checkbtn_save_copy_to_folder, 0, 2,
- rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_save_copy_to_folder),
- item->prefs->save_copy_to_folder ? TRUE : FALSE);
-
+ if (!can_save) {
+ no_save_warning = gtk_label_new(
+ _("<i>These preferences will not be saved as this folder "
+ "is a top-level one. However you can use them to set them "
+ "to the whole mailbox tree using \"Apply to subfolders\".</i>"));
+ gtk_label_set_use_markup(GTK_LABEL(no_save_warning), TRUE);
+ gtk_label_set_line_wrap(GTK_LABEL(no_save_warning), TRUE);
+ gtk_misc_set_alignment(GTK_MISC(no_save_warning), 0.0, 0.5);
+ gtk_table_attach(GTK_TABLE(table), no_save_warning, 0, 4,
+ rowcount, rowcount + 1, GTK_FILL, 0, 0, 0);
+ rowcount++;
+ }
+
+ /* Apply to subfolders */
+ label = gtk_label_new(_("Apply to\nsubfolders"));
+ gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);
+ gtk_table_attach(GTK_TABLE(table), label, 3, 4,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
- /* Default To */
- checkbtn_default_to = gtk_check_button_new_with_label(_("Default To: "));
- gtk_widget_show(checkbtn_default_to);
- gtk_table_attach(GTK_TABLE(table), checkbtn_default_to, 0, 1,
- rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_to),
- item->prefs->enable_default_to);
-
- entry_default_to = gtk_entry_new();
- gtk_widget_show(entry_default_to);
- gtk_table_attach_defaults(GTK_TABLE(table), entry_default_to, 1, 2, rowcount, rowcount + 1);
- SET_TOGGLE_SENSITIVITY(checkbtn_default_to, entry_default_to);
- gtk_entry_set_text(GTK_ENTRY(entry_default_to), SAFE_STRING(item->prefs->default_to));
- address_completion_register_entry(GTK_ENTRY(entry_default_to));
+ /* folder_type */
+ folder_type = gtkut_sc_combobox_create(NULL, FALSE);
+ gtk_widget_show (folder_type);
+
+ type = F_NORMAL;
+ if (item->stype == F_INBOX)
+ type = F_INBOX;
+ else if (folder_has_parent_of_type(item, F_OUTBOX))
+ type = F_OUTBOX;
+ else if (folder_has_parent_of_type(item, F_DRAFT))
+ type = F_DRAFT;
+ else if (folder_has_parent_of_type(item, F_QUEUE))
+ type = F_QUEUE;
+ else if (folder_has_parent_of_type(item, F_TRASH))
+ type = F_TRASH;
+
+ folder_type_menu = GTK_LIST_STORE(gtk_combo_box_get_model(
+ GTK_COMBO_BOX(folder_type)));
+
+ COMBOBOX_ADD (folder_type_menu, _("Normal"), F_NORMAL);
+ COMBOBOX_ADD (folder_type_menu, _("Inbox"), F_INBOX);
+ COMBOBOX_ADD (folder_type_menu, _("Outbox"), F_OUTBOX);
+ COMBOBOX_ADD (folder_type_menu, _("Drafts"), F_DRAFT);
+ COMBOBOX_ADD (folder_type_menu, _("Queue"), F_QUEUE);
+ COMBOBOX_ADD (folder_type_menu, _("Trash"), F_TRASH);
+
+ combobox_select_by_data(GTK_COMBO_BOX(folder_type), type);
+
+ dummy_checkbtn = gtk_check_button_new();
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dummy_checkbtn), type != F_INBOX);
+ gtk_widget_set_sensitive(dummy_checkbtn, FALSE);
+
+ if (type == item->stype && type == F_NORMAL)
+ gtk_widget_set_sensitive(folder_type, TRUE);
+ else
+ gtk_widget_set_sensitive(folder_type, FALSE);
+
+ label = gtk_label_new(_("Folder type"));
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_table_attach(GTK_TABLE(table), label, 0, 1,
+ rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), folder_type, 1, 2,
+ rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), dummy_checkbtn, 3, 4,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
/* Simplify Subject */
- checkbtn_simplify_subject = gtk_check_button_new_with_label(_("Simplify Subject RegExp: "));
- gtk_widget_show(checkbtn_simplify_subject);
+ checkbtn_simplify_subject = gtk_check_button_new_with_label(_("Simplify Subject RegExp"));
gtk_table_attach(GTK_TABLE(table), checkbtn_simplify_subject, 0, 1,
- rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+ rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_simplify_subject),
item->prefs->enable_simplify_subject);
+ g_signal_connect(G_OBJECT(checkbtn_simplify_subject), "toggled",
+ G_CALLBACK(folder_regexp_set_subject_example_cb), page);
+
entry_simplify_subject = gtk_entry_new();
- gtk_widget_show(entry_simplify_subject);
- gtk_table_attach_defaults(GTK_TABLE(table), entry_simplify_subject, 1, 2,
- rowcount, rowcount + 1);
+ gtk_table_attach(GTK_TABLE(table), entry_simplify_subject, 1, 3,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject, entry_simplify_subject);
gtk_entry_set_text(GTK_ENTRY(entry_simplify_subject),
SAFE_STRING(item->prefs->simplify_subject_regexp));
+ g_signal_connect(G_OBJECT(entry_simplify_subject), "changed",
+ G_CALLBACK(folder_regexp_test_cb), page);
+
+ simplify_subject_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), simplify_subject_rec_checkbtn, 3, 4,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
+ /* Test RegExp */
+ label_regexp_test = gtk_label_new(_("Test RegExp"));
+ gtk_misc_set_alignment(GTK_MISC(label_regexp_test), 0, 0.5);
+ gtk_table_attach(GTK_TABLE(table), label_regexp_test, 0, 1,
+ rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
+ SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject, label_regexp_test);
+
+ entry_regexp_test_string = gtk_entry_new();
+ gtk_table_attach(GTK_TABLE(table), entry_regexp_test_string, 1, 2,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject, entry_regexp_test_string);
+
+ g_signal_connect(G_OBJECT(entry_regexp_test_string), "changed",
+ G_CALLBACK(folder_regexp_test_cb), page);
+
+ hbox_regexp = gtk_hbox_new (FALSE, 4);
+ gtk_widget_show (hbox_regexp);
+ gtk_table_attach(GTK_TABLE(table), hbox_regexp, 2, 3,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
+ left_arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
+ gtk_widget_show(left_arrow);
+ gtk_box_pack_start (GTK_BOX(hbox_regexp), left_arrow, FALSE, FALSE, 0);
+ SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject, left_arrow);
+
+ entry_regexp_test_result = gtk_entry_new();
+ gtk_box_pack_end (GTK_BOX(hbox_regexp), entry_regexp_test_result, TRUE, TRUE, 0);
+ SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject, entry_regexp_test_result);
+ gtk_editable_set_editable(GTK_EDITABLE(entry_regexp_test_result), FALSE);
+
rowcount++;
/* Folder chmod */
- checkbtn_folder_chmod = gtk_check_button_new_with_label(_("Folder chmod: "));
- gtk_widget_show(checkbtn_folder_chmod);
+ checkbtn_folder_chmod = gtk_check_button_new_with_label(_("Folder chmod"));
gtk_table_attach(GTK_TABLE(table), checkbtn_folder_chmod, 0, 1,
- rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+ rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_chmod),
item->prefs->enable_folder_chmod);
entry_folder_chmod = gtk_entry_new();
- gtk_widget_show(entry_folder_chmod);
- gtk_table_attach_defaults(GTK_TABLE(table), entry_folder_chmod, 1, 2,
- rowcount, rowcount + 1);
+ gtk_table_attach(GTK_TABLE(table), entry_folder_chmod, 1, 2,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
SET_TOGGLE_SENSITIVITY(checkbtn_folder_chmod, entry_folder_chmod);
if (item->prefs->folder_chmod) {
gchar *buf;
g_free(buf);
}
+ folder_chmod_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), folder_chmod_rec_checkbtn, 3, 4,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
+ /* Folder color */
+ folder_color = gtk_label_new(_("Folder color"));
+ gtk_misc_set_alignment(GTK_MISC(folder_color), 0, 0.5);
+ gtk_table_attach(GTK_TABLE(table), folder_color, 0, 1,
+ rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
+
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_table_attach(GTK_TABLE(table), hbox, 1, 2,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
+ folder_color_btn = gtk_button_new_with_label("");
+ gtk_widget_set_size_request(folder_color_btn, 36, 26);
+ gtk_box_pack_start (GTK_BOX(hbox), folder_color_btn, FALSE, FALSE, 0);
+ CLAWS_SET_TIP(folder_color_btn,
+ _("Pick color for folder"));
+
+ page->folder_color = item->prefs->color;
+
+ g_signal_connect(G_OBJECT(folder_color_btn), "clicked",
+ G_CALLBACK(folder_color_set_dialog),
+ page);
+
+ gtkut_set_widget_bgcolor_rgb(folder_color_btn, item->prefs->color);
+
+ folder_color_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), folder_color_rec_checkbtn, 3, 4,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
+ /* Enable processing at startup */
+ checkbtn_enable_processing =
+ gtk_check_button_new_with_label(_("Run Processing rules at start-up"));
+ gtk_table_attach(GTK_TABLE(table), checkbtn_enable_processing, 0, 2,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_processing),
+ item->prefs->enable_processing);
+
+ enable_processing_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), enable_processing_rec_checkbtn, 3, 4,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
+ /* Enable processing rules when opening folder */
+ checkbtn_enable_processing_when_opening =
+ gtk_check_button_new_with_label(_("Run Processing rules when opening"));
+ gtk_table_attach(GTK_TABLE(table), checkbtn_enable_processing_when_opening, 0, 2,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_processing_when_opening),
+ item->prefs->enable_processing_when_opening);
+
+ enable_processing_when_opening_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), enable_processing_when_opening_rec_checkbtn, 3, 4,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
+ /* Check folder for new mail */
+ checkbtn_newmailcheck = gtk_check_button_new_with_label(_("Scan for new mail"));
+ CLAWS_SET_TIP(checkbtn_newmailcheck,
+ _("Turn this option on if mail is delivered directly "
+ "to this folder by server side filtering on IMAP or "
+ "by an external application"));
+ gtk_table_attach(GTK_TABLE(table), checkbtn_newmailcheck, 0, 2,
+ rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_newmailcheck),
+ item->prefs->newmailcheck);
+ newmailcheck_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), newmailcheck_rec_checkbtn, 3, 4,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
+ /* Synchronise folder for offline use */
+ checkbtn_offlinesync = gtk_check_button_new_with_label(_("Synchronise for offline use"));
+ gtk_table_attach(GTK_TABLE(table), checkbtn_offlinesync, 0, 2,
+ rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
+ offlinesync_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), offlinesync_rec_checkbtn, 3, 4,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
+ hbox = gtk_hbox_new (FALSE, 8);
+ gtk_widget_show (hbox);
+ gtk_table_attach(GTK_TABLE(table), hbox, 0, 4,
+ rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ rowcount++;
+
+ hbox_spc = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (hbox_spc);
+ gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
+ gtk_widget_set_size_request (hbox_spc, 12, -1);
+
+ label_offlinesync = gtk_label_new(_("Fetch message bodies from the last"));
+ gtk_widget_show (label_offlinesync);
+ gtk_box_pack_start (GTK_BOX (hbox), label_offlinesync, FALSE, FALSE, 0);
+
+ entry_offlinesync = gtk_entry_new();
+ gtk_widget_set_size_request (entry_offlinesync, 64, -1);
+ gtk_widget_show (entry_offlinesync);
+ CLAWS_SET_TIP(entry_offlinesync, _("0: all bodies"));
+ gtk_box_pack_start (GTK_BOX (hbox), entry_offlinesync, FALSE, FALSE, 0);
+
+ label_end_offlinesync = gtk_label_new(_("days"));
+ gtk_widget_show (label_end_offlinesync);
+ gtk_box_pack_start (GTK_BOX (hbox), label_end_offlinesync, FALSE, FALSE, 0);
+
+ checkbtn_remove_old_offlinesync = gtk_check_button_new_with_label(
+ _("Remove older messages bodies"));
+
+ hbox2 = gtk_hbox_new (FALSE, 8);
+ gtk_widget_show (hbox2);
+ gtk_table_attach(GTK_TABLE(table), hbox2, 0, 4,
+ rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ rowcount++;
+
+ hbox_spc = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (hbox_spc);
+ gtk_box_pack_start (GTK_BOX (hbox2), hbox_spc, FALSE, FALSE, 0);
+ gtk_widget_set_size_request (hbox_spc, 12, -1);
+ gtk_box_pack_start (GTK_BOX (hbox2), checkbtn_remove_old_offlinesync, FALSE, FALSE, 0);
+
+ SET_TOGGLE_SENSITIVITY (checkbtn_offlinesync, hbox);
+ SET_TOGGLE_SENSITIVITY (checkbtn_offlinesync, hbox2);
+
+ clean_cache_btn = gtk_button_new_with_label(_("Discard folder cache"));
+ gtk_widget_show (clean_cache_btn);
+ gtk_table_attach(GTK_TABLE(table), clean_cache_btn, 0, 1,
+ rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ g_signal_connect(G_OBJECT(clean_cache_btn), "clicked",
+ G_CALLBACK(clean_cache_cb),
+ page);
+
+ gtk_widget_show_all(table);
+
+ if (item->folder && (item->folder->klass->type != F_IMAP &&
+ item->folder->klass->type != F_NEWS)) {
+ item->prefs->offlinesync = TRUE;
+ item->prefs->offlinesync_days = 0;
+ item->prefs->remove_old_bodies = FALSE;
+
+ gtk_widget_set_sensitive(GTK_WIDGET(checkbtn_offlinesync),
+ FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(offlinesync_rec_checkbtn),
+ FALSE);
+ gtk_widget_hide(GTK_WIDGET(checkbtn_offlinesync));
+ gtk_widget_hide(GTK_WIDGET(hbox));
+ gtk_widget_hide(GTK_WIDGET(hbox2));
+ gtk_widget_hide(GTK_WIDGET(offlinesync_rec_checkbtn));
+ gtk_widget_hide(GTK_WIDGET(clean_cache_btn));
+
+ }
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_offlinesync),
+ item->prefs->offlinesync);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_remove_old_offlinesync),
+ item->prefs->remove_old_bodies);
+ gtk_entry_set_text(GTK_ENTRY(entry_offlinesync), itos(item->prefs->offlinesync_days));
+
+ page->table = table;
+ page->folder_type = folder_type;
+ page->no_save_warning = no_save_warning;
+ page->checkbtn_simplify_subject = checkbtn_simplify_subject;
+ page->entry_simplify_subject = entry_simplify_subject;
+ page->entry_regexp_test_string = entry_regexp_test_string;
+ page->entry_regexp_test_result = entry_regexp_test_result;
+ page->checkbtn_folder_chmod = checkbtn_folder_chmod;
+ page->entry_folder_chmod = entry_folder_chmod;
+ page->folder_color_btn = folder_color_btn;
+ page->checkbtn_enable_processing = checkbtn_enable_processing;
+ page->checkbtn_enable_processing_when_opening = checkbtn_enable_processing_when_opening;
+ page->checkbtn_newmailcheck = checkbtn_newmailcheck;
+ page->checkbtn_offlinesync = checkbtn_offlinesync;
+ page->label_offlinesync = label_offlinesync;
+ page->entry_offlinesync = entry_offlinesync;
+ page->label_end_offlinesync = label_end_offlinesync;
+ page->checkbtn_remove_old_offlinesync = checkbtn_remove_old_offlinesync;
+
+ page->simplify_subject_rec_checkbtn = simplify_subject_rec_checkbtn;
+ page->folder_chmod_rec_checkbtn = folder_chmod_rec_checkbtn;
+ page->folder_color_rec_checkbtn = folder_color_rec_checkbtn;
+ page->enable_processing_rec_checkbtn = enable_processing_rec_checkbtn;
+ page->enable_processing_when_opening_rec_checkbtn = enable_processing_when_opening_rec_checkbtn;
+ page->newmailcheck_rec_checkbtn = newmailcheck_rec_checkbtn;
+ page->offlinesync_rec_checkbtn = offlinesync_rec_checkbtn;
+
+ page->page.widget = table;
+
+ folder_regexp_set_subject_example_cb(NULL, page);
+}
+
+static void prefs_folder_item_general_destroy_widget_func(PrefsPage *page_)
+{
+ /* FolderItemGeneralPage *page = (FolderItemGeneralPage *) page_; */
+}
+
+/** \brief Save the prefs in page to folder.
+ *
+ * If the folder is not the one specified in page->item, then only those properties
+ * that have the relevant 'apply to sub folders' button checked are saved
+ */
+static void general_save_folder_prefs(FolderItem *folder, FolderItemGeneralPage *page)
+{
+ FolderItemPrefs *prefs = folder->prefs;
+ gchar *buf;
+ gboolean all = FALSE;
+ SpecialFolderItemType type = F_NORMAL;
+
+ if (folder->path == NULL)
+ return;
+
+ g_return_if_fail(prefs != NULL);
+
+ if (page->item == folder)
+ all = TRUE;
+
+ type = combobox_get_active_data(GTK_COMBO_BOX(page->folder_type));
+ if (all && folder->stype != type) {
+ folder_item_change_type(folder, type);
+ }
+
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->simplify_subject_rec_checkbtn))) {
+ prefs->enable_simplify_subject =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_simplify_subject));
+ ASSIGN_STRING(prefs->simplify_subject_regexp,
+ gtk_editable_get_chars(GTK_EDITABLE(page->entry_simplify_subject), 0, -1));
+ }
+
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->folder_chmod_rec_checkbtn))) {
+ prefs->enable_folder_chmod =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_folder_chmod));
+ buf = gtk_editable_get_chars(GTK_EDITABLE(page->entry_folder_chmod), 0, -1);
+ prefs->folder_chmod = prefs_folder_item_chmod_mode(buf);
+ g_free(buf);
+ }
+
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->folder_color_rec_checkbtn))) {
+ int old_color = prefs->color;
+ prefs->color = page->folder_color;
+
+ /* update folder view */
+ if (prefs->color != old_color)
+ folder_item_update(folder, F_ITEM_UPDATE_MSGCNT);
+ }
+
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable_processing_rec_checkbtn))) {
+ prefs->enable_processing =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_processing));
+ }
+
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable_processing_when_opening_rec_checkbtn))) {
+ prefs->enable_processing_when_opening =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_processing_when_opening));
+ }
+
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->newmailcheck_rec_checkbtn))) {
+ prefs->newmailcheck =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_newmailcheck));
+ }
+
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->offlinesync_rec_checkbtn))) {
+ prefs->offlinesync =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_offlinesync));
+ prefs->offlinesync_days =
+ atoi(gtk_entry_get_text(GTK_ENTRY(page->entry_offlinesync)));
+ prefs->remove_old_bodies =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_remove_old_offlinesync));
+ }
+
+ folder_item_prefs_save_config(folder);
+}
+
+static gboolean general_save_recurse_func(GNode *node, gpointer data)
+{
+ FolderItem *item = (FolderItem *) node->data;
+ FolderItemGeneralPage *page = (FolderItemGeneralPage *) data;
+
+ g_return_val_if_fail(item != NULL, TRUE);
+ g_return_val_if_fail(page != NULL, TRUE);
+
+ general_save_folder_prefs(item, page);
+
+ /* optimise by not continuing if none of the 'apply to sub folders'
+ check boxes are selected - and optimise the checking by only doing
+ it once */
+ if ((node == page->item->node) &&
+ !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->simplify_subject_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->folder_chmod_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->folder_color_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable_processing_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable_processing_when_opening_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->newmailcheck_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->offlinesync_rec_checkbtn))))
+ return TRUE;
+ else
+ return FALSE;
+}
+
+static void prefs_folder_item_general_save_func(PrefsPage *page_)
+{
+ FolderItemGeneralPage *page = (FolderItemGeneralPage *) page_;
+
+ g_node_traverse(page->item->node, G_PRE_ORDER, G_TRAVERSE_ALL,
+ -1, general_save_recurse_func, page);
+
+ main_window_set_menu_sensitive(mainwindow_get_mainwindow());
+
+}
+
+static RecvProtocol item_protocol(FolderItem *item)
+{
+ if (!item)
+ return A_NONE;
+ if (!item->folder)
+ return A_NONE;
+ if (!item->folder->account)
+ return A_NONE;
+ return item->folder->account->protocol;
+}
+
+static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
+ GtkWindow * window,
+ gpointer data)
+{
+ FolderItemComposePage *page = (FolderItemComposePage *) page_;
+ FolderItem *item = (FolderItem *) data;
+ guint rowcount;
+
+ GtkWidget *table;
+ GtkWidget *label;
+
+ GtkWidget *no_save_warning = NULL;
+ GtkWidget *checkbtn_request_return_receipt = NULL;
+ GtkWidget *checkbtn_save_copy_to_folder = NULL;
+ GtkWidget *checkbtn_default_to = NULL;
+ GtkWidget *entry_default_to = NULL;
+ GtkWidget *checkbtn_default_reply_to = NULL;
+ GtkWidget *entry_default_reply_to = NULL;
+ GtkWidget *checkbtn_enable_default_account = NULL;
+ GtkWidget *optmenu_default_account = NULL;
+ GtkListStore *optmenu_default_account_menu = NULL;
+ GtkTreeIter iter;
+#if USE_ENCHANT
+ GtkWidget *checkbtn_enable_default_dictionary = NULL;
+ GtkWidget *combo_default_dictionary = NULL;
+ GtkWidget *checkbtn_enable_default_alt_dictionary = NULL;
+ GtkWidget *combo_default_alt_dictionary = NULL;
+ GtkWidget *default_dictionary_rec_checkbtn = NULL;
+ GtkWidget *default_alt_dictionary_rec_checkbtn = NULL;
+ gchar *dictionary;
+#endif
+ GtkWidget *request_return_receipt_rec_checkbtn = NULL;
+ GtkWidget *save_copy_to_folder_rec_checkbtn = NULL;
+ GtkWidget *default_to_rec_checkbtn = NULL;
+ GtkWidget *default_reply_to_rec_checkbtn = NULL;
+ GtkWidget *default_account_rec_checkbtn = NULL;
+
+ GList *cur_ac;
+ GList *account_list;
+ PrefsAccount *ac_prefs;
+ gboolean default_account_set = FALSE;
+
+ page->item = item;
+
+ /* Table */
+#if USE_ENCHANT
+# define TABLEHEIGHT 7
+#else
+# define TABLEHEIGHT 6
+#endif
+ table = gtk_table_new(TABLEHEIGHT, 3, FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (table), VBOX_BORDER);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 4);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 4);
+ rowcount = 0;
+
+ if (!can_save) {
+ no_save_warning = gtk_label_new(
+ _("<i>These preferences will not be saved as this folder "
+ "is a top-level one. However you can use them to set them "
+ "to the whole mailbox tree using \"Apply to subfolders\".</i>"));
+ gtk_label_set_use_markup(GTK_LABEL(no_save_warning), TRUE);
+ gtk_label_set_line_wrap(GTK_LABEL(no_save_warning), TRUE);
+ gtk_misc_set_alignment(GTK_MISC(no_save_warning), 0.0, 0.5);
+ gtk_table_attach(GTK_TABLE(table), no_save_warning, 0, 3,
+ rowcount, rowcount + 1, GTK_FILL, 0, 0, 0);
+ rowcount++;
+ }
+
+ /* Apply to subfolders */
+ label = gtk_label_new(_("Apply to\nsubfolders"));
+ gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);
+ gtk_table_attach(GTK_TABLE(table), label, 2, 3,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
rowcount++;
+ if (item_protocol(item) != A_NNTP) {
+ /* Request Return Receipt */
+ checkbtn_request_return_receipt = gtk_check_button_new_with_label
+ (_("Request Return Receipt"));
+ gtk_table_attach(GTK_TABLE(table), checkbtn_request_return_receipt,
+ 0, 2, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL,
+ GTK_FILL, 0, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_request_return_receipt),
+ item->ret_rcpt ? TRUE : FALSE);
+
+ request_return_receipt_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), request_return_receipt_rec_checkbtn, 2, 3,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
+ /* Save Copy to Folder */
+ checkbtn_save_copy_to_folder = gtk_check_button_new_with_label
+ (_("Save copy of outgoing messages to this folder instead of Sent"));
+ gtk_table_attach(GTK_TABLE(table), checkbtn_save_copy_to_folder, 0, 2,
+ rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_save_copy_to_folder),
+ item->prefs->save_copy_to_folder ? TRUE : FALSE);
+
+ save_copy_to_folder_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), save_copy_to_folder_rec_checkbtn, 2, 3,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
+ /* Default To */
+ checkbtn_default_to = gtk_check_button_new_with_label(_("Default To:"));
+ gtk_table_attach(GTK_TABLE(table), checkbtn_default_to, 0, 1,
+ rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_to),
+ item->prefs->enable_default_to);
+
+ entry_default_to = gtk_entry_new();
+ gtk_table_attach(GTK_TABLE(table), entry_default_to, 1, 2,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+ SET_TOGGLE_SENSITIVITY(checkbtn_default_to, entry_default_to);
+ gtk_entry_set_text(GTK_ENTRY(entry_default_to), SAFE_STRING(item->prefs->default_to));
+ address_completion_register_entry(GTK_ENTRY(entry_default_to),
+ TRUE);
+
+ default_to_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), default_to_rec_checkbtn, 2, 3,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
+ /* Default address to reply to */
+ checkbtn_default_reply_to = gtk_check_button_new_with_label(_("Default To: for replies"));
+ gtk_table_attach(GTK_TABLE(table), checkbtn_default_reply_to, 0, 1,
+ rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_reply_to),
+ item->prefs->enable_default_reply_to);
+
+ entry_default_reply_to = gtk_entry_new();
+ gtk_table_attach(GTK_TABLE(table), entry_default_reply_to, 1, 2,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+ SET_TOGGLE_SENSITIVITY(checkbtn_default_reply_to, entry_default_reply_to);
+ gtk_entry_set_text(GTK_ENTRY(entry_default_reply_to), SAFE_STRING(item->prefs->default_reply_to));
+ address_completion_register_entry(
+ GTK_ENTRY(entry_default_reply_to), TRUE);
+
+ default_reply_to_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), default_reply_to_rec_checkbtn, 2, 3,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+ }
/* Default account */
- checkbtn_enable_default_account = gtk_check_button_new_with_label(_("Default account: "));
- gtk_widget_show(checkbtn_enable_default_account);
+ checkbtn_enable_default_account = gtk_check_button_new_with_label(_("Default account"));
gtk_table_attach(GTK_TABLE(table), checkbtn_enable_default_account, 0, 1,
rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_account),
item->prefs->enable_default_account);
- optmenu_default_account = gtk_option_menu_new ();
- gtk_widget_show (optmenu_default_account);
- gtk_table_attach_defaults(GTK_TABLE(table), optmenu_default_account, 1, 2,
- rowcount, rowcount + 1);
- optmenu_default_account_menu = gtk_menu_new ();
+ optmenu_default_account = gtkut_sc_combobox_create(NULL, FALSE);
+ gtk_table_attach(GTK_TABLE(table), optmenu_default_account, 1, 2,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+ optmenu_default_account_menu = GTK_LIST_STORE(
+ gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu_default_account)));
account_list = account_get_list();
- account_index = 0;
- index = 0;
for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
ac_prefs = (PrefsAccount *)cur_ac->data;
- MENUITEM_ADD (optmenu_default_account_menu, optmenu_default_account_menuitem,
+ if (item->folder->account &&
+ ( (item_protocol(item) == A_NNTP && ac_prefs->protocol != A_NNTP)
+ ||(item_protocol(item) != A_NNTP && ac_prefs->protocol == A_NNTP)))
+ continue;
+
+ if (item->folder->klass->type != F_NEWS && ac_prefs->protocol == A_NNTP)
+ continue;
+
+ COMBOBOX_ADD_ESCAPED (optmenu_default_account_menu,
ac_prefs->account_name?ac_prefs->account_name : _("Untitled"),
ac_prefs->account_id);
- /* get the index for menu's set_history (sad method?) */
- if (ac_prefs->account_id == item->prefs->default_account)
- account_index = index;
- index++;
+
+ /* Set combobox to current default account id */
+ if (ac_prefs->account_id == item->prefs->default_account) {
+ combobox_select_by_data(GTK_COMBO_BOX(optmenu_default_account),
+ ac_prefs->account_id);
+ default_account_set = TRUE;
+ }
}
- dialog->item->prefs->default_account = item->prefs->default_account;
+ /* If nothing has been set (folder doesn't have a default account set),
+ * pre-select global default account, since that's what actually used
+ * anyway. We don't want nothing selected in combobox. */
+ if( !default_account_set )
+ combobox_select_by_data(GTK_COMBO_BOX(optmenu_default_account),
+ account_get_default()->account_id);
- optmenu=GTK_OPTION_MENU(optmenu_default_account);
- gtk_option_menu_set_menu(optmenu, optmenu_default_account_menu);
+ SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_account, optmenu_default_account);
- gtk_option_menu_set_history(optmenu, account_index);
+ default_account_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), default_account_rec_checkbtn, 2, 3,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+ rowcount++;
- menu = gtk_option_menu_get_menu(optmenu);
- menuitem = gtk_menu_get_active(GTK_MENU(menu));
- gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
+#if USE_ENCHANT
+ /* Default dictionary */
+ checkbtn_enable_default_dictionary = gtk_check_button_new_with_label(_("Default dictionary"));
+ gtk_table_attach(GTK_TABLE(table), checkbtn_enable_default_dictionary, 0, 1,
+ rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_dictionary),
+ item->prefs->enable_default_dictionary);
+
+ combo_default_dictionary = gtkaspell_dictionary_combo_new(TRUE);
+ gtk_table_attach(GTK_TABLE(table), combo_default_dictionary, 1, 2,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+
+ dictionary = item->prefs->default_dictionary;
+ if (dictionary && strrchr(dictionary, '/')) {
+ gchar *tmp = g_strdup(strrchr(dictionary, '/')+1);
+ g_free(item->prefs->default_dictionary);
+ item->prefs->default_dictionary = tmp;
+ dictionary = item->prefs->default_dictionary;
+ }
+ if (item->prefs->default_dictionary &&
+ strchr(item->prefs->default_dictionary, '-')) {
+ *(strchr(item->prefs->default_dictionary, '-')) = '\0';
+ }
+ if (dictionary)
+ gtkaspell_set_dictionary_menu_active_item(
+ GTK_COMBO_BOX(combo_default_dictionary), dictionary);
- SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_account, optmenu_default_account);
+ SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_dictionary, combo_default_dictionary);
+ default_dictionary_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), default_dictionary_rec_checkbtn, 2, 3,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
rowcount++;
- /* Ok and Cancle Buttons */
- gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
- &cancel_btn, _("Cancel"), NULL, NULL);
- gtk_widget_show(confirm_area);
- gtk_table_attach_defaults(GTK_TABLE(table), confirm_area, 0, 2,
- rowcount, rowcount + 1);
- gtk_widget_grab_default(ok_btn);
- gtk_signal_connect (GTK_OBJECT(ok_btn), "clicked",
- GTK_SIGNAL_FUNC(prefs_folder_item_ok_cb), dialog);
- gtk_signal_connect (GTK_OBJECT(cancel_btn), "clicked",
- GTK_SIGNAL_FUNC(prefs_folder_item_cancel_cb), dialog);
-
- dialog->window = window;
- dialog->checkbtn_request_return_receipt = checkbtn_request_return_receipt;
- dialog->checkbtn_save_copy_to_folder = checkbtn_save_copy_to_folder;
- dialog->checkbtn_default_to = checkbtn_default_to;
- dialog->entry_default_to = entry_default_to;
- dialog->checkbtn_simplify_subject = checkbtn_simplify_subject;
- dialog->entry_simplify_subject = entry_simplify_subject;
- dialog->checkbtn_folder_chmod = checkbtn_folder_chmod;
- dialog->entry_folder_chmod = entry_folder_chmod;
- dialog->checkbtn_enable_default_account = checkbtn_enable_default_account;
- dialog->optmenu_default_account = optmenu_default_account;
-
- g_free(infotext);
-
- address_completion_start(window);
-
- gtk_widget_show(window);
+ /* Default dictionary */
+ checkbtn_enable_default_alt_dictionary = gtk_check_button_new_with_label(_("Default alternate dictionary"));
+ gtk_table_attach(GTK_TABLE(table), checkbtn_enable_default_alt_dictionary, 0, 1,
+ rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_alt_dictionary),
+ item->prefs->enable_default_alt_dictionary);
+
+ combo_default_alt_dictionary = gtkaspell_dictionary_combo_new(FALSE);
+ gtk_table_attach(GTK_TABLE(table), combo_default_alt_dictionary, 1, 2,
+ rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+
+ dictionary = item->prefs->default_alt_dictionary;
+ if (dictionary && strrchr(dictionary, '/')) {
+ gchar *tmp = g_strdup(strrchr(dictionary, '/')+1);
+ g_free(item->prefs->default_alt_dictionary);
+ item->prefs->default_alt_dictionary = tmp;
+ dictionary = item->prefs->default_alt_dictionary;
+ }
+ if (item->prefs->default_alt_dictionary &&
+ strchr(item->prefs->default_alt_dictionary, '-')) {
+ *(strchr(item->prefs->default_alt_dictionary, '-')) = '\0';
+ }
+ if (dictionary)
+ gtkaspell_set_dictionary_menu_active_item(
+ GTK_COMBO_BOX(combo_default_alt_dictionary), dictionary);
+
+ SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_alt_dictionary, combo_default_alt_dictionary);
+
+ default_alt_dictionary_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), default_alt_dictionary_rec_checkbtn, 2, 3,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+#endif
+
+ gtk_widget_show_all(table);
+
+ page->window = GTK_WIDGET(window);
+ page->table = table;
+ page->no_save_warning = no_save_warning;
+ page->checkbtn_request_return_receipt = checkbtn_request_return_receipt;
+ page->checkbtn_save_copy_to_folder = checkbtn_save_copy_to_folder;
+ page->checkbtn_default_to = checkbtn_default_to;
+ page->entry_default_to = entry_default_to;
+ page->checkbtn_default_reply_to = checkbtn_default_reply_to;
+ page->entry_default_reply_to = entry_default_reply_to;
+ page->checkbtn_enable_default_account = checkbtn_enable_default_account;
+ page->optmenu_default_account = optmenu_default_account;
+#ifdef USE_ENCHANT
+ page->checkbtn_enable_default_dictionary = checkbtn_enable_default_dictionary;
+ page->combo_default_dictionary = combo_default_dictionary;
+ page->checkbtn_enable_default_alt_dictionary = checkbtn_enable_default_alt_dictionary;
+ page->combo_default_alt_dictionary = combo_default_alt_dictionary;
+#endif
+
+ page->request_return_receipt_rec_checkbtn = request_return_receipt_rec_checkbtn;
+ page->save_copy_to_folder_rec_checkbtn = save_copy_to_folder_rec_checkbtn;
+ page->default_to_rec_checkbtn = default_to_rec_checkbtn;
+ page->default_reply_to_rec_checkbtn = default_reply_to_rec_checkbtn;
+ page->default_account_rec_checkbtn = default_account_rec_checkbtn;
+#if USE_ENCHANT
+ page->default_dictionary_rec_checkbtn = default_dictionary_rec_checkbtn;
+ page->default_alt_dictionary_rec_checkbtn = default_alt_dictionary_rec_checkbtn;
+#endif
+
+ page->page.widget = table;
}
-void prefs_folder_item_destroy(struct PrefsFolderItemDialog *dialog)
+static void prefs_folder_item_compose_destroy_widget_func(PrefsPage *page_)
{
- address_completion_unregister_entry(GTK_ENTRY(dialog->entry_default_to));
- address_completion_end(dialog->window);
- gtk_widget_destroy(dialog->window);
- g_free(dialog);
+ FolderItemComposePage *page = (FolderItemComposePage *) page_;
+
+ if (page->entry_default_to)
+ address_completion_unregister_entry(GTK_ENTRY(page->entry_default_to));
+ if (page->entry_default_reply_to)
+ address_completion_unregister_entry(GTK_ENTRY(page->entry_default_reply_to));
}
-void prefs_folder_item_cancel_cb(GtkWidget *widget,
- struct PrefsFolderItemDialog *dialog)
+/** \brief Save the prefs in page to folder.
+ *
+ * If the folder is not the one specified in page->item, then only those properties
+ * that have the relevant 'apply to sub folders' button checked are saved
+ */
+static void compose_save_folder_prefs(FolderItem *folder, FolderItemComposePage *page)
{
- prefs_folder_item_destroy(dialog);
-}
+ FolderItemPrefs *prefs = folder->prefs;
+
+ gboolean all = FALSE;
-void prefs_folder_item_delete_cb(GtkWidget *widget, GdkEventAny *event,
- struct PrefsFolderItemDialog *dialog)
+ if (folder->path == NULL)
+ return;
+
+ if (page->item == folder)
+ all = TRUE;
+
+ g_return_if_fail(prefs != NULL);
+
+ if (item_protocol(folder) != A_NNTP) {
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->request_return_receipt_rec_checkbtn))) {
+ prefs->request_return_receipt =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_request_return_receipt));
+ /* MIGRATION */
+ folder->ret_rcpt = prefs->request_return_receipt;
+ }
+
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->save_copy_to_folder_rec_checkbtn))) {
+ prefs->save_copy_to_folder =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_save_copy_to_folder));
+ }
+
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_to_rec_checkbtn))) {
+
+ prefs->enable_default_to =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_to));
+ ASSIGN_STRING(prefs->default_to,
+ gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_to), 0, -1));
+ }
+
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_reply_to_rec_checkbtn))) {
+ prefs->enable_default_reply_to =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_reply_to));
+ ASSIGN_STRING(prefs->default_reply_to,
+ gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_reply_to), 0, -1));
+ }
+ } else {
+ prefs->request_return_receipt = FALSE;
+ prefs->save_copy_to_folder = FALSE;
+ prefs->enable_default_to = FALSE;
+ prefs->enable_default_reply_to = FALSE;
+ }
+
+ if (all || gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn))) {
+ prefs->enable_default_account =
+ gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(page->checkbtn_enable_default_account));
+ prefs->default_account = combobox_get_active_data(
+ GTK_COMBO_BOX(page->optmenu_default_account));
+ }
+
+#if USE_ENCHANT
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_dictionary_rec_checkbtn))) {
+ prefs->enable_default_dictionary =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_default_dictionary));
+ ASSIGN_STRING(prefs->default_dictionary,
+ gtkaspell_get_dictionary_menu_active_item(
+ GTK_COMBO_BOX(page->combo_default_dictionary)));
+ }
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_alt_dictionary_rec_checkbtn))) {
+ prefs->enable_default_alt_dictionary =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_default_alt_dictionary));
+ ASSIGN_STRING(prefs->default_alt_dictionary,
+ gtkaspell_get_dictionary_menu_active_item(
+ GTK_COMBO_BOX(page->combo_default_alt_dictionary)));
+ }
+#endif
+
+ folder_item_prefs_save_config(folder);
+}
+
+static gboolean compose_save_recurse_func(GNode *node, gpointer data)
{
- prefs_folder_item_destroy(dialog);
+ FolderItem *item = (FolderItem *) node->data;
+ FolderItemComposePage *page = (FolderItemComposePage *) data;
+
+ g_return_val_if_fail(item != NULL, TRUE);
+ g_return_val_if_fail(page != NULL, TRUE);
+
+ compose_save_folder_prefs(item, page);
+
+ /* optimise by not continuing if none of the 'apply to sub folders'
+ check boxes are selected - and optimise the checking by only doing
+ it once */
+ if ((node == page->item->node) && item_protocol(item) != A_NNTP &&
+ !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->request_return_receipt_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->save_copy_to_folder_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_to_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn)) ||
+#if USE_ENCHANT
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_dictionary_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_alt_dictionary_rec_checkbtn)) ||
+#endif
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_reply_to_rec_checkbtn))))
+ return TRUE;
+ else if ((node == page->item->node) && item_protocol(item) == A_NNTP &&
+ !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn))
+#if USE_ENCHANT
+ || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_dictionary_rec_checkbtn))
+ || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_alt_dictionary_rec_checkbtn))
+#endif
+ ))
+ return TRUE;
+ else
+ return FALSE;
}
-void prefs_folder_item_ok_cb(GtkWidget *widget,
- struct PrefsFolderItemDialog *dialog)
+static void prefs_folder_item_compose_save_func(PrefsPage *page_)
{
- gchar *buf;
- PrefsFolderItem *prefs = dialog->item->prefs;
- GtkWidget *menu;
- GtkWidget *menuitem;
- gboolean old_simplify_val;
- gchar *old_simplify_str;
+ FolderItemComposePage *page = (FolderItemComposePage *) page_;
- g_return_if_fail(prefs != NULL);
+ g_node_traverse(page->item->node, G_PRE_ORDER, G_TRAVERSE_ALL,
+ -1, compose_save_recurse_func, page);
- old_simplify_val = prefs->enable_simplify_subject;
- old_simplify_str = prefs->simplify_subject_regexp;
+}
- prefs->request_return_receipt =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_request_return_receipt));
- /* MIGRATION */
- dialog->item->ret_rcpt = prefs->request_return_receipt;
+static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
+ GtkWindow * window,
+ gpointer data)
+{
+ FolderItemTemplatesPage *page = (FolderItemTemplatesPage *) page_;
+ FolderItem *item = (FolderItem *) data;
- prefs->save_copy_to_folder =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_save_copy_to_folder));
+ GtkWidget *notebook;
+ GtkWidget *vbox;
+ GtkWidget *page_vbox;
+ GtkWidget *no_save_warning;
+ GtkWidget *new_msg_format_rec_checkbtn;
+ GtkWidget *reply_format_rec_checkbtn;
+ GtkWidget *forward_format_rec_checkbtn;
- prefs->enable_default_to =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_default_to));
- g_free(prefs->default_to);
- prefs->default_to =
- gtk_editable_get_chars(GTK_EDITABLE(dialog->entry_default_to), 0, -1);
+ page->item = item;
- prefs->enable_simplify_subject =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_simplify_subject));
- prefs->simplify_subject_regexp =
- gtk_editable_get_chars(GTK_EDITABLE(dialog->entry_simplify_subject), 0, -1);
+ page_vbox = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (page_vbox);
- if (dialog->item == dialog->folderview->summaryview->folder_item &&
- (prefs->enable_simplify_subject != old_simplify_val ||
- 0 != strcmp2(prefs->simplify_subject_regexp, old_simplify_str)))
- summary_show(dialog->folderview->summaryview, dialog->item, FALSE);
+ if (!can_save) {
+ no_save_warning = gtk_label_new(
+ _("<i>These preferences will not be saved as this folder "
+ "is a top-level one. However you can use them to set them "
+ "to the whole mailbox tree using \"Apply to subfolders\".</i>"));
+ gtk_label_set_use_markup(GTK_LABEL(no_save_warning), TRUE);
+ gtk_label_set_line_wrap(GTK_LABEL(no_save_warning), TRUE);
+ gtk_misc_set_alignment(GTK_MISC(no_save_warning), 0.0, 0.5);
+ gtk_box_pack_start(GTK_BOX(page_vbox), no_save_warning, FALSE, FALSE, 4);
+ }
+
+ /* Notebook */
+ notebook = gtk_notebook_new();
+ gtk_widget_show(notebook);
+ gtk_box_pack_start(GTK_BOX(page_vbox), notebook, TRUE, TRUE, 0);
+
+ /* compose format */
+ vbox = gtk_vbox_new (FALSE, VSPACING);
+ gtk_widget_show (vbox);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), VBOX_BORDER);
+
+ quotefmt_create_new_msg_fmt_widgets(
+ window,
+ vbox,
+ &page->checkbtn_compose_with_format,
+ &page->compose_override_from_format,
+ &page->compose_subject_format,
+ &page->compose_body_format,
+ FALSE, FALSE);
+ address_completion_register_entry(GTK_ENTRY(page->compose_override_from_format),
+ TRUE);
+
+ new_msg_format_rec_checkbtn = gtk_check_button_new_with_label(
+ _("Apply to subfolders"));
+ gtk_box_pack_end (GTK_BOX(vbox), new_msg_format_rec_checkbtn, FALSE, FALSE, 0);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, gtk_label_new(_("Compose")));
+
+ /* reply format */
+ vbox = gtk_vbox_new (FALSE, VSPACING);
+ gtk_widget_show (vbox);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), VBOX_BORDER);
+
+ quotefmt_create_reply_fmt_widgets(
+ window,
+ vbox,
+ &page->checkbtn_reply_with_format,
+ &page->reply_override_from_format,
+ &page->reply_quotemark,
+ &page->reply_body_format,
+ FALSE, FALSE);
+ address_completion_register_entry(GTK_ENTRY(page->reply_override_from_format),
+ TRUE);
+
+ reply_format_rec_checkbtn = gtk_check_button_new_with_label(
+ _("Apply to subfolders"));
+ gtk_box_pack_end (GTK_BOX(vbox), reply_format_rec_checkbtn, FALSE, FALSE, 0);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, gtk_label_new(_("Reply")));
+
+ /* forward format */
+ vbox = gtk_vbox_new (FALSE, VSPACING);
+ gtk_widget_show (vbox);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), VBOX_BORDER);
+
+ quotefmt_create_forward_fmt_widgets(
+ window,
+ vbox,
+ &page->checkbtn_forward_with_format,
+ &page->forward_override_from_format,
+ &page->forward_quotemark,
+ &page->forward_body_format,
+ FALSE, FALSE);
+ address_completion_register_entry(GTK_ENTRY(page->forward_override_from_format),
+ TRUE);
+
+ forward_format_rec_checkbtn = gtk_check_button_new_with_label(
+ _("Apply to subfolders"));
+ gtk_box_pack_end (GTK_BOX(vbox), forward_format_rec_checkbtn, FALSE, FALSE, 0);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, gtk_label_new(_("Forward")));
+
+ /* information button */
+ quotefmt_add_info_button(window, page_vbox);
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(page->checkbtn_compose_with_format),
+ item->prefs->compose_with_format);
+ pref_set_entry_from_pref(GTK_ENTRY(page->compose_override_from_format),
+ item->prefs->compose_override_from_format);
+ pref_set_entry_from_pref(GTK_ENTRY(page->compose_subject_format),
+ item->prefs->compose_subject_format);
+ pref_set_textview_from_pref(GTK_TEXT_VIEW(page->compose_body_format),
+ item->prefs->compose_body_format);
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(page->checkbtn_reply_with_format),
+ item->prefs->reply_with_format);
+ pref_set_entry_from_pref(GTK_ENTRY(page->reply_quotemark),
+ item->prefs->reply_quotemark);
+ pref_set_entry_from_pref(GTK_ENTRY(page->reply_override_from_format),
+ item->prefs->reply_override_from_format);
+ pref_set_textview_from_pref(GTK_TEXT_VIEW(page->reply_body_format),
+ item->prefs->reply_body_format);
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(page->checkbtn_forward_with_format),
+ item->prefs->forward_with_format);
+ pref_set_entry_from_pref(GTK_ENTRY(page->forward_quotemark),
+ item->prefs->forward_quotemark);
+ pref_set_entry_from_pref(GTK_ENTRY(page->forward_override_from_format),
+ item->prefs->forward_override_from_format);
+ pref_set_textview_from_pref(GTK_TEXT_VIEW(page->forward_body_format),
+ item->prefs->forward_body_format);
+
+ gtk_widget_show_all(page_vbox);
+
+ page->window = GTK_WIDGET(window);
+
+ page->new_msg_format_rec_checkbtn = new_msg_format_rec_checkbtn;
+ page->reply_format_rec_checkbtn = reply_format_rec_checkbtn;
+ page->forward_format_rec_checkbtn = forward_format_rec_checkbtn;
+
+ page->page.widget = page_vbox;
+}
+
+static void prefs_folder_item_templates_destroy_widget_func(PrefsPage *page_)
+{
+ FolderItemTemplatesPage *page = (FolderItemTemplatesPage *) page_;
+
+ if (page->compose_override_from_format)
+ address_completion_unregister_entry(GTK_ENTRY(page->compose_override_from_format));
+ if (page->reply_override_from_format)
+ address_completion_unregister_entry(GTK_ENTRY(page->reply_override_from_format));
+ if (page->forward_override_from_format)
+ address_completion_unregister_entry(GTK_ENTRY(page->forward_override_from_format));
+}
+
+/** \brief Save the prefs in page to folder.
+ *
+ * If the folder is not the one specified in page->item, then only those properties
+ * that have the relevant 'apply to sub folders' button checked are saved
+ */
+static void templates_save_folder_prefs(FolderItem *folder, FolderItemTemplatesPage *page)
+{
+ FolderItemPrefs *prefs = folder->prefs;
+ gboolean all = FALSE;
+
+ if (folder->path == NULL)
+ return;
+
+ if (page->item == folder)
+ all = TRUE;
+
+ g_return_if_fail(prefs != NULL);
+
+ /* save and check formats */
+
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->new_msg_format_rec_checkbtn))) {
- if (old_simplify_str) g_free(old_simplify_str);
+ prefs->compose_with_format =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_compose_with_format));
+ prefs->compose_override_from_format = pref_get_pref_from_entry(
+ GTK_ENTRY(page->compose_override_from_format));
+ prefs->compose_subject_format = pref_get_pref_from_entry(
+ GTK_ENTRY(page->compose_subject_format));
+ prefs->compose_body_format = pref_get_pref_from_textview(
+ GTK_TEXT_VIEW(page->compose_body_format));
+ quotefmt_check_new_msg_formats(prefs->compose_with_format,
+ prefs->compose_override_from_format,
+ prefs->compose_subject_format,
+ prefs->compose_body_format);
+ }
- prefs->enable_folder_chmod =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_folder_chmod));
- buf = gtk_editable_get_chars(GTK_EDITABLE(dialog->entry_folder_chmod), 0, -1);
- prefs->folder_chmod = prefs_folder_item_chmod_mode(buf);
- g_free(buf);
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->reply_format_rec_checkbtn))) {
+ prefs->reply_with_format =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_reply_with_format));
+ prefs->reply_quotemark = gtk_editable_get_chars(
+ GTK_EDITABLE(page->reply_quotemark), 0, -1);
+ prefs->reply_override_from_format = pref_get_pref_from_entry(
+ GTK_ENTRY(page->reply_override_from_format));
+ prefs->reply_body_format = pref_get_pref_from_textview(
+ GTK_TEXT_VIEW(page->reply_body_format));
+ quotefmt_check_reply_formats(prefs->reply_with_format,
+ prefs->reply_override_from_format,
+ prefs->reply_quotemark,
+ prefs->reply_body_format);
+ }
- prefs->enable_default_account =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_enable_default_account));
- menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(dialog->optmenu_default_account));
- menuitem = gtk_menu_get_active(GTK_MENU(menu));
- prefs->default_account = GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(menuitem)));
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->forward_format_rec_checkbtn))) {
+ prefs->forward_with_format =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_forward_with_format));
+ prefs->forward_quotemark = gtk_editable_get_chars(
+ GTK_EDITABLE(page->forward_quotemark), 0, -1);
+ prefs->forward_override_from_format = pref_get_pref_from_entry(
+ GTK_ENTRY(page->forward_override_from_format));
+ prefs->forward_body_format = pref_get_pref_from_textview(
+ GTK_TEXT_VIEW(page->forward_body_format));
+ quotefmt_check_forward_formats(prefs->forward_with_format,
+ prefs->forward_override_from_format,
+ prefs->forward_quotemark,
+ prefs->forward_body_format);
+ }
+ folder_item_prefs_save_config(folder);
+}
- prefs_folder_item_save_config(dialog->item);
- prefs_folder_item_destroy(dialog);
+static gboolean templates_save_recurse_func(GNode *node, gpointer data)
+{
+ FolderItem *item = (FolderItem *) node->data;
+ FolderItemTemplatesPage *page = (FolderItemTemplatesPage *) data;
+
+ g_return_val_if_fail(item != NULL, TRUE);
+ g_return_val_if_fail(page != NULL, TRUE);
+
+ templates_save_folder_prefs(item, page);
+
+ /* optimise by not continuing if none of the 'apply to sub folders'
+ check boxes are selected - and optimise the checking by only doing
+ it once */
+ if ((node == page->item->node) &&
+ !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->new_msg_format_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->reply_format_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->forward_format_rec_checkbtn))))
+ return TRUE;
+ else
+ return FALSE;
+
+ return FALSE;
}
-gint prefs_folder_item_chmod_mode(gchar *folder_chmod)
+static void prefs_folder_item_templates_save_func(PrefsPage *page_)
+{
+ FolderItemTemplatesPage *page = (FolderItemTemplatesPage *) page_;
+
+ g_node_traverse(page->item->node, G_PRE_ORDER, G_TRAVERSE_ALL,
+ -1, templates_save_recurse_func, page);
+
+}
+
+static gint prefs_folder_item_chmod_mode(gchar *folder_chmod)
{
gint newmode = 0;
gchar *tmp;
return newmode;
}
+
+static void folder_color_set_dialog(GtkWidget *widget, gpointer data)
+{
+ FolderItemGeneralPage *page = (FolderItemGeneralPage *) data;
+ gint rgbcolor;
+
+ rgbcolor = colorsel_select_color_rgb(_("Pick color for folder"),
+ page->folder_color);
+ gtkut_set_widget_bgcolor_rgb(page->folder_color_btn, rgbcolor);
+ page->folder_color = rgbcolor;
+}
+
+static void clean_cache_cb(GtkWidget *widget, gpointer data)
+{
+ FolderItemGeneralPage *page = (FolderItemGeneralPage *) data;
+ FolderItem *item = page->item;
+ gboolean was_open = FALSE;
+ FolderView *folderview = NULL;
+
+ if (alertpanel_full(_("Discard cache"),
+ _("Do you really want to discard the local cached "
+ "data for this folder?"),
+ GTK_STOCK_CANCEL, _("+Discard"), NULL, FALSE,
+ NULL, ALERT_WARNING, G_ALERTDEFAULT)
+ != G_ALERTALTERNATE)
+ return;
+
+ if (mainwindow_get_mainwindow())
+ folderview = mainwindow_get_mainwindow()->folderview;
+
+ if (folderview && item->opened) {
+ folderview_close_opened(folderview);
+ was_open = TRUE;
+ }
+ folder_item_discard_cache(item);
+ if (was_open)
+ folderview_select(folderview,item);
+}
+
+static regex_t *summary_compile_simplify_regexp(gchar *simplify_subject_regexp)
+{
+ int err;
+ gchar buf[BUFFSIZE];
+ regex_t *preg = NULL;
+
+ preg = g_new0(regex_t, 1);
+
+ err = string_match_precompile(simplify_subject_regexp,
+ preg, REG_EXTENDED);
+ if (err) {
+ regerror(err, preg, buf, BUFFSIZE);
+ g_free(preg);
+ preg = NULL;
+ }
+
+ return preg;
+}
+
+static void folder_regexp_test_cb(GtkWidget *widget, gpointer data)
+{
+ static GdkColor red;
+ static gboolean colors_initialised = FALSE;
+ static gchar buf[BUFFSIZE];
+ FolderItemGeneralPage *page = (FolderItemGeneralPage *)data;
+ gchar *test_string, *regexp;
+ regex_t *preg;
+
+ regexp = g_strdup(gtk_entry_get_text(GTK_ENTRY(page->entry_simplify_subject)));
+ test_string = g_strdup(gtk_entry_get_text(GTK_ENTRY(page->entry_regexp_test_string)));
+
+ if (!regexp || !regexp[0]) {
+ gtk_widget_modify_base(page->entry_simplify_subject,
+ GTK_STATE_NORMAL, NULL);
+ if (test_string) {
+ gtk_entry_set_text(GTK_ENTRY(page->entry_regexp_test_result), test_string);
+ g_free(test_string);
+ }
+ return;
+ }
+
+ if (!test_string || !test_string[0]) {
+ g_free(regexp);
+ return;
+ }
+
+ if (!colors_initialised) {
+ gdk_color_parse("#ff7070", &red);
+ colors_initialised = gdk_colormap_alloc_color(
+ gdk_colormap_get_system(), &red, FALSE, TRUE);
+ }
+
+ preg = summary_compile_simplify_regexp(regexp);
+ if (colors_initialised) {
+ gtk_widget_modify_base(page->entry_simplify_subject,
+ GTK_STATE_NORMAL, preg ? NULL : &red);
+ }
+
+ if (preg != NULL) {
+ string_remove_match(buf, BUFFSIZE, test_string, preg);
+
+ gtk_entry_set_text(GTK_ENTRY(page->entry_regexp_test_result), buf);
+
+ regfree(preg);
+ g_free(preg);
+ }
+
+ g_free(test_string);
+ g_free(regexp);
+}
+
+static gchar *folder_regexp_get_subject_example(void)
+{
+ MsgInfo *msginfo_selected;
+ SummaryView *summaryview = NULL;
+
+ if (!mainwindow_get_mainwindow())
+ return NULL;
+ summaryview = mainwindow_get_mainwindow()->summaryview;
+
+ msginfo_selected = summary_get_selected_msg(summaryview);
+ return msginfo_selected ? g_strdup(msginfo_selected->subject) : NULL;
+}
+
+static void folder_regexp_set_subject_example_cb(GtkWidget *widget, gpointer data)
+{
+ FolderItemGeneralPage *page = (FolderItemGeneralPage *)data;
+
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_simplify_subject))) {
+ gchar *subject = folder_regexp_get_subject_example();
+ if (subject) {
+ gtk_entry_set_text(GTK_ENTRY(page->entry_regexp_test_string), subject);
+ g_free(subject);
+ }
+ }
+}
+
+static void register_general_page()
+{
+ static gchar *pfi_general_path[3];
+ static FolderItemGeneralPage folder_item_general_page;
+
+ pfi_general_path[0] = _("Folder");
+ pfi_general_path[1] = _("General");
+ pfi_general_path[2] = NULL;
+
+ folder_item_general_page.page.path = pfi_general_path;
+ folder_item_general_page.page.create_widget = prefs_folder_item_general_create_widget_func;
+ folder_item_general_page.page.destroy_widget = prefs_folder_item_general_destroy_widget_func;
+ folder_item_general_page.page.save_page = prefs_folder_item_general_save_func;
+
+ prefs_folder_item_register_page((PrefsPage *) &folder_item_general_page);
+}
+
+
+static void register_compose_page(void)
+{
+ static gchar *pfi_compose_path[3];
+ static FolderItemComposePage folder_item_compose_page;
+
+ pfi_compose_path[0] = _("Folder");
+ pfi_compose_path[1] = _("Compose");
+ pfi_compose_path[2] = NULL;
+
+ folder_item_compose_page.page.path = pfi_compose_path;
+ folder_item_compose_page.page.create_widget = prefs_folder_item_compose_create_widget_func;
+ folder_item_compose_page.page.destroy_widget = prefs_folder_item_compose_destroy_widget_func;
+ folder_item_compose_page.page.save_page = prefs_folder_item_compose_save_func;
+
+ prefs_folder_item_register_page((PrefsPage *) &folder_item_compose_page);
+}
+
+static void register_templates_page(void)
+{
+ static gchar *pfi_templates_path[3];
+ static FolderItemTemplatesPage folder_item_templates_page;
+
+ pfi_templates_path[0] = _("Folder");
+ pfi_templates_path[1] = _("Templates");
+ pfi_templates_path[2] = NULL;
+
+ folder_item_templates_page.page.path = pfi_templates_path;
+ folder_item_templates_page.page.create_widget = prefs_folder_item_templates_create_widget_func;
+ folder_item_templates_page.page.destroy_widget = prefs_folder_item_templates_destroy_widget_func;
+ folder_item_templates_page.page.save_page = prefs_folder_item_templates_save_func;
+
+ prefs_folder_item_register_page((PrefsPage *) &folder_item_templates_page);
+}
+
+static GSList *prefs_pages = NULL;
+
+static void prefs_folder_item_address_completion_start(GtkWindow * window)
+{
+ address_completion_start(GTK_WIDGET(window));
+}
+
+static void prefs_folder_item_address_completion_end(GtkWindow * window)
+{
+ address_completion_end(GTK_WIDGET(window));
+}
+
+void prefs_folder_item_open(FolderItem *item)
+{
+ gchar *id, *title;
+ if (prefs_pages == NULL) {
+ register_general_page();
+ register_compose_page();
+ register_templates_page();
+ }
+
+ if (item->path) {
+ id = folder_item_get_identifier (item);
+ can_save = TRUE;
+ } else {
+ id = g_strdup(item->name);
+ can_save = FALSE;
+ }
+ title = g_strdup_printf (_("Properties for folder %s"), id);
+ g_free (id);
+ prefswindow_open(title, prefs_pages, item,
+ &prefs_common.folderitemwin_width, &prefs_common.folderitemwin_height,
+ prefs_folder_item_address_completion_start,
+ prefs_folder_item_address_completion_end);
+
+ g_free (title);
+}
+
+static void prefs_folder_item_register_page(PrefsPage *page)
+{
+ prefs_pages = g_slist_append(prefs_pages, page);
+}
+
+static void prefs_folder_item_unregister_page(PrefsPage *page)
+{
+ prefs_pages = g_slist_remove(prefs_pages, page);
+}