NeoMutt  2024-12-12-14-g7b49f7
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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 -.
 
int alias_array_alias_add (struct AliasViewArray *ava, struct Alias *alias)
 Add an Alias to the AliasViewArray.
 
int alias_array_alias_delete (struct AliasViewArray *ava, const struct Alias *alias)
 Delete an Alias from the AliasViewArray.
 
int alias_array_count_visible (struct AliasViewArray *ava)
 Count number of visible Aliases.
 
void alias_set_title (struct MuttWindow *sbar, char *menu_name, char *limit)
 Create a title string for the Menu.
 
int alias_recalc (struct MuttWindow *win)
 Recalculate the display of the Alias Window - Implements MuttWindow::recalc() -.
 

Detailed Description

Shared code for the Alias and Query Dialogs.

Authors
  • Romeu Vieira
  • Richard Russon
  • Dennis Schön

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:156
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:87
GUI data wrapping an Alias.
Definition: gui.h:38
struct Alias * alias
Alias.
Definition: gui.h:46
int num
Index number in list.
Definition: gui.h:39
+ 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:267
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:212
+ 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:45
+ 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 72 of file gui.c.

73{
74 if (!limit)
75 {
76 sbar_set_title(sbar, menu_name);
77 return;
78 }
79
80 char buf[256] = { 0 };
81
82 int len = snprintf(buf, sizeof(buf), "%s - ", menu_name);
83
84 snprintf(buf + len, sizeof(buf) - len, _("Limit: %s"), limit);
85
86 sbar_set_title(sbar, buf);
87}
#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:227
+ Here is the call graph for this function:
+ Here is the caller graph for this function: