[evolution] Mail: Correct compress thread level indentation



commit 70da868b0696c619fbc587cb7cc9477fd9e6f5e8
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 24 09:41:35 2021 +0100

    Mail: Correct compress thread level indentation
    
    The computed level might not always match expected position
    in the tree with enabled thread-compress option.
    
    Related to https://gitlab.gnome.org/GNOME/evolution/-/issues/550

 src/mail/message-list.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/mail/message-list.c b/src/mail/message-list.c
index d3ca05c051..990c5abbda 100644
--- a/src/mail/message-list.c
+++ b/src/mail/message-list.c
@@ -3443,20 +3443,20 @@ message_list_depth (ETreeModel *tree_model,
 {
        guint depth;
 
-       depth = g_node_depth ((GNode *) path);
+       if (message_list_get_thread_compress (MESSAGE_LIST (tree_model))) {
+               GNode *node = ((GNode *) path);
 
-       if (depth > 1 && message_list_get_thread_compress (MESSAGE_LIST (tree_model))) {
-               GNode *node = ((GNode *) path)->parent;
+               depth = 1;
 
                while (node && !G_NODE_IS_ROOT (node)) {
-                       if (G_NODE_IS_ROOT (node->parent))
-                               break;
-
-                       if (!node->prev && !node->next)
-                               depth--;
+                       if (!node->children || node->prev || node->next || G_NODE_IS_ROOT (node->parent) ||
+                           (node->parent && (node->parent->prev || node->parent->next || G_NODE_IS_ROOT 
(node->parent->parent))))
+                               depth++;
 
                        node = node->parent;
                }
+       } else {
+               depth = g_node_depth ((GNode *) path);
        }
 
        return depth;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]