diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-09-27 08:56:15 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-09-27 08:56:15 +0000 |
commit | f358a633fb5df008b6d2bb3141fe71d074a6a61c (patch) | |
tree | 0f17c4c5425c10eff206c393776cbcdb78ce5ff2 /src | |
parent | d3841401b2350e9b4b28f6b943f5cda262076101 (diff) |
display the subject line in the window title bar.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@606 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/compose.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/compose.c b/src/compose.c index 511bc935..dfd6a75c 100644 --- a/src/compose.c +++ b/src/compose.c @@ -398,7 +398,9 @@ static void compose_attach_toggled (GtkWidget *widget, Compose *compose); #endif -static void compose_changed_cb (GtkTextBuffer *textbuf, +static void compose_buffer_changed_cb (GtkTextBuffer *textbuf, + Compose *compose); +static void compose_changed_cb (GtkEditable *editable, Compose *compose); static void compose_wrap_cb (gpointer data, @@ -700,6 +702,7 @@ void compose_new(PrefsAccount *account, FolderItem *item, const gchar *mailto, undo_unblock(compose->undostruct); compose_connect_changed_callbacks(compose); + compose_set_title(compose); if (prefs_common.auto_exteditor) compose_exec_ext_editor(compose); @@ -779,6 +782,7 @@ void compose_reply(MsgInfo *msginfo, FolderItem *item, ComposeMode mode, undo_unblock(compose->undostruct); compose_connect_changed_callbacks(compose); + compose_set_title(compose); #if USE_GPGME if (account->encrypt_reply && @@ -899,6 +903,7 @@ void compose_forward(GSList *mlist, FolderItem *item, gboolean as_attach, undo_unblock(compose->undostruct); compose_connect_changed_callbacks(compose); + compose_set_title(compose); if (account->protocol != A_NNTP) gtk_widget_grab_focus(compose->to_entry); @@ -969,6 +974,7 @@ void compose_redirect(MsgInfo *msginfo, FolderItem *item) undo_unblock(compose->undostruct); compose_connect_changed_callbacks(compose); + compose_set_title(compose); } void compose_reedit(MsgInfo *msginfo) @@ -1035,6 +1041,7 @@ void compose_reedit(MsgInfo *msginfo) undo_unblock(compose->undostruct); compose_connect_changed_callbacks(compose); + compose_set_title(compose); if (prefs_common.auto_exteditor) compose_exec_ext_editor(compose); @@ -2352,13 +2359,21 @@ static void compose_set_title(Compose *compose) { gchar *str; gchar *edited; + const gchar *subject; + const gchar *address; + + subject = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry)); + if (!subject || subject[0] == '\0') + subject = _("(No Subject)"); - edited = compose->modified ? _(" [Edited]") : ""; if (compose->account && compose->account->address) - str = g_strdup_printf(_("%s - Compose message%s"), - compose->account->address, edited); + address = compose->account->address; else - str = g_strdup_printf(_("Compose message%s"), edited); + address = _("(No From)"); + + edited = compose->modified ? _(" [Edited]") : ""; + str = g_strdup_printf(_("%s: %s - Compose%s"), + address, subject, edited); gtk_window_set_title(GTK_WINDOW(compose->window), str); g_free(str); } @@ -4418,7 +4433,7 @@ static void compose_connect_changed_callbacks(Compose *compose) buffer = gtk_text_view_get_buffer(text); g_signal_connect(G_OBJECT(buffer), "changed", - G_CALLBACK(compose_changed_cb), compose); + G_CALLBACK(compose_buffer_changed_cb), compose); g_signal_connect(G_OBJECT(compose->to_entry), "changed", G_CALLBACK(compose_changed_cb), compose); g_signal_connect(G_OBJECT(compose->newsgroups_entry), "changed", @@ -6023,7 +6038,7 @@ static void compose_attach_toggled(GtkWidget *widget, Compose *compose) } #endif -static void compose_changed_cb(GtkTextBuffer *textbuf, Compose *compose) +static void compose_buffer_changed_cb(GtkTextBuffer *textbuf, Compose *compose) { if (compose->modified == FALSE) { compose->modified = TRUE; @@ -6031,6 +6046,15 @@ static void compose_changed_cb(GtkTextBuffer *textbuf, Compose *compose) } } +static void compose_changed_cb(GtkEditable *editable, Compose *compose) +{ + if (compose->modified == FALSE || + editable == GTK_EDITABLE(compose->subject_entry)) { + compose->modified = TRUE; + compose_set_title(compose); + } +} + static void compose_wrap_cb(gpointer data, guint action, GtkWidget *widget) { Compose *compose = (Compose *)data; |