apply sync patch from Paul; use old claws prefs_folder_item_create() for now
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 20 Apr 2002 22:57:52 +0000 (22:57 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 20 Apr 2002 22:57:52 +0000 (22:57 +0000)
23 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/Makefile.am
src/account.c
src/account.h
src/compose.c
src/folder.c
src/folder.h
src/folderview.c
src/gtkutils.c
src/imap.c
src/imap.h
src/mainwindow.c
src/mh.c
src/mh.h
src/news.c
src/news.h
src/prefs.c
src/prefs.h
src/prefs_account.c
src/prefs_account.h

index 56ed8cd..4aa161b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,53 @@
+2002-04-17
+
+       * src/mainwindow.c: main_window_create(): restrict the minimum size.
+
+2002-04-17
+
+       * src/compose.c: merged the new line-wrapping routine.
+         join_next_line(): fixed a bug that didn't join multibyte
+         characters.
+         get_indent_length(): modified enums and variable names.
+         INDENT_CHARS: don't indent ':'.
+       * src/folderview.c:
+         folderview_rename_folder_cb()
+         folderview_delete_folder_cb(): support folder identifier.
+         folderview_rm_imap_folder_cb(): integrated with
+         folderview_delete_folder_cb().
+
+2002-04-15
+
+       * src/folder.[ch]: folder_item_scan(): return -1 if scanning failed.
+       * src/folderview.c: folderview_check_new(): abort checking if
+         folder_item_scan() failed.
+
+2002-04-15
+
+       * src/imap.c: imap_create_missing_folders(): create only INBOX and
+         Trash.
+       * src/prefs_folder_item.c: prefs_folder_item_set_dialog(): made the
+         type of news folders unchangeable.
+         prefs_folder_item_destroy(): use prefs_dialog_destroy().
+       * src/prefs.[ch]: prefs_dialog_destroy(): new.
+
+2002-04-15
+
+       * src/prefs_account.[ch]: added special folder setting to Advanced
+         tab. Also moved "IMAP server directory" setting to there.
+       * src/account.[ch]: account_get_special_folder(): new. It returns
+         the optimal special folder for accounts.
+       * src/compose.c: use account_get_special_folder().
+       * src/prefs_folder_item.[ch]: new. Implemented folder property
+         dialog, and the special folder settings (most of the functions in
+         claws are not integrated yet, and the structure is slightly
+         modified).
+       * src/folderview.c: enabled Property menu.
+
+2002-04-14
+
+       * src/textview.c: IS_RFC822_CHAR(): make email parser also stop
+         scanning when encountering separators ',' and ';'.
+
 2002-04-12
 
        * src/mainwindow.c: reorderd the menu a bit.
index 96946f2..bf20ca4 100644 (file)
@@ -1,4 +1,12 @@
+2002-04-21 [alfons]    0.7.4claws84
+
+       apply sync patch from Paul
+
+       * src/folderview.c
+               use old claws prefs_folder_item_create() for now
+
 2002-04-19 [match]     0.7.4claws83
+
        * src/addressbook.[ch]
        * src/addrharvest.[ch]
        * src/addrgather.[ch]
index 940e4ab..0738d08 100644 (file)
@@ -1,3 +1,52 @@
+2002-04-17
+
+       * src/mainwindow.c: main_window_create(): ºÇ¾®¥µ¥¤¥º¤òÀ©¸Â¡£
+
+2002-04-17
+
+       * src/compose.c: ¿·¤·¤¤¼«Æ°²þ¹Ô¥ë¡¼¥Á¥ó¤ò¥Þ¡¼¥¸¡£
+         join_next_line(): ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤ò·ë¹ç¤·¤Ê¤¤¥Ð¥°¤ò½¤Àµ¡£
+         get_indent_length(): enum ¤ÈÊÑ¿ô̾¤ò½¤Àµ¡£
+         INDENT_CHARS: ':' ¤ò¥¤¥ó¥Ç¥ó¥È¤·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+       * src/folderview.c:
+         folderview_rename_folder_cb()
+         folderview_delete_folder_cb(): ¥Õ¥©¥ë¥À¼±Ê̻ҤËÂбþ¡£
+         folderview_rm_imap_folder_cb(): folderview_delete_folder_cb()
+         ¤ÈÅý¹ç¡£
+
+2002-04-15
+
+       * src/folder.[ch]: folder_item_scan(): ¥¹¥­¥ã¥ó¤Ë¼ºÇÔ¤·¤¿¤é -1 ¤ò
+         ÊÖ¤¹¡£
+       * src/folderview.c: folderview_check_new(): folder_item_scan() ¤Ë
+         ¼ºÇÔ¤·¤¿¤é¥Á¥§¥Ã¥¯¤òÃæÃÇ¡£
+
+2002-04-15
+
+       * src/imap.c: imap_create_missing_folders(): INBOX ¤È Trash ¤Î¤ß¤ò
+         ºîÀ®¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/prefs_folder_item.c: prefs_folder_item_set_dialog(): ¥Ë¥å¡¼¥¹
+         ¥Õ¥©¥ë¥À¤Î¥¿¥¤¥×¤òÊѤ¨¤é¤ì¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+         prefs_folder_item_destroy(): prefs_dialog_destroy() ¤ò»ÈÍÑ¡£
+       * src/prefs.[ch]: prefs_dialog_destroy(): ¿·µ¬¡£
+
+2002-04-15
+
+       * src/prefs_account.[ch]: ¡Ö¹âÅÙ¤ÊÀßÄê¡×¥¿¥Ö¤ËÆÃÊÌ¥Õ¥©¥ë¥À¤ÎÀßÄê¤ò
+         Äɲᣡ֠IMAP ¥µ¡¼¥Ð¥Ç¥£¥ì¥¯¥È¥ê¡×¤ÎÀßÄê¤â¤½¤³¤Ë°ÜÆ°¡£
+       * src/account.[ch]: account_get_special_folder(): ¿·µ¬¡£¥¢¥«¥¦¥ó¥È
+         ¤ËÂФ¹¤ëºÇŬ¤ÊÆÃÊÌ¥Õ¥©¥ë¥À¤òÊÖ¤¹¡£
+       * src/compose.c: account_get_special_folder() ¤ò»ÈÍÑ¡£
+       * src/prefs_folder_item.[ch]: ¿·µ¬¡£¥Õ¥©¥ë¥À¥×¥í¥Ñ¥Æ¥£¥À¥¤¥¢¥í¥°¤ò
+         ¼ÂÁõ¤·¡¢ÆÃÊÌ¥Õ¥©¥ë¥À¤ÎÀßÄê¤ò¼ÂÁõ(claws ¤ÎÂçÉôʬ¤Îµ¡Ç½¤Ï¤Þ¤ÀÅý¹ç
+         ¤µ¤ì¤Æ¤ª¤é¤º¡¢¹½Â¤¤Ï¾¯¤·Êѹ¹¤µ¤ì¤Æ¤¤¤ë)¡£
+       * src/folderview.c: ¥×¥í¥Ñ¥Æ¥£¥á¥Ë¥å¡¼¤òÍ­¸ú¤Ë¤·¤¿¡£
+
+2002-04-14
+
+       * src/textview.c: IS_RFC822_CHAR(): ',' ¤ä ';' Åù¤Î¥»¥Ñ¥ì¡¼¥¿¤¬
+         ¸½¤ì¤¿¤È¤­¤Ë¤â¥Ñ¡¼¥µ¤Î¥¹¥­¥ã¥ó¤òÄä»ß¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
 2002-04-12
 
        * src/mainwindow.c: ¥á¥Ë¥å¡¼¤Î½ç½ø¤ò¾¯¤·Êѹ¹¡£
index 61b11fe..9b94b00 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws83
+EXTRA_VERSION=claws84
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 220e6c3..4672f90 100644 (file)
@@ -30,6 +30,7 @@ sylpheed_SOURCES = \
        prefs_common.c prefs_common.h \
        prefs_filter.c prefs_filter.h \
        prefs_account.c prefs_account.h \
+       prefs_folder_item.c prefs_folder_item.h \
        prefs_display_header.c prefs_display_header.h \
        prefs_customheader.c prefs_customheader.h \
        prefs_summary_column.c prefs_summary_column.h \
@@ -118,7 +119,6 @@ sylpheed_SOURCES = \
        manual.c manual.h \
        stringtable.c stringtable.h \
        scoring.c scoring.h \
-       prefs_folder_item.c prefs_folder_item.h \
        matcher.c matcher.h \
        prefs_matcher.c prefs_matcher.h \
        prefs_scoring.c prefs_scoring.h \
index bfbf656..f6b53a3 100644 (file)
@@ -362,6 +362,56 @@ void account_set_missing_folder(void)
        }
 }
 
