PATCH: Option to select default send button function



Less talk, more code! This patch adds a
check box (yes!) to prefs that allows to
select the function of the send button
on the compose window toolbar.
If unchecked, direct sending is
attempted first, if that fails the
message is queued. This is the former
behavior.
If checked, the message is queued in the
outbox for later delivery.

Melanie
diff -b -B -u -r ../balsa/src/balsa-app.h ./src/balsa-app.h
--- ../balsa/src/balsa-app.h	Tue Jul 10 16:45:59 2001
+++ ./src/balsa-app.h	Wed Jul 11 19:53:38 2001
@@ -167,6 +167,8 @@
     auth_context_t smtp_authctx;
 #endif
 
+	gint always_queue_sent_mail;
+
     /* signature stuff */
     gboolean sig_sending;
     gboolean sig_whenforward;
diff -b -B -u -r ../balsa/src/pref-manager.c ./src/pref-manager.c
--- ../balsa/src/pref-manager.c	Fri Jul  6 18:38:04 2001
+++ ./src/pref-manager.c	Wed Jul 11 20:52:36 2001
@@ -72,6 +72,7 @@
     GtkWidget *check_mail_upon_startup;
     GtkWidget *remember_open_mboxes;
     GtkWidget *mblist_show_mb_content_info;
+	GtkWidget *always_queue_sent_mail;
 
     /* Information messages */
     GtkWidget *information_message_menu;
@@ -326,6 +327,8 @@
 		       GTK_SIGNAL_FUNC(wrap_modified_cb), property_box);
     gtk_signal_connect(GTK_OBJECT(pui->wraplength), "changed",
 		       GTK_SIGNAL_FUNC(wrap_modified_cb), property_box);
+    gtk_signal_connect(GTK_OBJECT(pui->always_queue_sent_mail), "toggled",
+		       GTK_SIGNAL_FUNC(properties_modified_cb), property_box);
 
     /* arp */
     gtk_signal_connect(GTK_OBJECT(pui->quote_str), "changed",
@@ -516,6 +519,8 @@
 
     balsa_app.wordwrap = GTK_TOGGLE_BUTTON(pui->wordwrap)->active;
     balsa_app.wraplength =
+	balsa_app.always_queue_sent_mail =
+				GTK_TOGGLE_BUTTON(pui->always_queue_sent_mail)->active;
 	gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(pui->wraplength));
 
     balsa_app.close_mailbox_auto =
@@ -713,6 +718,8 @@
 				 balsa_app.wordwrap);
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(pui->wraplength),
 			      (float) balsa_app.wraplength);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->always_queue_sent_mail),
+				 balsa_app.always_queue_sent_mail);
 
     gtk_widget_set_sensitive(pui->wraplength,
 			     GTK_TOGGLE_BUTTON(pui->wordwrap)->active);
@@ -1270,10 +1277,17 @@
     gtk_box_pack_start(GTK_BOX(vbox1), frame2, FALSE, FALSE, 0);
     gtk_container_set_border_width(GTK_CONTAINER(frame2), 5);
 
+	vbox2 = vbox_in_container(frame2);
+
     table2 = GTK_TABLE(gtk_table_new(3, 2, FALSE));
-    gtk_container_add(GTK_CONTAINER(frame2), GTK_WIDGET(table2));
-    gtk_container_set_border_width(GTK_CONTAINER(table2), 5);
+    gtk_container_add(GTK_CONTAINER(vbox2), GTK_WIDGET(table2));
+    gtk_container_set_border_width(GTK_CONTAINER(table2), 2);
     pui->quote_str = attach_entry(_("Reply prefix:"), 4, table2);
+
+	pui->always_queue_sent_mail =
+	gtk_check_button_new_with_label(_("Send button always queues outgoing mail in outbox"));
+	gtk_box_pack_start(GTK_BOX(vbox2), pui->always_queue_sent_mail,
+				FALSE, TRUE, 0);
 
     frame2 = gtk_frame_new(_("Encoding"));
     gtk_box_pack_start(GTK_BOX(vbox1), frame2, FALSE, FALSE, 0);
diff -b -B -u -r ../balsa/src/save-restore.c ./src/save-restore.c
--- ../balsa/src/save-restore.c	Tue Jul 10 16:45:59 2001
+++ ./src/save-restore.c	Wed Jul 11 19:56:31 2001
@@ -569,6 +569,8 @@
     if (balsa_app.wraplength < 40)
 	balsa_app.wraplength = 40;
 
+	balsa_app.always_queue_sent_mail = d_get_gint("AlwaysQueueSentMail", 0);
+
     gnome_config_pop_prefix();
 
     /* Compose window ... */
@@ -769,6 +771,7 @@
     gnome_config_set_bool("WordWrap", balsa_app.wordwrap);
     gnome_config_set_int("WrapLength", balsa_app.wraplength);
 
+	gnome_config_set_int("AlwaysQueueSentMail", balsa_app.always_queue_sent_mail);
     gnome_config_pop_prefix();
 
     /* Compose window ... */
diff -b -B -u -r ../balsa/src/sendmsg-window.c ./src/sendmsg-window.c
--- ../balsa/src/sendmsg-window.c	Tue Jul 10 16:45:59 2001
+++ ./src/sendmsg-window.c	Wed Jul 11 20:51:27 2001
@@ -78,6 +78,7 @@
 static gchar *read_signature(void);
 static gint include_file_cb(GtkWidget *, BalsaSendmsg *);
 static gint send_message_cb(GtkWidget *, BalsaSendmsg *);
+static gint send_message_toolbar_cb(GtkWidget *, BalsaSendmsg *);
 static gint queue_message_cb(GtkWidget *, BalsaSendmsg *);
 static gint autopostpone_message( gpointer bsmsg );
 static gint postpone_message_cb(GtkWidget *, BalsaSendmsg *);
@@ -144,7 +145,7 @@
 static GnomeUIInfo main_toolbar[] = {
 #define TOOL_SEND_POS 0
     GNOMEUIINFO_ITEM_STOCK(N_("Send"), N_("Send this message"),
-			   send_message_cb,
+			   send_message_toolbar_cb,
 			   GNOME_STOCK_PIXMAP_MAIL_SND),
     GNOMEUIINFO_SEPARATOR,
 #define TOOL_ATTACH_POS 2
@@ -1993,7 +1994,18 @@
     return TRUE;
 }
 
-/* "send message" menu and toolbar callback */
+/* "send message" toolbar callback */
+static gint
+send_message_toolbar_cb(GtkWidget * widget, BalsaSendmsg * bsmsg)
+{
+    libbalsa_address_entry_clear_to_send(bsmsg->to[1]);
+    libbalsa_address_entry_clear_to_send(bsmsg->cc[1]);
+    libbalsa_address_entry_clear_to_send(bsmsg->bcc[1]);
+    return send_message_handler(bsmsg, balsa_app.always_queue_sent_mail);
+}
+
+
+/* "send message" menu callback */
 static gint
 send_message_cb(GtkWidget * widget, BalsaSendmsg * bsmsg)
 {


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