sync with sylpheed 0.5.0pre3 release
authorPaul Mangan <paul@claws-mail.org>
Sun, 1 Jul 2001 08:37:50 +0000 (08:37 +0000)
committerPaul Mangan <paul@claws-mail.org>
Sun, 1 Jul 2001 08:37:50 +0000 (08:37 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
src/account.c
src/folder.c
src/folder.h
src/folderview.c
src/folderview.h
src/imap.c
src/summaryview.c

index 2c57129..422c630 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2001-07-01
+
+       * version 0.5.0pre3
+
+       * src/folderview.[ch]: folderview_set_all(): new.
+       * src/account.c: account_add(): call folderview_set_all() after
+         creating IMAP4 tree.
+         account_edit_create(): account preferences dialog can be opened
+         with double clicking of the list.
+         account_selected(): new.
+         account_clist_set(): made the CList focus set correctly.
+
+2001-06-30
+
+       * src/imap.c: imap_scan_tree(): call imap_create_trash() if trash
+         is not found.
+         imap_scan_tree_recursive(): search the sub folders of INBOX.
+         recognize Trash folder.
+         imap_create_tree(): separated the part of creating trash.
+         imap_create_trash(): new.
+       * src/folder.c: folder_build_tree(), folder_write_list_recursive():
+         preserve no_sub and no_select.
+       * src/summaryview.c: summary_show(): don't proceed if item->no_select
+         is TRUE.
+
 2001-06-29
 
        * src/imap.c: imap_scan_tree(): fixed a bug that didn't set the
index ff61b1b..ee4a4a8 100644 (file)
@@ -1,3 +1,7 @@
+2001-07-01 [paul]
+
+       * sync with sylpheed 0.5.0pre3 release
+
 2001-06-30 [alfons]
 
        * src/filesel.[ch]
index 27bcee5..074e47e 100644 (file)
@@ -1,3 +1,28 @@
+2001-07-01
+
+       * version 0.5.0pre3
+
+       * src/folderview.[ch]: folderview_set_all(): ¿·µ¬¡£
+       * src/account.c: account_add(): IMAP4 ¥Ä¥ê¡¼¤òºîÀ®¤·¤¿¸å
+         folderview_set_all() ¤ò¸Æ¤Ö¤è¤¦¤Ë¤·¤¿¡£
+         account_edit_create(): ¥ê¥¹¥È¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ¥¢¥«¥¦¥ó¥È¤ÎÀßÄê
+         ¥À¥¤¥¢¥í¥°¤ò³«¤±¤ë¤è¤¦¤Ë¤·¤¿¡£
+         account_selected(): ¿·µ¬¡£
+         account_clist_set(): CList ¤Î¥Õ¥©¡¼¥«¥¹¤òÀµ¤·¤¯¥»¥Ã¥È¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+2001-06-30
+
+       * src/imap.c: imap_scan_tree(): trash ¤¬¸«¤Ä¤«¤é¤Ê¤±¤ì¤Ð
+         imap_create_tree() ¤ò¸Æ¤Ö¤è¤¦¤Ë¤·¤¿¡£
+         imap_scan_tree_recursive(): INBOX ¤Î¥µ¥Ö¥Õ¥©¥ë¥À¤òõ¤¹¤è¤¦¤Ë¤·¤¿¡£
+         Trash ¥Õ¥©¥ë¥À¤òǧ¼±¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+         imap_create_tree(): trash ¤òºîÀ®¤¹¤ëÉôʬ¤òʬ³ä¤·¤¿¡£
+         imap_create_trash(): ¿·µ¬¡£
+       * src/folder.c: folder_build_tree(), folder_write_list_recursive():
+         no_sub ¤È no_select ¤òÊݸ¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/summaryview.c: summary_show(): item->no_select ¤¬¿¿¤Î¾ì¹ç
+         Â³¹Ô¤·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+
 2001-06-29
 
        * src/imap.c: imap_scan_tree(): ¥ë¡¼¥È¥Õ¥©¥ë¥À¤òÀµ¤·¤¯¥»¥Ã¥È¤·¤Æ
index bca28dd..1c74f31 100644 (file)
@@ -80,6 +80,11 @@ static void account_edit_close               (void);
 static gint account_delete_event       (GtkWidget      *widget,
                                         GdkEventAny    *event,
                                         gpointer        data);
+static void account_selected           (GtkCList       *clist,
+                                        gint            row,
+                                        gint            column,
+                                        GdkEvent       *event,
+                                        gpointer        data);
 static void account_key_pressed                (GtkWidget      *widget,
                                         GdkEventKey    *event,
                                         gpointer        data);
@@ -280,9 +285,10 @@ void account_add(void)
                folder->account = ac_prefs;
                ac_prefs->folder = REMOTE_FOLDER(folder);
                folder_add(folder);
-               if (ac_prefs->protocol == A_IMAP4)
+               if (ac_prefs->protocol == A_IMAP4) {
                        folder->create_tree(folder);
-               folderview_update_all();
+                       folderview_set_all();
+               }
        }
 }
 
