2007-08-24 [paul] 2.10.0cvs160
authorPaul Mangan <paul@claws-mail.org>
Fri, 24 Aug 2007 11:07:45 +0000 (11:07 +0000)
committerPaul Mangan <paul@claws-mail.org>
Fri, 24 Aug 2007 11:07:45 +0000 (11:07 +0000)
* src/account.c
* src/folder.c
* src/folder.h
use suitable defaults for outbox,
queue, drafts and trash folders

ChangeLog
PATCHSETS
configure.ac
src/account.c
src/folder.c
src/folder.h

index 14cb4d41e19f1439367a5fccdfc96dc024e2f062..2fcf4f271be23f462c44f458d88652bb3efba3ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-24 [paul]      2.10.0cvs160
+
+       * src/account.c
+       * src/folder.c
+       * src/folder.h
+               use suitable defaults for outbox,
+               queue, drafts and trash folders
+
 2007-08-24 [wwp]       2.10.0cvs159
 
        * src/folderview.c
index a8ae693c4bdbbd03765877a5cf043bab9963ff12..9eb5a2b66a7874d6a05fd658135e028a308a7f65 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.60.2.95 -r 1.60.2.96 src/addressbook.c;  ) > 2.10.0cvs157.patchset
 ( cvs diff -u -r 1.12.2.47 -r 1.12.2.48 src/action.c;  cvs diff -u -r 1.60.2.47 -r 1.60.2.48 src/prefs_actions.c;  ) > 2.10.0cvs158.patchset
 ( cvs diff -u -r 1.207.2.176 -r 1.207.2.177 src/folderview.c;  ) > 2.10.0cvs159.patchset
