diff options
author | Alexander Larsson <alexl@redhat.com> | 2008-03-04 11:14:32 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2008-03-04 11:14:32 +0000 |
commit | c71bb3706203039a18dac2eb3dc2ee53c8493cb8 (patch) | |
tree | 3c0d4b212ad9b09a63dbf70ebc77931edcbf09ba /common/gmountsource.c | |
parent | 13a1cd21fe5bbeb50c16b0a3cc68a0acb1af90b2 (diff) | |
download | gvfs-c71bb3706203039a18dac2eb3dc2ee53c8493cb8.tar.gz |
Work around problems with type registering when the common code is used in
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.
svn path=/trunk/; revision=1521
Diffstat (limited to 'common/gmountsource.c')
-rw-r--r-- | common/gmountsource.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/common/gmountsource.c b/common/gmountsource.c index 8e9ed961..8445def9 100644 --- a/common/gmountsource.c +++ b/common/gmountsource.c @@ -35,7 +35,32 @@ struct _GMountSource 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) |