gvfs r1521 - in trunk: . common
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: gvfs r1521 - in trunk: . common
- Date: Tue,  4 Mar 2008 11:14:32 +0000 (GMT)
Author: alexl
Date: Tue Mar  4 11:14:32 2008
New Revision: 1521
URL: http://svn.gnome.org/viewvc/gvfs?rev=1521&view=rev
Log:
2008-03-04  Alexander Larsson  <alexl redhat com>
        * common/gmountsource.c:
        * common/gmounttracker.c:
	Work around problems with type registering when the common code
	is used in both daemon and client.
Modified:
   trunk/ChangeLog
   trunk/common/gmountsource.c
   trunk/common/gmounttracker.c
Modified: trunk/common/gmountsource.c
==============================================================================
--- trunk/common/gmountsource.c	(original)
+++ trunk/common/gmountsource.c	Tue Mar  4 11:14:32 2008
@@ -35,7 +35,32 @@
   char *obj_path;
 };
 
+/* We use this hack to avoid problems when this code
+   is shared in both the daemon and the client */
+static GType _g_mount_source_get_type (void) G_GNUC_CONST;
+
+#define g_mount_source_get_type _g_mount_source_get_type
 G_DEFINE_TYPE (GMountSource, g_mount_source, G_TYPE_OBJECT)
+#undef g_mount_source_get_type
+
+GType
+g_mount_source_get_type (void)
+{
+  static volatile gsize type_volatile = 0;
+  
+  if (g_once_init_enter (&type_volatile))
+    {
+      GType type;
+      
+      type = g_type_from_name ("GMountSource");
+      if (type == 0)
+	type = _g_mount_source_get_type ();
+      
+      g_once_init_leave (&type_volatile, type);
+    }
+  
+  return type_volatile;
+}
 
 static void
 g_mount_source_finalize (GObject *object)
Modified: trunk/common/gmounttracker.c
==============================================================================
--- trunk/common/gmounttracker.c	(original)
+++ trunk/common/gmounttracker.c	Tue Mar  4 11:14:32 2008
@@ -54,7 +54,33 @@
   DBusConnection *connection;
 };
 
+/* We use this hack to avoid problems when this code
+   is shared in both the daemon and the client */
+static GType _g_mount_tracker_get_type (void) G_GNUC_CONST;
+
+#define g_mount_tracker_get_type _g_mount_tracker_get_type
 G_DEFINE_TYPE (GMountTracker, g_mount_tracker, G_TYPE_OBJECT)
+#undef g_mount_tracker_get_type
+
+GType
+g_mount_tracker_get_type (void)
+{
+  static volatile gsize type_volatile = 0;
+  
+  if (g_once_init_enter (&type_volatile))
+    {
+      GType type;
+      
+      type = g_type_from_name ("GMountTracker");
+      if (type == 0)
+	type = _g_mount_tracker_get_type ();
+      
+      g_once_init_leave (&type_volatile, type);
+    }
+  
+  return type_volatile;
+}
+
 
 static DBusHandlerResult g_mount_tracker_filter_func  (DBusConnection        *conn,
 						       DBusMessage           *message,
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]