[Commits] [SCM] claws branch, master, updated. 3.17.0-49-g3964141
wwp at claws-mail.org
wwp at claws-mail.org
Fri Sep 7 08:06:19 CEST 2018
The branch, master has been updated
via 39641415ecdedbeb2322b02207ebab740e2e8907 (commit)
from fea0a7450600fb27689521dfda3e2d1aa147389e (commit)
Summary of changes:
src/compose.c | 25 ++++++++++++-
src/folder_item_prefs.c | 9 ++++-
src/folder_item_prefs.h | 12 ++++--
src/prefs_folder_item.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 133 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit 39641415ecdedbeb2322b02207ebab740e2e8907
Author: wwp <subscript at free.fr>
Date: Fri Sep 7 08:05:22 2018 +0200
Add new folder options: enable/disable per-folder signing and
encrypting (by default: obey to applicable account preference).
diff --git a/src/compose.c b/src/compose.c
index edc579a..637bb94 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -494,6 +494,7 @@ static void compose_update_privacy_system_menu_item(Compose * compose, gboolean
static void compose_activate_privacy_system (Compose *compose,
PrefsAccount *account,
gboolean warn);
+static void compose_apply_folder_privacy_settings(Compose *compose, FolderItem *folder_item);
static void compose_toggle_return_receipt_cb(GtkToggleAction *action,
gpointer data);
static void compose_toggle_remove_refs_cb(GtkToggleAction *action,
@@ -1005,6 +1006,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
cm_return_val_if_fail(account != NULL, NULL);
compose = compose_create(account, item, COMPOSE_NEW, FALSE);
+ compose_apply_folder_privacy_settings(compose, item);
/* override from name if mailto asked for it */
if (mailto_from) {
@@ -1555,6 +1557,7 @@ static Compose *compose_generic_reply(MsgInfo *msginfo,
cm_return_val_if_fail(account != NULL, NULL);
compose = compose_create(account, msginfo->folder, COMPOSE_REPLY, FALSE);
+ compose_apply_folder_privacy_settings(compose, msginfo->folder);
compose->updating = TRUE;
@@ -1740,6 +1743,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
else
mode = COMPOSE_FORWARD;
compose = compose_create(account, msginfo->folder, mode, batch);
+ compose_apply_folder_privacy_settings(compose, msginfo->folder);
compose->updating = TRUE;
compose->fwdinfo = procmsg_msginfo_get_full_info(msginfo);
@@ -1911,7 +1915,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
hooks_invoke(COMPOSE_CREATED_HOOKLIST, compose);
- return compose;
+ return compose;
}
#undef INSERT_FW_HEADER
@@ -1955,6 +1959,7 @@ static Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_
}
compose = compose_create(account, ((MsgInfo *)msginfo_list->data)->folder, COMPOSE_FORWARD, FALSE);
+ compose_apply_folder_privacy_settings(compose, ((MsgInfo *)msginfo_list->data)->folder);
compose->updating = TRUE;
@@ -2364,6 +2369,7 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
} else {
compose_activate_privacy_system(compose, account, FALSE);
}
+ compose_apply_folder_privacy_settings(compose, msginfo->folder);
compose->targetinfo = procmsg_msginfo_copy(msginfo);
compose->targetinfo->tags = g_slist_copy(msginfo->tags);
@@ -2490,6 +2496,7 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
cm_return_val_if_fail(account != NULL, NULL);
compose = compose_create(account, msginfo->folder, COMPOSE_REDIRECT, batch);
+ compose_apply_folder_privacy_settings(compose, msginfo->folder);
compose->updating = TRUE;
@@ -8310,8 +8317,8 @@ static Compose *compose_create(PrefsAccount *account,
/* Privacy Systems menu */
compose_update_privacy_systems_menu(compose);
-
compose_activate_privacy_system(compose, account, TRUE);
+
toolbar_set_style(compose->toolbar->toolbar, compose->handlebox, prefs_common.toolbar_style);
if (batch) {
gtk_widget_realize(window);
@@ -11527,6 +11534,20 @@ static void compose_activate_privacy_system(Compose *compose, PrefsAccount *acco
compose_update_privacy_system_menu_item(compose, warn);
}
+static void compose_apply_folder_privacy_settings(Compose *compose, FolderItem *folder_item)
+{
+ if (folder_item != NULL) {
+ if (folder_item->prefs->always_sign != SIGN_OR_ENCRYPT_DEFAULT) {
+ compose_use_signing(compose,
+ (folder_item->prefs->always_sign == SIGN_OR_ENCRYPT_ALWAYS) ? TRUE : FALSE);
+ }
+ if (folder_item->prefs->always_encrypt != SIGN_OR_ENCRYPT_DEFAULT) {
+ compose_use_encryption(compose,
+ (folder_item->prefs->always_encrypt == SIGN_OR_ENCRYPT_ALWAYS) ? TRUE : FALSE);
+ }
+ }
+}
+
static void compose_toggle_ruler_cb(GtkToggleAction *action, gpointer data)
{
Compose *compose = (Compose *)data;
diff --git a/src/folder_item_prefs.c b/src/folder_item_prefs.c
index d65423b..874f18d 100644
--- a/src/folder_item_prefs.c
+++ b/src/folder_item_prefs.c
@@ -77,6 +77,10 @@ static PrefParam param[] = {
{"default_alt_dictionary", NULL, &tmp_prefs.default_alt_dictionary, P_STRING,
NULL, NULL, NULL},
#endif
+ {"always_sign", "0", &tmp_prefs.always_sign, P_ENUM,
+ NULL, NULL, NULL},
+ {"always_encrypt", "0", &tmp_prefs.always_encrypt, P_ENUM,
+ NULL, NULL, NULL},
{"save_copy_to_folder", NULL, &tmp_prefs.save_copy_to_folder, P_BOOL,
NULL, NULL, NULL},
{"folder_color", "", &tmp_prefs.color, P_INT,
@@ -198,6 +202,8 @@ static FolderItemPrefs *folder_item_prefs_clear(FolderItemPrefs *prefs)
prefs->enable_default_alt_dictionary = FALSE;
prefs->default_alt_dictionary = NULL;
#endif
+ prefs->always_sign = SIGN_OR_ENCRYPT_DEFAULT;
+ prefs->always_encrypt = SIGN_OR_ENCRYPT_DEFAULT;
prefs->save_copy_to_folder = FALSE;
prefs->color = 0;
@@ -305,6 +311,8 @@ void folder_item_prefs_copy_prefs(FolderItem * src, FolderItem * dest)
tmp_prefs.enable_default_alt_dictionary = src->prefs->enable_default_alt_dictionary;
tmp_prefs.default_alt_dictionary = g_strdup(src->prefs->default_alt_dictionary);
#endif
+ tmp_prefs.always_sign = src->prefs->always_sign;
+ tmp_prefs.always_encrypt = src->prefs->always_encrypt;
tmp_prefs.save_copy_to_folder = src->prefs->save_copy_to_folder;
tmp_prefs.color = src->prefs->color;
@@ -333,5 +341,4 @@ void folder_item_prefs_copy_prefs(FolderItem * src, FolderItem * dest)
dest->hide_read_threads = src->hide_read_threads;
dest->sort_key = src->sort_key;
dest->sort_type = src->sort_type;
-
}
diff --git a/src/folder_item_prefs.h b/src/folder_item_prefs.h
index 44e4998..aa649c4 100644
--- a/src/folder_item_prefs.h
+++ b/src/folder_item_prefs.h
@@ -31,12 +31,17 @@ typedef enum {
HTML_PROMOTE_NEVER,
HTML_PROMOTE_ALWAYS
} HTMLPromoteType;
+typedef enum {
+ SIGN_OR_ENCRYPT_DEFAULT=0,
+ SIGN_OR_ENCRYPT_NEVER,
+ SIGN_OR_ENCRYPT_ALWAYS
+} SignOrEncryptType;
struct _FolderItemPrefs {
gchar * directory;
- int enable_processing; /* at start-up */
- int enable_processing_when_opening;
+ int enable_processing; /* at start-up */
+ int enable_processing_when_opening;
GSList * processing;
int newmailcheck;
@@ -67,7 +72,8 @@ struct _FolderItemPrefs {
gchar *default_dictionary;
gboolean enable_default_alt_dictionary;
gchar *default_alt_dictionary;
-
+ SignOrEncryptType always_sign;
+ SignOrEncryptType always_encrypt;
gboolean save_copy_to_folder;
guint color;
diff --git a/src/prefs_folder_item.c b/src/prefs_folder_item.c
index d05802a..aca5b7d 100644
--- a/src/prefs_folder_item.c
+++ b/src/prefs_folder_item.c
@@ -134,6 +134,8 @@ struct _FolderItemComposePage
GtkWidget *combo_default_dictionary;
GtkWidget *combo_default_alt_dictionary;
#endif
+ GtkWidget *always_sign;
+ GtkWidget *always_encrypt;
/* apply to sub folders */
GtkWidget *request_return_receipt_rec_checkbtn;
@@ -148,6 +150,8 @@ struct _FolderItemComposePage
GtkWidget *default_dictionary_rec_checkbtn;
GtkWidget *default_alt_dictionary_rec_checkbtn;
#endif
+ GtkWidget *always_sign_rec_checkbtn;
+ GtkWidget *always_encrypt_rec_checkbtn;
};
struct _FolderItemTemplatesPage
@@ -664,7 +668,7 @@ static void prefs_folder_item_general_destroy_widget_func(PrefsPage *page_)
/** \brief Save the prefs in page to folder.
*
- * If the folder is not the one specified in page->item, then only those properties
+ * 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)
@@ -818,6 +822,7 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
gchar *tr = NULL;
GtkWidget *table;
+ GtkWidget *hbox;
GtkWidget *label;
GtkWidget *no_save_warning = NULL;
@@ -846,6 +851,10 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
GtkWidget *default_alt_dictionary_rec_checkbtn = NULL;
gchar *dictionary;
#endif
+ GtkWidget *always_sign;
+ GtkListStore *always_sign_menu;
+ GtkWidget *always_encrypt;
+ GtkListStore *always_encrypt_menu;
GtkWidget *request_return_receipt_rec_checkbtn = NULL;
GtkWidget *save_copy_to_folder_rec_checkbtn = NULL;
GtkWidget *default_to_rec_checkbtn = NULL;
@@ -854,6 +863,8 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
GtkWidget *default_bcc_rec_checkbtn = NULL;
GtkWidget *default_replyto_rec_checkbtn = NULL;
GtkWidget *default_account_rec_checkbtn = NULL;
+ GtkWidget *always_sign_rec_checkbtn = NULL;
+ GtkWidget *always_encrypt_rec_checkbtn = NULL;
GList *cur_ac;
GList *account_list;
@@ -1133,7 +1144,7 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
rowcount++;
- /* Default dictionary */
+ /* Default alternate 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);
@@ -1168,6 +1179,70 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
rowcount++;
#endif
+ /* PGP sign? */
+ hbox = gtk_hbox_new (FALSE, 2);
+ gtk_widget_show (hbox);
+ gtk_table_attach (GTK_TABLE(table), hbox, 0, 2,
+ rowcount, rowcount+1, GTK_FILL, GTK_FILL, 0, 0);
+
+ label = gtk_label_new(_("Always sign messages"));
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ always_sign = gtkut_sc_combobox_create (NULL, FALSE);
+ gtk_widget_show (always_sign);
+ gtk_box_pack_start (GTK_BOX(hbox), always_sign, FALSE, FALSE, 0);
+
+ always_sign_menu = GTK_LIST_STORE(gtk_combo_box_get_model(
+ GTK_COMBO_BOX(always_sign)));
+ COMBOBOX_ADD (always_sign_menu, _("Default"), SIGN_OR_ENCRYPT_DEFAULT);
+ COMBOBOX_ADD (always_sign_menu, _("No"), SIGN_OR_ENCRYPT_NEVER);
+ COMBOBOX_ADD (always_sign_menu, _("Yes"), SIGN_OR_ENCRYPT_ALWAYS);
+
+ combobox_select_by_data(GTK_COMBO_BOX(always_sign),
+ item->prefs->always_sign);
+
+ CLAWS_SET_TIP(hbox, _("\"Default\" will follow the applicable account preference"));
+
+ always_sign_rec_checkbtn = gtk_check_button_new();
+ gtk_widget_show (always_sign_rec_checkbtn);
+ gtk_table_attach(GTK_TABLE(table), always_sign_rec_checkbtn, 2, 3,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
+ /* PGP encrypt? */
+ hbox = gtk_hbox_new (FALSE, 2);
+ gtk_widget_show (hbox);
+ gtk_table_attach (GTK_TABLE(table), hbox, 0, 2,
+ rowcount, rowcount+1, GTK_FILL, GTK_FILL, 0, 0);
+
+ label = gtk_label_new(_("Always encrypt messages"));
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ always_encrypt = gtkut_sc_combobox_create (NULL, FALSE);
+ gtk_widget_show (always_encrypt);
+ gtk_box_pack_start (GTK_BOX(hbox), always_encrypt, FALSE, FALSE, 0);
+
+ always_encrypt_menu = GTK_LIST_STORE(gtk_combo_box_get_model(
+ GTK_COMBO_BOX(always_encrypt)));
+ COMBOBOX_ADD (always_encrypt_menu, _("Default"), SIGN_OR_ENCRYPT_DEFAULT);
+ COMBOBOX_ADD (always_encrypt_menu, _("No"), SIGN_OR_ENCRYPT_NEVER);
+ COMBOBOX_ADD (always_encrypt_menu, _("Yes"), SIGN_OR_ENCRYPT_ALWAYS);
+
+ combobox_select_by_data(GTK_COMBO_BOX(always_encrypt),
+ item->prefs->always_encrypt);
+
+ CLAWS_SET_TIP(hbox, _("\"Default\" will follow the applicable account preference"));
+
+ always_encrypt_rec_checkbtn = gtk_check_button_new();
+ gtk_widget_show (always_encrypt_rec_checkbtn);
+ gtk_table_attach(GTK_TABLE(table), always_encrypt_rec_checkbtn, 2, 3,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ rowcount++;
+
gtk_widget_show_all(table);
page->window = GTK_WIDGET(window);
@@ -1193,6 +1268,8 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
page->checkbtn_enable_default_alt_dictionary = checkbtn_enable_default_alt_dictionary;
page->combo_default_alt_dictionary = combo_default_alt_dictionary;
#endif
+ page->always_sign = always_sign;
+ page->always_encrypt = always_encrypt;
page->request_return_receipt_rec_checkbtn = request_return_receipt_rec_checkbtn;
page->save_copy_to_folder_rec_checkbtn = save_copy_to_folder_rec_checkbtn;
@@ -1206,6 +1283,8 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
page->default_dictionary_rec_checkbtn = default_dictionary_rec_checkbtn;
page->default_alt_dictionary_rec_checkbtn = default_alt_dictionary_rec_checkbtn;
#endif
+ page->always_sign_rec_checkbtn = always_sign_rec_checkbtn;
+ page->always_encrypt_rec_checkbtn = always_encrypt_rec_checkbtn;
page->page.widget = table;
}
@@ -1332,6 +1411,14 @@ static void compose_save_folder_prefs(FolderItem *folder, FolderItemComposePage
GTK_COMBO_BOX(page->combo_default_alt_dictionary)));
}
#endif
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->always_sign_rec_checkbtn))) {
+ prefs->always_sign =
+ combobox_get_active_data(GTK_COMBO_BOX(page->always_sign));
+ }
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->always_encrypt_rec_checkbtn))) {
+ prefs->always_encrypt =
+ combobox_get_active_data(GTK_COMBO_BOX(page->always_encrypt));
+ }
folder_item_prefs_save_config(folder);
}
@@ -1361,6 +1448,8 @@ static gboolean compose_save_recurse_func(GNode *node, gpointer data)
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->always_sign_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->always_encrypt_rec_checkbtn)) ||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_reply_to_rec_checkbtn))
))
return TRUE;
@@ -1370,6 +1459,8 @@ static gboolean compose_save_recurse_func(GNode *node, gpointer data)
|| 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->always_sign_rec_checkbtn))
+ || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->always_encrypt_rec_checkbtn))
))
return TRUE;
else
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list