[balsa/69-resend-message: 15/16] sendmsg-window: Improve compose window titles
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/69-resend-message: 15/16] sendmsg-window: Improve compose window titles
- Date: Sun, 27 Mar 2022 13:45:30 +0000 (UTC)
commit e23c99d5c2e070ce0ed13215dc2f53d29e01ba59
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Mar 3 18:49:16 2022 -0500
sendmsg-window: Improve compose window titles
src/sendmsg-window.c | 42 ++++++++++++++++++++++++++++--------------
1 file changed, 28 insertions(+), 14 deletions(-)
---
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index ad830cbbd..c13286d47 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -6690,41 +6690,52 @@ rfc2822_skip_comments(const gchar * str)
static void
sendmsg_window_set_title(BalsaSendmsg * bsmsg)
{
- gchar *title_format;
InternetAddressList *list;
gchar *to_string;
- const gchar *subject_string = NULL;
+ const gchar *subject_string;
gchar *title;
+ list = libbalsa_address_view_get_list(bsmsg->recipient_view, "To:");
+ to_string = internet_address_list_to_string(list, NULL, FALSE);
+ g_object_unref(list);
+
+ g_assert(GTK_IS_ENTRY(bsmsg->subject[1]) || LIBBALSA_IS_MESSAGE(bsmsg->parent_message));
+ subject_string = bsmsg->subject[1] != NULL ?
+ gtk_entry_get_text(GTK_ENTRY(bsmsg->subject[1])) :
+ libbalsa_message_get_subject(bsmsg->parent_message);
+
+ if (subject_string == NULL || subject_string[0] == '\0')
+ subject_string = _("No subject");
+
switch (bsmsg->type) {
case SEND_REPLY:
case SEND_REPLY_ALL:
case SEND_REPLY_GROUP:
- title_format = _("Reply to %s: %s");
+ title = to_string != NULL ?
+ g_strdup_printf(_("Reply to %s: %s"), to_string, subject_string) :
+ g_strdup_printf(_("Reply: %s"), subject_string);
break;
case SEND_FORWARD_ATTACH:
case SEND_FORWARD_INLINE:
- title_format = _("Forward message to %s: %s");
+ title = to_string != NULL ?
+ g_strdup_printf(_("Forward message to %s: %s"), to_string, subject_string) :
+ g_strdup_printf(_("Forward message: %s"), subject_string);
break;
case SEND_RESEND:
- title_format = _("Resend message to %s");
+ title = to_string != NULL ?
+ g_strdup_printf(_("Resend message to %s: %s"), to_string, subject_string) :
+ g_strdup_printf(_("Resend message: %s"), subject_string);
break;
default:
- title_format = _("New message to %s: %s");
+ title = to_string != NULL ?
+ g_strdup_printf(_("New message to %s: %s"), to_string, subject_string) :
+ g_strdup_printf(_("New message: %s"), subject_string);
break;
}
- list = libbalsa_address_view_get_list(bsmsg->recipient_view, "To:");
- to_string = internet_address_list_to_string(list, NULL, FALSE);
- g_object_unref(list);
-
- if (bsmsg->subject[1] != NULL)
- subject_string = gtk_entry_get_text(GTK_ENTRY(bsmsg->subject[1]));
-
- title = g_strdup_printf(title_format, to_string ? to_string : "", subject_string);
g_free(to_string);
gtk_window_set_title(GTK_WINDOW(bsmsg->window), title);
g_free(title);
@@ -7204,6 +7215,9 @@ sendmsg_window_forward(LibBalsaMailbox *mailbox, guint msgno, SendType send_type
_("Attaching message failed.\n"
"Possible reason: not enough temporary space"));
}
+ bsmsg->parent_message = message;
+ libbalsa_mailbox_open(libbalsa_message_get_mailbox(message), NULL);
+ sendmsg_window_set_title(bsmsg);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]