@@ -436,6 +442,9 @@ static void account_edit_create(void)
                GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(clist)->column[i].button,
                                       GTK_CAN_FOCUS);
 
+       gtk_signal_connect (GTK_OBJECT (clist), "select_row",
+                           GTK_SIGNAL_FUNC (account_selected), NULL);
+
        vbox2 = gtk_vbox_new (FALSE, 0);
        gtk_widget_show (vbox2);
        gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
@@ -625,6 +634,13 @@ static gint account_delete_event(GtkWidget *widget, GdkEventAny *event,
        return TRUE;
 }
 
+static void account_selected(GtkCList *clist, gint row, gint column,
+                            GdkEvent *event, gpointer data)
+{
+       if (event && event->type == GDK_2BUTTON_PRESS)
+               account_edit_prefs();
+}
+
 static void account_key_pressed(GtkWidget *widget, GdkEventKey *event,
                                gpointer data)
 {
@@ -681,12 +697,16 @@ static void account_clist_set(void)
                gint row;
 
                row = account_clist_set_row((PrefsAccount *)cur->data, -1);
-               if ((PrefsAccount *)cur->data == cur_account)
+               if ((PrefsAccount *)cur->data == cur_account) {
                        gtk_clist_select_row(clist, row, -1);
+                       gtkut_clist_set_focus_row(clist, row);
+               }
        }
 
-       if (prev_row >= 0)
+       if (prev_row >= 0) {
                gtk_clist_select_row(clist, prev_row, -1);
+               gtkut_clist_set_focus_row(clist, prev_row);
+       }
 
        gtk_clist_thaw(clist);
 }
index 161e67a..b193407 100644 (file)
@@ -196,6 +196,15 @@ void folder_item_remove(FolderItem *item)
        g_node_destroy(node);
 }
 
+void folder_item_destroy(FolderItem *item)
+{
+       g_return_if_fail(item != NULL);
+
+       g_free(item->name);
+       g_free(item->path);
+       g_free(item);
+}
+
 void folder_set_ui_func(Folder *folder, FolderUIFunc func, gpointer data)
 {
        g_return_if_fail(folder != NULL);
@@ -1041,6 +1050,7 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
        const gchar *name = NULL;
        const gchar *path = NULL;
        PrefsAccount *account = NULL;
+       gboolean no_sub = FALSE, no_select = FALSE;
        gint mtime = 0, new = 0, unread = 0, total = 0;
 
        g_return_val_if_fail(node->data != NULL, FALSE);
@@ -1078,8 +1088,7 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
                        account = account_find_from_id(atoi(attr->value));
                        if (!account) g_warning("account_id: %s not found\n",
                                                attr->value);
-               }
-               else if (!strcmp(attr->name, "mtime"))
+               } else if (!strcmp(attr->name, "mtime"))
                        mtime = atoi(attr->value);
                else if (!strcmp(attr->name, "new"))
                        new = atoi(attr->value);
@@ -1087,6 +1096,10 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
                        unread = atoi(attr->value);
                else if (!strcmp(attr->name, "total"))
                        total = atoi(attr->value);
