From f02d1a8cc95114e78611ec9f83b81c097b3b68ab Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 30 Aug 2013 08:12:59 +0100 Subject: [PATCH] add option to disable the 'Subject is empty' warning dialogue --- src/compose.c | 13 +++++++++---- src/prefs_common.c | 2 ++ src/prefs_common.h | 1 + src/prefs_send.c | 9 +++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/compose.c b/src/compose.c index 33c628136..b5cec4f43 100644 --- a/src/compose.c +++ b/src/compose.c @@ -4998,9 +4998,9 @@ static gboolean compose_check_entries(Compose *compose, gboolean check_everythin return FALSE; } - if (!compose->batch) { + if (!compose->batch && prefs_common.warn_empty_subj == TRUE) { str = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry)); - if (*str == '\0' && check_everything == TRUE && + if (*str == '\0' && check_everything == TRUE && compose->mode != COMPOSE_REDIRECT) { AlertValue aval; gchar *button_label; @@ -5014,9 +5014,14 @@ static gboolean compose_check_entries(Compose *compose, gboolean check_everythin compose->sending?_("Send it anyway?"): _("Queue it anyway?")); - aval = alertpanel(compose->sending?_("Send"):_("Send later"), message, - GTK_STOCK_CANCEL, button_label, NULL); + aval = alertpanel_full(compose->sending?_("Send"):_("Send later"), message, + GTK_STOCK_CANCEL, button_label, NULL, TRUE, NULL, + ALERT_QUESTION, G_ALERTDEFAULT); g_free(message); + if (aval & G_ALERTDISABLE) { + aval &= ~G_ALERTDISABLE; + prefs_common.warn_empty_subj = FALSE; + } if (aval != G_ALERTALTERNATE) return FALSE; } diff --git a/src/prefs_common.c b/src/prefs_common.c index ecc0ccf08..c42bbb829 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -197,6 +197,8 @@ static PrefParam param[] = { NULL, NULL, NULL}, {"outgoing_fallback_to_ascii", "TRUE", &prefs_common.outgoing_fallback_to_ascii, P_BOOL, NULL, NULL, NULL}, + {"warn_empty_subj", "TRUE", &prefs_common.warn_empty_subj, + P_BOOL, NULL, NULL, NULL}, {"allow_jisx0201_kana", "FALSE", &prefs_common.allow_jisx0201_kana, P_BOOL, NULL, NULL, NULL}, diff --git a/src/prefs_common.h b/src/prefs_common.h index 9e4db9c97..16966c859 100644 --- a/src/prefs_common.h +++ b/src/prefs_common.h @@ -130,6 +130,7 @@ struct _PrefsCommon gchar *outgoing_charset; TransferEncodingMethod encoding_method; gboolean outgoing_fallback_to_ascii; + gboolean warn_empty_subj; gboolean allow_jisx0201_kana; diff --git a/src/prefs_send.c b/src/prefs_send.c index 25ff6db9e..ee8f876c4 100644 --- a/src/prefs_send.c +++ b/src/prefs_send.c @@ -52,6 +52,7 @@ typedef struct _SendPage GtkWidget *checkbtn_confirm_send_queued_messages; GtkWidget *checkbtn_never_send_retrcpt; GtkWidget *checkbtn_senddialog; + GtkWidget *checkbtn_warn_empty_subj; GtkWidget *combobox_charset; GtkWidget *combobox_encoding_method; } SendPage; @@ -145,6 +146,7 @@ static void prefs_send_create_widget(PrefsPage *_page, GtkWindow *window, GtkWidget *checkbtn_senddialog; GtkWidget *checkbtn_confirm_send_queued_messages; GtkWidget *checkbtn_never_send_retrcpt; + GtkWidget *checkbtn_warn_empty_subj; GtkWidget *table; vbox1 = gtk_vbox_new (FALSE, VSPACING); @@ -166,6 +168,8 @@ static void prefs_send_create_widget(PrefsPage *_page, GtkWindow *window, PACK_CHECK_BUTTON(vbox2, checkbtn_senddialog, _("Show send dialog")); + PACK_CHECK_BUTTON(vbox2, checkbtn_warn_empty_subj, + _("Warn when Subject is empty")); table = gtk_table_new(2, 2, FALSE); gtk_widget_show(table); @@ -297,6 +301,8 @@ static void prefs_send_create_widget(PrefsPage *_page, GtkWindow *window, prefs_common.never_send_retrcpt); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_senddialog), !prefs_common.send_dialog_invisible); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_warn_empty_subj), + prefs_common.warn_empty_subj); prefs_common_charset_set_optmenu(combobox_charset, prefs_common.outgoing_charset); combobox_select_by_data(GTK_COMBO_BOX(combobox_encoding), @@ -308,6 +314,7 @@ static void prefs_send_create_widget(PrefsPage *_page, GtkWindow *window, prefs_send->checkbtn_confirm_send_queued_messages = checkbtn_confirm_send_queued_messages; prefs_send->checkbtn_never_send_retrcpt = checkbtn_never_send_retrcpt; prefs_send->checkbtn_senddialog = checkbtn_senddialog; + prefs_send->checkbtn_warn_empty_subj = checkbtn_warn_empty_subj; prefs_send->combobox_charset = combobox_charset; prefs_send->combobox_encoding_method = combobox_encoding; @@ -326,6 +333,8 @@ static void prefs_send_save(PrefsPage *_page) GTK_TOGGLE_BUTTON(page->checkbtn_never_send_retrcpt)); prefs_common.send_dialog_invisible = !gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(page->checkbtn_senddialog)); + prefs_common.warn_empty_subj = gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(page->checkbtn_warn_empty_subj)); g_free(prefs_common.outgoing_charset); prefs_common.outgoing_charset = prefs_common_charset_set_data_from_optmenu( -- 2.25.1