NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
functions.c File Reference

Sidebar functions. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.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
  • Pietro Cerutti
  • 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 47 of file functions.c.

48{
49 struct SbEntry **sbep = NULL;
50 ARRAY_FOREACH_FROM(sbep, &wdata->entries, wdata->hil_index + 1)
51 {
52 if (!(*sbep)->is_hidden)
53 {
54 wdata->hil_index = ARRAY_FOREACH_IDX;
55 return true;
56 }
57 }
58
59 return false;
60}
#define ARRAY_FOREACH_FROM(elem, head, from)
Iterate from an index to the end.
Definition: array.h:223
Info about folders in the sidebar.
Definition: private.h:41
int hil_index
Highlighted mailbox.
Definition: private.h:95
struct SbEntryArray entries
Items to display in the sidebar.
Definition: private.h:91
+ 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 70 of file functions.c.

71{
72 struct SbEntry **sbep = NULL;
73 ARRAY_FOREACH_FROM_TO(sbep, &wdata->entries, begin, end)
74 {
75 if ((*sbep)->mailbox->has_new || ((*sbep)->mailbox->msg_unread != 0))
76 return sbep;
77 }
78 return NULL;
79}
#define ARRAY_FOREACH_FROM_TO(elem, head, from, to)
Iterate between two indexes.
Definition: array.h:247
+ 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 86 of file functions.c.

87{
88 struct SbEntry **sbep = NULL, **prev = NULL;
89 ARRAY_FOREACH_TO(sbep, &wdata->entries, wdata->hil_index)
90 {
91 if (!(*sbep)->is_hidden)
92 prev = sbep;
93 }
94
95 if (prev)
96 {
97 wdata->hil_index = ARRAY_IDX(&wdata->entries, prev);
98 return true;
99 }
100
101 return false;
102}
#define ARRAY_IDX(head, elem)
Return the index of an element of the array.
Definition: array.h:259
#define ARRAY_FOREACH_TO(elem, head, to)
Iterate from the beginning to an index.
Definition: array.h:234
+ 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 112 of file functions.c.

113{
114 struct SbEntry **sbep = NULL, **prev = NULL;
115 ARRAY_FOREACH_FROM_TO(sbep, &wdata->entries, begin, end)
116 {
117 if ((*sbep)->mailbox->has_new || ((*sbep)->mailbox->msg_unread != 0))
118 prev = sbep;
119 }
120
121 return prev;
122}
+ 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:263
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:237
static int op_sidebar_toggle_virtual(struct SidebarWindowData *wdata, int op)
Deprecated - Implements sidebar_function_t -.
Definition: functions.c:345
static int op_sidebar_next_new(struct SidebarWindowData *wdata, int op)
Selects the next new mailbox - Implements sidebar_function_t -.
Definition: functions.c:198
static int op_sidebar_next(struct SidebarWindowData *wdata, int op)
Selects the next unhidden mailbox - Implements sidebar_function_t -.
Definition: functions.c:178
static int op_sidebar_toggle_visible(struct SidebarWindowData *wdata, int op)
Make the sidebar (in)visible - Implements sidebar_function_t -.
Definition: functions.c:335
static int op_sidebar_prev(struct SidebarWindowData *wdata, int op)
Selects the previous unhidden mailbox - Implements sidebar_function_t -.
Definition: functions.c:289
static int op_sidebar_prev_new(struct SidebarWindowData *wdata, int op)
Selects the previous new mailbox - Implements sidebar_function_t -.
Definition: functions.c:309
static int op_sidebar_first(struct SidebarWindowData *wdata, int op)
Selects the first unhidden mailbox - Implements sidebar_function_t -.
Definition: functions.c:129
static int op_sidebar_open(struct SidebarWindowData *wdata, int op)
Open highlighted mailbox - Implements sidebar_function_t -.
Definition: functions.c:223
static int op_sidebar_last(struct SidebarWindowData *wdata, int op)
Selects the last unhidden mailbox - Implements sidebar_function_t -.
Definition: functions.c:154

All the NeoMutt functions that the Sidebar supports.

Definition at line 355 of file functions.c.