NeoMutt  2021-10-22-8-g9cb437
Teaching an old dog new tricks
DOXYGEN
status.c File Reference

GUI display a user-configurable status line. More...

#include "config.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "status.h"
#include "index/lib.h"
#include "menu/lib.h"
#include "context.h"
#include "format_flags.h"
#include "mutt_globals.h"
#include "mutt_mailbox.h"
#include "mutt_thread.h"
#include "muttlib.h"
#include "options.h"
#include "protos.h"
+ Include dependency graph for status.c:

Go to the source code of this file.

Data Structures

struct  MenuStatusLineData
 Data for creating a Menu line. More...
 

Functions

static char * get_sort_str (char *buf, size_t buflen, enum SortType method)
 Get the sort method as a string. More...
 
static const char * status_format_str (char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
 Create the status bar string - Implements format_t -. More...
 
void menu_status_line (char *buf, size_t buflen, struct IndexSharedData *shared, struct Menu *menu, int cols, const char *fmt)
 Create the status line. More...
 

Detailed Description

GUI display a user-configurable status line.

Authors
  • Michael R. Elkins

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 status.c.

Function Documentation

◆ get_sort_str()

static char* get_sort_str ( char *  buf,
size_t  buflen,
enum SortType  method 
)
static

Get the sort method as a string.

Parameters
bufBuffer for the sort string
buflenLength of the buffer
methodSort method, see SortType
Return values
ptrBuffer pointer

Definition at line 56 of file status.c.

57 {
58  snprintf(buf, buflen, "%s%s%s", (method & SORT_REVERSE) ? "reverse-" : "",
59  (method & SORT_LAST) ? "last-" : "",
61  return buf;
62 }
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition: mapping.c:42
const struct Mapping SortMethods[]
Sort methods for '$sort' for the index.
Definition: mutt_config.c:76
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:78
#define SORT_LAST
Sort thread by last-X, e.g. received date.
Definition: sort2.h:80
#define SORT_REVERSE
Reverse the order of the sort.
Definition: sort2.h:79
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_status_line()

void menu_status_line ( char *  buf,
size_t  buflen,
struct IndexSharedData shared,
struct Menu menu,
int  cols,
const char *  fmt 
)

Create the status line.

Parameters
[out]bufBuffer in which to save string
[in]buflenBuffer length
[in]sharedShared Index data
[in]menuCurrent menu
[in]colsMaximum number of columns to use
[in]fmtFormat string

Definition at line 445 of file status.c.

447 {
448  struct MenuStatusLineData data = { shared, menu };
449 
450  mutt_expando_format(buf, buflen, 0, cols, fmt, status_format_str,
451  (intptr_t) &data, MUTT_FORMAT_NO_FLAGS);
452 }
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
Definition: format_flags.h:30
static const char * status_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
Create the status bar string - Implements format_t -.
Definition: status.c:102
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t callback, intptr_t data, MuttFormatFlags flags)
Expand expandos (x) in a string -.
Definition: muttlib.c:780
Data for creating a Menu line.
Definition: status.c:68
struct IndexSharedData * shared
Data shared between Index, Pager and Sidebar.
Definition: status.c:69
struct Menu * menu
Current Menu.
Definition: status.c:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function: