add option to disable the 'Subject is empty' warning dialogue
authorPaul <paul@claws-mail.org>
Fri, 30 Aug 2013 07:12:59 +0000 (08:12 +0100)
committerPaul <paul@claws-mail.org>
Fri, 30 Aug 2013 07:12:59 +0000 (08:12 +0100)
src/compose.c
src/prefs_common.c
src/prefs_common.h
src/prefs_send.c

index 33c6281..b5cec4f 100644 (file)
@@ -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;
                }
index ecc0ccf..c42bbb8 100644 (file)
@@ -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},
index 9e4db9c..16966c8 100644 (file)
@@ -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;
 
index 25ff6db..ee8f876 100644 (file)
@@ -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(