[Commits] [SCM] claws branch, master, updated. 3.9.3-3-g02b5ac9
colin at claws-mail.org
colin at claws-mail.org
Fri Dec 20 11:56:46 CET 2013
The branch master of project "claws" (Claws Mail) has been updated
via 02b5ac9ed2d474e546a655c636e4c9e43dd3250b (commit)
from de111b33be695c09af245be19280402aad886020 (commit)
- Log -----------------------------------------------------------------
commit 02b5ac9ed2d474e546a655c636e4c9e43dd3250b
Author: Colin Leroy <colin at colino.net>
Date: Fri Dec 20 11:53:18 2013 +0100
Add preference to allow disabling automatic drafting of encrypted
messages.
diff --git a/src/compose.c b/src/compose.c
index 48170ae..69bfac6 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -10055,6 +10055,14 @@ void compose_close_toolbar(Compose *compose)
compose_close_cb(NULL, compose);
}
+static gboolean compose_can_autosave(Compose *compose)
+{
+ if (compose->privacy_system && compose->use_encryption)
+ return prefs_common.autosave && prefs_common.autosave_encrypted;
+ else
+ return prefs_common.autosave;
+}
+
static void compose_close_cb(GtkAction *action, gpointer data)
{
Compose *compose = (Compose *)data;
@@ -10089,8 +10097,8 @@ static void compose_close_cb(GtkAction *action, gpointer data)
g_mutex_unlock(compose->mutex);
switch (val) {
case G_ALERTDEFAULT:
- if (prefs_common.autosave && !reedit)
- compose_remove_draft(compose);
+ if (compose_can_autosave(compose) && !reedit)
+ compose_remove_draft(compose);
break;
case G_ALERTALTERNATE:
compose_draft(data, COMPOSE_QUIT_EDITING);
@@ -11306,7 +11314,7 @@ static void text_inserted(GtkTextBuffer *buffer, GtkTextIter *iter,
compose);
g_signal_stop_emission_by_name(G_OBJECT(buffer), "insert-text");
- if (prefs_common.autosave &&
+ if (compose_can_autosave(compose) &&
gtk_text_buffer_get_char_count(buffer) % prefs_common.autosave_length == 0 &&
compose->draft_timeout_tag != -2 /* disabled while loading */)
compose->draft_timeout_tag = g_timeout_add
diff --git a/src/prefs_common.c b/src/prefs_common.c
index c42bbb8..09680b3 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -239,6 +239,8 @@ static PrefParam param[] = {
P_BOOL, NULL, NULL, NULL},
{"autosave_length", "50", &prefs_common.autosave_length, P_INT,
NULL, NULL, NULL},
+ {"autosave_encrypted", "TRUE", &prefs_common.autosave_encrypted,
+ P_BOOL, NULL, NULL, NULL},
{"warn_large_insert", "TRUE", &prefs_common.warn_large_insert,
P_BOOL, NULL, NULL, NULL},
{"warn_large_insert_size", "500", &prefs_common.warn_large_insert_size,
diff --git a/src/prefs_common.h b/src/prefs_common.h
index 16966c8..11b3e55 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -150,6 +150,7 @@ struct _PrefsCommon
gboolean show_ruler;
gboolean autosave;
gint autosave_length;
+ gboolean autosave_encrypted;
gboolean warn_large_insert;
gint warn_large_insert_size;
gboolean compose_no_markup;
diff --git a/src/prefs_compose_writing.c b/src/prefs_compose_writing.c
index 6248121..46dd621 100644
--- a/src/prefs_compose_writing.c
+++ b/src/prefs_compose_writing.c
@@ -63,6 +63,7 @@ typedef struct _WritingPage
GtkWidget *checkbtn_redirect_keep_from;
GtkWidget *checkbtn_autosave;
GtkWidget *spinbtn_autosave_length;
+ GtkWidget *checkbtn_autosave_encrypted;
GtkWidget *checkbtn_warn_large_insert;
GtkWidget *spinbtn_warn_large_insert_size;
GtkWidget *optmenu_dnd_insert_or_attach;
@@ -106,7 +107,10 @@ static void prefs_compose_writing_create_widget(PrefsPage *_page, GtkWindow *win
GtkAdjustment *spinbtn_autosave_adj;
GtkWidget *spinbtn_autosave_length;
GtkWidget *label_autosave_length;
-
+
+ GtkWidget *hbox_autosave_encrypted;
+ GtkWidget *checkbtn_autosave_encrypted;
+
GtkWidget *hbox_dnd_insert_or_attach;
GtkWidget *label_dnd_insert_or_attach;
GtkWidget *optmenu_dnd_insert_or_attach;
@@ -154,11 +158,20 @@ static void prefs_compose_writing_create_widget(PrefsPage *_page, GtkWindow *win
gtk_widget_show (spinbtn_autosave_length);
gtk_box_pack_start (GTK_BOX (hbox_autosave), spinbtn_autosave_length, FALSE, FALSE, 0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_autosave_length), TRUE);
-
+
label_autosave_length = gtk_label_new(_("characters"));
gtk_widget_show (label_autosave_length);
gtk_box_pack_start (GTK_BOX (hbox_autosave), label_autosave_length, FALSE, FALSE, 0);
-
+
+ /* Editing: automatically save draft when encrypted */
+ hbox_autosave_encrypted = gtk_hbox_new (FALSE, 8);
+ gtk_box_pack_start(GTK_BOX(hbox_autosave_encrypted), gtk_label_new(" "), FALSE, FALSE, 0);
+ gtk_widget_show_all (hbox_autosave_encrypted);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox_autosave_encrypted, FALSE, FALSE, 0);
+
+ PACK_CHECK_BUTTON (hbox_autosave_encrypted, checkbtn_autosave_encrypted,
+ _("Even if message is to be encrypted"));
+
/* Editing: undo level */
hbox_undolevel = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox_undolevel);
@@ -240,6 +253,7 @@ static void prefs_compose_writing_create_widget(PrefsPage *_page, GtkWindow *win
SET_TOGGLE_SENSITIVITY (checkbtn_autosave, spinbtn_autosave_length);
SET_TOGGLE_SENSITIVITY (checkbtn_autosave, label_autosave_length);
+ SET_TOGGLE_SENSITIVITY (checkbtn_autosave, checkbtn_autosave_encrypted);
SET_TOGGLE_SENSITIVITY (checkbtn_warn_large_insert, spinbtn_warn_large_insert_size);
SET_TOGGLE_SENSITIVITY (checkbtn_warn_large_insert, label_warn_large_insert_size);
@@ -256,6 +270,8 @@ static void prefs_compose_writing_create_widget(PrefsPage *_page, GtkWindow *win
prefs_writing->checkbtn_autosave = checkbtn_autosave;
prefs_writing->spinbtn_autosave_length = spinbtn_autosave_length;
+ prefs_writing->checkbtn_autosave_encrypted = checkbtn_autosave_encrypted;
+
prefs_writing->checkbtn_warn_large_insert = checkbtn_warn_large_insert;
prefs_writing->spinbtn_warn_large_insert_size = spinbtn_warn_large_insert_size;
@@ -276,6 +292,8 @@ static void prefs_compose_writing_create_widget(PrefsPage *_page, GtkWindow *win
prefs_common.redirect_keep_from);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs_writing->checkbtn_autosave),
prefs_common.autosave);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs_writing->checkbtn_autosave_encrypted),
+ prefs_common.autosave_encrypted);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(prefs_writing->spinbtn_autosave_length),
prefs_common.autosave_length);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(prefs_writing->spinbtn_undolevel),
@@ -312,6 +330,8 @@ static void prefs_compose_writing_save(PrefsPage *_page)
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_redirect_keep_from));
prefs_common.autosave =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_autosave));
+ prefs_common.autosave_encrypted =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_autosave_encrypted));
prefs_common.autosave_length =
gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(page->spinbtn_autosave_length));
prefs_common.undolevels =
-----------------------------------------------------------------------
Summary of changes:
src/compose.c | 14 +++++++++++---
src/prefs_common.c | 2 ++
src/prefs_common.h | 1 +
src/prefs_compose_writing.c | 26 +++++++++++++++++++++++---
4 files changed, 37 insertions(+), 6 deletions(-)
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list