From: Richard Russon Date: Thu, 4 Jul 2019 16:14:06 +0000 (+0100) Subject: sidebar: pass in Mailbox X-Git-Tag: 2019-10-25~148^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e2344bbb191a4840b1e1856931e1e9434d7d72a;p=neomutt sidebar: pass in Mailbox --- diff --git a/index.c b/index.c index 4ca0820eb..c084ff9b2 100644 --- 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 4d19cc13a..7dad20f6b 100644 --- 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); diff --git a/sidebar.c b/sidebar.c index c2f683d31..0f5caed83 100644 --- 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; diff --git a/sidebar.h b/sidebar.h index 79ae7f733..2a7242d5e 100644 --- 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 */