+FolderItem *account_get_special_folder(PrefsAccount *ac_prefs,
+                                      SpecialFolderItemType type)
+{
+       FolderItem *item = NULL;
+
+       g_return_val_if_fail(ac_prefs != NULL, NULL);
+
+       if (type == F_OUTBOX) {
+               if (ac_prefs->set_sent_folder && ac_prefs->sent_folder) {
+                       item = folder_find_item_from_identifier
+                               (ac_prefs->sent_folder);
+               }
+               if (!item) {
+                       if (ac_prefs->folder)
+                               item = FOLDER(ac_prefs->folder)->outbox;
+                       if (!item)
+                               item = folder_get_default_outbox();
+               }
+       } else if (type == F_DRAFT) {
+               if (ac_prefs->set_draft_folder && ac_prefs->draft_folder) {
+                       item = folder_find_item_from_identifier
+                               (ac_prefs->draft_folder);
+               }
+               if (!item) {
+                       if (ac_prefs->folder)
+                               item = FOLDER(ac_prefs->folder)->draft;
+                       if (!item)
+                               item = folder_get_default_draft();
+               }
+       } else if (type == F_QUEUE) {
+               if (ac_prefs->folder)
+                       item = FOLDER(ac_prefs->folder)->queue;
+               if (!item)
+                       item = folder_get_default_queue();
+       } else if (type == F_TRASH) {
+               if (ac_prefs->set_trash_folder && ac_prefs->trash_folder) {
+                       item = folder_find_item_from_identifier
+                               (ac_prefs->trash_folder);
+               }
+               if (!item) {
+                       if (ac_prefs->folder)
+                               item = FOLDER(ac_prefs->folder)->trash;
+                       if (!item)
+                               item = folder_get_default_trash();
+               }
+       }
+
+       return item;
+}
+
 void account_destroy(PrefsAccount *ac_prefs)
 {
        g_return_if_fail(ac_prefs != NULL);
index 1eba201..c77aff3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
 
 #include "prefs.h"
 #include "prefs_account.h"
+#include "folder.h"
 
 typedef gint   (*AccountFunc)  (PrefsAccount   *ac_prefs,
                                 gpointer        user_data);
@@ -39,15 +40,21 @@ PrefsAccount *account_find_from_address             (const gchar    *address);
 PrefsAccount *account_find_from_id             (gint            id);
 
 void         account_set_menu          (void);
+
 void         account_foreach           (AccountFunc     func,
                                         gpointer        user_data);
 GList       *account_get_list          (void);
+
 void         account_edit_open         (void);
 void         account_add               (void);
 void         account_set_as_default    (PrefsAccount   *ac_prefs);
 void         account_set_as_recv_at_get_all    (PrefsAccount   *ac_prefs);
 PrefsAccount *account_get_default      (void);
+
 void         account_set_missing_folder(void);
+FolderItem   *account_get_special_folder(PrefsAccount          *ac_prefs,
+                                        SpecialFolderItemType   type);
+
 void         account_destroy           (PrefsAccount   *ac_prefs);
 
 #endif /* __ACCOUNT_H__ */
index 34b73df..6752646 100644 (file)
@@ -1998,6 +1998,9 @@ static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
        }                                                                    \
 }
 
+#define INDENT_CHARS   ">|#"
+#define SPACE_CHARS    " \t"
+
 static void compose_wrap_line(Compose *compose)
 {
        GtkSText *text = GTK_STEXT(compose->text);
@@ -2038,7 +2041,7 @@ static void compose_wrap_line(Compose *compose)
                        }
                        line_end = 1;
                } else {
-                       if (ch_len == 1 && strchr(">|:#", *cbuf))
+                       if (ch_len == 1 && strchr(INDENT_CHARS, *cbuf))
                                quoted = 1;
                        else if (ch_len != 1 || !isspace(*cbuf))
                                quoted = 0;
@@ -2060,7 +2063,8 @@ static void compose_wrap_line(Compose *compose)
                        }
                        line_end = 1;
                } else {
-                       if (line_end && ch_len == 1 && strchr(">|:#", *cbuf))
+                       if (line_end && ch_len == 1 &&
+                           strchr(INDENT_CHARS, *cbuf))
                                goto compose_end; /* quoted part */
 
                        line_end = 0;
@@ -2177,13 +2181,10 @@ void dump_text(GtkSText *text, int pos, int tlen, int breakoncr)
 #endif
 
 typedef enum {
-       WAIT_FOR_SPACETAB,
-       WAIT_FOR_INDENTCHAR,
-       WAIT_FOR_INDENTCHARORSPACETAB
-} IndentStates;
-
-#define INDCHARS   ">|:#"
-#define SPACECHARS " \t"
+       WAIT_FOR_SPACE,
+       WAIT_FOR_INDENT_CHAR,
+       WAIT_FOR_INDENT_CHAR_OR_SPACE
+} IndentState;
 
 /* return indent length, we allow:
    > followed by spaces/tabs
@@ -2195,50 +2196,49 @@ static guint get_indent_length(GtkSText *text, guint start_pos, guint text_len)
 {
        guint i_len = 0;
        guint i, ch_len, alnum_cnt = 0;
-       IndentStates state = WAIT_FOR_INDENTCHAR;
-       gchar cb[MB_LEN_MAX];
+       IndentState state = WAIT_FOR_INDENT_CHAR;
+       gchar cbuf[MB_LEN_MAX];
        gboolean is_space;
        gboolean is_indent;
 
        for (i = start_pos; i < text_len; i++) {
-               GET_CHAR(i, cb, ch_len);
+               GET_CHAR(i, cbuf, ch_len);
                if (ch_len > 1)
                        break;
 
-               if (cb[0] == '\n')
+               if (cbuf[0] == '\n')
                        break;
 
-               is_indent = strchr(INDCHARS, cb[0]) ? TRUE : FALSE;
-               is_space = strchr(SPACECHARS, cb[0]) ? TRUE : FALSE;
+               is_indent = strchr(INDENT_CHARS, cbuf[0]) ? TRUE : FALSE;
+               is_space = strchr(SPACE_CHARS, cbuf[0]) ? TRUE : FALSE;
 
                switch (state) {
-               case WAIT_FOR_SPACETAB:
+               case WAIT_FOR_SPACE:
                        if (is_space == FALSE)
                                goto out;
-                       state = WAIT_FOR_INDENTCHARORSPACETAB;
+                       state = WAIT_FOR_INDENT_CHAR_OR_SPACE;
                        break;
-               case WAIT_FOR_INDENTCHARORSPACETAB:
+               case WAIT_FOR_INDENT_CHAR_OR_SPACE:
                        if (is_indent == FALSE && is_space == FALSE &&
-                           !isupper(cb[0]))
+                           !isupper(cbuf[0]))
                                goto out;
                        if (is_space == TRUE) {
                                alnum_cnt = 0;
-                               state = WAIT_FOR_INDENTCHARORSPACETAB;
+                               state = WAIT_FOR_INDENT_CHAR_OR_SPACE;
                        } else if (is_indent == TRUE) {
                                alnum_cnt = 0;
-                               state = WAIT_FOR_SPACETAB;
+                               state = WAIT_FOR_SPACE;
                        } else {
                                alnum_cnt++;
-                               state = WAIT_FOR_INDENTCHAR;
-                               break;
+                               state = WAIT_FOR_INDENT_CHAR;
                        }
                        break;
-               case WAIT_FOR_INDENTCHAR:
-                       if (is_indent == FALSE && !isupper(cb[0]))
+               case WAIT_FOR_INDENT_CHAR:
+                       if (is_indent == FALSE && !isupper(cbuf[0]))
                                goto out;
                        if (is_indent == TRUE) {
                                alnum_cnt = 0;
-                               state = WAIT_FOR_SPACETAB;
+                               state = WAIT_FOR_SPACE;
                        } else {
                                alnum_cnt++;
                        }
@@ -2249,7 +2249,7 @@ static guint get_indent_length(GtkSText *text, guint start_pos, guint text_len)
        }
 
 out:
-       if ((i_len > 0) && (state == WAIT_FOR_INDENTCHAR))
+       if ((i_len > 0) && (state == WAIT_FOR_INDENT_CHAR))
                i_len -= alnum_cnt;
 
        return i_len;
@@ -2286,7 +2286,7 @@ static gboolean join_next_line(GtkSText *text, guint start_pos, guint tlen,
 
        if ((indent_len > 0) && (indent_len == prev_ilen)) {
                GET_CHAR(start_pos + indent_len, cbuf, ch_len);
-               if (ch_len == 1 && (cbuf[0] != '\n'))
+               if (ch_len > 0 && (cbuf[0] != '\n'))
                        do_join = TRUE;
        }
 
@@ -2351,7 +2351,6 @@ static void compose_wrap_line_all(Compose *compose)
                /* we have encountered line break */
                if (ch_len == 1 && *cbuf == '\n') {
                        gint clen;
-                       guint ilen;
                        gchar cb[MB_CUR_MAX];
 
                        /* should we join the next line */
@@ -2386,6 +2385,7 @@ static void compose_wrap_line_all(Compose *compose)
                                /* if text starts with quote fmt or with
                                   indent string, delete them */
                                if (i_len) {
+                                       guint ilen;
                                        ilen =  gtkut_stext_str_compare_n
                                                (text, cur_pos, p_pos, i_len,
                                                 tlen);
@@ -2780,13 +2780,10 @@ gint compose_send(Compose *compose)
                }
                /* save message to outbox */
                if (prefs_common.savemsg) {
-                       Folder *folder = FOLDER(compose->account->folder);
-                       FolderItem *outbox = NULL;
+                       FolderItem *outbox;
 
-                       if (folder)
-                               outbox = folder->outbox;
-                       if (!outbox)
-                               outbox = folder_get_default_outbox();
+                       outbox = account_get_special_folder
+                               (compose->account, F_OUTBOX);
                        if (procmsg_save_to_outbox(outbox, tmp, FALSE) < 0)
                                alertpanel_error
                                        (_("Can't save the message to outbox."));
@@ -3389,12 +3386,7 @@ static gint compose_queue(Compose *compose, gint *msgnum, FolderItem **item)
                return -1;
        }
 
-       if (compose->account->folder &&
-           FOLDER(compose->account->folder)->queue)
-               queue = FOLDER(compose->account->folder)->queue;
-       else
-               queue = folder_get_default_queue();
-
+       queue = account_get_special_folder(compose->account, F_QUEUE);
        folder_item_scan(queue);
        queue_path = folder_item_get_path(queue);
        if (!is_dir_exist(queue_path))
@@ -5954,11 +5946,7 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
 
        if (lock) return;
 
-       if (compose->account && compose->account->folder &&
-           FOLDER(compose->account->folder)->draft)
-               draft = FOLDER(compose->account->folder)->draft;
-       else
-               draft = folder_get_default_draft();
+       draft = account_get_special_folder(compose->account, F_DRAFT);
        g_return_if_fail(draft != NULL);
 
        lock = TRUE;
index 86ddd15..06da579 100644 (file)
@@ -746,17 +746,14 @@ gchar *folder_item_get_path(FolderItem *item)
        return path;
 }
 
