diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-07-08 08:36:21 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-07-08 08:36:21 +0000 |
commit | f61df3781b52ec6551a962ad62816f9c3cb6e951 (patch) | |
tree | db0893c1a94c72feaa32b970e9893459a0b44d53 /src/compose.c | |
parent | a07b24d01ccce1cfa58e74782f8b5b05c5a7055d (diff) |
put existing window in front when trying to reedit draft/queued messages which are already open.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@409 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/compose.c')
-rw-r--r-- | src/compose.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/compose.c b/src/compose.c index 3ed07ed5..5fc2a08e 100644 --- a/src/compose.c +++ b/src/compose.c @@ -158,6 +158,7 @@ static GList *compose_list = NULL; static Compose *compose_create (PrefsAccount *account, ComposeMode mode); +static Compose *compose_find_window_by_target (MsgInfo *msginfo); static void compose_connect_changed_callbacks (Compose *compose); static void compose_toolbar_create (Compose *compose, GtkWidget *container); @@ -990,6 +991,17 @@ void compose_reedit(MsgInfo *msginfo) if (!account) account = cur_account; g_return_if_fail(account != NULL); + if (msginfo->folder->stype == F_DRAFT || + msginfo->folder->stype == F_QUEUE) { + compose = compose_find_window_by_target(msginfo); + if (compose) { + debug_print + ("compose_reedit(): existing window found.\n"); + gtk_window_present(GTK_WINDOW(compose->window)); + return; + } + } + compose = compose_create(account, COMPOSE_REEDIT); compose->targetinfo = procmsg_msginfo_copy(msginfo); @@ -4313,6 +4325,22 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) return compose; } +static Compose *compose_find_window_by_target(MsgInfo *msginfo) +{ + GList *cur; + Compose *compose; + + g_return_val_if_fail(msginfo != NULL, NULL); + + for (cur = compose_list; cur != NULL; cur = cur->next) { + compose = cur->data; + if (procmsg_msginfo_equal(compose->targetinfo, msginfo)) + return compose; + } + + return NULL; +} + static void compose_connect_changed_callbacks(Compose *compose) { GtkTextView *text = GTK_TEXT_VIEW(compose->text); |