mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-18 05:18:47 +02:00
Use G_DEFINE_INTERFACE in gio
Note: Since we export types with Iface in the name rather than Interface we have to use some typedefs to make this work. New interfaces should probably use Interface as the public name.
This commit is contained in:
parent
91d96350a7
commit
39cd766e8e
@ -86,50 +86,11 @@
|
||||
*
|
||||
**/
|
||||
|
||||
static void g_app_info_base_init (gpointer g_class);
|
||||
static void g_app_info_class_init (gpointer g_class,
|
||||
gpointer class_data);
|
||||
|
||||
|
||||
GType
|
||||
g_app_info_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo app_info_info =
|
||||
{
|
||||
sizeof (GAppInfoIface), /* class_size */
|
||||
g_app_info_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
g_app_info_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GAppInfo"),
|
||||
&app_info_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 GAppInfoIface GAppInfoInterface;
|
||||
G_DEFINE_INTERFACE (GAppInfo, g_app_info, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_app_info_class_init (gpointer g_class,
|
||||
gpointer class_data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_app_info_base_init (gpointer g_class)
|
||||
g_app_info_default_init (GAppInfoInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -108,49 +108,11 @@
|
||||
* truly need asynchronous operations, make sure to initialize #GThread.
|
||||
**/
|
||||
|
||||
static void g_async_result_base_init (gpointer g_class);
|
||||
static void g_async_result_class_init (gpointer g_class,
|
||||
gpointer class_data);
|
||||
|
||||
GType
|
||||
g_async_result_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo async_result_info =
|
||||
{
|
||||
sizeof (GAsyncResultIface), /* class_size */
|
||||
g_async_result_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
g_async_result_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GAsyncResult"),
|
||||
&async_result_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 GAsyncResultIface GAsyncResultInterface;
|
||||
G_DEFINE_INTERFACE (GAsyncResult, g_async_result, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_async_result_class_init (gpointer g_class,
|
||||
gpointer class_data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_async_result_base_init (gpointer g_class)
|
||||
g_async_result_default_init (GAsyncResultInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2639,49 +2639,11 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
|
||||
|
||||
/* GDesktopAppInfoLookup interface: */
|
||||
|
||||
static void g_desktop_app_info_lookup_base_init (gpointer g_class);
|
||||
static void g_desktop_app_info_lookup_class_init (gpointer g_class,
|
||||
gpointer class_data);
|
||||
|
||||
GType
|
||||
g_desktop_app_info_lookup_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo desktop_app_info_lookup_info =
|
||||
{
|
||||
sizeof (GDesktopAppInfoLookupIface), /* class_size */
|
||||
g_desktop_app_info_lookup_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
g_desktop_app_info_lookup_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GDesktopAppInfoLookup"),
|
||||
&desktop_app_info_lookup_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 GDesktopAppInfoLookupIface GDesktopAppInfoLookupInterface;
|
||||
G_DEFINE_INTERFACE (GDesktopAppInfoLookup, g_desktop_app_info_lookup, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_desktop_app_info_lookup_class_init (gpointer g_class,
|
||||
gpointer class_data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_desktop_app_info_lookup_base_init (gpointer g_class)
|
||||
g_desktop_app_info_lookup_default_init (GDesktopAppInfoLookupInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
|
51
gio/gdrive.c
51
gio/gdrive.c
@ -63,54 +63,12 @@
|
||||
* #GDrive in that API.
|
||||
**/
|
||||
|
||||
static void g_drive_base_init (gpointer g_class);
|
||||
static void g_drive_class_init (gpointer g_class,
|
||||
gpointer class_data);
|
||||
|
||||
GType
|
||||
g_drive_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo drive_info =
|
||||
{
|
||||
sizeof (GDriveIface), /* class_size */
|
||||
g_drive_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
g_drive_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GDrive"),
|
||||
&drive_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 GDriveIface GDriveInterface;
|
||||
G_DEFINE_INTERFACE(GDrive, g_drive, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_drive_class_init (gpointer g_class,
|
||||
gpointer class_data)
|
||||
g_drive_default_init (GDriveInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_drive_base_init (gpointer g_class)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
if (! initialized)
|
||||
{
|
||||
/**
|
||||
* GDrive::changed:
|
||||
* @drive: a #GDrive.
|
||||
@ -173,9 +131,6 @@ g_drive_base_init (gpointer g_class)
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
46
gio/gfile.c
46
gio/gfile.c
@ -121,10 +121,6 @@
|
||||
* </para>
|
||||
**/
|
||||
|
||||
static void g_file_base_init (gpointer g_class);
|
||||
static void g_file_class_init (gpointer g_class,
|
||||
gpointer class_data);
|
||||
|
||||
static void g_file_real_query_info_async (GFile *file,
|
||||
const char *attributes,
|
||||
GFileQueryInfoFlags flags,
|
||||
@ -265,43 +261,12 @@ static gboolean g_file_real_copy_finish (GFile
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
GType
|
||||
g_file_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo file_info =
|
||||
{
|
||||
sizeof (GFileIface), /* class_size */
|
||||
g_file_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
g_file_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GFile"),
|
||||
&file_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 GFileIface GFileInterface;
|
||||
G_DEFINE_INTERFACE (GFile, g_file, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_file_class_init (gpointer g_class,
|
||||
gpointer class_data)
|
||||
g_file_default_init (GFileIface *iface)
|
||||
{
|
||||
GFileIface *iface = g_class;
|
||||
|
||||
iface->enumerate_children_async = g_file_real_enumerate_children_async;
|
||||
iface->enumerate_children_finish = g_file_real_enumerate_children_finish;
|
||||
iface->set_display_name_async = g_file_real_set_display_name_async;
|
||||
@ -333,11 +298,6 @@ g_file_class_init (gpointer g_class,
|
||||
iface->copy_finish = g_file_real_copy_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
g_file_base_init (gpointer g_class)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* g_file_is_native:
|
||||
|
44
gio/gicon.c
44
gio/gicon.c
@ -63,49 +63,11 @@
|
||||
* with the type system prior to calling g_icon_new_for_string().
|
||||
**/
|
||||
|
||||
static void g_icon_base_init (gpointer g_class);
|
||||
static void g_icon_class_init (gpointer g_class,
|
||||
gpointer class_data);
|
||||
|
||||
GType
|
||||
g_icon_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo icon_info =
|
||||
{
|
||||
sizeof (GIconIface), /* class_size */
|
||||
g_icon_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
g_icon_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GIcon"),
|
||||
&icon_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 GIconIface GIconInterface;
|
||||
G_DEFINE_INTERFACE(GIcon, g_icon, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_icon_class_init (gpointer g_class,
|
||||
gpointer class_data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_icon_base_init (gpointer g_class)
|
||||
g_icon_default_init (GIconInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -48,56 +48,17 @@ static GInputStream *g_loadable_icon_real_load_finish (GLoadableIcon *ico
|
||||
GAsyncResult *res,
|
||||
char **type,
|
||||
GError **error);
|
||||
static void g_loadable_icon_base_init (gpointer g_class);
|
||||
static void g_loadable_icon_class_init (gpointer g_class,
|
||||
gpointer class_data);
|
||||
|
||||
GType
|
||||
g_loadable_icon_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo loadable_icon_info =
|
||||
{
|
||||
sizeof (GLoadableIconIface), /* class_size */
|
||||
g_loadable_icon_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
g_loadable_icon_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GLoadableIcon"),
|
||||
&loadable_icon_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_ICON);
|
||||
|
||||
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
|
||||
}
|
||||
|
||||
return g_define_type_id__volatile;
|
||||
}
|
||||
typedef GLoadableIconIface GLoadableIconInterface;
|
||||
G_DEFINE_INTERFACE(GLoadableIcon, g_loadable_icon, G_TYPE_ICON)
|
||||
|
||||
static void
|
||||
g_loadable_icon_class_init (gpointer g_class,
|
||||
gpointer class_data)
|
||||
g_loadable_icon_default_init (GLoadableIconIface *iface)
|
||||
{
|
||||
GLoadableIconIface *iface = g_class;
|
||||
|
||||
iface->load_async = g_loadable_icon_real_load_async;
|
||||
iface->load_finish = g_loadable_icon_real_load_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
g_loadable_icon_base_init (gpointer g_class)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* g_loadable_icon_load:
|
||||
* @icon: a #GLoadableIcon.
|
||||
|
51
gio/gmount.c
51
gio/gmount.c
@ -63,54 +63,12 @@
|
||||
* is called, then it will be filled with any error information.
|
||||
**/
|
||||
|
||||
static void g_mount_base_init (gpointer g_class);
|
||||
static void g_mount_class_init (gpointer g_class,
|
||||
gpointer class_data);
|
||||
|
||||
GType
|
||||
g_mount_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo mount_info =
|
||||
{
|
||||
sizeof (GMountIface), /* class_size */
|
||||
g_mount_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
g_mount_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GMount"),
|
||||
&mount_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 GMountIface GMountInterface;
|
||||
G_DEFINE_INTERFACE (GMount, g_mount, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_mount_class_init (gpointer g_class,
|
||||
gpointer class_data)
|
||||
g_mount_default_init (GMountInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_mount_base_init (gpointer g_class)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
if (! initialized)
|
||||
{
|
||||
/**
|
||||
* GMount::changed:
|
||||
* @mount: the object on which the signal is emitted
|
||||
@ -157,9 +115,6 @@ g_mount_base_init (gpointer g_class)
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,43 +37,11 @@
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
static void g_seekable_base_init (gpointer g_class);
|
||||
|
||||
|
||||
GType
|
||||
g_seekable_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo seekable_info =
|
||||
{
|
||||
sizeof (GSeekableIface), /* class_size */
|
||||
g_seekable_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_("GSeekable"),
|
||||
&seekable_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 GSeekableIface GSeekableInterface;
|
||||
G_DEFINE_INTERFACE (GSeekable, g_seekable, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_seekable_base_init (gpointer g_class)
|
||||
g_seekable_default_init (GSeekableInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -79,54 +79,12 @@
|
||||
* libhal_manger_find_device_string_match().
|
||||
*/
|
||||
|
||||
static void g_volume_base_init (gpointer g_class);
|
||||
static void g_volume_class_init (gpointer g_class,
|
||||
gpointer class_data);
|
||||
|
||||
GType
|
||||
g_volume_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
const GTypeInfo volume_info =
|
||||
{
|
||||
sizeof (GVolumeIface), /* class_size */
|
||||
g_volume_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
g_volume_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_type_register_static (G_TYPE_INTERFACE, I_("GVolume"),
|
||||
&volume_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 GVolumeIface GVolumeInterface;
|
||||
G_DEFINE_INTERFACE(GVolume, g_volume, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
g_volume_class_init (gpointer g_class,
|
||||
gpointer class_data)
|
||||
g_volume_default_init (GVolumeInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_volume_base_init (gpointer g_class)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
if (! initialized)
|
||||
{
|
||||
/**
|
||||
* GVolume::changed:
|
||||
*
|
||||
@ -154,9 +112,6 @@ g_volume_base_init (gpointer g_class)
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user