NeoMutt  2023-11-03-107-g582dc1
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
functions.c File Reference

Sidebar functions. More...

#include "config.h"
#include <stddef.h>
#include <stdbool.h>
#include "private.h"
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "functions.h"
#include "lib.h"
#include "index/lib.h"
+ Include dependency graph for functions.c:

Go to the source code of this file.

Functions

bool sb_next (struct SidebarWindowData *wdata)
 Find the next unhidden Mailbox.
 
static struct SbEntry ** sb_next_new (struct SidebarWindowData *wdata, size_t begin, size_t end)
 Return the next mailbox with new messages.
 
bool sb_prev (struct SidebarWindowData *wdata)
 Find the previous unhidden Mailbox.
 
static struct SbEntry ** sb_prev_new (struct SidebarWindowData *wdata, size_t begin, size_t end)
 Return the previous mailbox with new messages.
 
static int op_sidebar_first (struct SidebarWindowData *wdata, int op)
 Selects the first unhidden mailbox - Implements sidebar_function_t -.
 
static int op_sidebar_last (struct SidebarWindowData *wdata, int op)
 Selects the last unhidden mailbox - Implements sidebar_function_t -.
 
static int op_sidebar_next (struct SidebarWindowData *wdata, int op)
 Selects the next unhidden mailbox - Implements sidebar_function_t -.
 
static int op_sidebar_next_new (struct SidebarWindowData *wdata, int op)
 Selects the next new mailbox - Implements sidebar_function_t -.
 
static int op_sidebar_open (struct SidebarWindowData *wdata, int op)
 Open highlighted mailbox - Implements sidebar_function_t -.
 
static int op_sidebar_page_down (struct SidebarWindowData *wdata, int op)
 Selects the first entry in the next page of mailboxes - Implements sidebar_function_t -.
 
static int op_sidebar_page_up (struct SidebarWindowData *wdata, int op)
 Selects the last entry in the previous page of mailboxes - Implements sidebar_function_t -.
 
static int op_sidebar_prev (struct SidebarWindowData *wdata, int op)
 Selects the previous unhidden mailbox - Implements sidebar_function_t -.
 
static int op_sidebar_prev_new (struct SidebarWindowData *wdata, int op)
 Selects the previous new mailbox - Implements sidebar_function_t -.
 
static int op_sidebar_toggle_visible (struct SidebarWindowData *wdata, int op)
 Make the sidebar (in)visible - Implements sidebar_function_t -.
 
static int op_sidebar_toggle_virtual (struct SidebarWindowData *wdata, int op)
 Deprecated - Implements sidebar_function_t -.
 
int sb_function_dispatcher (struct MuttWindow *win, int op)
 Perform a Sidebar function - Implements function_dispatcher_t -.
 

Variables

static const struct SidebarFunction SidebarFunctions []
 All the NeoMutt functions that the Sidebar supports.
 

Detailed Description

Sidebar functions.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file functions.c.

Function Documentation

◆ sb_next()

bool sb_next ( struct SidebarWindowData wdata)

Find the next unhidden Mailbox.

Parameters
wdataSidebar data
Return values
trueMailbox found

Definition at line 46 of file functions.c.

47{
48 struct SbEntry **sbep = NULL;
49 ARRAY_FOREACH_FROM(sbep, &wdata->entries, wdata->hil_index + 1)
50 {
51 if (!(*sbep)->is_hidden)
52 {
53 wdata->hil_index = ARRAY_FOREACH_IDX;
54 return true;
55 }
56 }
57
58 return false;
59}
#define ARRAY_FOREACH_FROM(elem, head, from)
Iterate from an index to the end.
Definition: array.h:222
Info about folders in the sidebar.
Definition: private.h:41
int hil_index
Highlighted mailbox.
Definition: private.h:71
struct SbEntryArray entries
Items to display in the sidebar.
Definition: private.h:67
+ Here is the caller graph for this function:

◆ sb_next_new()

static struct SbEntry ** sb_next_new ( struct SidebarWindowData wdata,
size_t  begin,
size_t  end 
)
static

Return the next mailbox with new messages.

Parameters
wdataSidebar data
beginStarting index for searching
endEnding index for searching
Return values
ptrPointer to the first entry with new messages
NULLNone could be found

Definition at line 69 of file functions.c.

70{
71 struct SbEntry **sbep = NULL;
72 ARRAY_FOREACH_FROM_TO(sbep, &wdata->entries, begin, end)
73 {
74 if ((*sbep)->mailbox->has_new || ((*sbep)->mailbox->msg_unread != 0))
75 return sbep;
76 }
77 return NULL;
78}
#define ARRAY_FOREACH_FROM_TO(elem, head, from, to)
Iterate between two indexes.
Definition: array.h:246
+ Here is the caller graph for this function:

◆ sb_prev()

