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

Compose Bar Data. More...

#include "config.h"
#include "mutt/lib.h"
#include "core/lib.h"
#include "cbar_data.h"
+ Include dependency graph for cbar_data.c:

Go to the source code of this file.

Functions

int cbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t. More...
 
int cbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t. More...
 
void cbar_data_free (struct MuttWindow *win, void **ptr)
 Free the private data attached to the MuttWindow - Implements MuttWindow::wdata_free() -. More...
 
struct ComposeBarDatacbar_data_new (void)
 Free the private data attached to the MuttWindow. More...
 

Detailed Description

Compose Bar Data.

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

Function Documentation

◆ cbar_color_observer()

int cbar_color_observer ( struct NotifyCallback nc)

Notification that a Color has changed - Implements observer_t.

Definition at line 205 of file cbar.c.

206 {
207  if ((nc->event_type != NT_COLOR) || !nc->global_data || !nc->event_data)
208  return -1;
209 
210  struct EventColor *ev_c = nc->event_data;
211 
212  // MT_COLOR_MAX is sent on `uncolor *`
213  if ((ev_c->color != MT_COLOR_STATUS) && (ev_c->color != MT_COLOR_MAX))
214  return 0;
215 
216  struct MuttWindow *win_cbar = nc->global_data;
217  win_cbar->actions |= WA_REPAINT;
218  mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
219 
220  return 0;
221 }
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:111
An Event that happened to a Colour.
Definition: color.h:122
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:39
Status bar (takes a pattern)
Definition: color.h:75
enum ColorId color
Definition: color.h:124
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
void * event_data
Data from notify_send()
Definition: observer.h:44
Log at debug level 5.
Definition: logging.h:44
+ Here is the caller graph for this function:

◆ cbar_config_observer()

int cbar_config_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t.

Definition at line 241 of file cbar.c.

242 {
243  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
244  return -1;
245 
246  struct EventConfig *ev_c = nc->event_data;
247  if (!mutt_str_equal(ev_c->name, "compose_format"))
248  return 0;
249 
250  struct MuttWindow *win_cbar = nc->global_data;
251  win_cbar->actions |= WA_RECALC;
252  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
253 
254  return 0;
255 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:904
A config-change event.
Definition: subset.h:69
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
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
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cbar_data_new()

struct ComposeBarData* cbar_data_new ( void  )

Free the private data attached to the MuttWindow.

Definition at line 55 of file cbar_data.c.

56 {
57  struct ComposeBarData *cbar_data = mutt_mem_calloc(1, sizeof(struct ComposeBarData));
58 
59  return cbar_data;
60 }
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
Data to fill the Compose Bar Window.
Definition: cbar_data.h:33
+ Here is the call graph for this function:
+ Here is the caller graph for this function: