mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Rename callback execte and destroy functions
This commit is contained in:
parent
70a79abd3b
commit
606a860bdc
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user