]> granicus.if.org Git - neomutt/commitdiff
sidebar: pass in Mailbox
authorRichard Russon <rich@flatcap.org>
Thu, 4 Jul 2019 16:14:06 +0000 (17:14 +0100)
committerRichard Russon <rich@flatcap.org>
Fri, 5 Jul 2019 11:16:25 +0000 (12:16 +0100)
index.c
main.c
sidebar.c
sidebar.h

diff --git a/index.c b/index.c
index 4ca0820ebe6774389136d5cfa3a04e86dbb389de..c084ff9b261e9076551a6a4434a25e0629e00027 100644 (file)
--- a/index.c
+++ b/index.c
@@ -719,7 +719,7 @@ static int main_change_folder(struct Menu *menu, int op, struct Mailbox *m,
     collapse_all(menu, 0);
 
 #ifdef USE_SIDEBAR
-  mutt_sb_set_open_mailbox();
+  mutt_sb_set_open_mailbox(Context ? Context->mailbox : NULL);
 #endif
 
   mutt_clear_error();
@@ -2306,7 +2306,7 @@ int mutt_index_menu(void)
 #endif
         mutt_buffer_expand_path(folderbuf);
 #ifdef USE_SIDEBAR
-        mutt_sb_set_open_mailbox();
+        mutt_sb_set_open_mailbox(Context ? Context->mailbox : NULL);
 #endif
         goto changefoldercleanup;
 
diff --git a/main.c b/main.c
index 4d19cc13a11b284987b6f0c563a4804134e72fc6..7dad20f6ba7ef1c7394276070f736632a92ee06e 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1224,7 +1224,7 @@ int main(int argc, char *argv[], char *envp[])
     if (Context || !explicit_folder)
     {
 #ifdef USE_SIDEBAR
-      mutt_sb_set_open_mailbox();
+      mutt_sb_set_open_mailbox(Context ? Context->mailbox : NULL);
 #endif
       mutt_index_menu();
       ctx_free(&Context);
index c2f683d313dbb03fc1513ba8521f3c625f93beee..0f5caed83c8ecec6d76ec5c86df66ad61642fc11 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -1070,21 +1070,22 @@ struct Mailbox *mutt_sb_get_highlight(void)
 }
 
 /**
- * mutt_sb_set_open_mailbox - Set the OpnMailbox based on the global Context
+ * mutt_sb_set_open_mailbox - Set the 'open' Mailbox
+ * @param m Mailbox
  *
- * Search through the list of mailboxes.  If a Mailbox has a matching path, set
- * OpnMailbox to it.
+ * Search through the list of mailboxes.
+ * If a Mailbox has a matching path, set OpnMailbox to it.
  */
-void mutt_sb_set_open_mailbox(void)
+void mutt_sb_set_open_mailbox(struct Mailbox *m)
 {
   OpnIndex = -1;
 
-  if (!Context)
+  if (!m)
     return;
 
   for (int entry = 0; entry < EntryCount; entry++)
   {
-    if (mutt_str_strcmp(Entries[entry]->mailbox->realpath, Context->mailbox->realpath) == 0)
+    if (mutt_str_strcmp(Entries[entry]->mailbox->realpath, m->realpath) == 0)
     {
       OpnIndex = entry;
       HilIndex = entry;
index 79ae7f733f551cfdeaab83e76882efd4873a71c5..2a7242d5e18965ecd26c01e9c7bc891ac33773b8 100644 (file)
--- a/sidebar.h
+++ b/sidebar.h
@@ -46,6 +46,6 @@ void mutt_sb_change_mailbox(int op);
 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_set_open_mailbox(struct Mailbox *m);
 
 #endif /* MUTT_SIDEBAR_H */