diff options
author | James Booth <boothj5@gmail.com> | 2016-07-03 01:03:05 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-07-03 01:03:05 +0100 |
commit | 606a860bdc2fd93773405655be467064aa949cc6 (patch) | |
tree | d34217d4112e2762bbaab0502779e8188ab45361 /src | |
parent | 70a79abd3bbc978f2dc1a4c54bdc7202e14ea9a8 (diff) | |
download | profani-tty-606a860bdc2fd93773405655be467064aa949cc6.tar.gz |
Rename callback execte and destroy functions
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/api.c | 16 | ||||
-rw-r--r-- | src/plugins/callbacks.c | 8 | ||||
-rw-r--r-- | src/plugins/callbacks.h | 8 | ||||
-rw-r--r-- | src/plugins/plugins.c | 2 |
4 files changed, 17 insertions, 17 deletions
diff --git a/src/plugins/api.c b/src/plugins/api.c index 24947d95..ea134fe4 100644 --- a/src/plugins/api.c +++ b/src/plugins/api.c @@ -108,14 +108,14 @@ api_cons_bad_cmd_usage(const char *const cmd) void api_register_command(const char *const plugin_name, const char *command_name, int min_args, int max_args, const char **synopsis, const char *description, const char *arguments[][2], const char **examples, void *callback, - void(*callback_func)(PluginCommand *command, gchar **args)) + void(*callback_exec)(PluginCommand *command, gchar **args)) { PluginCommand *command = malloc(sizeof(PluginCommand)); command->command_name = command_name; command->min_args = min_args; command->max_args = max_args; command->callback = callback; - command->callback_func = callback_func; + command->callback_exec = callback_exec; CommandHelp *help = malloc(sizeof(CommandHelp)); @@ -145,11 +145,11 @@ api_register_command(const char *const plugin_name, const char *command_name, in void api_register_timed(const char *const plugin_name, void *callback, int interval_seconds, - void (*callback_func)(PluginTimedFunction *timed_function)) + void (*callback_exec)(PluginTimedFunction *timed_function)) { PluginTimedFunction *timed_function = malloc(sizeof(PluginTimedFunction)); timed_function->callback = callback; - timed_function->callback_func = callback_func; + timed_function->callback_exec = callback_exec; timed_function->interval_seconds = interval_seconds; timed_function->timer = g_timer_new(); @@ -295,13 +295,13 @@ api_win_create( const char *const plugin_name, const char *tag, void *callback, - void(*destroy)(void *callback), - void(*callback_func)(PluginWindowCallback *window_callback, const char *tag, const char * const line)) + void(*callback_exec)(PluginWindowCallback *window_callback, const char *tag, const char * const line), + void(*callback_destroy)(void *callback)) { PluginWindowCallback *window = malloc(sizeof(PluginWindowCallback)); window->callback = callback; - window->callback_func = callback_func; - window->destroy = destroy; + window->callback_exec = callback_exec; + window->callback_destroy = callback_destroy; callbacks_add_window_handler(tag, window); wins_new_plugin(tag); diff --git a/src/plugins/callbacks.c b/src/plugins/callbacks.c index 2572f7a4..57a8c09d 100644 --- a/src/plugins/callbacks.c +++ b/src/plugins/callbacks.c @@ -51,8 +51,8 @@ static GHashTable *p_window_callbacks = NULL; static void _free_window_callback(PluginWindowCallback *window_callback) { - if (window_callback->destroy) { - window_callback->destroy(window_callback->callback); + if (window_callback->callback_destroy) { + window_callback->callback_destroy(window_callback->callback); } free(window_callback); } @@ -115,7 +115,7 @@ plugins_run_command(const char * const input) g_strfreev(split); return TRUE; } else { - command->callback_func(command, args); + command->callback_exec(command, args); g_strfreev(split); g_strfreev(args); return TRUE; @@ -153,7 +153,7 @@ plugins_run_timed(void) gdouble elapsed = g_timer_elapsed(timed_function->timer, NULL); if (timed_function->interval_seconds > 0 && elapsed >= timed_function->interval_seconds) { - timed_function->callback_func(timed_function); + timed_function->callback_exec(timed_function); g_timer_start(timed_function->timer); } diff --git a/src/plugins/callbacks.h b/src/plugins/callbacks.h index 9b175d0a..0ef6de9f 100644 --- a/src/plugins/callbacks.h +++ b/src/plugins/callbacks.h @@ -45,20 +45,20 @@ typedef struct p_command { int max_args; CommandHelp *help; void *callback; - void (*callback_func)(struct p_command *command, gchar **args); + void (*callback_exec)(struct p_command *command, gchar **args); } PluginCommand; typedef struct p_timed_function { void *callback; - void (*callback_func)(struct p_timed_function *timed_function); + void (*callback_exec)(struct p_timed_function *timed_function); int interval_seconds; GTimer *timer; } PluginTimedFunction; typedef struct p_window_input_callback { void *callback; - void (*destroy)(void *callback); - void (*callback_func)(struct p_window_input_callback *window_callback, const char *tag, const char * const line); + void (*callback_exec)(struct p_window_input_callback *window_callback, const char *tag, const char * const line); + void (*callback_destroy)(void *callback); } PluginWindowCallback; void callbacks_init(void); diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c index 01b07e6f..dfa8e763 100644 --- a/src/plugins/plugins.c +++ b/src/plugins/plugins.c @@ -233,7 +233,7 @@ void plugins_win_process_line(char *win, const char * const line) { PluginWindowCallback *window = callbacks_get_window_handler(win); - window->callback_func(window, win, line); + window->callback_exec(window, win, line); } void |