summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--client/gdaemonvfs.c15
-rw-r--r--client/gdaemonvfs.h7
-rw-r--r--client/gdaemonvolumemonitor.c26
-rw-r--r--hal/ghalvolumemonitor.c4
-rw-r--r--hal/hal-module.c5
-rw-r--r--hal/hal-pool.c1
7 files changed, 52 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 800a1cd7..4a292d16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2007-12-19 Alexander Larsson <alexl@redhat.com>
+
+ * client/gdaemonvfs.[ch]:
+ * client/gdaemonvolumemonitor.c:
+ * hal/ghalvolumemonitor.c:
+ * hal/hal-module.c:
+ Remove spew
+ Update for new APIs
+ Don't use GDaemonVolumeMonitor if not using GDaemonVfs.
+
+ * hal/hal-pool.c:
+ Close custom dbus connection before unrefing
+
2007-12-19 David Zeuthen <davidz@redhat.com>
Add the cdda:// backend for Compact Disc Digital Audio discs.
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c
index 50220ef6..5906b9c2 100644
--- a/client/gdaemonvfs.c
+++ b/client/gdaemonvfs.c
@@ -38,13 +38,6 @@
#include "gdaemonvolumemonitor.h"
#include <glib/gi18n-lib.h>
-#define G_TYPE_DAEMON_VFS (g_daemon_vfs_get_type ())
-#define G_DAEMON_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DAEMON_VFS, GDaemonVfs))
-#define G_DAEMON_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_DAEMON_VFS, GDaemonVfsClass))
-#define G_IS_DAEMON_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DAEMON_VFS))
-#define G_IS_DAEMON_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_DAEMON_VFS))
-#define G_DAEMON_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_DAEMON_VFS, GDaemonVfsClass))
-
struct _GDaemonVfs
{
@@ -180,6 +173,7 @@ g_daemon_vfs_init (GDaemonVfs *vfs)
guint n_mappers;
const char * const *schemes, * const *mount_types;
GVfsUriMapper *mapper;
+ GList *modules;
int i;
vfs->async_bus = dbus_bus_get_private (DBUS_BUS_SESSION, NULL);
@@ -209,7 +203,7 @@ g_daemon_vfs_init (GDaemonVfs *vfs)
_g_dbus_connection_integrate_with_main (vfs->async_bus);
- g_io_modules_load_all_in_directory (GVFS_MODULE_DIR);
+ modules = g_io_modules_load_all_in_directory (GVFS_MODULE_DIR);
vfs->from_uri_hash = g_hash_table_new (g_str_hash, g_str_equal);
vfs->to_uri_hash = g_hash_table_new (g_str_hash, g_str_equal);
@@ -228,7 +222,10 @@ g_daemon_vfs_init (GDaemonVfs *vfs)
for (i = 0; mount_types != NULL && mount_types[i] != NULL; i++)
g_hash_table_insert (vfs->to_uri_hash, (char *)mount_types[i], mapper);
}
-
+
+ /* The above should have ref:ed the modules anyway */
+ g_list_foreach (modules, g_type_module_unuse, NULL);
+ g_list_free (modules);
g_free (mappers);
}
diff --git a/client/gdaemonvfs.h b/client/gdaemonvfs.h
index 4b7ed693..1ae89714 100644
--- a/client/gdaemonvfs.h
+++ b/client/gdaemonvfs.h
@@ -31,6 +31,13 @@
G_BEGIN_DECLS
+#define G_TYPE_DAEMON_VFS (g_daemon_vfs_get_type ())
+#define G_DAEMON_VFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DAEMON_VFS, GDaemonVfs))
+#define G_DAEMON_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_DAEMON_VFS, GDaemonVfsClass))
+#define G_IS_DAEMON_VFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DAEMON_VFS))
+#define G_IS_DAEMON_VFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_DAEMON_VFS))
+#define G_DAEMON_VFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_DAEMON_VFS, GDaemonVfsClass))
+
typedef struct _GDaemonVfs GDaemonVfs;
typedef struct _GDaemonVfsClass GDaemonVfsClass;
diff --git a/client/gdaemonvolumemonitor.c b/client/gdaemonvolumemonitor.c
index 77effae2..adc9bba3 100644
--- a/client/gdaemonvolumemonitor.c
+++ b/client/gdaemonvolumemonitor.c
@@ -28,6 +28,7 @@
#include <glib/gi18n-lib.h>
#include "gdaemonvolumemonitor.h"
#include "gdaemonmount.h"
+#include "gdaemonvfs.h"
#include "gmounttracker.h"
struct _GDaemonVolumeMonitor {
@@ -151,7 +152,7 @@ g_daemon_volume_monitor_init (GDaemonVolumeMonitor *daemon_monitor)
GDaemonMount *mount;
GMountInfo *info;
GVolume *volume;
-
+
daemon_monitor->mount_tracker = g_mount_tracker_new (_g_daemon_vfs_get_async_bus ());
g_signal_connect_swapped (daemon_monitor->mount_tracker, "mounted",
@@ -188,9 +189,9 @@ g_daemon_volume_monitor_finalize (GObject *object)
g_signal_handlers_disconnect_by_func (monitor->mount_tracker, mount_added, monitor);
g_signal_handlers_disconnect_by_func (monitor->mount_tracker, mount_removed, monitor);
-
+
g_object_unref (monitor->mount_tracker);
-
+
g_list_foreach (monitor->mounts, (GFunc)g_object_unref, NULL);
g_list_free (monitor->mounts);
@@ -203,6 +204,24 @@ g_daemon_volume_monitor_class_finalize (GDaemonVolumeMonitorClass *klass)
{
}
+static gboolean
+is_supported (void)
+{
+ GVfs *vfs;
+ gboolean res;
+
+
+ res = FALSE;
+
+ /* Don't do anything if the default vfs is not DAEMON_VFS */
+ vfs = g_vfs_get_default ();
+
+ if (vfs != NULL && G_IS_DAEMON_VFS (vfs))
+ res = TRUE;
+
+ return res;
+}
+
static void
g_daemon_volume_monitor_class_init (GDaemonVolumeMonitorClass *klass)
{
@@ -211,6 +230,7 @@ g_daemon_volume_monitor_class_init (GDaemonVolumeMonitorClass *klass)
gobject_class->finalize = g_daemon_volume_monitor_finalize;
+ monitor_class->is_supported = is_supported;
monitor_class->get_mounts = get_mounts;
monitor_class->get_volumes = get_volumes;
monitor_class->get_connected_drives = get_connected_drives;
diff --git a/hal/ghalvolumemonitor.c b/hal/ghalvolumemonitor.c
index 9bc8fdee..24a5d629 100644
--- a/hal/ghalvolumemonitor.c
+++ b/hal/ghalvolumemonitor.c
@@ -89,8 +89,6 @@ g_hal_volume_monitor_finalize (GObject *object)
{
GHalVolumeMonitor *monitor;
- g_warning ("finalizing hal vm");
-
the_volume_monitor = NULL;
monitor = G_HAL_VOLUME_MONITOR (object);
@@ -465,11 +463,11 @@ g_hal_volume_monitor_class_init (GHalVolumeMonitorClass *klass)
monitor_class->get_volume_for_uuid = get_volume_for_uuid;
monitor_class->get_mount_for_uuid = get_mount_for_uuid;
monitor_class->adopt_orphan_mount = adopt_orphan_mount;
+ monitor_class->is_supported = is_supported;
native_class->priority = 1;
native_class->name = "hal";
native_class->get_mount_for_mount_path = get_mount_for_mount_path;
- native_class->is_supported = is_supported;
}
/**
diff --git a/hal/hal-module.c b/hal/hal-module.c
index 66c75772..46b53041 100644
--- a/hal/hal-module.c
+++ b/hal/hal-module.c
@@ -42,12 +42,9 @@ g_io_module_load (GIOModule *module)
g_hal_mount_register (module);
g_hal_volume_register (module);
g_hal_volume_monitor_register (module);
-
- //g_warning ("hal loaded");
-}
+ }
void
g_io_module_unload (GIOModule *module)
{
- //g_warning ("hal unloaded");
}
diff --git a/hal/hal-pool.c b/hal/hal-pool.c
index 2377e09b..91e91291 100644
--- a/hal/hal-pool.c
+++ b/hal/hal-pool.c
@@ -61,6 +61,7 @@ hal_pool_finalize (HalPool *pool)
"interface='org.freedesktop.Hal.Device',"
"sender='org.freedesktop.Hal'", NULL);
libhal_ctx_shutdown (pool->priv->hal_ctx, NULL);
+ dbus_connection_close (pool->priv->dbus_connection);
dbus_connection_unref (pool->priv->dbus_connection);
if (G_OBJECT_CLASS (hal_pool_parent_class)->finalize)