[glib] Use G_DEFINE_INTERFACE in gio



commit 39cd766e8ef6901c097fdf2d3148fdc952f06b0e
Author: Dan Winship <danw gnome org>
Date:   Tue Dec 1 10:42:58 2009 +0100

    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.

 gio/gappinfo.c        |   45 +------------
 gio/gasyncresult.c    |   44 +------------
 gio/gdesktopappinfo.c |   44 +------------
 gio/gdrive.c          |  175 ++++++++++++++++++-------------------------------
 gio/gfile.c           |   46 +------------
 gio/gicon.c           |   44 +------------
 gio/gloadableicon.c   |   45 +------------
 gio/gmount.c          |  143 ++++++++++++++--------------------------
 gio/gseekable.c       |   38 +----------
 gio/gvolume.c         |  103 ++++++++---------------------
 10 files changed, 164 insertions(+), 563 deletions(-)
---
diff --git a/gio/gappinfo.c b/gio/gappinfo.c
index ecc5c95..6feec82 100644
--- a/gio/gappinfo.c
+++ b/gio/gappinfo.c
@@ -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;
-}
-
-static void
-g_app_info_class_init (gpointer g_class,
-		       gpointer class_data)
-{
-}
+typedef GAppInfoIface GAppInfoInterface;
+G_DEFINE_INTERFACE (GAppInfo, g_app_info, G_TYPE_OBJECT)
 
 static void
-g_app_info_base_init (gpointer g_class)
+g_app_info_default_init (GAppInfoInterface *iface)
 {
 }
 
diff --git a/gio/gasyncresult.c b/gio/gasyncresult.c
index 936a7bd..40af22f 100644
--- a/gio/gasyncresult.c
+++ b/gio/gasyncresult.c
@@ -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;
-}
-
-static void
-g_async_result_class_init (gpointer g_class,
-			   gpointer class_data)
-{
-}
+typedef GAsyncResultIface GAsyncResultInterface;
+G_DEFINE_INTERFACE (GAsyncResult, g_async_result, G_TYPE_OBJECT)
 
 static void
-g_async_result_base_init (gpointer g_class)
+g_async_result_default_init (GAsyncResultInterface *iface)
 {
 }
 
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 7770444..efe56e3 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -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;
-}
-
-static void
-g_desktop_app_info_lookup_class_init (gpointer g_class,
-				      gpointer class_data)
-{
-}
+typedef GDesktopAppInfoLookupIface GDesktopAppInfoLookupInterface;
+G_DEFINE_INTERFACE (GDesktopAppInfoLookup, g_desktop_app_info_lookup, G_TYPE_OBJECT)
 
 static void
-g_desktop_app_info_lookup_base_init (gpointer g_class)
+g_desktop_app_info_lookup_default_init (GDesktopAppInfoLookupInterface *iface)
 {
 }
 
diff --git a/gio/gdrive.c b/gio/gdrive.c
index a120c3d..4a45dff 100644
--- a/gio/gdrive.c
+++ b/gio/gdrive.c
@@ -63,119 +63,74 @@
  * #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.
