add ability to leave downloaded mail on server for n days
[claws.git] / src / prefs_account.c
index 252322c8884cdd9d378c5341c363c20fb7e89e4a..25b62ce799d50b8664ee97bbc467ecb92d15583f 100644 (file)
@@ -86,6 +86,7 @@ static struct Basic {
 static struct Receive {
        GtkWidget *pop3_frame;
        GtkWidget *rmmail_chkbtn;
 static struct Receive {
        GtkWidget *pop3_frame;
        GtkWidget *rmmail_chkbtn;
+       GtkWidget *leave_time_entry;
        GtkWidget *getall_chkbtn;
        GtkWidget *size_limit_chkbtn;
        GtkWidget *size_limit_entry;
        GtkWidget *getall_chkbtn;
        GtkWidget *size_limit_chkbtn;
        GtkWidget *size_limit_entry;
@@ -248,6 +249,10 @@ static PrefParam param[] = {
        {"remove_mail", "TRUE", &tmp_ac_prefs.rmmail, P_BOOL,
         &receive.rmmail_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
        {"remove_mail", "TRUE", &tmp_ac_prefs.rmmail, P_BOOL,
         &receive.rmmail_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
+       
+       {"leave_mail_time", "0", &tmp_ac_prefs.leave_time, P_STRING,
+        &receive.leave_time_entry,
+        prefs_set_data_from_entry, prefs_set_entry},
 
        {"get_all_mail", "FALSE", &tmp_ac_prefs.getall, P_BOOL,
         &receive.getall_chkbtn,
 
        {"get_all_mail", "FALSE", &tmp_ac_prefs.getall, P_BOOL,
         &receive.getall_chkbtn,
@@ -988,8 +993,12 @@ static void prefs_account_receive_create(void)
        GtkWidget *label;
        GtkWidget *filter_on_recv_chkbtn;
        GtkWidget *vbox3;
        GtkWidget *label;
        GtkWidget *filter_on_recv_chkbtn;
        GtkWidget *vbox3;
+       GtkWidget *hbox2;
        GtkWidget *inbox_label;
        GtkWidget *inbox_entry;
        GtkWidget *inbox_label;
        GtkWidget *inbox_entry;
+       GtkWidget *leave_time_entry;
+       GtkWidget *leave_time_label;
+       GtkWidget *leave_time_hint;     
        GtkWidget *inbox_btn;
        GtkWidget *frame2;
        GtkWidget *imapdir_label;
        GtkWidget *inbox_btn;
        GtkWidget *frame2;
        GtkWidget *imapdir_label;
@@ -1008,8 +1017,26 @@ static void prefs_account_receive_create(void)
        gtk_container_add (GTK_CONTAINER (frame1), vbox2);
        gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
 
        gtk_container_add (GTK_CONTAINER (frame1), vbox2);
        gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
 
-       PACK_CHECK_BUTTON (vbox2, rmmail_chkbtn,
-                          _("Remove messages on server when received"));
+       hbox2 = gtk_hbox_new (FALSE, 0);
+       gtk_widget_show (hbox2);
+       gtk_container_add (GTK_CONTAINER (vbox2), hbox2);
+       gtk_container_set_border_width (GTK_CONTAINER (hbox2), 0);
+
+       PACK_CHECK_BUTTON (hbox2, rmmail_chkbtn,
+                          _("Remove messages on server when received for "));
+       leave_time_entry = gtk_entry_new ();
+       gtk_widget_show (leave_time_entry);
+       gtk_widget_set_usize (leave_time_entry, DEFAULT_ENTRY_WIDTH, -1);
+       gtk_box_pack_start (GTK_BOX (hbox2), leave_time_entry, TRUE, TRUE, 0);
+       
+       leave_time_label = gtk_label_new (_(" days"));
+       gtk_widget_show (leave_time_label);
+       gtk_box_pack_start (GTK_BOX (hbox2), leave_time_label, FALSE, FALSE, 0);
+       
+       leave_time_hint=gtk_label_new (_("(Setting to 0 days will delete messages immediately)"));
+       gtk_widget_show(leave_time_hint);
+       gtk_box_pack_start (GTK_BOX (vbox2), leave_time_hint, FALSE, FALSE, 0);
+               
        PACK_CHECK_BUTTON (vbox2, getall_chkbtn,
                           _("Download all messages on server"));
 
        PACK_CHECK_BUTTON (vbox2, getall_chkbtn,
                           _("Download all messages on server"));
 
@@ -1092,6 +1119,7 @@ static void prefs_account_receive_create(void)
 
        receive.pop3_frame            = frame1;
        receive.rmmail_chkbtn         = rmmail_chkbtn;
 
        receive.pop3_frame            = frame1;
        receive.rmmail_chkbtn         = rmmail_chkbtn;
+       receive.leave_time_entry      = leave_time_entry;
        receive.getall_chkbtn         = getall_chkbtn;
        receive.size_limit_chkbtn     = size_limit_chkbtn;
        receive.size_limit_entry      = size_limit_entry;
        receive.getall_chkbtn         = getall_chkbtn;
        receive.size_limit_chkbtn     = size_limit_chkbtn;
        receive.size_limit_entry      = size_limit_entry;