NeoMutt  2022-04-29-247-gc6aae8
Teaching an old dog new tricks
DOXYGEN
gui.h File Reference

Shared code for the Alias and Query Dialogs. More...

#include <stdbool.h>
#include "mutt/lib.h"
+ Include dependency graph for gui.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  AliasView
 GUI data wrapping an Alias. More...
 
struct  AliasMenuData
 AliasView array wrapper with Pattern information -. More...
 

Functions

 ARRAY_HEAD (AliasViewArray, struct AliasView)
 
int alias_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
int alias_array_alias_add (struct AliasViewArray *ava, struct Alias *alias)
 Add an Alias to the AliasViewArray. More...
 
int alias_array_alias_delete (struct AliasViewArray *ava, const struct Alias *alias)
 Delete an Alias from the AliasViewArray. More...
 
int alias_array_count_visible (struct AliasViewArray *ava)
 Count number of visible Aliases. More...
 
void alias_set_title (struct MuttWindow *sbar, char *menu_name, char *limit)
 Create a title string for the Menu. More...
 
int alias_recalc (struct MuttWindow *win)
 Recalculate the display of the Alias Window - Implements MuttWindow::recalc() -. More...
 

Detailed Description

Shared code for the Alias and Query Dialogs.

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 gui.h.

Function Documentation

◆ ARRAY_HEAD()

ARRAY_HEAD ( AliasViewArray  ,
struct AliasView   
)

◆ alias_array_alias_add()

int alias_array_alias_add ( struct AliasViewArray *  ava,
struct Alias alias 
)

Add an Alias to the AliasViewArray.

Parameters
avaArray of Aliases
aliasAlias to add
Return values
numSize of array
-1Error
Note
The Alias is wrapped in an AliasView
Call alias_array_sort() to sort and reindex the AliasViewArray

Definition at line 47 of file array.c.

48{
49 if (!ava || !alias)
50 return -1;
51
52 struct AliasView av = {
53 .num = 0,
54 .orig_seq = ARRAY_SIZE(ava),
55 .is_tagged = false,
56 .is_deleted = false,
57 .is_visible = true,
58 .alias = alias,
59 };
60 ARRAY_ADD(ava, av);
61 return ARRAY_SIZE(ava);
62}
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition: array.h:155
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:86
GUI data wrapping an Alias.
Definition: gui.h:36
struct Alias * alias
Alias.
Definition: gui.h:44
int num
Index number in list.
Definition: gui.h:37
+ Here is the caller graph for this function:

◆ alias_array_alias_delete()

int alias_array_alias_delete ( struct AliasViewArray *  ava,
const struct Alias alias 
)

Delete an Alias from the AliasViewArray.

Parameters
avaArray of Aliases
aliasAlias to remove
Return values
numSize of array
-1Error
Note
Call alias_array_sort() to sort and reindex the AliasViewArray

Definition at line 73 of file array.c.

74{
75 if (!ava || !alias)
76 return -1;
77
78 struct AliasView *avp = NULL;
79 ARRAY_FOREACH(avp, ava)
80 {
81 if (avp->alias != alias)
82 continue;
83
84 ARRAY_REMOVE(ava, avp);
85 break;
86 }
87
88 return ARRAY_SIZE(ava);
89}
#define ARRAY_REMOVE(head, elem)
Remove an entry from the array, shifting down the subsequent entries.
Definition: array.h:266
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:211
+ Here is the caller graph for this function:

◆ alias_array_count_visible()

int alias_array_count_visible ( struct AliasViewArray *  ava)

Count number of visible Aliases.

Parameters
avaArray of Aliases

Definition at line 95 of file array.c.

96{
97 int count = 0;
98
99 struct AliasView *avp = NULL;
100 ARRAY_FOREACH(avp, ava)
101 {
102 if (avp->is_visible)
103 count++;
104 }
105
106 return count;
107}
bool is_visible
Is visible?
Definition: gui.h:43
+ Here is the caller graph for this function:

◆ alias_set_title()

void alias_set_title ( struct MuttWindow sbar,
char *  menu_name,
char *  limit 
)

Create a title string for the Menu.

Parameters
sbarSimple Bar Window
menu_nameMenu name
limitLimit being applied

Definition at line 69 of file gui.c.

70{
71 if (!limit)
72 {
73 sbar_set_title(sbar, menu_name);
74 return;
75 }
76
77 char buf[256] = { 0 };
78
79 int len = snprintf(buf, sizeof(buf), "%s - ", menu_name);
80
81 snprintf(buf + len, sizeof(buf) - len, _("Limit: %s"), limit);
82
83 sbar_set_title(sbar, buf);
84}
#define _(a)
Definition: message.h:28
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
Definition: sbar.c:224
+ Here is the call graph for this function:
+ Here is the caller graph for this function: