Re: Is this normal?



On Tue, Nov 21, 2000 at 09:07:11AM +0100, Pawel Salek wrote:
> 
> On 2000-11-21 04:06:25 +0100 Gaelyne Gasson wrote:
> > Anyway, I thought I would mention this behavour as it seems unusual. 
> > And, if Balsa is auto-closing the mailboxes, I probably don't ever need
> to
> > worry about closing them myself. <g>  
> 
> Balsa closes mailboxes that have not been accessed for ten minutes. This
> time should be probably configurable... (TODO?)
> 
> /Pawel
> -- 

Patch (for 1.0.0) that makes timeout configurable (Preferences->Misc) follows. 
Autoclosing can be turned off.    

slon!

-- 
To me, M$ is a big kid who needs to have the whole sandbox for himself. 
Until that child can learn to share, I'll play with the kids that do share the sandbox.
--- balsa-1.0.0/src/balsa-app.h	Tue Nov  7 08:55:21 2000
+++ balsa/src/balsa-app.h	Tue Nov 21 13:25:36 2000
@@ -174,6 +174,11 @@
     gint check_mail_timer;
     gint check_mail_timer_id;
 
+
+    /* automatically close mailboxes after XX minutes */
+    gboolean close_mailbox_auto;
+    gint close_mailbox_timeout;
+
     /* GUI settings */
     gint mw_width;
     gint mw_height;
--- balsa-1.0.0/src/main-window.c	Sat Nov 11 17:19:49 2000
+++ balsa/src/main-window.c	Tue Nov 21 13:34:00 2000
@@ -156,8 +156,6 @@
 static void filter_dlg_cb(GtkWidget * widget, gpointer data);
 #endif
 
-gboolean balsa_close_mailbox_on_timer(GtkWidget * widget, gpointer * data);
-
 static void mailbox_close_cb(GtkWidget * widget, gpointer data);
 static void mailbox_commit_changes(GtkWidget * widget, gpointer data);
 static void mailbox_empty_trash(GtkWidget * widget, gpointer data);
@@ -986,6 +987,9 @@
     GtkWidget *page, *index_page;
     int i, c, time;
 
+    if (! balsa_app.close_mailbox_auto)
+	return TRUE;
+
     g_get_current_time(&current_time);
 
     c = gtk_notebook_get_current_page(GTK_NOTEBOOK(balsa_app.notebook));
@@ -1000,7 +1004,7 @@
 	time =
 	    current_time.tv_sec -
 	    BALSA_INDEX_PAGE(index_page)->last_use.tv_sec;
-	if (time > 600) {
+	if (time > (balsa_app.close_mailbox_timeout * 60)) {
 	    if (balsa_app.debug)
 		fprintf(stderr, "Closing Page %d, time: %d\n", i, time);
 	    gtk_notebook_remove_page(GTK_NOTEBOOK(balsa_app.notebook), i);
--- balsa-1.0.0/src/main-window.h	Sat Nov 11 17:17:24 2000
+++ balsa/src/main-window.h	Tue Nov 21 13:19:39 2000
@@ -60,6 +60,8 @@
 gboolean send_progress_notify_cb(void);
 gint check_new_messages_auto_cb(gpointer data);
 void check_new_messages_cb(GtkWidget *, gpointer data);
+gboolean balsa_close_mailbox_on_timer(GtkWidget * widget, gpointer * data);
+
 
 #if defined(__FILE__) && defined(__LINE__)
 # ifdef __FUNCTION__
--- balsa-1.0.0/src/pref-manager.c	Tue Oct 17 01:26:10 2000
+++ balsa/src/pref-manager.c	Tue Nov 21 13:29:21 2000
@@ -51,6 +51,9 @@
     GtkWidget *check_mail_auto;
     GtkWidget *check_mail_minutes;
 
+    GtkWidget *close_mailbox_auto;
+    GtkWidget *close_mailbox_minutes;
+
     GtkWidget *previewpane;
     GtkWidget *view_allheaders;
     GtkWidget *debug;		/* enable/disable debugging */
@@ -148,6 +151,7 @@
 static void address_book_add_cb(GtkWidget * widget, gpointer data);
 static void address_book_delete_cb(GtkWidget * widget, gpointer data);
 static void timer_modified_cb(GtkWidget * widget, GtkWidget * pbox);
+static void mailbox_timer_modified_cb(GtkWidget * widget, GtkWidget * pbox);
 static void wrap_modified_cb(GtkWidget * widget, GtkWidget * pbox);
 static void spelling_optionmenu_cb(GtkItem * menuitem, gpointer data);
 static void set_default_address_book_cb(GtkWidget * button, gpointer data);
@@ -363,6 +367,13 @@
 
     gtk_signal_connect(GTK_OBJECT(pui->check_mail_minutes), "changed",
 		       GTK_SIGNAL_FUNC(timer_modified_cb), property_box);
+
+    gtk_signal_connect(GTK_OBJECT(pui->close_mailbox_auto), "toggled",
+		       GTK_SIGNAL_FUNC(mailbox_timer_modified_cb), property_box);
+
+    gtk_signal_connect(GTK_OBJECT(pui->close_mailbox_minutes), "changed",
+		       GTK_SIGNAL_FUNC(mailbox_timer_modified_cb), property_box);
+
     gtk_signal_connect(GTK_OBJECT(pui->wordwrap), "toggled",
 		       GTK_SIGNAL_FUNC(wrap_modified_cb), property_box);
     gtk_signal_connect(GTK_OBJECT(pui->wraplength), "changed",
@@ -587,6 +600,11 @@
     g_free(balsa_app.bcc);
     balsa_app.bcc = g_strdup(gtk_entry_get_text(GTK_ENTRY(pui->bcc)));
 
+    balsa_app.close_mailbox_auto =
+	GTK_TOGGLE_BUTTON(pui->close_mailbox_auto)->active;
+    balsa_app.close_mailbox_timeout =
+	gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
+					 (pui->close_mailbox_minutes));
 
     /* arp */
     g_free(balsa_app.quote_str);
@@ -781,6 +799,15 @@
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(pui->check_mail_minutes),
 			      (float) balsa_app.check_mail_timer);
 
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->close_mailbox_auto),
+				 balsa_app.close_mailbox_auto);
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(pui->close_mailbox_minutes),
+			      (float) balsa_app.close_mailbox_timeout);
+
+    gtk_widget_set_sensitive(pui->close_mailbox_minutes,
+			     GTK_TOGGLE_BUTTON(pui->close_mailbox_auto)->
+    		    	    active);
+
     gtk_widget_set_sensitive(pui->smtp_server,
 			     GTK_TOGGLE_BUTTON(pui->rb_smtp_server)->
 			     active);
