]> granicus.if.org Git - neomutt/commitdiff
sidebar: unify virtual-mailboxes
authorAustin Ray <austin@austinray.io>
Thu, 1 Nov 2018 22:30:33 +0000 (18:30 -0400)
committerRichard Russon <rich@flatcap.org>
Sun, 4 Nov 2018 01:02:14 +0000 (01:02 +0000)
Removed all notmuch specific code from `sidebar.c` This allows for
virtual-mailboxes to appear alongside every other mailbox, and reduces
coupling in sidebar.

In order to facilitate this, the command sidebar-virtual-toggle was
removed as it is no longer necessary. Some users may have utilized this
method so an alternative should be considered.

curs_lib.c
curs_main.c
init.c
sidebar.c
sidebar.h

index e8c4b3a8457c7f38c942f30f3bc656a3a37dad67..602901b16156be6a74d4c32ceca4ce876ec98701 100644 (file)
@@ -59,9 +59,6 @@
 #ifdef HAVE_ISWBLANK
 #include <wctype.h>
 #endif
-#ifdef USE_NOTMUCH
-#include "notmuch/mutt_notmuch.h"
-#endif
 #ifdef USE_INOTIFY
 #include "monitor.h"
 #endif
index 1d05b085d2750d12c8ddcd9c385ddc548c0a9dab..6f5f5d43428f7cfc76d33b1a302cbb828200fa2a 100644 (file)
@@ -3469,10 +3469,6 @@ int mutt_index_menu(void)
         bool_str_toggle(Config, "sidebar_visible", NULL);
         mutt_window_reflow();
         break;
-
-      case OP_SIDEBAR_TOGGLE_VIRTUAL:
-        mutt_sb_toggle_virtual();
-        break;
 #endif
       default:
         if (menu->menu == MENU_MAIN)
diff --git a/init.c b/init.c
index 59d5e373991e4c31dfa0a9eac74d301dd5942c70..049bdbb3f4271cbe2114ae4dbe37b2f24d4c6f47 100644 (file)
--- a/init.c
+++ b/init.c
@@ -3088,7 +3088,6 @@ int mutt_init(bool skip_sys_rc, struct ListHead *commands)
       if (mp->m->magic == MUTT_NOTMUCH)
       {
         cs_str_string_set(Config, "spoolfile", mp->m->path, NULL);
-        mutt_sb_toggle_virtual();
         break;
       }
     }
index cc4f15af3ec2197a2c584b5250a533906166b9dd..ba9179060c43d6a48b6f3e76c7957cd0cae59a9f 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -49,9 +49,6 @@
 #include "mx.h"
 #include "opcodes.h"
 #include "sort.h"
-#ifdef USE_NOTMUCH
-#include "notmuch/mutt_notmuch.h"
-#endif
 
 /* These Config Variables are only used in sidebar.c */
 short SidebarComponentDepth; ///< Config: (sidebar) Strip leading path components from sidebar folders
@@ -97,15 +94,6 @@ enum DivType
   SB_DIV_UTF8   /**< A unicode line-drawing character */
 };
 
-/**
- * enum SidebarSrc - Display real or virtual mailboxes in the sidebar
- */
-enum SidebarSrc
-{
-  SB_SRC_INCOMING, /**< Display real mailboxes */
-  SB_SRC_VIRT,     /**< Display virtual mailboxes */
-} sidebar_source = SB_SRC_INCOMING;
-
 /**
  * sidebar_format_str - Format a string for the sidebar - Implements ::format_t
  *
@@ -374,15 +362,6 @@ static void update_entries_visibility(void)
 
     sbe->is_hidden = false;
 
-#ifdef USE_NOTMUCH
-    if (((sbe->mailbox->magic != MUTT_NOTMUCH) && (sidebar_source == SB_SRC_VIRT)) ||
-        ((sbe->mailbox->magic == MUTT_NOTMUCH) && (sidebar_source == SB_SRC_INCOMING)))
-    {
-      sbe->is_hidden = true;
-      continue;
-    }
-#endif
-
     if (!new_only)
       continue;
 
@@ -874,15 +853,8 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width)
     if (Context && (Context->mailbox->realpath[0] != '\0') &&
         (mutt_str_strcmp(m->realpath, Context->mailbox->realpath) == 0))
     {
-#ifdef USE_NOTMUCH
-      if (m->magic == MUTT_NOTMUCH)
-        nm_nonctx_get_count(m);
-      else
-#endif
-      {
-        m->msg_unread = Context->mailbox->msg_unread;
-        m->msg_count = Context->mailbox->msg_count;
-      }
+      m->msg_unread = Context->mailbox->msg_unread;
+      m->msg_count = Context->mailbox->msg_count;
       m->msg_flagged = Context->mailbox->msg_flagged;
     }
 
@@ -1176,37 +1148,3 @@ void mutt_sb_notify_mailbox(struct Mailbox *m, bool created)
   mutt_menu_set_current_redraw(REDRAW_SIDEBAR);
 }
 
-/**
- * mutt_sb_toggle_virtual - Switch between regular and virtual folders
- */
-void mutt_sb_toggle_virtual(void)
-{
-#ifdef USE_NOTMUCH
-  if (sidebar_source == SB_SRC_INCOMING)
-    sidebar_source = SB_SRC_VIRT;
-  else
-#endif
-    sidebar_source = SB_SRC_INCOMING;
-
-  TopIndex = -1;
-  OpnIndex = -1;
-  HilIndex = -1;
-  BotIndex = -1;
-
-  /* First clear all the sidebar entries */
-  EntryCount = 0;
-  FREE(&Entries);
-  EntryLen = 0;
-  struct MailboxNode *np = NULL;
-  STAILQ_FOREACH(np, &AllMailboxes, entries)
-  {
-    /* and reintroduce the ones that are visible */
-    if (((np->m->magic == MUTT_NOTMUCH) && (sidebar_source == SB_SRC_VIRT)) ||
-        ((np->m->magic != MUTT_NOTMUCH) && (sidebar_source == SB_SRC_INCOMING)))
-    {
-      mutt_sb_notify_mailbox(np->m, true);
-    }
-  }
-
-  mutt_menu_set_current_redraw(REDRAW_SIDEBAR);
-}
index 5f8e61d356586083f6189f61d296d69370be16a9..682ea17013f07a10cadf34ce032809e4bce88975 100644 (file)
--- a/sidebar.h
+++ b/sidebar.h
@@ -47,6 +47,5 @@ void mutt_sb_draw(void);
 struct Mailbox *mutt_sb_get_highlight(void);
 void mutt_sb_notify_mailbox(struct Mailbox *m, bool created);
 void mutt_sb_set_open_mailbox(void);
-void mutt_sb_toggle_virtual(void);
 
 #endif /* MUTT_SIDEBAR_H */