summaryrefslogtreecommitdiff
path: root/client/gdaemonvfs.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2007-11-07 12:04:15 +0000
committerAlexander Larsson <alexl@src.gnome.org>2007-11-07 12:04:15 +0000
commit43a3f3df0a5f77b5b42139ff42e5381663b38949 (patch)
tree149cf8571f201d7f3bb07dbcf7b79bb6ea1227de /client/gdaemonvfs.c
parentddb76a1a3ef03815d30655031c30ca1b4097d197 (diff)
downloadgvfs-43a3f3df0a5f77b5b42139ff42e5381663b38949.tar.gz
Update to new gvfs construction API
2007-11-07 Alexander Larsson <alexl@redhat.com> * client/gdaemonvfs.c: Update to new gvfs construction API svn path=/trunk/; revision=1017
Diffstat (limited to 'client/gdaemonvfs.c')
-rw-r--r--client/gdaemonvfs.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c
index 9b8c4222..1aa08fe6 100644
--- a/client/gdaemonvfs.c
+++ b/client/gdaemonvfs.c
@@ -80,8 +80,11 @@ g_daemon_vfs_finalize (GObject *object)
vfs = G_DAEMON_VFS (object);
- g_hash_table_destroy (vfs->from_uri_hash);
- g_hash_table_destroy (vfs->to_uri_hash);
+ if (vfs->from_uri_hash)
+ g_hash_table_destroy (vfs->from_uri_hash);
+
+ if (vfs->to_uri_hash)
+ g_hash_table_destroy (vfs->to_uri_hash);
g_strfreev (vfs->supported_uri_schemes);
@@ -91,6 +94,9 @@ g_daemon_vfs_finalize (GObject *object)
dbus_connection_unref (vfs->async_bus);
}
+ if (vfs->wrapped_vfs)
+ g_object_unref (vfs->wrapped_vfs);
+
/* must chain up */
G_OBJECT_CLASS (g_daemon_vfs_parent_class)->finalize (object);
}
@@ -165,15 +171,17 @@ g_daemon_vfs_init (GDaemonVfs *vfs)
g_assert (the_vfs == NULL);
the_vfs = vfs;
- vfs->wrapped_vfs = g_vfs_get_local ();
-
if (g_thread_supported ())
dbus_threads_init_default ();
vfs->async_bus = dbus_bus_get_private (DBUS_BUS_SESSION, NULL);
- if (vfs->async_bus)
- _g_dbus_connection_integrate_with_main (vfs->async_bus);
+ if (vfs->async_bus == NULL)
+ return;
+
+ vfs->wrapped_vfs = g_vfs_get_local ();
+
+ _g_dbus_connection_integrate_with_main (vfs->async_bus);
g_io_modules_ensure_loaded (GVFS_MODULE_DIR);
@@ -668,16 +676,11 @@ _g_daemon_vfs_get_async_bus (void)
return the_vfs->async_bus;
}
-static const char *
-g_daemon_vfs_get_name (GVfs *vfs)
-{
- return "gvfs";
-}
-
-static int
-g_daemon_vfs_get_priority (GVfs *vfs)
+static gboolean
+g_daemon_vfs_is_active (GVfs *vfs)
{
- return 10;
+ GDaemonVfs *daemon_vfs = G_DAEMON_VFS (vfs);
+ return daemon_vfs->async_bus != NULL;
}
static void
@@ -698,8 +701,11 @@ g_daemon_vfs_class_init (GDaemonVfsClass *class)
object_class->finalize = g_daemon_vfs_finalize;
vfs_class = G_VFS_CLASS (class);
- vfs_class->get_name = g_daemon_vfs_get_name;
- vfs_class->get_priority = g_daemon_vfs_get_priority;
+
+ vfs_class->name = "gvfs";
+ vfs_class->priority = 10;
+
+ vfs_class->is_active = g_daemon_vfs_is_active;
vfs_class->get_file_for_path = g_daemon_vfs_get_file_for_path;
vfs_class->get_file_for_uri = g_daemon_vfs_get_file_for_uri;
vfs_class->get_supported_uri_schemes = g_daemon_vfs_get_supported_uri_schemes;