@@ -1928,6 +1955,7 @@
     GtkWidget *label927;
     GtkWidget *label;
     GtkWidget *label9;
+    GtkWidget *label33;
     GtkWidget *color_frame;
     GtkWidget *unread_color_box;
     GtkWidget *unread_color_label;
@@ -1936,6 +1964,8 @@
     GtkWidget *quoted_color_box_end;
     GtkWidget *quoted_color_label_end;
     GtkWidget *vbox12;
+    GtkWidget *hbox1;
+    GtkObject *spinbutton4_adj;
 
     vbox9 = gtk_vbox_new(FALSE, 0);
     gtk_widget_show(vbox9);
@@ -1959,6 +1989,25 @@
     gtk_widget_show(pui->empty_trash);
     gtk_box_pack_start(GTK_BOX(vbox10), pui->empty_trash, FALSE, FALSE, 0);
 
+    hbox1 = gtk_hbox_new(FALSE, 0);
+    gtk_widget_show(hbox1);
+    gtk_box_pack_start(GTK_BOX(vbox10), hbox1, FALSE, FALSE, 0);
+
+    pui->close_mailbox_auto =
+	gtk_check_button_new_with_label(_("Automatically close mailbox if unused more than"));
+    gtk_widget_show(pui->close_mailbox_auto);
+    gtk_box_pack_start(GTK_BOX(hbox1), pui->close_mailbox_auto, FALSE, FALSE, 0);
+
+    spinbutton4_adj = gtk_adjustment_new(10, 1, 100, 1, 10, 10);
+    pui->close_mailbox_minutes =
+	gtk_spin_button_new(GTK_ADJUSTMENT(spinbutton4_adj), 1, 0);
+    gtk_widget_show(pui->close_mailbox_minutes);
+    gtk_widget_set_sensitive(pui->close_mailbox_minutes, FALSE);
+    gtk_box_pack_start(GTK_BOX(hbox1), pui->close_mailbox_minutes, FALSE, FALSE, 0);
+
+    label33 = gtk_label_new(_("Minutes"));
+    gtk_widget_show(label33);
+    gtk_box_pack_start(GTK_BOX(hbox1), label33, FALSE, TRUE, 0);
 
     /* font */
     frame14 = gtk_frame_new(_("Font"));
@@ -2447,6 +2496,22 @@
     properties_modified_cb(widget, pbox);
 
 }
+
+void
+mailbox_timer_modified_cb(GtkWidget * widget, GtkWidget * pbox)
+{
+    if (gtk_toggle_button_get_active
+	(GTK_TOGGLE_BUTTON(pui->close_mailbox_auto)))
+	    gtk_widget_set_sensitive(GTK_WIDGET(pui->close_mailbox_minutes),
+				     TRUE);
+    else
+	gtk_widget_set_sensitive(GTK_WIDGET(pui->close_mailbox_minutes),
+				 FALSE);
+
+    properties_modified_cb(widget, pbox);
+
+}
+
 
 static void
 wrap_modified_cb(GtkWidget * widget, GtkWidget * pbox)
--- balsa-1.0.0/src/save-restore.c	Sun Oct  8 15:49:30 2000
+++ balsa/src/save-restore.c	Tue Nov 21 13:30:07 2000
@@ -481,6 +481,9 @@
     /* debugging enabled */
     balsa_app.debug = gnome_config_get_bool("Debug=false");
 
+    balsa_app.close_mailbox_auto = gnome_config_get_bool("AutoCloseMailbox=true");
+    balsa_app.close_mailbox_timeout = gnome_config_get_int("AutoCloseMailboxTimeout=10");
+
     balsa_app.remember_open_mboxes =
 	gnome_config_get_bool("RememberOpenMailboxes=false");
     gnome_config_get_vector("OpenMailboxes", &open_mailbox_count,
@@ -635,6 +638,10 @@
     gnome_config_set_string("MailDir", balsa_app.local_mail_directory);
 
     gnome_config_set_bool("Debug", balsa_app.debug);
+
+    gnome_config_set_bool("AutoCloseMailbox", balsa_app.close_mailbox_auto);
+    gnome_config_set_int("AutoCloseMailboxTimeout", balsa_app.close_mailbox_timeout);
+
 
     open_mailboxes_vector =
 	mailbox_list_to_vector(balsa_app.open_mailbox_list);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]