Patch: Save message (and continue)
- From: Toralf Lund <toralf kscanners com>
- To: Balsa Mailing List <balsa-list gnome org>
- Subject: Patch: Save message (and continue)
- Date: Thu, 6 Sep 2001 11:47:48 +0200
Here is todays patch from me... This time I've looked at the draft/"save
message" functionality. I've implemented a new "save" operation that is
like "postpone", but keeps the message composition edit window so that you
can continue editing the message right away.
Why is this needed? - Well, conventional wisdom is that you should save you
data often so that you don't loose so much work if something goes wrong. To
a certain extent, I object to this view as it takes responsibility away
from the
application developers (if I loose valuable data because the application
crashes, I daresay it's the developers' responsibility for not writing
stable software, rather than mine for not saving.) Still, it's not an ideal
world, so I do want to save my messages once or twice while editing them.
Using "Postpone", then "Continue" in those cases is rather tedious,
especially since continue doesn't handle attachments etc.
So here is a simpler way that also won't loose the message structure. Note
that I've also linked the new function to the "Save" toolbar icon. Whether
you want "save and continue" or postpone, or both, in the toolbar is a
matter of taste, but as long as the title of the item is "Save", it seems
wrong to me that it also closes the window.
--
Toralf Lund <toralf@kscanners.com> +47 66 85 51 22
Kongsberg Scanners AS +47 66 85 51 00 (switchboard)
http://www.kscanners.no/~toralf +47 66 85 51 01 (fax)
Index: src/sendmsg-window.c
===================================================================
RCS file: /cvs/gnome/balsa/src/sendmsg-window.c,v
retrieving revision 1.296
diff -u -b -r1.296 sendmsg-window.c
--- src/sendmsg-window.c 2001/08/31 13:51:25 1.296
+++ src/sendmsg-window.c 2001/09/06 09:26:50
@@ -83,6 +83,7 @@
static gint queue_message_cb(GtkWidget *, BalsaSendmsg *);
static gint autopostpone_message( gpointer bsmsg );
static gint postpone_message_cb(GtkWidget *, BalsaSendmsg *);
+static gint save_message_cb(GtkWidget *, BalsaSendmsg *);
static gint print_message_cb(GtkWidget *, BalsaSendmsg *);
static gint attach_clicked(GtkWidget *, gpointer);
static gint close_window(GtkWidget *, gpointer);
@@ -167,14 +168,17 @@
#define MENU_FILE_POSTPONE_POS 5
GNOMEUIINFO_ITEM_STOCK(N_("_Postpone"), NULL,
postpone_message_cb, GNOME_STOCK_MENU_SAVE),
+#define MENU_FILE_POSTPONE_POS 5
+ GNOMEUIINFO_ITEM_STOCK(N_("_Save"), NULL,
+ save_message_cb, GNOME_STOCK_MENU_SAVE),
-#define MENU_FILE_PRINT_POS 6
+#define MENU_FILE_PRINT_POS 7
GNOMEUIINFO_ITEM_STOCK(N_("Print..."), N_("Print the edited message"),
print_message_cb, GNOME_STOCK_MENU_PRINT),
-#define MENU_FILE_SEPARATOR2_POS 7
+#define MENU_FILE_SEPARATOR2_POS 8
GNOMEUIINFO_SEPARATOR,
-#define MENU_FILE_CLOSE_POS 8
+#define MENU_FILE_CLOSE_POS 9
GNOMEUIINFO_MENU_CLOSE_ITEM(close_window, NULL),
GNOMEUIINFO_END
@@ -1486,7 +1490,7 @@
set_toolbar_button_callback(1, GNOME_STOCK_PIXMAP_ATTACH,
GTK_SIGNAL_FUNC(attach_clicked), msg);
set_toolbar_button_callback(1, GNOME_STOCK_PIXMAP_SAVE,
- GTK_SIGNAL_FUNC(postpone_message_cb), msg);
+ GTK_SIGNAL_FUNC(save_message_cb), msg);
set_toolbar_button_callback(1, BALSA_PIXMAP_IDENTITY,
GTK_SIGNAL_FUNC(change_identity_dialog_cb),
msg);
@@ -2135,9 +2139,7 @@
return postpone_message_cb( NULL, (BalsaSendmsg *)bsmsg );
}
-/* "postpone message" menu and toolbar callback */
-static gint
-postpone_message_cb(GtkWidget * widget, BalsaSendmsg * bsmsg)
+static gboolean update_draft(BalsaSendmsg * bsmsg)
{
LibBalsaMessage *message;
@@ -2163,11 +2165,52 @@
libbalsa_mailbox_sync_backend(bsmsg->orig_message->mailbox);
}
+ return TRUE;
+
+
+}
+
+/* "postpone message" menu and toolbar callback */
+static gint
+postpone_message_cb(GtkWidget * widget, BalsaSendmsg * bsmsg)
+{
+ if (update_draft(bsmsg)) {
+ LibBalsaMessage *message = bsmsg2message(bsmsg, FALSE);
+
gtk_object_destroy(GTK_OBJECT(message));
balsa_sendmsg_destroy(bsmsg);
return TRUE;
+ }
+ return FALSE;
}
+
+
+static gint
+save_message_cb(GtkWidget * widget, BalsaSendmsg * bsmsg)
+{
+ if (update_draft(bsmsg)) {
+ LibBalsaMessage *message = bsmsg2message(bsmsg, FALSE);
+ GList *draft_entry;
+
+ libbalsa_mailbox_open(balsa_app.draftbox);
+ draft_entry=g_list_last(balsa_app.draftbox->message_list);
+
+ if(bsmsg->orig_message) {
+ if(bsmsg->orig_message->mailbox)
+ libbalsa_mailbox_close(bsmsg->orig_message->mailbox);
+ gtk_object_unref(GTK_OBJECT(bsmsg->orig_message));
+ }
+ bsmsg->type=SEND_CONTINUE;
+ bsmsg->orig_message=LIBBALSA_MESSAGE(draft_entry->data);
+ bsmsg->orig_message->mailbox=balsa_app.draftbox;
+ gtk_object_ref(GTK_OBJECT(bsmsg->orig_message));
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
static gint
print_message_cb(GtkWidget * widget, BalsaSendmsg * bsmsg)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]