1
0

Refactored actions

* New return type which allows showing messages or toasts.
* Unified action header.
* More macros to make stuff consistent.
* A few bugfixes.
This commit is contained in:
Patrick Gaskin
2020-04-24 20:24:34 -04:00
parent ff5a2c0406
commit bcc61c14d4
13 changed files with 181 additions and 116 deletions

View File

@@ -6,6 +6,8 @@ extern "C" {
#include <stddef.h>
#include "action.h"
typedef enum {
NM_MENU_LOCATION_MAIN_MENU = 1,
NM_MENU_LOCATION_READER_MENU = 2,
@@ -15,7 +17,7 @@ typedef struct {
nm_menu_location_t loc;
char *lbl;
char *arg;
int (*act)(const char *arg, char **out_err); // can block, must return 0 on success, nonzero with out_err set to the malloc'd error message on error
nm_action_fn_t act; // can block, must return 0 on success, nonzero with out_err set to the malloc'd error message on error
} nm_menu_item_t;
// nm_menu_hook hooks a dlopen'd libnickel handle to add the specified menus,