bool sb_prev ( struct SidebarWindowData wdata)

Find the previous unhidden Mailbox.

Parameters
wdataSidebar data
Return values
trueMailbox found

Definition at line 85 of file functions.c.

86{
87 struct SbEntry **sbep = NULL, **prev = NULL;
88 ARRAY_FOREACH_TO(sbep, &wdata->entries, wdata->hil_index)
89 {
90 if (!(*sbep)->is_hidden)
91 prev = sbep;
92 }
93
94 if (prev)
95 {
96 wdata->hil_index = ARRAY_IDX(&wdata->entries, prev);
97 return true;
98 }
99
100 return false;
101}
#define ARRAY_IDX(head, elem)
Return the index of an element of the array.
Definition: array.h:258
#define ARRAY_FOREACH_TO(elem, head, to)
Iterate from the beginning to an index.
Definition: array.h:233
+ Here is the caller graph for this function:

◆ sb_prev_new()

static struct SbEntry ** sb_prev_new ( struct SidebarWindowData wdata,
size_t  begin,
size_t  end 
)
static

Return the previous mailbox with new messages.

Parameters
wdataSidebar data
beginStarting index for searching
endEnding index for searching
Return values
ptrPointer to the first entry with new messages
NULLNone could be found

Definition at line 111 of file functions.c.

112{
113 struct SbEntry **sbep = NULL, **prev = NULL;
114 ARRAY_FOREACH_FROM_TO(sbep, &wdata->entries, begin, end)
115 {
116 if ((*sbep)->mailbox->has_new || ((*sbep)->mailbox->msg_unread != 0))
117 prev = sbep;
118 }
119
120 return prev;
121}
+ Here is the caller graph for this function:

Variable Documentation

◆ SidebarFunctions

const struct SidebarFunction SidebarFunctions[]
static
Initial value:
= {
{ OP_SIDEBAR_FIRST, op_sidebar_first },
{ OP_SIDEBAR_LAST, op_sidebar_last },
{ OP_SIDEBAR_NEXT, op_sidebar_next },
{ OP_SIDEBAR_NEXT_NEW, op_sidebar_next_new },
{ OP_SIDEBAR_OPEN, op_sidebar_open },
{ OP_SIDEBAR_PAGE_DOWN, op_sidebar_page_down },
{ OP_SIDEBAR_PAGE_UP, op_sidebar_page_up },
{ OP_SIDEBAR_PREV, op_sidebar_prev },
{ OP_SIDEBAR_PREV_NEW, op_sidebar_prev_new },
{ OP_SIDEBAR_TOGGLE_VIRTUAL, op_sidebar_toggle_virtual },
{ OP_SIDEBAR_TOGGLE_VISIBLE, op_sidebar_toggle_visible },
{ 0, NULL },
}
static int op_sidebar_page_up(struct SidebarWindowData *wdata, int op)
Selects the last entry in the previous page of mailboxes - Implements sidebar_function_t -.
Definition: functions.c:262
static int op_sidebar_page_down(struct SidebarWindowData *wdata, int op)
Selects the first entry in the next page of mailboxes - Implements sidebar_function_t -.
Definition: functions.c:236
static int op_sidebar_toggle_virtual(struct SidebarWindowData *wdata, int op)
Deprecated - Implements sidebar_function_t -.
Definition: functions.c:344
static int op_sidebar_next_new(struct SidebarWindowData *wdata, int op)
Selects the next new mailbox - Implements sidebar_function_t -.
Definition: functions.c:197
static int op_sidebar_next(struct SidebarWindowData *wdata, int op)
Selects the next unhidden mailbox - Implements sidebar_function_t -.
Definition: functions.c:177
static int op_sidebar_toggle_visible(struct SidebarWindowData *wdata, int op)
Make the sidebar (in)visible - Implements sidebar_function_t -.
Definition: functions.c:334
static int op_sidebar_prev(struct SidebarWindowData *wdata, int op)
Selects the previous unhidden mailbox - Implements sidebar_function_t -.
Definition: functions.c:288
static int op_sidebar_prev_new(struct SidebarWindowData *wdata, int op)
Selects the previous new mailbox - Implements sidebar_function_t -.
Definition: functions.c:308
static int op_sidebar_first(struct SidebarWindowData *wdata, int op)
Selects the first unhidden mailbox - Implements sidebar_function_t -.
Definition: functions.c:128
static int op_sidebar_open(struct SidebarWindowData *wdata, int op)
Open highlighted mailbox - Implements sidebar_function_t -.
Definition: functions.c:222
static int op_sidebar_last(struct SidebarWindowData *wdata, int op)
Selects the last unhidden mailbox - Implements sidebar_function_t -.
Definition: functions.c:153

All the NeoMutt functions that the Sidebar supports.

Definition at line 354 of file functions.c.