NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
gui.c File Reference

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

#include "config.h"
#include <stdio.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "gui/lib.h"
#include "gui.h"
#include "lib.h"
#include "menu/lib.h"
+ Include dependency graph for gui.c:

Go to the source code of this file.

Functions

int alias_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t. 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.c.

Function Documentation

◆ alias_config_observer()

int alias_config_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t.

The Address Book Window is affected by changes to $sort_alias.

Definition at line 43 of file gui.c.

44 {
45  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
46  return -1;
47 
48  struct EventConfig *ev_c = nc->event_data;
49 
50  if (!mutt_str_equal(ev_c->name, "sort_alias"))
51  return 0;
52 
53  struct Menu *menu = nc->global_data;
54 
56  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
57 
58  return 0;
59 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:904
Definition: lib.h:67
A config-change event.
Definition: subset.h:69
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
void * event_data
Data from notify_send()
Definition: observer.h:44
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:42
Log at debug level 5.
Definition: logging.h:44
const char * name
Name of config item that changed.
Definition: subset.h:72
+ Here is the call graph for this function:
+ 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 67 of file gui.c.

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