diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-private-boxed-types.c | 37 | ||||
-rw-r--r-- | src/mm-private-boxed-types.h | 7 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/mm-private-boxed-types.c b/src/mm-private-boxed-types.c index a7b166ef..465649b5 100644 --- a/src/mm-private-boxed-types.c +++ b/src/mm-private-boxed-types.c @@ -170,3 +170,40 @@ mm_pointer_array_get_type (void) return g_define_type_id__volatile; } + +static void +async_method_free (MMAsyncMethod *method) +{ + g_slice_free (MMAsyncMethod, method); +} + +static MMAsyncMethod * +async_method_copy (MMAsyncMethod *original) +{ + MMAsyncMethod *copy; + + if (!original) + return NULL; + + copy = g_slice_new (MMAsyncMethod); + copy->async = original->async; + copy->finish = original->finish; + return copy; +} + +GType +mm_async_method_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) { + GType g_define_type_id = + g_boxed_type_register_static (g_intern_static_string ("MMAsyncMethod"), + (GBoxedCopyFunc) async_method_copy, + (GBoxedFreeFunc) async_method_free); + + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} diff --git a/src/mm-private-boxed-types.h b/src/mm-private-boxed-types.h index dba8d359..fcdcbb10 100644 --- a/src/mm-private-boxed-types.h +++ b/src/mm-private-boxed-types.h @@ -34,6 +34,13 @@ GType mm_str_pair_array_get_type (void) G_GNUC_CONST; GType mm_pointer_array_get_type (void) G_GNUC_CONST; #define MM_TYPE_POINTER_ARRAY (mm_pointer_array_get_type ()) +typedef struct { + GCallback async; + GCallback finish; +} MMAsyncMethod; +GType mm_async_method_get_type (void) G_GNUC_CONST; +#define MM_TYPE_ASYNC_METHOD (mm_async_method_get_type ()) + G_END_DECLS #endif /* __MM_PRIVATE_BOXED_TYPES_H__ */ |