implement saving of outgoing messages to current folder.
authorChristoph Hohmann <reboot@gmx.ch>
Fri, 21 Dec 2001 13:20:11 +0000 (13:20 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Fri, 21 Dec 2001 13:20:11 +0000 (13:20 +0000)
fix segfault when no default outbox is available (closes bug #495683)

ChangeLog.claws
configure.in
src/compose.c
src/prefs_folder_item.c
src/prefs_folder_item.h

index e801e3a..b14ece9 100644 (file)
@@ -1,3 +1,11 @@
+2001-12-21 [christoph] 0.6.6claws6
+
+       * src/compose.c
+       * src/prefs_folder_item.[ch]
+               implement saving of outgoing messages to current folder.
+               fix segfault when no default outbox is available
+               (closes bug #495683)
+
 2001-12-21 [carsten]   0.6.6claws5
        * src/folderview.c
        * src/summaryview.c
index 39cd65c..010168f 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws5
+EXTRA_VERSION=claws6
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 30c0169..aa1959c 100644 (file)
@@ -598,6 +598,17 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
                        compose_entry_append(compose, mailto, COMPOSE_NEWSGROUPS);
                }
        }
+
+       /* Set save folder */
+       if(item && item->prefs && item->prefs->save_copy_to_folder) {
+               gchar *folderidentifier;
+
+               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn), prefs_common.savemsg);
+               folderidentifier = folder_item_get_identifier(item);
+               gtk_entry_set_text(GTK_ENTRY(compose->savemsg_entry), folderidentifier);
+               g_free(folderidentifier);
+       }
+
        gtk_widget_grab_focus(compose->subject_entry);
 
        if (prefs_common.auto_exteditor)
@@ -730,6 +741,16 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
                menu_set_toggle(ifactory, "/Message/Request Return Receipt", TRUE);
        }
 
+       /* Set save folder */
+       if(msginfo->folder && msginfo->folder->prefs && msginfo->folder->prefs->save_copy_to_folder) {
+               gchar *folderidentifier;
+
+               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn), TRUE);
+               folderidentifier = folder_item_get_identifier(msginfo->folder);
+               gtk_entry_set_text(GTK_ENTRY(compose->savemsg_entry), folderidentifier);
+               g_free(folderidentifier);
+       }
+
        if (compose_parse_header(compose, msginfo) < 0) return;
        compose_reply_set_entry(compose, msginfo, to_all, ignore_replyto,
                                followup_and_reply_to);
@@ -4014,7 +4035,9 @@ static GtkWidget *compose_create_others(Compose *compose)
        savemsg_checkbtn = gtk_check_button_new_with_label(_("Save Message to "));
        gtk_widget_show(savemsg_checkbtn);
        gtk_table_attach(GTK_TABLE(table), savemsg_checkbtn, 0, 1, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
-       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(savemsg_checkbtn), prefs_common.savemsg);
+       if(folder_get_default_outbox()) {
+               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(savemsg_checkbtn), prefs_common.savemsg);
+       }
        gtk_signal_connect(GTK_OBJECT(savemsg_checkbtn), "toggled",
                            GTK_SIGNAL_FUNC(compose_savemsg_checkbtn_cb), compose);
 
@@ -4022,9 +4045,11 @@ static GtkWidget *compose_create_others(Compose *compose)
        gtk_widget_show(savemsg_entry);
        gtk_table_attach_defaults(GTK_TABLE(table), savemsg_entry, 1, 2, rowcount, rowcount + 1);
        gtk_editable_set_editable(GTK_EDITABLE(savemsg_entry), prefs_common.savemsg);
-       folderidentifier = folder_item_get_identifier(folder_get_default_outbox());
-       gtk_entry_set_text(GTK_ENTRY(savemsg_entry), folderidentifier);
-       g_free(folderidentifier);
+       if(folder_get_default_outbox()) {
+               folderidentifier = folder_item_get_identifier(folder_get_default_outbox());
+               gtk_entry_set_text(GTK_ENTRY(savemsg_entry), folderidentifier);
+               g_free(folderidentifier);
+       }
 
        savemsg_select = gtk_button_new_with_label (_("Select ..."));
        gtk_widget_show (savemsg_select);
index 6190fb8..4fd86bf 100644 (file)
@@ -38,6 +38,7 @@ struct PrefsFolderItemDialog
        FolderItem *item;
        GtkWidget *window;
        GtkWidget *checkbtn_request_return_receipt;
+       GtkWidget *checkbtn_save_copy_to_folder;
        GtkWidget *checkbtn_default_to;
        GtkWidget *entry_default_to;
        GtkWidget *checkbtn_folder_chmod;
@@ -82,6 +83,8 @@ static PrefParam param[] = {
         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}
 };
 
@@ -183,6 +186,7 @@ PrefsFolderItem * prefs_folder_item_new(void)
        tmp_prefs.folder_chmod = 0;
        tmp_prefs.enable_default_account = FALSE;
        tmp_prefs.default_account = 0;
+       tmp_prefs.save_copy_to_folder = FALSE;
 
        * prefs = tmp_prefs;
        
@@ -243,6 +247,7 @@ void prefs_folder_item_create(FolderItem *item) {
        GtkWidget *confirm_area;
        
        GtkWidget *checkbtn_request_return_receipt;
+       GtkWidget *checkbtn_save_copy_to_folder;
        GtkWidget *checkbtn_default_to;
        GtkWidget *entry_default_to;
        GtkWidget *checkbtn_folder_chmod;
@@ -300,6 +305,15 @@ void prefs_folder_item_create(FolderItem *item) {
 
        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 outbox"));
+       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);
+
+       rowcount++;
+
        /* Default To */
        checkbtn_default_to = gtk_check_button_new_with_label(_("Default To: "));
        gtk_widget_show(checkbtn_default_to);
@@ -395,6 +409,7 @@ void prefs_folder_item_create(FolderItem *item) {
 
        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_folder_chmod = checkbtn_folder_chmod;
@@ -431,6 +446,9 @@ void prefs_folder_item_ok_cb(GtkWidget *widget, struct PrefsFolderItemDialog *di
        /* MIGRATION */    
        dialog->item->ret_rcpt = prefs->request_return_receipt;
 
+       prefs->save_copy_to_folder = 
+           gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_save_copy_to_folder));
+
        prefs->enable_default_to = 
            gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_default_to));
        g_free(prefs->default_to);
index 2c3bd35..31fa3ff 100644 (file)
@@ -51,6 +51,7 @@ struct _PrefsFolderItem {
        gint folder_chmod;
        gboolean enable_default_account;
        gint default_account;
+       gboolean save_copy_to_folder;
 };
 
 typedef struct _PrefsFolderItem PrefsFolderItem;