-      * 
-      * Emitted when the drive's state has changed.
-      **/
-      g_signal_new (I_("changed"),
-                    G_TYPE_DRIVE,
-                    G_SIGNAL_RUN_LAST,
-                    G_STRUCT_OFFSET (GDriveIface, changed),
-                    NULL, NULL,
-                    g_cclosure_marshal_VOID__VOID,
-                    G_TYPE_NONE, 0);
-
-      /**
-      * GDrive::disconnected:
-      * @drive: a #GDrive.
-      * 
-      * This signal is emitted when the #GDrive have been
-      * disconnected. If the recipient is holding references to the
-      * object they should release them so the object can be
-      * finalized.
-      **/
-      g_signal_new (I_("disconnected"),
-                    G_TYPE_DRIVE,
-                    G_SIGNAL_RUN_LAST,
-                    G_STRUCT_OFFSET (GDriveIface, disconnected),
-                    NULL, NULL,
-                    g_cclosure_marshal_VOID__VOID,
-                    G_TYPE_NONE, 0);
-
-      /**
-      * GDrive::eject-button:
-      * @drive: a #GDrive.
-      * 
-      * Emitted when the physical eject button (if any) of a drive has
-      * been pressed.
-      **/
-      g_signal_new (I_("eject-button"),
-                    G_TYPE_DRIVE,
-                    G_SIGNAL_RUN_LAST,
-                    G_STRUCT_OFFSET (GDriveIface, eject_button),
-                    NULL, NULL,
-                    g_cclosure_marshal_VOID__VOID,
-                    G_TYPE_NONE, 0);
-
-      /**
-      * GDrive::stop-button:
-      * @drive: a #GDrive.
-      *
-      * Emitted when the physical stop button (if any) of a drive has
-      * been pressed.
-      *
-      * Since: 2.22
-      **/
-      g_signal_new (I_("stop-button"),
-                    G_TYPE_DRIVE,
-                    G_SIGNAL_RUN_LAST,
-                    G_STRUCT_OFFSET (GDriveIface, stop_button),
-                    NULL, NULL,
-                    g_cclosure_marshal_VOID__VOID,
-                    G_TYPE_NONE, 0);
-
-      initialized = TRUE;
-    }
+  /**
+   * GDrive::changed:
+   * @drive: a #GDrive.
+   *
+   * Emitted when the drive's state has changed.
+   **/
+  g_signal_new (I_("changed"),
+		G_TYPE_DRIVE,
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (GDriveIface, changed),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
+
+  /**
+   * GDrive::disconnected:
+   * @drive: a #GDrive.
+   *
+   * This signal is emitted when the #GDrive have been
+   * disconnected. If the recipient is holding references to the
+   * object they should release them so the object can be
+   * finalized.
+   **/
+  g_signal_new (I_("disconnected"),
+		G_TYPE_DRIVE,
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (GDriveIface, disconnected),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
+
+  /**
+   * GDrive::eject-button:
+   * @drive: a #GDrive.
+   *
+   * Emitted when the physical eject button (if any) of a drive has
+   * been pressed.
+   **/
+  g_signal_new (I_("eject-button"),
+		G_TYPE_DRIVE,
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (GDriveIface, eject_button),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
+
+  /**
+   * GDrive::stop-button:
+   * @drive: a #GDrive.
+   *
+   * Emitted when the physical stop button (if any) of a drive has
+   * been pressed.
+   *
+   * Since: 2.22
+   **/
+  g_signal_new (I_("stop-button"),
+		G_TYPE_DRIVE,
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (GDriveIface, stop_button),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
 }
 
 /**
diff --git a/gio/gfile.c b/gio/gfile.c
index edff98c..5bd8915 100644
--- a/gio/gfile.c
+++ b/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:
diff --git a/gio/gicon.c b/gio/gicon.c
index 32538b5..5c0083e 100644
--- a/gio/gicon.c
+++ b/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;
-}
-
-static void
-g_icon_class_init (gpointer g_class,
-		   gpointer class_data)
-{
-}
+typedef GIconIface GIconInterface;
+G_DEFINE_INTERFACE(GIcon, g_icon, G_TYPE_OBJECT)
 
 static void
-g_icon_base_init (gpointer g_class)
+g_icon_default_init (GIconInterface *iface)
 {
 }
 
diff --git a/gio/gloadableicon.c b/gio/gloadableicon.c
index b5ba6f5..9221d35 100644
--- a/gio/gloadableicon.c
+++ b/gio/gloadableicon.c
@@ -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.
diff --git a/gio/gmount.c b/gio/gmount.c
index 2eee073..3e80dfb 100644
--- a/gio/gmount.c
+++ b/gio/gmount.c
@@ -63,103 +63,58 @@
  * 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
-      * 
-      * Emitted when the mount has been changed.
-      **/
-      g_signal_new (I_("changed"),
-                    G_TYPE_MOUNT,
-                    G_SIGNAL_RUN_LAST,
-                    G_STRUCT_OFFSET (GMountIface, changed),
-                    NULL, NULL,
-                    g_cclosure_marshal_VOID__VOID,
-                    G_TYPE_NONE, 0);
-
-     /**
-      * GMount::unmounted:
-      * @mount: the object on which the signal is emitted
-      * 
-      * This signal is emitted when the #GMount have been
-      * unmounted. If the recipient is holding references to the
-      * object they should release them so the object can be
-      * finalized.
-      **/
-      g_signal_new (I_("unmounted"),
-                    G_TYPE_MOUNT,
-                    G_SIGNAL_RUN_LAST,
-                    G_STRUCT_OFFSET (GMountIface, unmounted),
-                    NULL, NULL,
-                    g_cclosure_marshal_VOID__VOID,
-                    G_TYPE_NONE, 0);
-     /**
-      * GMount::pre-unmount:
-      * @mount: the object on which the signal is emitted
-      *
-      * This signal is emitted when the #GMount is about to be
-      * unmounted.
-      *
-      * Since: 2.22
-      **/
-      g_signal_new (I_("pre-unmount"),
-                    G_TYPE_MOUNT,
-                    G_SIGNAL_RUN_LAST,
-                    G_STRUCT_OFFSET (GMountIface, pre_unmount),
-                    NULL, NULL,
-                    g_cclosure_marshal_VOID__VOID,
-                    G_TYPE_NONE, 0);
-
-      initialized = TRUE;
-    }
+  /**
+   * GMount::changed:
+   * @mount: the object on which the signal is emitted
+   *
+   * Emitted when the mount has been changed.
+   **/
+  g_signal_new (I_("changed"),
+                G_TYPE_MOUNT,
+                G_SIGNAL_RUN_LAST,
+                G_STRUCT_OFFSET (GMountIface, changed),
+                NULL, NULL,
+                g_cclosure_marshal_VOID__VOID,
+                G_TYPE_NONE, 0);
+
+  /**
+   * GMount::unmounted:
+   * @mount: the object on which the signal is emitted
+   *
+   * This signal is emitted when the #GMount have been
+   * unmounted. If the recipient is holding references to the
+   * object they should release them so the object can be
+   * finalized.
+   **/
+  g_signal_new (I_("unmounted"),
+                G_TYPE_MOUNT,
+                G_SIGNAL_RUN_LAST,
+                G_STRUCT_OFFSET (GMountIface, unmounted),
+                NULL, NULL,
+                g_cclosure_marshal_VOID__VOID,
+                G_TYPE_NONE, 0);
+  /**
+   * GMount::pre-unmount:
+   * @mount: the object on which the signal is emitted
+   *
+   * This signal is emitted when the #GMount is about to be
+   * unmounted.
+   *
+   * Since: 2.22
+   **/
+  g_signal_new (I_("pre-unmount"),
+                G_TYPE_MOUNT,
+                G_SIGNAL_RUN_LAST,
+                G_STRUCT_OFFSET (GMountIface, pre_unmount),
+                NULL, NULL,
+                g_cclosure_marshal_VOID__VOID,
+                G_TYPE_NONE, 0);
 }
 
 /**
diff --git a/gio/gseekable.c b/gio/gseekable.c
index a2cbb8a..04af1f8 100644
--- a/gio/gseekable.c
+++ b/gio/gseekable.c
@@ -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)
 {
 }
 
diff --git a/gio/gvolume.c b/gio/gvolume.c
index c58679c..b2b85bb 100644
--- a/gio/gvolume.c
+++ b/gio/gvolume.c
@@ -79,84 +79,39 @@
  * 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:
-      * 
-      * Emitted when the volume has been changed.
-      **/
-      g_signal_new (I_("changed"),
-                    G_TYPE_VOLUME,
-                    G_SIGNAL_RUN_LAST,
-                    G_STRUCT_OFFSET (GVolumeIface, changed),
-                    NULL, NULL,
-                    g_cclosure_marshal_VOID__VOID,
-                    G_TYPE_NONE, 0);
-
-     /**
-      * GVolume::removed:
-      * 
-      * This signal is emitted when the #GVolume have been removed. If
-      * the recipient is holding references to the object they should
-      * release them so the object can be finalized.
-      **/
-      g_signal_new (I_("removed"),
-                    G_TYPE_VOLUME,
-                    G_SIGNAL_RUN_LAST,
-                    G_STRUCT_OFFSET (GVolumeIface, removed),
-                    NULL, NULL,
-                    g_cclosure_marshal_VOID__VOID,
-                    G_TYPE_NONE, 0);
-
-      initialized = TRUE;
-    }
+  /**
+   * GVolume::changed:
+   * 
+   * Emitted when the volume has been changed.
+   **/
+  g_signal_new (I_("changed"),
+		G_TYPE_VOLUME,
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (GVolumeIface, changed),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
+
+  /**
+   * GVolume::removed:
+   * 
+   * This signal is emitted when the #GVolume have been removed. If
+   * the recipient is holding references to the object they should
+   * release them so the object can be finalized.
+   **/
+  g_signal_new (I_("removed"),
+		G_TYPE_VOLUME,
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (GVolumeIface, removed),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
 }
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]