mirror of https://github.com/MidnightCommander/mc
Event system: added addition parameter event_init_data to mc_event_del() function.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
3aa74a2320
commit
b473577525
|
@ -30,7 +30,7 @@ gboolean mc_event_deinit (GError **);
|
|||
|
||||
/* manage.c: */
|
||||
gboolean mc_event_add (const gchar *, const gchar *, mc_event_callback_func_t, gpointer, GError **);
|
||||
void mc_event_del (const gchar *, const gchar *, mc_event_callback_func_t);
|
||||
void mc_event_del (const gchar *, const gchar *, mc_event_callback_func_t, gpointer);
|
||||
void mc_event_destroy (const gchar *, const gchar *);
|
||||
void mc_event_group_del (const gchar *);
|
||||
gboolean mc_event_present (const gchar *, const gchar *);
|
||||
|
|
|
@ -25,7 +25,7 @@ GTree *mc_event_get_event_group_by_name (const gchar * event_group_name, gboolea
|
|||
GPtrArray *mc_event_get_event_by_name (GTree * event_group, const gchar * event_name,
|
||||
gboolean create_new, GError ** mcerror);
|
||||
mc_event_callback_t *mc_event_is_callback_in_array (GPtrArray * callbacks,
|
||||
mc_event_callback_func_t event_callback);
|
||||
mc_event_callback_func_t event_callback, gpointer event_init_data);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
#endif /* MC_EVENT_INTERNAL_H */
|
||||
|
|
|
@ -86,7 +86,7 @@ mc_event_add (const gchar * event_group_name, const gchar * event_name,
|
|||
if (callbacks == NULL)
|
||||
return FALSE;
|
||||
|
||||
cb = mc_event_is_callback_in_array (callbacks, event_callback);
|
||||
cb = mc_event_is_callback_in_array (callbacks, event_callback, event_init_data);
|
||||
if (cb == NULL)
|
||||
{
|
||||
cb = g_new0 (mc_event_callback_t, 1);
|
||||
|
@ -101,7 +101,7 @@ mc_event_add (const gchar * event_group_name, const gchar * event_name,
|
|||
|
||||
void
|
||||
mc_event_del (const gchar * event_group_name, const gchar * event_name,
|
||||
mc_event_callback_func_t event_callback)
|
||||
mc_event_callback_func_t event_callback, gpointer event_init_data)
|
||||
{
|
||||
GTree *event_group;
|
||||
GPtrArray *callbacks;
|
||||
|
@ -119,7 +119,7 @@ mc_event_del (const gchar * event_group_name, const gchar * event_name,
|
|||
if (callbacks == NULL)
|
||||
return;
|
||||
|
||||
cb = mc_event_is_callback_in_array (callbacks, event_callback);
|
||||
cb = mc_event_is_callback_in_array (callbacks, event_callback, event_init_data);
|
||||
|
||||
if (cb == NULL)
|
||||
return;
|
||||
|
@ -208,14 +208,14 @@ mc_event_get_event_by_name (GTree * event_group, const gchar * event_name, gbool
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
mc_event_callback_t *
|
||||
mc_event_is_callback_in_array (GPtrArray * callbacks, mc_event_callback_func_t event_callback)
|
||||
mc_event_is_callback_in_array (GPtrArray * callbacks, mc_event_callback_func_t event_callback, gpointer event_init_data)
|
||||
{
|
||||
guint array_index;
|
||||
|
||||
for (array_index = 0; array_index < callbacks->len; array_index++)
|
||||
{
|
||||
mc_event_callback_t *cb = g_ptr_array_index (callbacks, array_index);
|
||||
if (cb->callback == event_callback)
|
||||
if (cb->callback == event_callback && cb->init_data == event_init_data)
|
||||
return cb;
|
||||
}
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue