Commit f25a8934 authored by Ell's avatar Ell

app: rename GimpParallelRunAsyncFunc to GimpRunAsyncFunc

... and move it to core-type.h, in preparation for next commit.
parent 48d71bf6
......@@ -267,6 +267,9 @@ typedef gboolean (* GimpObjectFilterFunc) (GimpObject *object,
typedef gint64 (* GimpMemsizeFunc) (gpointer instance,
gint64 *gui_size);
typedef void (* GimpRunAsyncFunc) (GimpAsync *async,
gpointer user_data);
/* structs */
......
......@@ -51,11 +51,11 @@ extern "C"
typedef struct
{
GimpAsync *async;
gint priority;
GimpParallelRunAsyncFunc func;
gpointer user_data;
GDestroyNotify user_data_destroy_func;
GimpAsync *async;
gint priority;
GimpRunAsyncFunc func;
gpointer user_data;
GDestroyNotify user_data_destroy_func;
} GimpParallelRunAsyncTask;
typedef struct
......@@ -129,17 +129,17 @@ gimp_parallel_exit (Gimp *gimp)
}
GimpAsync *
gimp_parallel_run_async (GimpParallelRunAsyncFunc func,
gpointer user_data)
gimp_parallel_run_async (GimpRunAsyncFunc func,
gpointer user_data)
{
return gimp_parallel_run_async_full (0, func, user_data, NULL);
}
GimpAsync *
gimp_parallel_run_async_full (gint priority,
GimpParallelRunAsyncFunc func,
gpointer user_data,
GDestroyNotify user_data_destroy_func)
gimp_parallel_run_async_full (gint priority,
GimpRunAsyncFunc func,
gpointer user_data,
GDestroyNotify user_data_destroy_func)
{
GimpAsync *async;
GimpParallelRunAsyncTask *task;
......@@ -182,16 +182,16 @@ gimp_parallel_run_async_full (gint priority,
}
GimpAsync *
gimp_parallel_run_async_independent (GimpParallelRunAsyncFunc func,
gpointer user_data)
gimp_parallel_run_async_independent (GimpRunAsyncFunc func,
gpointer user_data)
{
return gimp_parallel_run_async_independent_full (0, func, user_data);
}
GimpAsync *
gimp_parallel_run_async_independent_full (gint priority,
GimpParallelRunAsyncFunc func,
gpointer user_data)
gimp_parallel_run_async_independent_full (gint priority,
GimpRunAsyncFunc func,
gpointer user_data)
{
GimpAsync *async;
GimpParallelRunAsyncTask *task;
......
......@@ -22,24 +22,20 @@
#define __GIMP_PARALLEL_H__
typedef void (* GimpParallelRunAsyncFunc) (GimpAsync *async,
gpointer user_data);
void gimp_parallel_init (Gimp *gimp);
void gimp_parallel_exit (Gimp *gimp);
GimpAsync * gimp_parallel_run_async (GimpParallelRunAsyncFunc func,
gpointer user_data);
GimpAsync * gimp_parallel_run_async_full (gint priority,
GimpParallelRunAsyncFunc func,
gpointer user_data,
GDestroyNotify user_data_destroy_func);
GimpAsync * gimp_parallel_run_async_independent (GimpParallelRunAsyncFunc func,
gpointer user_data);
GimpAsync * gimp_parallel_run_async_independent_full (gint priority,
GimpParallelRunAsyncFunc func,
gpointer user_data);
void gimp_parallel_init (Gimp *gimp);
void gimp_parallel_exit (Gimp *gimp);
GimpAsync * gimp_parallel_run_async (GimpRunAsyncFunc func,
gpointer user_data);
GimpAsync * gimp_parallel_run_async_full (gint priority,
GimpRunAsyncFunc func,
gpointer user_data,
GDestroyNotify user_data_destroy_func);
GimpAsync * gimp_parallel_run_async_independent (GimpRunAsyncFunc func,
gpointer user_data);
GimpAsync * gimp_parallel_run_async_independent_full (gint priority,
GimpRunAsyncFunc func,
gpointer user_data);
#ifdef __cplusplus
......@@ -49,48 +45,48 @@ extern "C++"
#include <new>
template <class ParallelRunAsyncFunc>
template <class RunAsyncFunc>
inline GimpAsync *
gimp_parallel_run_async (ParallelRunAsyncFunc func)
gimp_parallel_run_async (RunAsyncFunc func)
{
ParallelRunAsyncFunc *func_copy = g_new (ParallelRunAsyncFunc, 1);
RunAsyncFunc *func_copy = g_new (RunAsyncFunc, 1);
new (func_copy) ParallelRunAsyncFunc (func);
new (func_copy) RunAsyncFunc (func);
return gimp_parallel_run_async_full (0,
[] (GimpAsync *async,
gpointer user_data)
{
ParallelRunAsyncFunc *func_copy =
(ParallelRunAsyncFunc *) user_data;
RunAsyncFunc *func_copy =
(RunAsyncFunc *) user_data;
(*func_copy) (async);
func_copy->~ParallelRunAsyncFunc ();
func_copy->~RunAsyncFunc ();
g_free (func_copy);
},
func_copy,
[] (gpointer user_data)
{
ParallelRunAsyncFunc *func_copy =
(ParallelRunAsyncFunc *) user_data;
RunAsyncFunc *func_copy =
(RunAsyncFunc *) user_data;
func_copy->~ParallelRunAsyncFunc ();
func_copy->~RunAsyncFunc ();
g_free (func_copy);
});
}
template <class ParallelRunAsyncFunc,
template <class RunAsyncFunc,
class DestroyFunc>
inline GimpAsync *
gimp_parallel_run_async_full (gint priority,
ParallelRunAsyncFunc func,
DestroyFunc destroy_func)
gimp_parallel_run_async_full (gint priority,
RunAsyncFunc func,
DestroyFunc destroy_func)
{
typedef struct
{
ParallelRunAsyncFunc func;
DestroyFunc destroy_func;
RunAsyncFunc func;
DestroyFunc destroy_func;
} Funcs;
Funcs *funcs_copy = g_new (Funcs, 1);
......@@ -122,33 +118,33 @@ gimp_parallel_run_async_full (gint priority,
});
}
template <class ParallelRunAsyncFunc>
template <class RunAsyncFunc>
inline GimpAsync *
gimp_parallel_run_async_independent_full (gint priority,
ParallelRunAsyncFunc func)
gimp_parallel_run_async_independent_full (gint priority,
RunAsyncFunc func)
{
ParallelRunAsyncFunc *func_copy = g_new (ParallelRunAsyncFunc, 1);
RunAsyncFunc *func_copy = g_new (RunAsyncFunc, 1);
new (func_copy) ParallelRunAsyncFunc (func);
new (func_copy) RunAsyncFunc (func);
return gimp_parallel_run_async_independent_full (priority,
[] (GimpAsync *async,
gpointer user_data)
{
ParallelRunAsyncFunc *func_copy =
(ParallelRunAsyncFunc *) user_data;
RunAsyncFunc *func_copy =
(RunAsyncFunc *) user_data;
(*func_copy) (async);
func_copy->~ParallelRunAsyncFunc ();
func_copy->~RunAsyncFunc ();
g_free (func_copy);
},
func_copy);
}
template <class ParallelRunAsyncFunc>
template <class RunAsyncFunc>
inline GimpAsync *
gimp_parallel_run_async_independent (ParallelRunAsyncFunc func)
gimp_parallel_run_async_independent (RunAsyncFunc func)
{
return gimp_parallel_run_async_independent_full (0, func);
}
......
......@@ -410,7 +410,7 @@ gimp_drawable_get_sub_preview_async (GimpDrawable *drawable,
return gimp_parallel_run_async_full (
+1,
(GimpParallelRunAsyncFunc) gimp_drawable_get_sub_preview_async_func,
(GimpRunAsyncFunc) gimp_drawable_get_sub_preview_async_func,
sub_preview_data_new (
gimp_drawable_get_preview_format (drawable),
buffer,
......
......@@ -355,7 +355,7 @@ gimp_histogram_calculate_async (GimpHistogram *histogram,
}
histogram->priv->calculate_async = gimp_parallel_run_async (
(GimpParallelRunAsyncFunc) gimp_histogram_calculate_internal,
(GimpRunAsyncFunc) gimp_histogram_calculate_internal,
context);
gimp_async_add_callback (
......
......@@ -666,7 +666,7 @@ gimp_line_art_prepare_async (GimpLineArt *line_art,
async = gimp_parallel_run_async_full (
priority,
(GimpParallelRunAsyncFunc) gimp_line_art_prepare_async_func,
(GimpRunAsyncFunc) gimp_line_art_prepare_async_func,
data, (GDestroyNotify) line_art_data_free);
return async;
......
......@@ -512,7 +512,7 @@ gui_wait (Gimp *gimp,
{
/* listens for a cancellation request */
input_async = gimp_parallel_run_async_independent (
(GimpParallelRunAsyncFunc) gui_wait_input_async,
(GimpRunAsyncFunc) gui_wait_input_async,
input_pipe);
while (! gimp_waitable_wait_for (waitable, 0.1 * G_TIME_SPAN_SECOND))
......
......@@ -334,7 +334,7 @@ gimp_font_factory_load (GimpFontFactory *factory,
*/
async = gimp_parallel_run_async_independent_full (
+10,
(GimpParallelRunAsyncFunc) gimp_font_factory_load_async,
(GimpRunAsyncFunc) gimp_font_factory_load_async,
config);
gimp_async_add_callback_for_object (
......
......@@ -4545,7 +4545,7 @@ gimp_dashboard_log_stop_recording (GimpDashboard *dashboard,
GimpAsync *async;
async = gimp_parallel_run_async_independent (
(GimpParallelRunAsyncFunc) gimp_dashboard_log_write_address_map,
(GimpRunAsyncFunc) gimp_dashboard_log_write_address_map,
dashboard);
gimp_wait (priv->gimp, GIMP_WAITABLE (async),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment