code cleanup
authorChristoph Hohmann <reboot@gmx.ch>
Sat, 27 Oct 2001 16:29:03 +0000 (16:29 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Sat, 27 Oct 2001 16:29:03 +0000 (16:29 +0000)
ChangeLog.claws
src/compose.c

index 7e8dab4..3c12457 100644 (file)
@@ -3,6 +3,9 @@
        * src/compose.c
                make the folder's default account to be used when
                replying. (patch by wwp <subscript@free.fr>)
+       * src/compose.c
+               code cleanup, nearly killed all of wwp's patch
+               for folder's default account in compose
 
 2001-10-26 [alfons]
 
@@ -47,7 +50,7 @@
        * src/gtkstext.c
        
                make GtkSText follow style of GtkText (closes bug 
-               #469211 "text selection while writing message");
+               #469211 "text selection while writing message")
                
                do sync with GTK 1.2.10
 
index 3cc2043..79b377c 100644 (file)
@@ -497,21 +497,10 @@ Compose * compose_new_with_folderitem(PrefsAccount *account, FolderItem *item)
 Compose * compose_generic_new(PrefsAccount *account, const gchar *to, FolderItem *item)
 {
        Compose *compose;
-       GList *cur_ac;
-       GList *account_list;
-       PrefsAccount *ac_prefs;
-
-       if (item && item->prefs->enable_default_account) {
-               /* get a PrefsAccount *pointer on the wished account */
-               account_list=account_get_list();
-               for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
-                       ac_prefs = (PrefsAccount *)cur_ac->data;
-                       if (ac_prefs->account_id == item->prefs->default_account) {
-                               account = ac_prefs;
-                               break;
-                       }
-               }
-       }
+
+       if (item && item->prefs && item->prefs->enable_default_account)
+               account = account_find_from_id(item->prefs->default_account);
+
        if (!account) account = cur_account;
        g_return_val_if_fail(account != NULL, NULL);
 
@@ -603,28 +592,14 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
        PrefsAccount *account;
        PrefsAccount *reply_account;
        GtkSText *text;
-       GList *cur_ac;
-       GList *account_list;
-       PrefsAccount *ac_prefs;
 
        g_return_if_fail(msginfo != NULL);
        g_return_if_fail(msginfo->folder != NULL);
 
-       /* select the account set in folderitem's property (if enabled) */
        account = NULL;
-       if (msginfo->folder->prefs && msginfo->folder->prefs->enable_default_account) {
-               if (!account) {
-                       /* get a PrefsAccount *pointer on the wished account */
-                       account_list = account_get_list();
-                       for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
-                               ac_prefs = (PrefsAccount *)cur_ac->data;
-                               if (ac_prefs->account_id == msginfo->folder->prefs->default_account) {
-                                       account = ac_prefs;
-                                       break;
-                               }
-                       }
-               }
-       }
+       /* select the account set in folderitem's property (if enabled) */
+       if (msginfo->folder->prefs && msginfo->folder->prefs->enable_default_account)
+               account = account_find_from_id(msginfo->folder->prefs->default_account);
        
        /* select the account for the whole folder (IMAP / NNTP) */
        if (!account)