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 | |
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
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLog.ja | 6 | ||||
-rw-r--r-- | src/compose.c | 28 | ||||
-rw-r--r-- | src/procmsg.c | 17 | ||||
-rw-r--r-- | src/procmsg.h | 2 |
5 files changed, 59 insertions, 0 deletions
@@ -1,5 +1,11 @@ 2005-07-08 + * src/compose.c + src/procmsg.[ch]: put existing window in front when trying to reedit + draft/queued messages which are already open. + +2005-07-08 + * src/alertpanel.[ch]: alertpanel_full(): added more generic function. * src/compose.c src/account.c diff --git a/ChangeLog.ja b/ChangeLog.ja index cf85d2b5..269b76ea 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,11 @@ 2005-07-08 + * src/compose.c + src/procmsg.[ch]: 既に開いている草稿/送信待ちメッセージを再編集 + しようとした場合、存在するウィンドウを前面に出すようにした。 + +2005-07-08 + * src/alertpanel.[ch]: alertpanel_full(): より汎用的な関数を追加。 * src/compose.c src/account.c 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); diff --git a/src/procmsg.c b/src/procmsg.c index 714788da..d3be3765 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -1465,6 +1465,23 @@ MsgInfo *procmsg_msginfo_get_full_info(MsgInfo *msginfo) return full_msginfo; } +gboolean procmsg_msginfo_equal(MsgInfo *msginfo_a, MsgInfo *msginfo_b) +{ + if (!msginfo_a || !msginfo_b) + return FALSE; + + if (msginfo_a == msginfo_b) + return TRUE; + + if (msginfo_a->folder == msginfo_b->folder && + msginfo_a->msgnum == msginfo_b->msgnum && + msginfo_a->size == msginfo_b->size && + msginfo_a->mtime == msginfo_b->mtime) + return TRUE; + + return FALSE; +} + void procmsg_msginfo_free(MsgInfo *msginfo) { if (msginfo == NULL) return; diff --git a/src/procmsg.h b/src/procmsg.h index a6fd1dfe..852bc6f0 100644 --- a/src/procmsg.h +++ b/src/procmsg.h @@ -277,6 +277,8 @@ void procmsg_print_message (MsgInfo *msginfo, MsgInfo *procmsg_msginfo_copy (MsgInfo *msginfo); MsgInfo *procmsg_msginfo_get_full_info (MsgInfo *msginfo); +gboolean procmsg_msginfo_equal (MsgInfo *msginfo_a, + MsgInfo *msginfo_b); void procmsg_msginfo_free (MsgInfo *msginfo); gint procmsg_cmp_msgnum_for_sort (gconstpointer a, |