mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-20 11:06:22 +00:00
Check for plugin win before creating
This commit is contained in:
@@ -302,6 +302,10 @@ api_win_create(
|
||||
void(*callback_exec)(PluginWindowCallback *window_callback, const char *tag, const char * const line),
|
||||
void(*callback_destroy)(void *callback))
|
||||
{
|
||||
if (callbacks_win_exists(plugin_name, tag)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PluginWindowCallback *window = malloc(sizeof(PluginWindowCallback));
|
||||
window->callback = callback;
|
||||
window->callback_exec = callback_exec;
|
||||
|
||||
@@ -206,6 +206,20 @@ callbacks_add_timed(const char *const plugin_name, PluginTimedFunction *timed_fu
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
callbacks_win_exists(const char *const plugin_name, const char *tag)
|
||||
{
|
||||
GHashTable *window_callbacks = g_hash_table_lookup(p_window_callbacks, plugin_name);
|
||||
if (window_callbacks) {
|
||||
PluginWindowCallback *cb = g_hash_table_lookup(window_callbacks, tag);
|
||||
if (cb) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
callbacks_add_window_handler(const char *const plugin_name, const char *tag, PluginWindowCallback *window_callback)
|
||||
{
|
||||
|
||||
@@ -69,6 +69,7 @@ void callbacks_close(void);
|
||||
|
||||
void callbacks_add_command(const char *const plugin_name, PluginCommand *command);
|
||||
void callbacks_add_timed(const char *const plugin_name, PluginTimedFunction *timed_function);
|
||||
gboolean callbacks_win_exists(const char *const plugin_name, const char *tag);
|
||||
void callbacks_add_window_handler(const char *const plugin_name, const char *tag, PluginWindowCallback *window_callback);
|
||||
void * callbacks_get_window_handler(const char *tag);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user