0.9.4claws71
authorChristoph Hohmann <reboot@gmx.ch>
Mon, 8 Sep 2003 10:33:11 +0000 (10:33 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Mon, 8 Sep 2003 10:33:11 +0000 (10:33 +0000)
* src/compose.c
        replace '\n' and '\r' before removing trailing spaces

* src/folder.[ch]
* src/folderview.c
        add information about new or removed items in folder tree change
        notification and use this in folderview to add and remove only
        the appected items and not refresh the whole tree

ChangeLog.claws
configure.ac
src/compose.c
src/folder.c
src/folder.h
src/folderview.c

index ec4ab23..6dd6672 100644 (file)
@@ -1,4 +1,16 @@
+2003-09-07 [christoph] 0.9.4claws71
+
+       * src/compose.c
+               replace '\n' and '\r' before removing trailing spaces
+
+       * src/folder.[ch]
+       * src/folderview.c
+               add information about new or removed items in folder tree change
+               notification and use this in folderview to add and remove only
+               the appected items and not refresh the whole tree
+
 2003-09-07 [match]     0.9.4claws70
+
        * src/Makefile.am
        * src/addr_compl.c
        * src/addressbook.c
index 68ac385..a4e885c 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=70
+EXTRA_VERSION=71
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index b8d99c5..df9d2f1 100644 (file)
@@ -4396,9 +4396,9 @@ static void compose_convert_header(gchar *dest, gint len, gchar *src,
 
        if (len < 1) return;
 
-       g_strchomp(src);
        subst_char(src, '\n', ' ');
        subst_char(src, '\r', ' ');
+       g_strchomp(src);
 
        conv_encode_header(dest, len, src, header_len, addr_field);
 }
index 3271521..4607c41 100644 (file)
@@ -229,13 +229,16 @@ void folder_item_append(FolderItem *parent, FolderItem *item)
        item->node = g_node_append_data(parent->node, item);
 
        hookdata.folder = item->folder;
-       hookdata.update_flags = FOLDER_TREE_CHANGED;
+       hookdata.update_flags = FOLDER_TREE_CHANGED | FOLDER_NEW_FOLDERITEM;
+       hookdata.item = item;
        hooks_invoke(FOLDER_UPDATE_HOOKLIST, &hookdata);
 }
 
 static gboolean folder_item_remove_func(GNode *node, gpointer data)
 {
        FolderItem *item = FOLDER_ITEM(node->data);
+       FolderUpdateData hookdata;
+       Folder *folder = item->folder;
 
        if (item->cache != NULL) {
                msgcache_destroy(item->cache);
@@ -243,14 +246,18 @@ static gboolean folder_item_remove_func(GNode *node, gpointer data)
        }
 
        folder_item_destroy(item);
+
+       hookdata.folder = folder;
+       hookdata.update_flags = FOLDER_TREE_CHANGED | FOLDER_REMOVE_FOLDERITEM;
+       hookdata.item = item;
+       hooks_invoke(FOLDER_UPDATE_HOOKLIST, &hookdata);
+
        return FALSE;
 }
 
 void folder_item_remove(FolderItem *item)
 {
-       Folder *folder = item->folder;
        GNode *node;
-       FolderUpdateData hookdata;
 
        g_return_if_fail(item != NULL);
        g_return_if_fail(item->folder != NULL);
@@ -264,10 +271,6 @@ void folder_item_remove(FolderItem *item)
        g_node_traverse(node, G_POST_ORDER, G_TRAVERSE_ALL, -1,
                        folder_item_remove_func, NULL);
        g_node_destroy(node);
-
-       hookdata.folder = folder;
-       hookdata.update_flags = FOLDER_TREE_CHANGED;
-       hooks_invoke(FOLDER_UPDATE_HOOKLIST, &hookdata);
 }
 
 void folder_item_remove_children(FolderItem *item)
@@ -486,6 +489,7 @@ void folder_scan_tree(Folder *folder)
 
        hookdata.folder = folder;
        hookdata.update_flags = FOLDER_TREE_CHANGED;
+       hookdata.item = NULL;
        hooks_invoke(FOLDER_UPDATE_HOOKLIST, &hookdata);
 
        g_node_traverse(folder->node, G_POST_ORDER, G_TRAVERSE_ALL, -1, folder_scan_tree_func, pptable);
index 4670ea5..c352228 100644 (file)
@@ -110,11 +110,8 @@ typedef enum
 typedef enum
 {
        FOLDER_TREE_CHANGED = 1 << 0,
-/*
-       maybe enhance with:
-       FOLDER_NEW_FOLDERITEM
-       FOLDER_REMOVE_FOLDERITEM
-*/
+       FOLDER_NEW_FOLDERITEM = 1 << 1,
+       FOLDER_REMOVE_FOLDERITEM = 1 << 2,
 } FolderUpdateFlags;
 
 typedef enum
@@ -332,9 +329,7 @@ struct _FolderUpdateData
 {
        Folder                  *folder;
        FolderUpdateFlags        update_flags;
-/*
-       FolderItem              *item
-*/
+       FolderItem              *item;
 };
 
 struct _FolderItemUpdateData
index e22884f..0423c0a 100644 (file)
@@ -2769,9 +2769,15 @@ gboolean folderview_update_folder(gpointer source, gpointer userdata)
        ctree = folderview->ctree;
        g_return_val_if_fail(ctree != NULL, FALSE);
 
-       if (hookdata->update_flags & FOLDER_TREE_CHANGED) {
+       if (hookdata->update_flags & FOLDER_NEW_FOLDERITEM)
+               folderview_create_folder_node(folderview, hookdata->item);
+       else if (hookdata->update_flags & FOLDER_REMOVE_FOLDERITEM) {
+               GtkCTreeNode *node;
+
+               node = gtk_ctree_find_by_row_data(GTK_CTREE(ctree), NULL, hookdata->item);
+               gtk_ctree_remove_node(GTK_CTREE(ctree), node);
+       } else if (hookdata->update_flags & FOLDER_TREE_CHANGED)
                folderview_set(folderview);
-       }
 
        return FALSE;
 }