mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
[gio] Use G_DEFINE_INTERFACE macro
Use this macro in gasyncinitable, gconverter, ginitable and gsocketconnectable https://bugzilla.gnome.org/show_bug.cgi?id=616245
This commit is contained in:
parent
3585e64be8
commit
3569de342e
@ -48,7 +48,6 @@
|
||||
* a set %GError on failure.
|
||||
*/
|
||||
|
||||
static void g_async_initable_base_init (gpointer g_iface);
|
||||
static void g_async_initable_real_init_async (GAsyncInitable *initable,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
@ -58,42 +57,14 @@ static gboolean g_async_initable_real_init_finish (GAsyncInitable *initabl
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
GType
|
||||
g_async_initable_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo initable_info =
|
||||
{
|
||||
sizeof (GAsyncInitableIface), /* class_size */
|
||||
g_async_initable_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GAsyncInitable"),
|
||||
&initable_info, 0);
|
||||
typedef GAsyncInitableIface GAsyncInitableInterface;
|
||||
G_DEFINE_INTERFACE (GAsyncInitable, g_async_initable, G_TYPE_OBJECT)
|
||||
|
||||
g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_OBJECT);
|
||||
|
||||
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
|
||||
}
|
||||
|
||||
return g_define_type_id__volatile;
|
||||
}
|
||||
|
||||
static void
|
||||
g_async_initable_base_init (gpointer g_iface)
|
||||
g_async_initable_default_init (GAsyncInitableInterface *iface)
|
||||
{
|
||||
GAsyncInitableIface *iface = g_iface;
|
||||
|
||||
iface->init_async = g_async_initable_real_init_async;
|
||||
iface->init_finish = g_async_initable_real_init_finish;
|
||||
}
|
||||
|
@ -43,41 +43,12 @@
|
||||
* Since: 2.24
|
||||
**/
|
||||
|
||||
static void g_converter_base_init (gpointer g_class);
|
||||
|
||||
GType
|
||||
g_converter_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo converter_info =
|
||||
{
|
||||
sizeof (GConverterIface), /* class_size */
|
||||
g_converter_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GConverter"),
|
||||
&converter_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_OBJECT);
|
||||
|
||||
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
|
||||
}
|
||||
|
||||
return g_define_type_id__volatile;
|
||||
}
|
||||
typedef GConverterIface GConverterInterface;
|
||||
G_DEFINE_INTERFACE (GConverter, g_converter, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_converter_base_init (gpointer g_class)
|
||||
g_converter_default_init (GConverterInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -52,35 +52,12 @@
|
||||
* an exception on failure.
|
||||
*/
|
||||
|
||||
GType
|
||||
g_initable_get_type (void)
|
||||
typedef GInitableIface GInitableInterface;
|
||||
G_DEFINE_INTERFACE (GInitable, g_initable, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_initable_default_init (GInitableInterface *iface)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo initable_info =
|
||||
{
|
||||
sizeof (GInitableIface), /* class_size */
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GInitable"),
|
||||
&initable_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_OBJECT);
|
||||
|
||||
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
|
||||
}
|
||||
|
||||
return g_define_type_id__volatile;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,35 +91,13 @@
|
||||
* ]|
|
||||
*/
|
||||
|
||||
GType
|
||||
g_socket_connectable_get_type (void)
|
||||
|
||||
typedef GSocketConnectableIface GSocketConnectableInterface;
|
||||
G_DEFINE_INTERFACE (GSocketConnectable, g_socket_connectable, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_socket_connectable_default_init (GSocketConnectableInterface *iface)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo connectable_info =
|
||||
{
|
||||
sizeof (GSocketConnectableIface), /* class_size */
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GSocketConnectable"),
|
||||
&connectable_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_OBJECT);
|
||||
|
||||
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
|
||||
}
|
||||
|
||||
return g_define_type_id__volatile;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user