-void folder_item_scan(FolderItem *item)
+gint folder_item_scan(FolderItem *item)
 {
        Folder *folder;
 
        g_return_if_fail(item != NULL);
 
        folder = item->folder;
-
-       g_return_if_fail(folder->scan != NULL);
-
-       folder->scan(folder, item);
+       return folder->scan(folder, item);
 }
 
 static void folder_item_scan_foreach_func(gpointer key, gpointer val,
index 78cf114..5f8f62c 100644 (file)
@@ -133,7 +133,7 @@ struct _Folder
        gboolean (*is_msg_changed)      (Folder         *folder,
                                         FolderItem     *item,
                                         MsgInfo        *msginfo);
-       void     (*scan)                (Folder         *folder,
+       gint     (*scan)                (Folder         *folder,
                                         FolderItem     *item);
        void     (*scan_tree)           (Folder         *folder);
 
@@ -277,7 +277,7 @@ FolderItem *folder_get_default_processing (void);
 void folder_set_missing_folders                (void);
 
 gchar *folder_item_get_path            (FolderItem     *item);
-void   folder_item_scan                        (FolderItem     *item);
+gint   folder_item_scan                        (FolderItem     *item);
 void   folder_item_scan_foreach                (GHashTable     *table);
 gchar *folder_item_fetch_msg           (FolderItem     *item,
                                         gint            num);
index cf73b82..839e4e7 100644 (file)
@@ -55,6 +55,7 @@
 #include "prefs_common.h"
 #include "prefs_account.h"
 #include "prefs_filter.h"
+#include "prefs_folder_item.h"
 #include "account.h"
 #include "folder.h"
 #include "inc.h"
@@ -214,9 +215,6 @@ static void folderview_remove_mailbox_cb(FolderView *folderview,
 static void folderview_new_imap_folder_cb(FolderView   *folderview,
                                          guint          action,
                                          GtkWidget     *widget);
-static void folderview_rm_imap_folder_cb (FolderView   *folderview,
-                                         guint          action,
-                                         GtkWidget     *widget);
 static void folderview_rm_imap_server_cb (FolderView   *folderview,
                                          guint          action,
                                          GtkWidget     *widget);
@@ -235,6 +233,10 @@ static void folderview_search_cb   (FolderView     *folderview,
                                         guint           action,
                                         GtkWidget      *widget);
 
+static void folderview_property_cb     (FolderView     *folderview,
+                                        guint           action,
+                                        GtkWidget      *widget);
+
 static gboolean folderview_drag_motion_cb(GtkWidget      *widget,
                                          GdkDragContext *context,
                                          gint            x,
@@ -257,7 +259,6 @@ static void folderview_scoring_cb(FolderView *folderview, guint action,
                                  GtkWidget *widget);
 static void folderview_processing_cb(FolderView *folderview, guint action,
                                     GtkWidget *widget);
-static void folderview_property_cb(FolderView *folderview, guint action, GtkWidget *widget);
 
 static GtkItemFactoryEntry folderview_mbox_popup_entries[] =
 {
@@ -298,7 +299,7 @@ static GtkItemFactoryEntry folderview_imap_popup_entries[] =
        {N_("/---"),                    NULL, NULL, 0, "<Separator>"},
        {N_("/Create _new folder..."),  NULL, folderview_new_imap_folder_cb, 0, NULL},
        {N_("/_Rename folder..."),      NULL, folderview_rename_folder_cb,   0, NULL},
-       {N_("/_Delete folder"),         NULL, folderview_rm_imap_folder_cb,  0, NULL},
+       {N_("/_Delete folder"),         NULL, folderview_delete_folder_cb,   0, NULL},
        {N_("/---"),                    NULL, NULL, 0, "<Separator>"},
        {N_("/_Check for new messages"),
                                        NULL, folderview_update_tree_cb, 0, NULL},
@@ -307,7 +308,7 @@ static GtkItemFactoryEntry folderview_imap_popup_entries[] =
        {N_("/Remove _IMAP4 account"),  NULL, folderview_rm_imap_server_cb, 0, NULL},
        {N_("/---"),                    NULL, NULL, 0, "<Separator>"},
        {N_("/_Search folder..."),      NULL, folderview_search_cb, 0, NULL},
-       {N_("/_Property..."),           NULL, NULL, 0, NULL},
+       {N_("/_Property..."),           NULL, folderview_property_cb, 0, NULL},
        {N_("/_Processing..."),         NULL, folderview_processing_cb, 0, NULL},
        {N_("/S_coring..."),            NULL, folderview_scoring_cb, 0, NULL}
 };
@@ -323,7 +324,7 @@ static GtkItemFactoryEntry folderview_news_popup_entries[] =
        {N_("/Remove _news account"),    NULL, folderview_rm_news_server_cb, 0, NULL},
        {N_("/---"),                     NULL, NULL, 0, "<Separator>"},
        {N_("/_Search folder..."),       NULL, folderview_search_cb, 0, NULL},
-       {N_("/_Property..."),            NULL, NULL, 0, NULL},
+       {N_("/_Property..."),            NULL, folderview_property_cb, 0, NULL},
        {N_("/_Processing..."),          NULL, folderview_processing_cb, 0, NULL},
        {N_("/S_coring..."),            NULL, folderview_scoring_cb, 0, NULL}
 };
@@ -856,7 +857,10 @@ void folderview_check_new(Folder *folder)
                        if (!folder && !FOLDER_IS_LOCAL(item->folder)) continue;
 
                        folderview_scan_tree_func(item->folder, item, NULL);
-                       folder_item_scan(item);
+                       if (folder_item_scan(item) < 0) {
+                               if (folder && !FOLDER_IS_LOCAL(folder))
+                                       break;
+                       }
                        folderview_update_node(folderview, node);
                }
 
@@ -988,7 +992,9 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
                        openxpm = inboxopenxpm;
                        openmask = inboxopenxpmmask;
                }
-               name = g_strdup(_("Inbox"));
+               name = g_strdup(FOLDER_IS_LOCAL(item->folder) &&
+                               !strcmp2(item->name, INBOX_DIR) ? _("Inbox") :
+                               item->name);
                break;
        case F_OUTBOX:
                if (item->hide_read_msgs) {
@@ -1002,7 +1008,9 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
                        openxpm = outboxopenxpm;
                        openmask = outboxopenxpmmask;
                }
-               name = g_strdup(_("Sent"));
+               name = g_strdup(FOLDER_IS_LOCAL(item->folder) &&
+                               !strcmp2(item->name, OUTBOX_DIR) ? _("Sent") :
+                               item->name);
                break;
        case F_QUEUE:
                if (item->hide_read_msgs) {
@@ -1016,7 +1024,9 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
                        openxpm = queueopenxpm;
                        openmask = queueopenxpmmask;
                }
-               name = g_strdup(_("Queue"));
+               name = g_strdup(FOLDER_IS_LOCAL(item->folder) &&
+                               !strcmp2(item->name, QUEUE_DIR) ? _("Queue") :
+                               item->name);
                break;
        case F_TRASH:
                if (item->hide_read_msgs) {
@@ -1030,7 +1040,9 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
                        openxpm = trashopenxpm;
                        openmask = trashopenxpmmask;
                }
-               name = g_strdup(_("Trash"));
+               name = g_strdup(FOLDER_IS_LOCAL(item->folder) &&
+                               !strcmp2(item->name, TRASH_DIR) ? _("Trash") :
+                               item->name);
                break;
        case F_DRAFT:
                xpm = folderxpm;
@@ -1042,7 +1054,9 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
                        openxpm = folderopenxpm;
                        openmask = folderopenxpmmask;
                }
