mirror of https://github.com/GNOME/gimp.git
app: add gimp_async_remove_callback()
... which removes a callback previously added through gimp_async_add_callback().
This commit is contained in:
parent
3e92e7a449
commit
85f67e196c
|
@ -328,6 +328,45 @@ gimp_async_add_callback (GimpAsync *async,
|
|||
g_mutex_unlock (&async->priv->mutex);
|
||||
}
|
||||
|
||||
/* removes all callbacks previously registered through
|
||||
* 'gimp_async_add_callback()', matching 'callback' and 'data', which hasn't
|
||||
* been called yet.
|
||||
*
|
||||
* may only be called on the main thread.
|
||||
*/
|
||||
void
|
||||
gimp_async_remove_callback (GimpAsync *async,
|
||||
GimpAsyncCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
GList *iter;
|
||||
|
||||
g_return_if_fail (GIMP_IS_ASYNC (async));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
g_mutex_lock (&async->priv->mutex);
|
||||
|
||||
iter = g_queue_peek_head_link (&async->priv->callbacks);
|
||||
|
||||
while (iter)
|
||||
{
|
||||
GimpAsyncCallbackInfo *callback_info = iter->data;
|
||||
GList *next = g_list_next (iter);
|
||||
|
||||
if (callback_info->callback == callback &&
|
||||
callback_info->data == data)
|
||||
{
|
||||
g_queue_delete_link (&async->priv->callbacks, iter);
|
||||
|
||||
g_slice_free (GimpAsyncCallbackInfo, callback_info);
|
||||
}
|
||||
|
||||
iter = next;
|
||||
}
|
||||
|
||||
g_mutex_unlock (&async->priv->mutex);
|
||||
}
|
||||
|
||||
/* transitions 'async' to the "stopped" state, indicating that the task
|
||||
* completed normally, possibly providing a result.
|
||||
*
|
||||
|
|
|
@ -50,31 +50,35 @@ struct _GimpAsyncClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_async_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_async_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpAsync * gimp_async_new (void);
|
||||
GimpAsync * gimp_async_new (void);
|
||||
|
||||
gboolean gimp_async_is_stopped (GimpAsync *async);
|
||||
gboolean gimp_async_is_stopped (GimpAsync *async);
|
||||
|
||||
void gimp_async_wait (GimpAsync *async);
|
||||
gboolean gimp_async_wait_until (GimpAsync *async,
|
||||
gint64 end_time);
|
||||
void gimp_async_add_callback (GimpAsync *async,
|
||||
GimpAsyncCallback callback,
|
||||
gpointer data);
|
||||
void gimp_async_wait (GimpAsync *async);
|
||||
gboolean gimp_async_wait_until (GimpAsync *async,
|
||||
gint64 end_time);
|
||||
|
||||
void gimp_async_finish (GimpAsync *async,
|
||||
gpointer result);
|
||||
void gimp_async_finish_full (GimpAsync *async,
|
||||
gpointer result,
|
||||
GDestroyNotify result_destroy_func);
|
||||
gboolean gimp_async_is_finished (GimpAsync *async);
|
||||
gpointer gimp_async_get_result (GimpAsync *async);
|
||||
void gimp_async_add_callback (GimpAsync *async,
|
||||
GimpAsyncCallback callback,
|
||||
gpointer data);
|
||||
void gimp_async_remove_callback (GimpAsync *async,
|
||||
GimpAsyncCallback callback,
|
||||
gpointer data);
|
||||
|
||||
void gimp_async_abort (GimpAsync *async);
|
||||
void gimp_async_finish (GimpAsync *async,
|
||||
gpointer result);
|
||||
void gimp_async_finish_full (GimpAsync *async,
|
||||
gpointer result,
|
||||
GDestroyNotify result_destroy_func);
|
||||
gboolean gimp_async_is_finished (GimpAsync *async);
|
||||
gpointer gimp_async_get_result (GimpAsync *async);
|
||||
|
||||
void gimp_async_cancel (GimpAsync *async);
|
||||
gboolean gimp_async_is_canceled (GimpAsync *async);
|
||||
void gimp_async_abort (GimpAsync *async);
|
||||
|
||||
void gimp_async_cancel (GimpAsync *async);
|
||||
gboolean gimp_async_is_canceled (GimpAsync *async);
|
||||
|
||||
|
||||
#endif /* __GIMP_ASYNC_H__ */
|
||||
|
|
Loading…
Reference in New Issue