+               else if (!strcmp(attr->name, "no_sub"))
+                       no_sub = *attr->value == '1' ? TRUE : FALSE;
+               else if (!strcmp(attr->name, "no_select"))
+                       no_select = *attr->value == '1' ? TRUE : FALSE;
        }
 
        item = folder_item_new(name, path);
@@ -1096,6 +1109,8 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
        item->new = new;
        item->unread = unread;
        item->total = total;
+       item->no_sub = no_sub;
+       item->no_select = no_select;
        item->parent = FOLDER_ITEM(node->parent->data);
        item->folder = folder;
        switch (stype) {
@@ -1236,8 +1251,12 @@ static void folder_write_list_recursive(GNode *node, gpointer data)
                        fputs("\"", fp);
                }
                if (item->account)
-                       fprintf(fp, " account_id = \"%d\"",
+                       fprintf(fp, " account_id=\"%d\"",
                                item->account->account_id);
+               if (item->no_sub)
+                       fputs(" no_sub=\"1\"", fp);
+               if (item->no_select)
+                       fputs(" no_select=\"1\"", fp);
                fprintf(fp,
                        " mtime=\"%ld\" new=\"%d\" unread=\"%d\" total=\"%d\"",
                        item->mtime, item->new, item->unread, item->total);
index 688b3ae..306d33e 100644 (file)
@@ -241,6 +241,7 @@ FolderItem *folder_item_new (const gchar    *name,
 void        folder_item_append (FolderItem     *parent,
                                 FolderItem     *item);
 void        folder_item_remove (FolderItem     *item);
+void        folder_item_destroy        (FolderItem     *item);
 void        folder_set_ui_func (Folder         *folder,
                                 FolderUIFunc    func,
                                 gpointer        data);
index 70cc6ca..34a029c 100644 (file)
@@ -312,7 +312,7 @@ FolderView *folderview_create(void)
        gtk_ctree_set_expander_style(GTK_CTREE(ctree),
                                     GTK_CTREE_EXPANDER_SQUARE);
        gtk_ctree_set_indent(GTK_CTREE(ctree), CTREE_INDENT);
-       
+
        /* don't let title buttons take key focus */
        for (i = 0; i < N_FOLDER_COLS; i++)
                GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(ctree)->column[i].button,
@@ -456,6 +456,14 @@ void folderview_set(FolderView *folderview)
        STATUSBAR_POP(mainwin);
 }
 
+void folderview_set_all(void)
+{
+       GList *list;
+
+       for (list = folderview_list; list != NULL; list = list->next)
+               folderview_set((FolderView *)list->data);
+}
+
 void folderview_select(FolderView *folderview, FolderItem *item)
 {
        GtkCTree *ctree = GTK_CTREE(folderview->ctree);
@@ -628,7 +636,6 @@ static GtkWidget *label_window_create(const gchar *str)
 
 void folderview_update_tree(Folder *folder)
 {
-       GList *list;
        GtkWidget *window;
 
        g_return_if_fail(folder != NULL);
@@ -642,12 +649,7 @@ void folderview_update_tree(Folder *folder)
        folder_set_ui_func(folder, NULL, NULL);
 
        folder_write_list();
-
-       for (list = folderview_list; list != NULL; list = list->next) {
-               FolderView *folderview = (FolderView *)list->data;
-
-               folderview_set(folderview);
-       }
+       folderview_set_all();
 
        gtk_widget_destroy(window);
 }
@@ -670,12 +672,7 @@ void folderview_update_all(void)
        }
 
        folder_write_list();
-
-       for (list = folderview_list; list != NULL; list = list->next) {
-               FolderView *folderview = (FolderView *)list->data;
-
-               folderview_set(folderview);
-       }
+       folderview_set_all();
 
        gtk_widget_destroy(window);
 }
index 9db0ba4..52fdad9 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-2001 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
@@ -60,7 +60,7 @@ struct _FolderView
 FolderView *folderview_create          (void);
 void folderview_init                   (FolderView     *folderview);
 void folderview_set                    (FolderView     *folderview);
-void folderview_set_imap_account       (FolderView     *folderview);
+void folderview_set_all                        (void);
 void folderview_select                 (FolderView     *folderview,
                                         FolderItem     *item);
 void folderview_unselect               (FolderView     *folderview);
index 416df1e..4108bab 100644 (file)
@@ -57,6 +57,7 @@ static void imap_scan_tree_recursive  (IMAPSession    *session,
                                         IMAPNameSpace  *namespace);
 static GSList *imap_parse_list         (IMAPSession    *session,
                                         const gchar    *path);
+static gint imap_create_trash          (Folder         *folder);
 
 static gint imap_do_copy               (Folder         *folder,
                                         FolderItem     *dest,
@@ -717,12 +718,16 @@ void imap_scan_tree(Folder *folder)
        folder->node = g_node_new(item);
        g_free(root_folder);
 
-       inbox = folder_item_new("INBOX", "INBOX");
-       inbox->stype = F_INBOX;
-       folder_item_append(item, inbox);
-       folder->inbox = inbox;
-
        imap_scan_tree_recursive(session, item, namespace);
+
+       if (!folder->inbox) {
+               inbox = folder_item_new("INBOX", "INBOX");
+               inbox->stype = F_INBOX;
+               folder_item_append(item, inbox);
+               folder->inbox = inbox;
+       }
+       if (!folder->trash)
+               imap_create_trash(folder);
 }
 
 static void imap_scan_tree_recursive(IMAPSession *session,
@@ -763,6 +768,20 @@ static void imap_scan_tree_recursive(IMAPSession *session,
        item_list = imap_parse_list(session, real_path);
        for (cur = item_list; cur != NULL; cur = cur->next) {
                new_item = cur->data;
+               if (!strcmp(new_item->path, "INBOX")) {
+                       if (!item->folder->inbox) {
+                               new_item->stype = F_INBOX;
+                               item->folder->inbox = new_item;
+                       } else {
+                               folder_item_destroy(new_item);
+                               continue;
+                       }
+               } else if (!item->parent && !item->folder->trash) {
+                       if (!strcasecmp(g_basename(new_item->path), "Trash")) {
+                               new_item->stype = F_TRASH;
+                               item->folder->trash = new_item;
+                       }
+               }
                folder_item_append(item, new_item);
                if (new_item->no_sub == FALSE)
                        imap_scan_tree_recursive(session, new_item, namespace);
@@ -823,7 +842,6 @@ static GSList *imap_parse_list(IMAPSession *session, const gchar *path)
                strtailchomp(buf, separator[0]);
                if (buf[0] == '\0') continue;
                if (!strcmp(buf, path)) continue;
-               if (!strcmp(buf, "INBOX")) continue;
 
                if (separator[0] != '\0')
                        subst_char(buf, separator[0], '/');
@@ -849,25 +867,43 @@ static GSList *imap_parse_list(IMAPSession *session, const gchar *path)
 
 gint imap_create_tree(Folder *folder)
 {
-       IMAPFolder *imapfolder = IMAP_FOLDER(folder);
        FolderItem *item;
-       FolderItem *new_item;
-       gchar *trash_path;
-       gchar *imap_dir = "";
 
        g_return_val_if_fail(folder != NULL, -1);
        g_return_val_if_fail(folder->node != NULL, -1);
        g_return_val_if_fail(folder->node->data != NULL, -1);
        g_return_val_if_fail(folder->account != NULL, -1);
 
-       imap_session_get(folder);
+       imap_scan_tree(folder);
 
        item = FOLDER_ITEM(folder->node->data);
 
-       new_item = folder_item_new("INBOX", "INBOX");
-       new_item->stype = F_INBOX;
-       folder_item_append(item, new_item);
-       folder->inbox = new_item;
+       if (!folder->inbox) {
+               FolderItem *inbox;
+
+               inbox = folder_item_new("INBOX", "INBOX");
+               inbox->stype = F_INBOX;
+               folder_item_append(item, inbox);
+               folder->inbox = inbox;
+       }
+       if (!folder->trash)
+               imap_create_trash(folder);
+
+       return 0;
+}
+
+static gint imap_create_trash(Folder *folder)
+{
+       IMAPFolder *imapfolder = IMAP_FOLDER(folder);
+       FolderItem *item;
+       FolderItem *new_item;
+       gchar *trash_path;
+       gchar *imap_dir = "";
+
+       g_return_val_if_fail(folder != NULL, -1);
+       g_return_val_if_fail(folder->node != NULL, -1);
+       g_return_val_if_fail(folder->node->data != NULL, -1);
+       g_return_val_if_fail(folder->account != NULL, -1);
 
        if (folder->account->imap_dir && *folder->account->imap_dir) {
                gchar *tmpdir;
@@ -887,12 +923,13 @@ gint imap_create_tree(Folder *folder)
 
                        Xstrdup_a(name, namespace->name, return -1);
                        subst_char(name, namespace->separator, '/');
-                       trash_path = g_strconcat(name, imap_dir, "trash", NULL);
+                       trash_path = g_strconcat(name, imap_dir, "Trash", NULL);
                } else
-                       trash_path = g_strconcat(imap_dir, "trash", NULL);
+                       trash_path = g_strconcat(imap_dir, "Trash", NULL);
        } else
-               trash_path = g_strconcat(imap_dir, "trash", NULL);
+               trash_path = g_strconcat(imap_dir, "Trash", NULL);
 
+       item = FOLDER_ITEM(folder->node->data);
        new_item = imap_create_folder(folder, item, trash_path);
 
        if (!new_item) {
@@ -913,6 +950,7 @@ gint imap_create_tree(Folder *folder)
        folder->trash = new_item;
 
        g_free(trash_path);
+
        return 0;
 }
 
index 62d714c..132d285 100644 (file)
@@ -687,7 +687,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
        messageview_clear(summaryview->messageview);
 
        buf = NULL;
-       if (!item || !item->path || !item->parent ||
+       if (!item || !item->path || !item->parent || item->no_select ||
            (item->folder->type == F_MH &&
             ((buf = folder_item_get_path(item)) == NULL ||
              change_dir(buf) < 0))) {
@@ -936,9 +936,8 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
        menu_set_sensitive(ifactory, "/Reply",                    sens);
        menu_set_sensitive(ifactory, "/Reply to sender",          sens);
        menu_set_sensitive(ifactory, "/Reply to all",             sens);
-       
-       menu_set_sensitive(ifactory, "/Forward",                                TRUE);
-       menu_set_sensitive(ifactory, "/Forward as attachment",  TRUE);
+       menu_set_sensitive(ifactory, "/Forward",                  TRUE);
+       menu_set_sensitive(ifactory, "/Forward as attachment",    TRUE);
        
        menu_set_sensitive(ifactory, "/Open in new window", sens);
        menu_set_sensitive(ifactory, "/View source", sens);
@@ -956,8 +955,8 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
        menu_set_sensitive(ifactory, "/Mark/Mark",   TRUE);
        menu_set_sensitive(ifactory, "/Mark/Unmark", TRUE);
 
-       menu_set_sensitive(ifactory, "/Mark/Mark as unread",        TRUE);
-       menu_set_sensitive(ifactory, "/Mark/Mark as read",          TRUE);
+       menu_set_sensitive(ifactory, "/Mark/Mark as unread", TRUE);
+       menu_set_sensitive(ifactory, "/Mark/Mark as read",   TRUE);
 
        menu_set_sensitive(ifactory, "/Select all", TRUE);
 
@@ -2162,7 +2161,6 @@ static void summary_mark_row_as_unread(SummaryView *summaryview,
        MSG_UNSET_FLAGS(msginfo->flags, MSG_REPLIED | MSG_FORWARDED);
        if (!MSG_IS_UNREAD(msginfo->flags)) {
                MSG_SET_FLAGS(msginfo->flags, MSG_UNREAD);
-
                gtk_ctree_node_set_pixmap(ctree, row, S_COL_UNREAD,
                                          unreadxpm, unreadxpmmask);
                summaryview->unread++;