+( cvs diff -u -r 1.61.2.66 -r 1.61.2.67 src/account.c;  cvs diff -u -r 1.213.2.157 -r 1.213.2.158 src/folder.c;  cvs diff -u -r 1.87.2.45 -r 1.87.2.46 src/folder.h;  ) > 2.10.0cvs160.patchset
index 00ff9db92c73acfefc4b80b17be251c2f2ff0018..ec259c0bbc9dda45b3cf34fdf23b2948da8539b2 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=10
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=159
+EXTRA_VERSION=160
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 35ee2e227277efdfa65628bc6a75f3aa2a1696af..2091d8f7b8ba062373ae2006012c006e75926179 100644 (file)
@@ -582,6 +582,8 @@ FolderItem *account_get_special_folder(PrefsAccount *ac_prefs,
                if (!item) {
                        if (ac_prefs->folder)
                                item = FOLDER(ac_prefs->folder)->outbox;
+                       if (!item)
+                               item = folder_get_default_outbox_for_class(F_MH);
                        if (!item)
                                item = folder_get_default_outbox();
                }
@@ -594,6 +596,8 @@ FolderItem *account_get_special_folder(PrefsAccount *ac_prefs,
                if (!item) {
                        if (ac_prefs->folder)
                                item = FOLDER(ac_prefs->folder)->draft;
+                       if (!item)
+                               item = folder_get_default_draft_for_class(F_MH);
                        if (!item)
                                item = folder_get_default_draft();
                }
@@ -606,6 +610,8 @@ FolderItem *account_get_special_folder(PrefsAccount *ac_prefs,
                if (!item) {
                        if (ac_prefs->folder)
                                item = FOLDER(ac_prefs->folder)->queue;
+                       if (!item)
+                               item = folder_get_default_queue_for_class(F_MH);
                        if (!item)
                                item = folder_get_default_queue();
                }
@@ -618,6 +624,8 @@ FolderItem *account_get_special_folder(PrefsAccount *ac_prefs,
                if (!item) {
                        if (ac_prefs->folder)
                                item = FOLDER(ac_prefs->folder)->trash;
+                       if (!item)
+                               item = folder_get_default_trash_for_class(F_MH);
                        if (!item)
                                item = folder_get_default_trash();
                }
index 32e082f2191dcf37d618d2a3375ce54a8cfd000b..5834a3463533300f6e6367e732cafd99c27375a6 100644 (file)
@@ -1466,6 +1466,26 @@ FolderItem *folder_get_default_outbox(void)
        return NULL;
 }
 
+FolderItem *folder_get_default_outbox_for_class(FolderType type)
+{
+       GList *flist;
+
+       for (flist = folder_list; flist != NULL; flist = g_list_next(flist)) {
+               Folder * folder = FOLDER(flist->data);
+
+               if (folder == NULL)
+                       continue;
+               if (folder->outbox == NULL)
+                       continue;
+               if (folder->klass->type != type)
+                       continue;
+
+               return folder->outbox;
+       }
+
+       return NULL;
+}
+
 FolderItem *folder_get_default_draft(void)
 {
        GList *flist;
@@ -1486,6 +1506,26 @@ FolderItem *folder_get_default_draft(void)
        return NULL;
 }
 
+FolderItem *folder_get_default_draft_for_class(FolderType type)
+{
+       GList *flist;
+
+       for (flist = folder_list; flist != NULL; flist = g_list_next(flist)) {
+               Folder * folder = FOLDER(flist->data);
+
+               if (folder == NULL)
+                       continue;
+               if (folder->draft == NULL)
+                       continue;
+               if (folder->klass->type != type)
+                       continue;
+
+               return folder->draft;
+       }
+
+       return NULL;
+}
+
 FolderItem *folder_get_default_queue(void)
 {
        GList *flist;
@@ -1506,6 +1546,26 @@ FolderItem *folder_get_default_queue(void)
        return NULL;
 }
 
+FolderItem *folder_get_default_queue_for_class(FolderType type)
+{
+       GList *flist;
+
+       for (flist = folder_list; flist != NULL; flist = g_list_next(flist)) {
+               Folder * folder = FOLDER(flist->data);
+
+               if (folder == NULL)
+                       continue;
+               if (folder->queue == NULL)
+                       continue;
+               if (folder->klass->type != type)
+                       continue;
+
+               return folder->queue;
+       }
+
+       return NULL;
+}
+
 FolderItem *folder_get_default_trash(void)
 {
        GList *flist;
@@ -1526,6 +1586,26 @@ FolderItem *folder_get_default_trash(void)
        return NULL;
 }
 
+FolderItem *folder_get_default_trash_for_class(FolderType type)
+{
+       GList *flist;
+
+       for (flist = folder_list; flist != NULL; flist = g_list_next(flist)) {
+               Folder * folder = FOLDER(flist->data);
+
+               if (folder == NULL)
+                       continue;
+               if (folder->trash == NULL)
+                       continue;
+               if (folder->klass->type != type)
+                       continue;
+
+               return folder->trash;
+       }
+
+       return NULL;
+}
+
 #define CREATE_FOLDER_IF_NOT_EXIST(member, dir, type)          \
 {                                                              \
        if (!folder->member) {                                  \
index 828dbf458ee947066c1ce52e4ff4e9049b20eb11..e3db51ba38052ab71e338d9f08b818b8739ff795 100644 (file)
@@ -770,9 +770,13 @@ gchar         *folder_item_get_name                (FolderItem     *item);
 FolderItem *folder_get_default_inbox   (void);
 FolderItem *folder_get_default_inbox_for_class(FolderType type);
 FolderItem *folder_get_default_outbox  (void);
+FolderItem *folder_get_default_outbox_for_class(FolderType type);
 FolderItem *folder_get_default_draft   (void);
+FolderItem *folder_get_default_draft_for_class(FolderType type);
 FolderItem *folder_get_default_queue   (void);
+FolderItem *folder_get_default_queu_for_class(FolderType type);
 FolderItem *folder_get_default_trash   (void);
+FolderItem *folder_get_default_trash_for_class(FolderType type);
 FolderItem *folder_get_default_processing (void);
 void folder_set_missing_folders                (void);
 void folder_unref_account_all          (PrefsAccount   *account);