From 34a24148d4315d15e092760c983ff45115a32e00 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 25 Jan 2006 06:53:07 +0000 Subject: don't show 'Empty trash' dialog if trashed messages don't exist. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@927 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 8 ++++++++ ChangeLog.ja | 8 ++++++++ libsylph/procmsg.c | 14 ++++++++++++++ libsylph/procmsg.h | 1 + src/folderview.c | 6 ++++-- src/mainwindow.c | 3 +++ 6 files changed, 38 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19d45598..5fc1e44d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-01-25 + + * libsylph/procmsg.[ch]: procmsg_trash_messages_exist(): added. + * src/folderview.c: folderview_menu_popup(): don't make 'Empty trash' + active if trashed messages don't exist. + src/mainwindow.c: main_window_empty_trash(): return immediately + when trashed messages don't exist. + 2006-01-25 * src/compose.c: 'File/Insert signature' now inserts signature into diff --git a/ChangeLog.ja b/ChangeLog.ja index 1719cad3..a3da4e6c 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,11 @@ +2006-01-25 + + * libsylph/procmsg.[ch]: procmsg_trash_messages_exist(): 追加。 + * src/folderview.c: folderview_menu_popup(): ごみ箱のメッセージが存在 + しなければ「ごみ箱を空にする」を有効にしないようにした。 + * src/mainwindow.c: main_window_empty_trash(): ごみ箱のメッセージが存在 + しなければすぐに返るようにした。 + 2006-01-25 * src/compose.c: 「ファイル/署名を挿入」で署名を現在のカーソル位置に diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c index 26abee6a..3487bdf0 100644 --- a/libsylph/procmsg.c +++ b/libsylph/procmsg.c @@ -1188,6 +1188,20 @@ gboolean procmsg_msg_exist(MsgInfo *msginfo) return ret; } +gboolean procmsg_trash_messages_exist(void) +{ + FolderItem *trash; + GList *cur; + + for (cur = folder_get_list(); cur != NULL; cur = cur->next) { + trash = FOLDER(cur->data)->trash; + if (trash && trash->total > 0) + return TRUE; + } + + return FALSE; +} + void procmsg_empty_trash(FolderItem *trash) { if (trash && trash->total > 0) { diff --git a/libsylph/procmsg.h b/libsylph/procmsg.h index 87af5b75..19de310e 100644 --- a/libsylph/procmsg.h +++ b/libsylph/procmsg.h @@ -287,6 +287,7 @@ FILE *procmsg_open_message_decrypted (MsgInfo *msginfo, gboolean procmsg_msg_exist (MsgInfo *msginfo); +gboolean procmsg_trash_messages_exist (void); void procmsg_empty_trash (FolderItem *trash); void procmsg_empty_all_trash (void); diff --git a/src/folderview.c b/src/folderview.c index 8349b9e5..5a903324 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -1605,8 +1605,10 @@ static gboolean folderview_menu_popup(FolderView *folderview, rename_folder = delete_folder = TRUE; if (folder->klass->move_folder) move_folder = TRUE; - } else if (item->stype == F_TRASH) - empty_trash = TRUE; + } else if (item->stype == F_TRASH) { + if (item->total > 0) + empty_trash = TRUE; + } } else if (FOLDER_TYPE(folder) == F_NEWS) { if (item->parent != NULL) delete_folder = TRUE; diff --git a/src/mainwindow.c b/src/mainwindow.c index e42f6f89..632355de 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -1616,6 +1616,9 @@ void main_window_empty_trash(MainWindow *mainwin, gboolean confirm) { GList *list; + if (!procmsg_trash_messages_exist()) + return; + if (confirm) { if (alertpanel(_("Empty all trash"), _("Delete all messages in trash folders?"), -- cgit v1.2.3