+2005-08-10 [colin] 1.9.13cvs29
+
+ * src/folder.c
+ * src/folderutils.c
+ * src/folderview.c
+ * src/imap_gtk.c
+ * src/mainwindow.c
+ * src/mh_gtk.c
+ * src/procmsg.c
+ * src/summaryview.c
+ Optimize folder_has_parent_of_type
+ Prevent moving special sub-folders from contextual menus
+ Rework message a bit ("Empty all messages" -> "Delete all
+ messages")
+ Fix bug #780 (MSexchange IMAP - using IMAP "Sent Items"
+ and "Deleted Items" folders)
+
2005-08-08 [colin] 1.9.13cvs28
* src/summaryview.c
( cvs diff -u -r 1.213.2.48 -r 1.213.2.49 src/folder.c; ) > 1.9.13cvs26.patchset
( cvs diff -u -r 1.395.2.107 -r 1.395.2.108 src/summaryview.c; ) > 1.9.13cvs27.patchset
( cvs diff -u -r 1.395.2.108 -r 1.395.2.109 src/summaryview.c; cvs diff -u -r 1.1.2.10 -r 1.1.2.11 src/prefs_summaries.c; ) > 1.9.13cvs28.patchset
+( cvs diff -u -r 1.213.2.49 -r 1.213.2.50 src/folder.c; cvs diff -u -r 1.3.2.6 -r 1.3.2.7 src/folderutils.c; cvs diff -u -r 1.207.2.55 -r 1.207.2.56 src/folderview.c; cvs diff -u -r 1.1.2.17 -r 1.1.2.18 src/imap_gtk.c; cvs diff -u -r 1.274.2.53 -r 1.274.2.54 src/mainwindow.c; cvs diff -u -r 1.2.2.10 -r 1.2.2.11 src/mh_gtk.c; cvs diff -u -r 1.150.2.34 -r 1.150.2.35 src/procmsg.c; cvs diff -u -r 1.395.2.109 -r 1.395.2.110 src/summaryview.c; ) > 1.9.13cvs29.patchset
MICRO_VERSION=13
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=28
+EXTRA_VERSION=29
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
item->apply_sub = FALSE;
item->mark_queue = NULL;
item->data = NULL;
+ item->parent_stype = -1;
item->prefs = folder_item_prefs_new();
SpecialFolderItemType type)
{
FolderItem *cur = item;
+
+ /* if we already know it, make it short */
+ if (item->parent_stype != -1) {
+ return (item->parent_stype == type);
+ }
+
+ /* if we don't, find the type from the first possible parent,
+ * and set our parent type to be faster next time */
while (cur) {
if (cur->stype == type || cur->parent_stype == type) {
item->parent_stype = type;
}
cur = folder_item_parent(cur);
}
+
+ /* if we didn't match what was asked, we didn't return. If our
+ * parent type is unknown, we may as well find it now to be faster
+ * later. */
+ if (item->parent_stype == -1) {
+ cur = item;
+ while (cur) {
+ /* here's an exception: Inbox subfolders are normal. */
+ if (item->parent_stype == -1 && cur->stype == F_INBOX
+ && item != cur) {
+ debug_print("set item %s parent type to %d "
+ "even if %s is F_INBOX\n",
+ item->path, 0, cur->path);
+ item->parent_stype = F_NORMAL;
+ break;
+ }
+ /* ah, we know this parent's parent's type, we may as
+ * well copy it instead of going up the full way */
+ if (cur->parent_stype != -1) {
+ item->parent_stype = cur->parent_stype;
+ debug_print("set item %s parent type to %d "
+ "from %s's parent type\n",
+ item->path, cur->parent_stype,
+ cur->path);
+ break;
+ }
+ /* we found a parent that has a special type. That's
+ * our parent type. */
+ if (cur->stype != F_NORMAL) {
+ debug_print("set item %s parent type to %d "
+ "from %s's type\n",
+ item->path, cur->stype, cur->path);
+ cur->parent_stype = cur->stype;
+ item->parent_stype = cur->stype;
+ break;
+ }
+ /* if we didn't find anything, go up once more */
+ cur = folder_item_parent(cur);
+ }
+ /* as we still didn't find anything, our parents must all be
+ * normal. */
+ if (item->parent_stype == -1) {
+ debug_print("set item %s to 0 from default\n",
+ item->path);
+ item->parent_stype = F_NORMAL;
+ }
+ }
return FALSE;
}
#include "utils.h"
#include "prefs_common.h"
#include "folderutils.h"
+#include "prefs_account.h"
+#include "account.h"
gint folderutils_delete_duplicates(FolderItem *item,
DeleteDuplicatesMode mode)
if (duplist) {
switch (mode) {
case DELETE_DUPLICATES_REMOVE: {
- FolderItem *trash = item->folder->trash;
+ FolderItem *trash = NULL;
+ gboolean in_trash = FALSE;
+ PrefsAccount *ac;
- if (folder_has_parent_of_type(item, F_TRASH) || trash == NULL)
+ if (NULL != (ac = account_find_from_item(item))) {
+ trash = account_get_special_folder(ac, F_TRASH);
+ in_trash = (trash != NULL && trash == item);
+ }
+ if (trash == NULL)
+ trash = item->folder->trash;
+
+ if (folder_has_parent_of_type(item, F_TRASH) || trash == NULL || in_trash)
folder_item_remove_msgs(item, duplist);
else
folder_item_move_msgs(trash, duplist);
FolderViewPopup *fpopup;
GtkItemFactory *fpopup_factory;
GtkWidget *popup;
+ FolderItem *special_trash = NULL;
+ PrefsAccount *ac;
if (!event) return FALSE;
if (fpopup->set_sensitivity != NULL)
fpopup->set_sensitivity(fpopup_factory, item);
- if (item == folder->trash &&
+ if (NULL != (ac = account_find_from_item(item)))
+ special_trash = account_get_special_folder(ac, F_TRASH);
+
+ if ((item == folder->trash || item == special_trash) &&
gtk_item_factory_get_item(fpopup_factory, "/Empty trash...") == NULL) {
gtk_item_factory_create_item(fpopup_factory, &folder_view_trash_popup_entries[0], folderview, 1);
gtk_item_factory_create_item(fpopup_factory, &folder_view_trash_popup_entries[1], folderview, 1);
- } else if (item != folder->trash) {
+ } else if (item != folder->trash && (special_trash == NULL || item != special_trash)) {
gtk_item_factory_delete_entry(fpopup_factory, &folder_view_trash_popup_entries[0]);
gtk_item_factory_delete_entry(fpopup_factory, &folder_view_trash_popup_entries[1]);
}
folderview->selected == folderview->opened);
SET_SENS("/Properties...", item->node->parent != NULL);
SET_SENS("/Processing...", item->node->parent != NULL);
- if (item == folder->trash) {
+ if (item == folder->trash || item == special_trash) {
GSList *msglist = folder_item_get_msg_list(item);
SET_SENS("/Empty trash...", msglist != NULL);
procmsg_msg_list_free(msglist);
GSList *mlist = NULL;
GSList *cur = NULL;
if (!folderview->selected) return;
-
+ FolderItem *special_trash = NULL;
+ PrefsAccount *ac;
+
item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
g_return_if_fail(item != NULL);
g_return_if_fail(item->folder != NULL);
- if (item != item->folder->trash) return;
+
+ if (NULL != (ac = account_find_from_item(item)))
+ special_trash = account_get_special_folder(ac, F_TRASH);
+
+ if (item != item->folder->trash && item != special_trash) return;
if (prefs_common.ask_on_clean) {
if (alertpanel(_("Empty trash"),
- _("Empty all messages in trash?"),
+ _("Delete all messages in trash?"),
GTK_STOCK_YES, GTK_STOCK_NO, NULL) != G_ALERTDEFAULT)
return;
}
static void set_sensitivity(GtkItemFactory *factory, FolderItem *item)
{
+ gboolean folder_is_normal =
+ item != NULL &&
+ item->stype == F_NORMAL &&
+ !folder_has_parent_of_type(item, F_OUTBOX) &&
+ !folder_has_parent_of_type(item, F_DRAFT) &&
+ !folder_has_parent_of_type(item, F_QUEUE) &&
+ !folder_has_parent_of_type(item, F_TRASH);
#define SET_SENS(name, sens) \
menu_set_sensitive(factory, name, sens)
SET_SENS("/Create new folder...", TRUE);
SET_SENS("/Rename folder...", item->stype == F_NORMAL && folder_item_parent(item) != NULL);
- SET_SENS("/Move folder...", item->stype == F_NORMAL && folder_item_parent(item) != NULL);
+ SET_SENS("/Move folder...", folder_is_normal && folder_item_parent(item) != NULL);
SET_SENS("/Delete folder", item->stype == F_NORMAL && folder_item_parent(item) != NULL);
SET_SENS("/Check for new messages", folder_item_parent(item) == NULL);
folder = FOLDER(list->data);
if (folder && folder->trash && folder->trash->total_msgs > 0)
has_trash++;
+ if (folder->account && folder->account->set_trash_folder &&
+ folder_find_item_from_identifier(folder->account->trash_folder))
+ has_trash++;
}
if (!has_trash) return;
if (confirm) {
if (alertpanel(_("Empty trash"),
- _("Empty all messages in trash?"),
+ _("Delete all messages in trash folders?"),
GTK_STOCK_YES, GTK_STOCK_NO, NULL)
!= G_ALERTDEFAULT)
return;
static void set_sensitivity(GtkItemFactory *factory, FolderItem *item)
{
+ gboolean folder_is_normal =
+ item != NULL &&
+ item->stype == F_NORMAL &&
+ !folder_has_parent_of_type(item, F_OUTBOX) &&
+ !folder_has_parent_of_type(item, F_DRAFT) &&
+ !folder_has_parent_of_type(item, F_QUEUE) &&
+ !folder_has_parent_of_type(item, F_TRASH);
#define SET_SENS(name, sens) \
menu_set_sensitive(factory, name, sens)
SET_SENS("/Create new folder...", TRUE);
SET_SENS("/Rename folder...", item->stype == F_NORMAL && folder_item_parent(item) != NULL);
- SET_SENS("/Move folder...", item->stype == F_NORMAL && folder_item_parent(item) != NULL);
+ SET_SENS("/Move folder...", folder_is_normal && folder_item_parent(item) != NULL);
SET_SENS("/Delete folder", item->stype == F_NORMAL && folder_item_parent(item) != NULL);
SET_SENS("/Check for new messages", folder_item_parent(item) == NULL);
GList *cur;
for (cur = folder_get_list(); cur != NULL; cur = cur->next) {
- trash = FOLDER(cur->data)->trash;
+ Folder *folder = FOLDER(cur->data);
+ trash = folder->trash;
procmsg_empty_trash(trash);
+ if (folder->account && folder->account->set_trash_folder &&
+ folder_find_item_from_identifier(folder->account->trash_folder))
+ procmsg_empty_trash(
+ folder_find_item_from_identifier(folder->account->trash_folder));
}
}
void summary_delete_trash(SummaryView *summaryview)
{
- FolderItem *to_folder;
-
+ FolderItem *to_folder = NULL;
+ PrefsAccount *ac;
if (!summaryview->folder_item ||
FOLDER_TYPE(summaryview->folder_item->folder) == F_NEWS) return;
+
+ if (NULL != (ac = account_find_from_item(summaryview->folder_item)))
+ to_folder = account_get_special_folder(ac, F_TRASH);
- to_folder = summaryview->folder_item->folder->trash;
+ if (to_folder == NULL)
+ to_folder = summaryview->folder_item->folder->trash;
if (to_folder == NULL || to_folder == summaryview->folder_item)
summary_delete(summaryview);