-               name = g_strdup(_("Drafts"));
+               name = g_strdup(FOLDER_IS_LOCAL(item->folder) &&
+                               !strcmp2(item->name, DRAFT_DIR) ? _("Drafts") :
+                               item->name);
                break;
        default:
                if (item->hide_read_msgs) {
@@ -1355,10 +1369,9 @@ void folderview_delete_folder(FolderView *folderview)
        case F_MH:
        case F_MBOX:
        case F_MAILDIR:
+       case F_IMAP:
                folderview_delete_folder_cb(folderview, 0, NULL);
                break;
-       case F_IMAP:
-               folderview_rm_imap_folder_cb(folderview, 0, NULL);
        case F_NEWS:
        default:
                break;
@@ -1383,10 +1396,10 @@ static void folderview_button_pressed(GtkWidget *ctree, GdkEventButton *event,
        gboolean update_tree     = FALSE;
        gboolean rescan_tree     = FALSE;
        gboolean remove_tree     = FALSE;
+       gboolean search_folder   = FALSE;
        gboolean folder_property = FALSE;
        gboolean folder_processing  = FALSE;
        gboolean folder_scoring  = FALSE;
-       gboolean search_folder = FALSE;
 
        if (!event) return;
 
@@ -1433,14 +1446,14 @@ static void folderview_button_pressed(GtkWidget *ctree, GdkEventButton *event,
                if (item->parent == NULL)
                        update_tree = remove_tree = TRUE;
                else
-                       mark_all_read = search_folder = TRUE;
+                       mark_all_read = search_folder = folder_property = TRUE;
                if (FOLDER_IS_LOCAL(folder) || FOLDER_TYPE(folder) == F_IMAP || FOLDER_TYPE(folder) == F_MBOX) {
                        if (item->parent == NULL)
                                update_tree = rescan_tree = TRUE;
                        else if (item->stype == F_NORMAL)
-                               rename_folder = delete_folder = folder_property = folder_scoring = folder_processing = TRUE;
+                               rename_folder = delete_folder = folder_scoring = folder_processing = TRUE;
                        else if (item->stype == F_INBOX)
-                               folder_property = folder_scoring = folder_processing = TRUE;
+                               folder_scoring = folder_processing = TRUE;
                        else if (item->stype == F_TRASH)
                                folder_processing = TRUE;
                        else if (item->stype == F_OUTBOX)
@@ -1469,10 +1482,10 @@ static void folderview_button_pressed(GtkWidget *ctree, GdkEventButton *event,
                SET_SENS(mail_factory, "/Check for new messages", update_tree);
                SET_SENS(mail_factory, "/Rescan folder tree", rescan_tree);
                SET_SENS(mail_factory, "/Remove mailbox", remove_tree);
+               SET_SENS(mail_factory, "/Search folder...", search_folder);
                SET_SENS(mail_factory, "/Property...", folder_property);
                SET_SENS(mail_factory, "/Processing...", folder_processing);
                SET_SENS(mail_factory, "/Scoring...", folder_scoring);
-               SET_SENS(mail_factory, "/Search folder...", search_folder);
        } else if (FOLDER_TYPE(folder) == F_IMAP) {
                popup = folderview->imap_popup;
                menu_set_insensitive_all(GTK_MENU_SHELL(popup));
@@ -1483,9 +1496,10 @@ static void folderview_button_pressed(GtkWidget *ctree, GdkEventButton *event,
                SET_SENS(imap_factory, "/Check for new messages", update_tree);
                SET_SENS(imap_factory, "/Rescan folder tree", rescan_tree);
                SET_SENS(imap_factory, "/Remove IMAP4 account", remove_tree);
+               SET_SENS(imap_factory, "/Search folder...", search_folder);
+               SET_SENS(imap_factory, "/Property...", folder_property);
                SET_SENS(imap_factory, "/Processing...", folder_processing);
                SET_SENS(imap_factory, "/Scoring...", folder_scoring);
-               SET_SENS(imap_factory, "/Search folder...", search_folder);
        } else if (FOLDER_TYPE(folder) == F_NEWS) {
                popup = folderview->news_popup;
                menu_set_insensitive_all(GTK_MENU_SHELL(popup));
@@ -1497,6 +1511,7 @@ static void folderview_button_pressed(GtkWidget *ctree, GdkEventButton *event,
 #endif
                SET_SENS(news_factory, "/Remove news account", remove_tree);
                SET_SENS(news_factory, "/Search folder...", search_folder);
+               SET_SENS(news_factory, "/Property...", folder_property);
                SET_SENS(news_factory, "/Processing...", folder_processing);
                SET_SENS(news_factory, "/Scoring...", folder_scoring);
        } else if (FOLDER_TYPE(folder) == F_MBOX) {
@@ -1505,6 +1520,7 @@ static void folderview_button_pressed(GtkWidget *ctree, GdkEventButton *event,
                SET_SENS(mbox_factory, "/Create new folder...", new_folder);
                SET_SENS(mbox_factory, "/Rename folder...", rename_folder);
                SET_SENS(mbox_factory, "/Delete folder", delete_folder);
+               SET_SENS(news_factory, "/Property...", folder_property);
                SET_SENS(mbox_factory, "/Processing...", folder_processing);
                SET_SENS(mbox_factory, "/Scoring...", folder_scoring);
        } else
@@ -1841,7 +1857,8 @@ static void folderview_rename_folder_cb(FolderView *folderview, guint action,
        gchar *new_folder;
        gchar *message;
        gchar *old_path;
-       gchar *new_path;
+       gchar *old_id;
+       gchar *new_id;
 
        if (!folderview->selected) return;
 
@@ -1874,29 +1891,28 @@ static void folderview_rename_folder_cb(FolderView *folderview, guint action,
        }
 
        Xstrdup_a(old_path, item->path, {g_free(new_folder); return;});
+       old_id = folder_item_get_identifier(item);
 
        if (item->folder->rename_folder(item->folder, item, new_folder) < 0) {
+               g_free(old_id);
                g_free(new_folder);
                return;
        }
-
-       if (strchr(item->path, G_DIR_SEPARATOR) != NULL) {
-               gchar *dirname;
-               dirname = g_dirname(item->path);
-               new_path = g_strconcat(dirname, G_DIR_SEPARATOR_S, new_folder, NULL);
-               g_free(dirname);
-       } else
-               new_path = g_strdup(new_folder);
-
        g_free(new_folder);
 
-       if (folder_get_default_folder() == item->folder)
-               prefs_filter_rename_path(old_path, new_path);
-
-       if (FOLDER_TYPE(item->folder) == F_MH)
-               prefs_filtering_rename_path(old_path, new_path);
-
-       g_free(new_path);
+       if (prefs_common.fltlist) {
+               if (folder_get_default_folder() == item->folder)
+                       prefs_filter_rename_path(old_path, item->path);
+               new_id = folder_item_get_identifier(item);
+               prefs_filter_rename_path(old_id, new_id);
+       } else {
+               if (FOLDER_TYPE(item->folder) == F_MH)
+                       prefs_filtering_rename_path(old_path, item->path);
+               new_id = folder_item_get_identifier(item);
+               prefs_filtering_rename_path(old_id, new_id);
+       }
+       g_free(old_id);
+       g_free(new_id);
 
        gtk_clist_freeze(GTK_CLIST(ctree));
 
@@ -1981,6 +1997,7 @@ static void folderview_delete_folder_cb(FolderView *folderview, guint action,
        gchar *message;
        AlertValue avalue;
        gchar *old_path;
+       gchar *old_id;
 
        if (!folderview->selected) return;
 
@@ -1999,19 +2016,30 @@ static void folderview_delete_folder_cb(FolderView *folderview, guint action,
        if (avalue != G_ALERTDEFAULT) return;
 
        Xstrdup_a(old_path, item->path, return);
+       old_id = folder_item_get_identifier(item);
 
        if (item->folder->remove_folder(item->folder, item) < 0) {
                alertpanel_error(_("Can't remove the folder `%s'."),
                                 item->path);
+               if (folderview->opened == folderview->selected)
+                       summary_show(folderview->summaryview,
+                                    folderview->summaryview->folder_item,
+                                    FALSE);
+               g_free(old_id);
                return;
        }
 
-       if (folder_get_default_folder() == item->folder)
-               prefs_filter_delete_path(old_path);
-
-       if (FOLDER_TYPE(item->folder) == F_MH)
-               prefs_filtering_delete_path(old_path);
-
+       if (prefs_common.fltlist) {
+               if (folder_get_default_folder() == item->folder)
+                       prefs_filter_delete_path(old_path);
+               prefs_filter_delete_path(old_id);
+               g_free(old_id);
+       } else {
+               if (FOLDER_TYPE(item->folder) == F_MH)
+                       prefs_filtering_delete_path(old_path);
+               prefs_filtering_delete_path(old_id);
+               g_free(old_id);
+       }
        if (folderview->opened == folderview->selected ||
            gtk_ctree_is_ancestor(ctree,
                                  folderview->selected,
@@ -2125,51 +2153,6 @@ static void folderview_new_imap_folder_cb(FolderView *folderview, guint action,
        folder_write_list();
 }
 
-static void folderview_rm_imap_folder_cb(FolderView *folderview, guint action,
-                                        GtkWidget *widget)
-{
-       GtkCTree *ctree = GTK_CTREE(folderview->ctree);
-       FolderItem *item;
-       gchar *message;
-       AlertValue avalue;
-
-       if (!folderview->selected) return;
-
-       item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
-       g_return_if_fail(item != NULL);
-       g_return_if_fail(item->folder != NULL);
-       g_return_if_fail(item->folder->type == F_IMAP);
-       g_return_if_fail(item->folder->account != NULL);
-
-       message = g_strdup_printf(_("Really delete folder `%s'?"),
-                                 g_basename(item->path));
-       avalue = alertpanel(_("Delete folder"), message,
-                           _("Yes"), _("+No"), NULL);
-       g_free(message);
-       if (avalue != G_ALERTDEFAULT) return;
-
-       if (item->folder->remove_folder(item->folder, item) < 0) {
-               alertpanel_error(_("Can't remove the folder `%s'."),
-                                item->path);
-               if (folderview->opened == folderview->selected)
-                       summary_show(folderview->summaryview,
-                                    folderview->summaryview->folder_item,
-                                    FALSE);
-               return;
-       }
-
-       if (folderview->opened == folderview->selected ||
-           gtk_ctree_is_ancestor(ctree,
-                                 folderview->selected,
-                                 folderview->opened)) {
-               summary_clear_all(folderview->summaryview);
-               folderview->opened = NULL;
-       }
-
-       gtk_ctree_remove_node(ctree, folderview->selected);
-       folder_write_list();
-}
-
 static void folderview_rm_imap_server_cb(FolderView *folderview, guint action,
                                         GtkWidget *widget)
 {
@@ -2380,6 +2363,28 @@ static void folderview_search_cb(FolderView *folderview, guint action,
        summary_search(folderview->summaryview);
 }
 
+static void folderview_property_cb(FolderView *folderview, guint action,
+                                  GtkWidget *widget)
+{
+       GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+       FolderItem *item;
+
+       if (!folderview->selected) return;
+
+       item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
+       g_return_if_fail(item != NULL);
+       g_return_if_fail(item->folder != NULL);
+
+#if CLAWS
+       prefs_folder_item_create(folderview, item);
+#else
+       /*
+        * CLAWS: wait till Hiro has completed his stuff
+        */
+       prefs_folder_item_open(item);
+#endif 
+}
+
 static gboolean folderview_drag_motion_cb(GtkWidget      *widget,
                                          GdkDragContext *context,
                                          gint            x,
@@ -2517,21 +2522,6 @@ static void folderview_processing_cb(FolderView *folderview, guint action,
        prefs_filtering_open(item);
 }
 
-static void folderview_property_cb(FolderView *folderview, guint action, 
-                                  GtkWidget *widget) 
-{
-       GtkCTree *ctree = GTK_CTREE(folderview->ctree);
-       FolderItem *item;
-
-       if (!folderview->selected) return;
-
-       item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
-       g_return_if_fail(item != NULL);
-       g_return_if_fail(item->folder != NULL);
-
-       prefs_folder_item_create(folderview, item);
-}
-
 void folderview_set_target_folder_color(gint color_op) 
 {
        gint firstone = 1;
index f212578..9e651ef 100644 (file)
@@ -422,7 +422,7 @@ void gtkut_widget_wait_for_draw(GtkWidget *widget)
 {
        gboolean flag = FALSE;
 
-       if (!GTK_WIDGET_VISIBLE(widget)) return;
+       if (!GTK_WIDGET_VISIBLE(widget) || !GTK_WIDGET_MAPPED(widget)) return;
 
        gtk_signal_connect(GTK_OBJECT(widget), "draw",
                           GTK_SIGNAL_FUNC(gtkut_widget_draw_cb), &flag);
index f5edec7..8e86b46 100644 (file)
@@ -922,28 +922,30 @@ gboolean imap_is_msg_changed(Folder *folder, FolderItem *item, MsgInfo *msginfo)
        return FALSE;
 }
 
-void imap_scan_folder(Folder *folder, FolderItem *item)
+gint imap_scan_folder(Folder *folder, FolderItem *item)
 {
        IMAPSession *session;
        gint messages, recent, unseen;
        guint32 uid_validity;
        gint ok;
 
-       g_return_if_fail(folder != NULL);
-       g_return_if_fail(item != NULL);
+       g_return_val_if_fail(folder != NULL, -1);
+       g_return_val_if_fail(item != NULL, -1);
 
        session = imap_session_get(folder);
-       if (!session) return;
+       if (!session) return -1;
 
        ok = imap_status(session, IMAP_FOLDER(folder), item->path,
                         &messages, &recent, &unseen, &uid_validity);
        statusbar_pop_all();
-       if (ok != IMAP_SUCCESS) return;
+       if (ok != IMAP_SUCCESS) return -1;
 
        item->new = unseen > 0 ? recent : 0;
        item->unread = unseen;
        item->total = messages;
        /* item->mtime = uid_validity; */
+
+       return 0;
 }
 
 void imap_scan_tree(Folder *folder)
@@ -1180,6 +1182,7 @@ static void imap_create_missing_folders(Folder *folder)
        if (!folder->inbox)
                folder->inbox = imap_create_special_folder
                        (folder, F_INBOX, "INBOX");
+#if 0
        if (!folder->outbox)
                folder->outbox = imap_create_special_folder
                        (folder, F_OUTBOX, "Sent");
@@ -1189,6 +1192,7 @@ static void imap_create_missing_folders(Folder *folder)
        if (!folder->queue)
                folder->queue = imap_create_special_folder
                        (folder, F_QUEUE, "Queue");
+#endif
        if (!folder->trash)
                folder->trash = imap_create_special_folder
                        (folder, F_TRASH, "Trash");
index c323ed2..54f8717 100644 (file)
@@ -127,7 +127,7 @@ gboolean imap_is_msg_changed                (Folder         *folder,
                                         FolderItem     *item,
                                         MsgInfo        *msginfo);
 
-void imap_scan_folder                  (Folder         *folder,
+gint imap_scan_folder                  (Folder         *folder,
                                         FolderItem     *item);
 void imap_scan_tree                    (Folder         *folder);
 
index 7d2c443..d6b32cb 100644 (file)
@@ -796,6 +796,8 @@ MainWindow *main_window_create(SeparateType type)
        GtkWidget *fwd_popup;
        gint i;
 
+       static GdkGeometry geometry;
+
        debug_print(_("Creating main window...\n"));
        mainwin = g_new0(MainWindow, 1);
 
@@ -804,6 +806,14 @@ MainWindow *main_window_create(SeparateType type)
        gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION);
        gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
        gtk_window_set_wmclass(GTK_WINDOW(window), "main_window", "Sylpheed");
+
+       if (!geometry.min_height) {
+               geometry.min_width = 320;
+               geometry.min_height = 200;
+       }
+       gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
+                                     GDK_HINT_MIN_SIZE);
+
        gtk_signal_connect(GTK_OBJECT(window), "delete_event",
                           GTK_SIGNAL_FUNC(main_window_close_cb), mainwin);
        MANAGE_WINDOW_SIGNALS_CONNECT(window);
index 1ecc2c0..b45a143 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -695,7 +695,7 @@ gboolean mh_is_msg_changed(Folder *folder, FolderItem *item, MsgInfo *msginfo)
        return FALSE;
 }
 
-void mh_scan_folder(Folder *folder, FolderItem *item)
+gint mh_scan_folder(Folder *folder, FolderItem *item)
 {
        gchar *path;
        DIR *dp;
@@ -705,21 +705,21 @@ void mh_scan_folder(Folder *folder, FolderItem *item)
        gint num;
        gint n_msg = 0;
 
-       g_return_if_fail(item != NULL);
+       g_return_val_if_fail(item != NULL, -1);
 
        debug_print("mh_scan_folder(): Scanning %s ...\n", item->path);
 
        path = folder_item_get_path(item);
-       g_return_if_fail(path != NULL);
+       g_return_val_if_fail(path != NULL, -1);
        if (change_dir(path) < 0) {
                g_free(path);
-               return;
+               return -1;
        }
        g_free(path);
 
        if ((dp = opendir(".")) == NULL) {
                FILE_OP_ERROR(item->path, "opendir");
-               return;
+               return -1;
        }
 
        if (folder->ui_func)
@@ -754,6 +754,8 @@ void mh_scan_folder(Folder *folder, FolderItem *item)
 
        debug_print(_("Last number in dir %s = %d\n"), item->path, max);
        item->last_num = max;
+
+       return 0;
 }
 
 void mh_scan_tree(Folder *folder)
index b26a3f8..a1749ce 100644 (file)
--- a/src/mh.h
+++ b/src/mh.h
@@ -69,7 +69,7 @@ gboolean mh_is_msg_changed    (Folder         *folder,
                                 FolderItem     *item,
                                 MsgInfo        *msginfo);
 
-void    mh_scan_folder         (Folder         *folder,
+gint    mh_scan_folder         (Folder         *folder,
                                 FolderItem     *item);
 void    mh_scan_tree           (Folder         *folder);
 
index 6e46ecc..507a6b1 100644 (file)
@@ -359,7 +359,7 @@ gchar *news_fetch_msg(Folder *folder, FolderItem *item, gint num)
        return filename;
 }
 
-void news_scan_group(Folder *folder, FolderItem *item)
+gint news_scan_group(Folder *folder, FolderItem *item)
 {
        NNTPSession *session;
        gint num = 0, first = 0, last = 0;
@@ -368,21 +368,21 @@ void news_scan_group(Folder *folder, FolderItem *item)
        gchar *path;
        gint ok;
 
-       g_return_if_fail(folder != NULL);
-       g_return_if_fail(item != NULL);
+       g_return_val_if_fail(folder != NULL, -1);
+       g_return_val_if_fail(item != NULL, -1);
 
        session = news_session_get(folder);
-       if (!session) return;
+       if (!session) return -1;
 
        ok = news_select_group(session, item->path, &num, &first, &last);
        if (ok != NN_SUCCESS) {
                log_warning(_("can't set group: %s\n"), item->path);
-               return;
+               return -1;
        }
 
        if (num == 0) {
                item->new = item->unread = item->total = item->last_num = 0;
-               return;
+               return 0;
        }
 
        path = folder_item_get_path(item);
@@ -392,17 +392,22 @@ void news_scan_group(Folder *folder, FolderItem *item)
        }
        g_free(path);
 
-       if (last >= max) {
+       if (first < min) {
+               new = unread = total = num;
+       } else if (max < first) {
+               new = unread = total = num;
+       } else if (last > max) {
                new += last - max;
                unread += last - max;
                if (new > num) new = num;
                if (unread > num) unread = num;
        }
-
        item->new = new;
        item->unread = unread;
        item->total = num;
        item->last_num = last;
+
+       return 0;
 }
 
 static NewsGroupInfo *news_group_info_new(const gchar *name,
index de3ed77..a6d591c 100644 (file)
@@ -70,7 +70,7 @@ gchar *news_fetch_msg                 (Folder         *folder,
                                         FolderItem     *item,
                                         gint            num);
 
-void news_scan_group                   (Folder         *folder,
+gint news_scan_group                   (Folder         *folder,
                                         FolderItem     *item);
 
 GSList *news_get_group_list            (Folder         *folder);
index 33bf205..ffed3d8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -486,6 +486,16 @@ void prefs_dialog_create(PrefsDialog *dialog)
        dialog->apply_btn  = apply_btn;
 }
 
+void prefs_dialog_destroy(PrefsDialog *dialog)
+{
+       gtk_widget_destroy(dialog->window);
+       dialog->window     = NULL;
+       dialog->notebook   = NULL;
+       dialog->ok_btn     = NULL;
+       dialog->cancel_btn = NULL;
+       dialog->apply_btn  = NULL;
+}
+
 void prefs_button_toggled(GtkToggleButton *toggle_btn, GtkWidget *widget)
 {
        gboolean is_active;
index 4ff46a2..18291c2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -154,6 +154,7 @@ void prefs_set_default              (PrefParam      *param);
 void prefs_free                        (PrefParam      *param);
 
 void prefs_dialog_create       (PrefsDialog    *dialog);
+void prefs_dialog_destroy      (PrefsDialog    *dialog);
 
 void prefs_button_toggled      (GtkToggleButton        *toggle_btn,
                                 GtkWidget              *widget);
index a3c4841..84e6201 100644 (file)
@@ -95,9 +95,6 @@ static struct Receive {
        GtkWidget *inbox_entry;
        GtkWidget *inbox_btn;
 
-       GtkWidget *imap_frame;
-       GtkWidget *imapdir_entry;
-
        GtkWidget *recvatgetall_chkbtn;
 } receive;
 
@@ -169,6 +166,15 @@ static struct Advanced {
        GtkWidget *crosspost_chkbtn;
        GtkWidget *crosspost_colormenu;
 
+       GtkWidget *imap_frame;
+       GtkWidget *imapdir_entry;
+
+       GtkWidget *sent_folder_chkbtn;
+       GtkWidget *sent_folder_entry;
+       GtkWidget *draft_folder_chkbtn;
+       GtkWidget *draft_folder_entry;
+       GtkWidget *trash_folder_chkbtn;
+       GtkWidget *trash_folder_entry;
 } advanced;
 
 static void prefs_account_fix_size                     (void);
@@ -270,9 +276,6 @@ static PrefParam param[] = {
         &receive.filter_on_recv_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
-       {"imap_directory", NULL, &tmp_ac_prefs.imap_dir, P_STRING,
-        &receive.imapdir_entry, prefs_set_data_from_entry, prefs_set_entry},
-
        {"receive_at_get_all", "TRUE", &tmp_ac_prefs.recv_at_getall, P_BOOL,
         &receive.recvatgetall_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
@@ -425,6 +428,29 @@ static PrefParam param[] = {
         prefs_account_crosspost_set_data_from_colormenu,
         prefs_account_crosspost_set_colormenu},
 
+       {"imap_directory", NULL, &tmp_ac_prefs.imap_dir, P_STRING,
+        &advanced.imapdir_entry, prefs_set_data_from_entry, prefs_set_entry},
+
+       {"set_sent_folder", "FALSE", &tmp_ac_prefs.set_sent_folder, P_BOOL,
+        &advanced.sent_folder_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"sent_folder", NULL, &tmp_ac_prefs.sent_folder, P_STRING,
+        &advanced.sent_folder_entry,
+        prefs_set_data_from_entry, prefs_set_entry},
+
+       {"set_draft_folder", "FALSE", &tmp_ac_prefs.set_draft_folder, P_BOOL,
+        &advanced.draft_folder_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"draft_folder", NULL, &tmp_ac_prefs.draft_folder, P_STRING,
+        &advanced.draft_folder_entry,
+        prefs_set_data_from_entry, prefs_set_entry},
+
+       {"set_trash_folder", "FALSE", &tmp_ac_prefs.set_trash_folder, P_BOOL,
+        &advanced.trash_folder_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"trash_folder", NULL, &tmp_ac_prefs.trash_folder, P_STRING,
+        &advanced.trash_folder_entry,
+        prefs_set_data_from_entry, prefs_set_entry},
 
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
@@ -442,7 +468,8 @@ static void prefs_account_ssl_create                (void);
 #endif /* USE_SSL */
 static void prefs_account_advanced_create      (void);
 
-static void prefs_account_select_inbox_cb      (void);
+static void prefs_account_select_folder_cb     (GtkWidget      *widget,
+                                                gpointer        data);
 static void prefs_account_edit_custom_header   (void);
 
 static gint prefs_account_deleted              (GtkWidget      *widget,
@@ -1003,9 +1030,6 @@ static void prefs_account_receive_create(void)
        GtkWidget *leave_time_label;
        GtkWidget *leave_time_hint;     
        GtkWidget *inbox_btn;
-       GtkWidget *frame2;
-       GtkWidget *imapdir_label;
-       GtkWidget *imapdir_entry;
        GtkWidget *recvatgetall_chkbtn;
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
@@ -1082,8 +1106,8 @@ static void prefs_account_receive_create(void)
        gtk_widget_show (inbox_btn);
        gtk_box_pack_start (GTK_BOX (hbox1), inbox_btn, FALSE, FALSE, 0);
        gtk_signal_connect (GTK_OBJECT (inbox_btn), "clicked",
-                           GTK_SIGNAL_FUNC (prefs_account_select_inbox_cb),
-                           NULL);
+                           GTK_SIGNAL_FUNC (prefs_account_select_folder_cb),
+                           inbox_entry);
 
        PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
 
@@ -1097,25 +1121,6 @@ static void prefs_account_receive_create(void)
        gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
        gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
 
-       PACK_FRAME (vbox1, frame2, _("IMAP4"));
-
-       vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
-       gtk_widget_show (vbox2);
-       gtk_container_add (GTK_CONTAINER (frame2), vbox2);
-       gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
-
-       hbox1 = gtk_hbox_new (FALSE, 8);
-       gtk_widget_show (hbox1);
-       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
-
-       imapdir_label = gtk_label_new (_("IMAP server directory"));
-       gtk_widget_show (imapdir_label);
-       gtk_box_pack_start (GTK_BOX (hbox1), imapdir_label, FALSE, FALSE, 0);
-
-       imapdir_entry = gtk_entry_new();
-       gtk_widget_show (imapdir_entry);
-       gtk_box_pack_start (GTK_BOX (hbox1), imapdir_entry, TRUE, TRUE, 0);
-
        PACK_CHECK_BUTTON
                (vbox1, recvatgetall_chkbtn,
                 _("`Get all' checks for new messages on this account"));
@@ -1131,9 +1136,6 @@ static void prefs_account_receive_create(void)
        receive.inbox_entry           = inbox_entry;
        receive.inbox_btn             = inbox_btn;
 
-       receive.imap_frame    = frame2;
-       receive.imapdir_entry = imapdir_entry;
-
        receive.recvatgetall_chkbtn   = recvatgetall_chkbtn;
 }
 
@@ -1147,7 +1149,6 @@ static void prefs_account_send_create(void)
        GtkWidget *hbox;
        GtkWidget *customhdr_chkbtn;
        GtkWidget *customhdr_edit_btn;
-       GtkWidget *frame3;
        GtkWidget *vbox3;
        GtkWidget *smtp_auth_chkbtn;
        GtkWidget *vbox4;
@@ -1190,11 +1191,11 @@ static void prefs_account_send_create(void)
 
        SET_TOGGLE_SENSITIVITY (customhdr_chkbtn, customhdr_edit_btn);
 
-       PACK_FRAME (vbox1, frame3, _("Authentication"));
+       PACK_FRAME (vbox1, frame, _("Authentication"));
 
        vbox3 = gtk_vbox_new (FALSE, 0);
        gtk_widget_show (vbox3);
-       gtk_container_add (GTK_CONTAINER (frame3), vbox3);
+       gtk_container_add (GTK_CONTAINER (frame), vbox3);
        gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8);
 
        PACK_CHECK_BUTTON (vbox3, smtp_auth_chkbtn,
@@ -1613,6 +1614,18 @@ static void prefs_account_advanced_create(void)
        GtkWidget *menuitem;
        GtkWidget *item;
        gint i;
+       GtkWidget *imap_frame;
+       GtkWidget *imapdir_label;
+       GtkWidget *imapdir_entry;
+       GtkWidget *folder_frame;
+       GtkWidget *vbox3;
+       GtkWidget *table;
+       GtkWidget *sent_folder_chkbtn;
+       GtkWidget *sent_folder_entry;
+       GtkWidget *draft_folder_chkbtn;
+       GtkWidget *draft_folder_entry;
+       GtkWidget *trash_folder_chkbtn;
+       GtkWidget *trash_folder_entry;
 
 #define PACK_HBOX(hbox) \
        { \
@@ -1693,9 +1706,78 @@ static void prefs_account_advanced_create(void)
        gtk_option_menu_set_menu (GTK_OPTION_MENU(colormenu_crosspost), menu);
        SET_TOGGLE_SENSITIVITY(checkbtn_crosspost, colormenu_crosspost);
 
+       PACK_FRAME (vbox1, imap_frame, _("IMAP4"));
+
+       vbox3 = gtk_vbox_new (FALSE, VSPACING_NARROW);
+       gtk_widget_show (vbox3);
+       gtk_container_add (GTK_CONTAINER (imap_frame), vbox3);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8);
+
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0);
+
+       imapdir_label = gtk_label_new (_("IMAP server directory"));
+       gtk_widget_show (imapdir_label);
+       gtk_box_pack_start (GTK_BOX (hbox1), imapdir_label, FALSE, FALSE, 0);
+
+       imapdir_entry = gtk_entry_new();
+       gtk_widget_show (imapdir_entry);
+       gtk_box_pack_start (GTK_BOX (hbox1), imapdir_entry, TRUE, TRUE, 0);
+
 #undef PACK_HBOX
 #undef PACK_PORT_ENTRY
 
+       /* special folder setting (maybe these options are redundant) */
+
+       PACK_FRAME (vbox1, folder_frame, _("Folder"));
+
+       vbox3 = gtk_vbox_new (FALSE, 0);
+       gtk_widget_show (vbox3);
+       gtk_container_add (GTK_CONTAINER (folder_frame), vbox3);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8);
+
+       table = gtk_table_new (3, 3, FALSE);
+       gtk_widget_show (table);
+       gtk_container_add (GTK_CONTAINER (vbox3), table);
+       gtk_table_set_row_spacings (GTK_TABLE (table), VSPACING_NARROW_2);
+       gtk_table_set_col_spacings (GTK_TABLE (table), 4);
+
+#define SET_CHECK_BTN_AND_ENTRY(label, chkbtn, entry, n)               \
+{                                                                      \
+       GtkWidget *button;                                              \
+                                                                       \
+       chkbtn = gtk_check_button_new_with_label (label);               \
+       gtk_widget_show (chkbtn);                                       \
+       gtk_table_attach (GTK_TABLE (table), chkbtn,                    \
+                         0, 1, n, n + 1, GTK_FILL, 0, 0, 0);           \
+                                                                       \
+       entry = gtk_entry_new ();                                       \
+       gtk_widget_show (entry);                                        \
+       gtk_table_attach (GTK_TABLE (table), entry, 1, 2, n, n + 1,     \
+                         GTK_EXPAND | GTK_SHRINK | GTK_FILL,           \
+                         GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);    \
+                                                                       \
+       button = gtk_button_new_with_label (_(" ... "));                \
+       gtk_widget_show (button);                                       \
+       gtk_table_attach (GTK_TABLE (table), button,                    \
+                         2, 3, n, n + 1, GTK_FILL, 0, 0, 0);           \
+       gtk_signal_connect                                              \
+               (GTK_OBJECT (button), "clicked",                        \
+                GTK_SIGNAL_FUNC (prefs_account_select_folder_cb),      \
+                entry);                                                \
+                                                                       \
+       SET_TOGGLE_SENSITIVITY (chkbtn, entry);                         \
+       SET_TOGGLE_SENSITIVITY (chkbtn, button);                        \
+}
+
+       SET_CHECK_BTN_AND_ENTRY(_("Put sent messages to"),
+                               sent_folder_chkbtn, sent_folder_entry, 0);
+       SET_CHECK_BTN_AND_ENTRY(_("Put draft messages to"),
+                               draft_folder_chkbtn, draft_folder_entry, 1);
+       SET_CHECK_BTN_AND_ENTRY(_("Put deleted messages to"),
+                               trash_folder_chkbtn, trash_folder_entry, 2);
+
        advanced.smtpport_chkbtn        = checkbtn_smtpport;
        advanced.smtpport_entry         = entry_smtpport;
        advanced.popport_hbox           = hbox_popport;
@@ -1713,6 +1795,16 @@ static void prefs_account_advanced_create(void)
        advanced.tunnelcmd_entry        = entry_tunnelcmd;
        advanced.crosspost_chkbtn       = checkbtn_crosspost;
        advanced.crosspost_colormenu    = colormenu_crosspost;
+
+       advanced.imap_frame             = imap_frame;
+       advanced.imapdir_entry          = imapdir_entry;
+
+       advanced.sent_folder_chkbtn  = sent_folder_chkbtn;
+       advanced.sent_folder_entry   = sent_folder_entry;
+       advanced.draft_folder_chkbtn = draft_folder_chkbtn;
+       advanced.draft_folder_entry  = draft_folder_entry;
+       advanced.trash_folder_chkbtn = trash_folder_chkbtn;
+       advanced.trash_folder_entry  = trash_folder_entry;
 }
 
 static gint prefs_account_deleted(GtkWidget *widget, GdkEventAny *event,
@@ -1798,17 +1890,19 @@ static void prefs_account_cancel(void)
        gtk_main_quit();
 }
 
-static void prefs_account_select_inbox_cb(void)
+static void prefs_account_select_folder_cb(GtkWidget *widget, gpointer data)
 {
        FolderItem *item;
-       gchar      *path;
+       gchar *id;
 
        item = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL);
-       if (item) {
-               path = folder_item_get_identifier(item);
-               gtk_entry_set_text(GTK_ENTRY(receive.inbox_entry), path);
-               g_free(path);
-       }       
+       if (item && item->path) {
+               id = folder_item_get_identifier(item);
+               if (id) {
+                       gtk_entry_set_text(GTK_ENTRY(data), id);
+                       g_free(id);
+               }
+       }
 }
 
 static void prefs_account_edit_custom_header(void)
@@ -1967,7 +2061,6 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                prefs_account_nntpauth_toggled
                        (GTK_TOGGLE_BUTTON(basic.nntpauth_chkbtn), NULL);
                gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
-               gtk_widget_set_sensitive(receive.imap_frame, FALSE);
                gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
 #if USE_SSL
                gtk_widget_set_sensitive(ssl.receive_frame, TRUE);
@@ -1981,6 +2074,7 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_show(advanced.nntpport_hbox);
                gtk_widget_show(advanced.crosspost_chkbtn);
                gtk_widget_show(advanced.crosspost_colormenu);
+               gtk_widget_set_sensitive(advanced.imap_frame, FALSE);
                break;
        case A_LOCAL:
                gtk_widget_hide(basic.nntpserv_label);
@@ -2022,7 +2116,6 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_set_sensitive(basic.uid_entry,  TRUE);
                gtk_widget_set_sensitive(basic.pass_entry, TRUE);
                gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
-               gtk_widget_set_sensitive(receive.imap_frame, FALSE);
                gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, FALSE);
                prefs_account_mailcmd_toggled
                        (GTK_TOGGLE_BUTTON(basic.mailcmd_chkbtn), NULL);
@@ -2039,6 +2132,7 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_hide(advanced.nntpport_hbox);
                gtk_widget_hide(advanced.crosspost_chkbtn);
                gtk_widget_hide(advanced.crosspost_colormenu);
+               gtk_widget_set_sensitive(advanced.imap_frame, FALSE);
                break;
        case A_IMAP4:
                gtk_widget_hide(basic.nntpserv_label);
@@ -2082,7 +2176,6 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_set_sensitive(basic.uid_entry,  TRUE);
                gtk_widget_set_sensitive(basic.pass_entry, TRUE);
                gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
-               gtk_widget_set_sensitive(receive.imap_frame, TRUE);
                gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
                gtk_widget_set_sensitive(basic.smtpserv_entry, TRUE);
                gtk_widget_set_sensitive(basic.smtpserv_label, TRUE);
@@ -2099,6 +2192,7 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_hide(advanced.nntpport_hbox);
                gtk_widget_hide(advanced.crosspost_chkbtn);
                gtk_widget_hide(advanced.crosspost_colormenu);
+               gtk_widget_set_sensitive(advanced.imap_frame, TRUE);
                break;
        case A_POP3:
        default:
@@ -2143,7 +2237,6 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_set_sensitive(basic.uid_entry,  TRUE);
                gtk_widget_set_sensitive(basic.pass_entry, TRUE);
                gtk_widget_set_sensitive(receive.pop3_frame, TRUE);
-               gtk_widget_set_sensitive(receive.imap_frame, FALSE);
                gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
                gtk_widget_set_sensitive(basic.smtpserv_entry, TRUE);
                gtk_widget_set_sensitive(basic.smtpserv_label, TRUE);
@@ -2160,6 +2253,7 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_hide(advanced.nntpport_hbox);
                gtk_widget_hide(advanced.crosspost_chkbtn);
                gtk_widget_hide(advanced.crosspost_colormenu);
+               gtk_widget_set_sensitive(advanced.imap_frame, FALSE);
                break;
        }
 
index aff4dda..90bcf5e 100644 (file)
@@ -108,8 +108,6 @@ struct _PrefsAccount
        gint   session_type;
        GSList *to_delete;
 
-       gchar *imap_dir;
-
        /* Send */
        gboolean add_date;
        gboolean gen_msgid;
@@ -168,6 +166,15 @@ struct _PrefsAccount
        gboolean  set_tunnelcmd;
        gchar     *tunnelcmd;
 
+       gchar *imap_dir;
+
+       gboolean set_sent_folder;
+       gchar *sent_folder;
+       gboolean set_draft_folder;
+       gchar *draft_folder;
+       gboolean set_trash_folder;
+       gchar *trash_folder;
+
        /* Default or not */
        gboolean is_default;
        /* Unique account ID */