2005-01-24 [colin] 1.0.0cvs10
authorColin Leroy <colin@colino.net>
Mon, 24 Jan 2005 08:02:46 +0000 (08:02 +0000)
committerColin Leroy <colin@colino.net>
Mon, 24 Jan 2005 08:02:46 +0000 (08:02 +0000)
* src/folderview.c
Use (+) in collapsed folders with quicksearch-
matching subfolders

ChangeLog.claws
PATCHSETS
configure.ac
src/folderview.c

index 52c95c8..992f9ae 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-24 [colin]     1.0.0cvs10
+
+       * src/folderview.c
+               Use (+) in collapsed folders with quicksearch-
+               matching subfolders
+
 2005-01-23 [holger]    1.0.0cvs9
 
        * src/crash.c
index 741a849..aab309f 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.454 -r 1.455 src/summaryview.c; ) > 1.0.0cvs7.patchset
 ( cvs diff -u -r 1.455 -r 1.456 src/summaryview.c; cvs diff -u -r 1.11 -r 1.12 src/gtk/quicksearch.c; ) > 1.0.0cvs8.patchset
 ( cvs diff -u -r 1.26 -r 1.27 src/crash.c; ) > 1.0.0cvs9.patchset
+( cvs diff -u -r 1.255 -r 1.256 src/folderview.c; ) > 1.0.0cvs10.patchset
index 816bd51..f709b7a 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=9
+EXTRA_VERSION=10
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index 306cc2a..b81e95a 100644 (file)
@@ -984,6 +984,51 @@ static gboolean folderview_have_unread_children(FolderView *folderview,
        return FALSE;
 }
 
+static gboolean folderview_search_matching_recursive(GtkCTree *ctree,
+                                                  GtkCTreeNode *node)
+{
+       FolderItem *item;
+
+       if (node) {
+               item = gtk_ctree_node_get_row_data(ctree, node);
+               if (item) {
+                       if (item->search_match)
+                               return TRUE;
+               }
+               node = GTK_CTREE_ROW(node)->children;
+       } else
+               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+
+       while (node) {
+               if (folderview_search_matching_recursive(ctree, node) == TRUE)
+                       return TRUE;
+               node = GTK_CTREE_ROW(node)->sibling;
+       }
+
+       return FALSE;
+}
+
+static gboolean folderview_have_matching_children(FolderView *folderview,
+                                               GtkCTreeNode *node)
+{
+       GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+
+       if (!node)
+               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+       if (!node)
+               return FALSE;
+
+       node = GTK_CTREE_ROW(node)->children;
+
+       while (node) {
+               if (folderview_search_matching_recursive(ctree, node) == TRUE)
+                       return TRUE;
+               node = GTK_CTREE_ROW(node)->sibling;
+       }
+
+       return FALSE;
+}
+
 static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
 {
        GtkCTree *ctree = GTK_CTREE(folderview->ctree);
@@ -998,6 +1043,7 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
        gchar *name;
        gchar *str;
        gboolean add_unread_mark;
+       gboolean add_sub_match_mark;
        gboolean use_bold, use_color;
 
        item = gtk_ctree_node_get_row_data(ctree, node);
@@ -1077,6 +1123,16 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
        }
        name = folder_item_get_name(item);
 
+       if (!GTK_CTREE_ROW(node)->expanded) {
+               add_unread_mark = folderview_have_unread_children(
+                                       folderview, node);
+               add_sub_match_mark = folderview_have_matching_children(
+                                       folderview, node);
+       } else {
+               add_unread_mark = FALSE;
+               add_sub_match_mark = FALSE;
+       }
+
        if (item->search_match) {
                if (!searchicon) {
                        stock_pixmap_gdk(folderview->ctree, STOCK_PIXMAP_QUICKSEARCH,
@@ -1086,12 +1142,6 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
                mask = openmask = searchmask;
        }
 
-       if (!GTK_CTREE_ROW(node)->expanded &&
-           folderview_have_unread_children(folderview, node))
-               add_unread_mark = TRUE;
-       else
-               add_unread_mark = FALSE;
-
        if (item->stype == F_QUEUE && item->total_msgs > 0 &&
            prefs_common.display_folder_unread) {
                str = g_strdup_printf("%s (%d%s)", name, item->total_msgs,
@@ -1100,12 +1150,13 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
                                        xpm, mask, openxpm, openmask,
                                        FALSE, GTK_CTREE_ROW(node)->expanded);
                g_free(str);
-       } else if ((item->unread_msgs > 0 || add_unread_mark) &&
-                prefs_common.display_folder_unread) {
+       } else if (((item->unread_msgs > 0 || add_unread_mark) &&
+                   prefs_common.display_folder_unread) 
+                  || add_sub_match_mark) {
 
                if (item->unread_msgs > 0)
                        str = g_strdup_printf("%s (%d%s%s)", name, item->unread_msgs,
-                                             add_unread_mark ? "+" : "", 
+                                             add_unread_mark || add_sub_match_mark ? "+" : "", 
                                              item->unreadmarked_msgs > 0 ? "!":"");
                else
                        str = g_strdup_printf("%s (+)", name);