[PATCH] Revert "Fix AFC mounts being shadowed"
- From: Bastien Nocera <hadess hadess net>
- Subject: [PATCH] Revert "Fix AFC mounts being shadowed"
- Date: Fri, 31 Jul 2009 18:11:05 +0100
This reverts commit 3889fe4132f05889976a64da50858759982cbf44.
Conflicts:
monitor/afc/afc-volume.c
---
monitor/afc/afc-volume-monitor.c | 13 ++++++++++-
monitor/afc/afc-volume.c | 42 ++++++++++++++++++++-----------------
monitor/afc/afc-volume.h | 3 +-
3 files changed, 37 insertions(+), 21 deletions(-)
diff --git a/monitor/afc/afc-volume-monitor.c b/monitor/afc/afc-volume-monitor.c
index 4ff91b7..da049a8 100644
--- a/monitor/afc/afc-volume-monitor.c
+++ b/monitor/afc/afc-volume-monitor.c
@@ -32,6 +32,8 @@ static void g_vfs_afc_monitor_create_volume(GVfsAfcVolumeMonitor *self, const
DBusError err;
GVfsAfcVolume *volume = NULL;
gchar *uuid = NULL;
+ GFile *activation_mount_root = NULL;
+ gchar *uri;
dbus_error_init(&err);
@@ -43,7 +45,12 @@ static void g_vfs_afc_monitor_create_volume(GVfsAfcVolumeMonitor *self, const
g_print("creating volume for device uuid '%s'\n", uuid);
- volume = g_vfs_afc_volume_new(G_VOLUME_MONITOR (self), udi, uuid);
+ uri = g_strdup_printf("afc://%s", uuid);
+
+ activation_mount_root = g_file_new_for_uri(uri);
+ g_free(uri);
+
+ volume = g_vfs_afc_volume_new(G_VOLUME_MONITOR (self), udi, uuid, activation_mount_root);
if (volume != NULL) {
self->volumes = g_list_prepend(self->volumes, volume);
g_signal_emit_by_name(self, "volume-added", volume);
@@ -52,6 +59,10 @@ static void g_vfs_afc_monitor_create_volume(GVfsAfcVolumeMonitor *self, const
if (uuid != NULL) {
g_free (uuid);
}
+
+ if (activation_mount_root != NULL) {
+ g_object_unref (activation_mount_root);
+ }
}
static GVfsAfcVolume *find_volume_by_uuid(GVfsAfcVolumeMonitor *self, const char * uuid)
diff --git a/monitor/afc/afc-volume.c b/monitor/afc/afc-volume.c
index ecfbf74..d886657 100644
--- a/monitor/afc/afc-volume.c
+++ b/monitor/afc/afc-volume.c
@@ -14,6 +14,8 @@ struct _GVfsAfcVolume {
GVolumeMonitor *monitor;
+ GFile *activation_root;
+
char *uuid;
char *udi;
@@ -33,6 +35,9 @@ static void g_vfs_afc_volume_finalize(GObject *self_)
self = G_VFS_AFC_VOLUME(self);
+ if (self->activation_root != NULL)
+ g_object_unref (self->activation_root);
+
g_free (self->uuid);
g_free (self->udi);
@@ -62,7 +67,8 @@ static void g_vfs_afc_volume_class_init(GVfsAfcVolumeClass *klass)
GVfsAfcVolume *g_vfs_afc_volume_new(GVolumeMonitor *monitor,
const char *udi,
- const char *uuid)
+ const char *uuid,
+ GFile *activation_root)
{
GVfsAfcVolume *self;
@@ -70,6 +76,7 @@ GVfsAfcVolume *g_vfs_afc_volume_new(GVolumeMonitor *monitor,
self->monitor = monitor;
self->uuid = g_strdup (uuid);
self->udi = g_strdup (udi);
+ self->activation_root = g_object_ref (activation_root);
return self;
}
@@ -139,7 +146,6 @@ typedef struct
{
GVfsAfcVolume *enclosing_volume;
GAsyncReadyCallback callback;
- GFile *root;
gpointer user_data;
} ActivationMountOp;
@@ -150,7 +156,6 @@ mount_callback (GObject *source_object,
{
ActivationMountOp *data = user_data;
data->callback (G_OBJECT (data->enclosing_volume), res, data->user_data);
- g_object_unref (data->root);
g_free (data);
}
@@ -164,26 +169,18 @@ g_vfs_afc_volume_mount (GVolume *volume,
{
GVfsAfcVolume *afc_volume = G_VFS_AFC_VOLUME (volume);
ActivationMountOp *data;
- GFile *root;
- char *uri;
- g_print ("g_vgs_afc_volume_mount (can_mount=%d uuid=%s)\n",
+ g_print ("g_vfs_afc_volume_mount (can_mount=%d uuid=%s)\n",
g_vfs_afc_volume_can_mount (volume),
+ afc_volume->activation_root,
afc_volume->uuid);
- uri = g_strdup_printf ("afc://%s", afc_volume->uuid);
- root = g_file_new_for_uri (uri);
- g_free (uri);
-
data = g_new0 (ActivationMountOp, 1);
data->enclosing_volume = afc_volume;
data->callback = callback;
data->user_data = user_data;
- data->root = root;
- g_object_set_data_full (G_OBJECT(volume), "root", g_object_ref (root), g_object_unref);
-
- g_file_mount_enclosing_volume (root,
+ g_file_mount_enclosing_volume (afc_volume->activation_root,
0,
mount_operation,
cancellable,
@@ -193,15 +190,13 @@ g_vfs_afc_volume_mount (GVolume *volume,
static gboolean
g_vfs_afc_volume_mount_finish (GVolume *volume,
- GAsyncResult *result,
- GError **error)
+ GAsyncResult *result,
+ GError **error)
{
GVfsAfcVolume *afc_volume = G_VFS_AFC_VOLUME (volume);
- GFile *root;
gboolean res;
- root = g_object_get_data (G_OBJECT (volume), "root");
- res = g_file_mount_enclosing_volume_finish (root, result, error);
+ res = g_file_mount_enclosing_volume_finish (afc_volume->activation_root, result, error);
return res;
}
@@ -243,6 +238,14 @@ g_vfs_afc_volume_enumerate_identifiers (GVolume *volume)
return (char **)g_ptr_array_free (res, FALSE);
}
+static GFile *
+g_vfs_afc_volume_get_activation_root (GVolume *volume)
+{
+ GVfsAfcVolume *afc_volume = G_VFS_AFC_VOLUME (volume);
+
+ return g_object_ref (afc_volume->activation_root);
+}
+
static void
g_vfs_afc_volume_iface_init (GVolumeIface *iface)
{
@@ -260,6 +263,7 @@ g_vfs_afc_volume_iface_init (GVolumeIface *iface)
iface->eject_finish = NULL;
iface->get_identifier = g_vfs_afc_volume_get_identifier;
iface->enumerate_identifiers = g_vfs_afc_volume_enumerate_identifiers;
+ iface->get_activation_root = g_vfs_afc_volume_get_activation_root;
}
char *g_vfs_afc_volume_get_udi(GVfsAfcVolume *volume)
diff --git a/monitor/afc/afc-volume.h b/monitor/afc/afc-volume.h
index 703610f..16f2398 100644
--- a/monitor/afc/afc-volume.h
+++ b/monitor/afc/afc-volume.h
@@ -37,7 +37,8 @@ GType g_vfs_afc_volume_get_type(void) G_GNUC_CONST;
GVfsAfcVolume *g_vfs_afc_volume_new(GVolumeMonitor *monitor,
const char *udi,
- const char *uuid);
+ const char *uuid,
+ GFile *activation_root);
char *g_vfs_afc_volume_get_udi(GVfsAfcVolume *volume);
gboolean g_vfs_afc_volume_has_uuid(GVfsAfcVolume *volume, const char *uuid);
--
1.6.2.5
--=-LYXq+VGwvZV89b+LyyUR--
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]