Change the blueness in Drafts folders to saving drafts as New. It makes
authorColin Leroy <colin@colino.net>
Fri, 25 Apr 2014 10:24:54 +0000 (12:24 +0200)
committerColin Leroy <colin@colino.net>
Fri, 25 Apr 2014 10:24:54 +0000 (12:24 +0200)
the folder noticed too, but the user can mark the draft as read if he
desires.

src/compose.c
src/folder.c
src/folderview.c
src/plugins/notification/notification_plugin.c

index 31f818e..aff1723 100644 (file)
@@ -9788,9 +9788,11 @@ gboolean compose_draft (gpointer data, guint action)
                goto warn_err;
        }
        
+       flag.perm_flags = MSG_NEW|MSG_UNREAD;
        if (compose->targetinfo) {
                target_locked = MSG_IS_LOCKED(compose->targetinfo->flags);
-               flag.perm_flags = target_locked?MSG_LOCKED:0;
+               if (target_locked) 
+                       flag.perm_flags |= MSG_LOCKED;
        }
        flag.tmp_flags = MSG_DRAFT;
 
@@ -9851,9 +9853,9 @@ warn_err:
        if (newmsginfo) {
                procmsg_msginfo_unset_flags(newmsginfo, ~0, ~0);
                if (target_locked)
-                       procmsg_msginfo_set_flags(newmsginfo, MSG_LOCKED, MSG_DRAFT);
+                       procmsg_msginfo_set_flags(newmsginfo, MSG_NEW|MSG_UNREAD|MSG_LOCKED, MSG_DRAFT);
                else
-                       procmsg_msginfo_set_flags(newmsginfo, 0, MSG_DRAFT);
+                       procmsg_msginfo_set_flags(newmsginfo, MSG_NEW|MSG_UNREAD, MSG_DRAFT);
                if (compose_use_attach(compose) && action != COMPOSE_AUTO_SAVE)
                        procmsg_msginfo_set_flags(newmsginfo, 0,
                                                  MSG_HAS_ATTACHMENT);
index 4c7a045..0cbbfb0 100644 (file)
@@ -2438,7 +2438,6 @@ gint folder_item_scan_full(FolderItem *item, gboolean filtering)
                }
                if ((folder_has_parent_of_type(item, F_OUTBOX) ||
                     folder_has_parent_of_type(item, F_QUEUE)  ||
-                    folder_has_parent_of_type(item, F_DRAFT)  ||
                     folder_has_parent_of_type(item, F_TRASH)) &&
                    (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)))
                        procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0);
index 3745aeb..db210be 100644 (file)
@@ -1262,43 +1262,6 @@ void folderview_check_new_all(void)
        inc_unlock();
 }
 
-static gboolean folderview_have_children_sub(FolderView *folderview,
-                                            FolderItem *item,
-                                            gboolean in_sub)
-{
-       GNode *node = NULL;
-       
-       if (!item || !item->folder || !item->folder->node)
-               return FALSE;
-               
-       node = item->folder->node;
-       
-       node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
-       node = node->children;
-
-       if (in_sub && item->total_msgs > 0) {
-               return TRUE;
-       }
-
-       while (node != NULL) {
-               if (node && node->data) {
-                       FolderItem *next_item = (FolderItem*) node->data;
-                       node = node->next;
-                       if (folderview_have_children_sub(folderview, 
-                                                        next_item, TRUE))
-                               return TRUE;
-               }
-       }
-
-       return FALSE;
-}
-
-static gboolean folderview_have_children(FolderView *folderview,
-                                        FolderItem *item)
-{
-       return folderview_have_children_sub(folderview, item, FALSE);
-}
-
 static gboolean folderview_have_new_children_sub(FolderView *folderview,
                                                 FolderItem *item,
                                                 gboolean in_sub)
@@ -1650,10 +1613,6 @@ static void folderview_update_node(FolderView *folderview, GtkCMCTreeNode *node)
                                break;
                        }
                }
-       } else if (folder_has_parent_of_type(item, F_DRAFT)) {
-               use_bold = use_color = item->total_msgs > 0 ||
-                                      (!GTK_CMCTREE_ROW(node)->expanded &&
-                                       folderview_have_children(folderview, item));
        } else {
                /* if unread messages exist, print with bold font */
                use_bold = (item->unread_msgs > 0|| item->new_msgs > 0) 
index dd99d88..4b5be73 100644 (file)
@@ -155,6 +155,9 @@ static gboolean my_folder_item_update_hook(gpointer source, gpointer data)
 
   g_return_val_if_fail(source != NULL, FALSE);
 
+  if (folder_has_parent_of_type(update_data->item, F_DRAFT))
+      return FALSE;
+
 #if defined(NOTIFICATION_LCDPROC) || defined(NOTIFICATION_TRAYICON) || defined(NOTIFICATION_INDICATOR)
     notification_update_msg_counts(NULL);
 #else