copy f12 changes

This commit is contained in:
Matthias Clasen 2009-11-12 17:32:43 +00:00
parent 19cc61cc96
commit 151763b96b
15 changed files with 557 additions and 497 deletions

View File

@ -1,31 +0,0 @@
From 37a559fdaf0b5cb880acd3718ed134fa7c48884d Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Tue, 13 Oct 2009 17:11:23 +0200
Subject: [PATCH 1/3] Disallow mounting empty drives
This concerns only removable media drives without any detected volumes.
The end result is no Mount item in Nautilus popup menu and no action taken
on double-click over the drive icon.
The exception is floppy drives, where we always allow mount without need
of detecting media manually first.
---
daemon/gvfsbackendcomputer.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemon/gvfsbackendcomputer.c b/daemon/gvfsbackendcomputer.c
index 4f4b9ca..7c6000c 100644
--- a/daemon/gvfsbackendcomputer.c
+++ b/daemon/gvfsbackendcomputer.c
@@ -473,7 +473,7 @@ recompute_files (GVfsBackendComputer *backend)
file->icon = g_drive_get_icon (file->drive);
file->display_name = g_drive_get_name (file->drive);
file->can_eject = g_drive_can_eject (file->drive);
- file->can_mount = TRUE;
+ file->can_mount = ! g_drive_is_media_removable (file->drive) || ! g_drive_is_media_check_automatic (file->drive) || g_drive_has_media (file->drive);
}
if (file->drive)
--
1.6.5.rc2

View File

@ -1,28 +0,0 @@
From 441c8a2daa493228b0a0466006f784c63a31a01e Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Tue, 13 Oct 2009 17:12:33 +0200
Subject: [PATCH 2/3] Disallow ejecting empty drives
Similar to previous commit, hide the Eject menu item when drive has no media.
---
monitor/gdu/ggdudrive.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/monitor/gdu/ggdudrive.c b/monitor/gdu/ggdudrive.c
index 20f8940..79c6809 100644
--- a/monitor/gdu/ggdudrive.c
+++ b/monitor/gdu/ggdudrive.c
@@ -188,7 +188,9 @@ update_drive (GGduDrive *drive)
*
* See also below where we e.g. set can_eject to TRUE for non-removable drives.
*/
- drive->can_eject = gdu_device_drive_get_is_media_ejectable (device) || gdu_device_drive_get_requires_eject (device) || gdu_device_is_removable (device);
+ drive->can_eject = ((gdu_device_drive_get_is_media_ejectable (device) || gdu_device_is_removable (device)) &&
+ gdu_device_is_media_available (device) && ! _is_pc_floppy_drive (device)) ||
+ gdu_device_drive_get_requires_eject (device);
drive->is_media_check_automatic = gdu_device_is_media_change_detected (device);
drive->can_poll_for_media = gdu_device_is_removable (device);
}
--
1.6.5.rc2

View File

@ -1,48 +0,0 @@
From becda6e9e9f8edb0042c0ca4844228ccfc907a7b Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Tue, 13 Oct 2009 17:13:02 +0200
Subject: [PATCH 3/3] Silently drop eject error messages when detaching drive
If there's no media in drive and yet it's marked as detachable,
calling eject would cause "no media in drive" error.
This is the case with my USB SD card reader.
---
monitor/gdu/ggdudrive.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/monitor/gdu/ggdudrive.c b/monitor/gdu/ggdudrive.c
index 79c6809..309e18c 100644
--- a/monitor/gdu/ggdudrive.c
+++ b/monitor/gdu/ggdudrive.c
@@ -641,6 +641,18 @@ eject_cb (GduDevice *device,
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
GGduDrive *drive;
+ gboolean drive_detachable;
+
+ drive = G_GDU_DRIVE (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
+ drive_detachable = drive->can_stop == FALSE && drive->start_stop_type == G_DRIVE_START_STOP_TYPE_SHUTDOWN;
+
+ if (error != NULL && error->code == G_IO_ERROR_FAILED &&
+ drive_detachable && ! drive->has_media && drive->is_media_removable)
+ {
+ /* Silently drop the error if there's no media in drive and we're still trying to detach it (see below) */
+ g_error_free (error);
+ error = NULL;
+ }
if (error != NULL)
{
@@ -651,8 +663,7 @@ eject_cb (GduDevice *device,
goto out;
}
- drive = G_GDU_DRIVE (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
- if (drive->can_stop == FALSE && drive->start_stop_type == G_DRIVE_START_STOP_TYPE_SHUTDOWN)
+ if (drive_detachable)
{
/* If device is not ejectable but it is detachable and we don't support stop(),
* then also run Detach() after Eject() - see update_drive() for details for why...
--
1.6.5.rc2

View File

@ -1,84 +0,0 @@
From dfa4b522b5c19c4723004baab3e54592f9875597 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Thu, 1 Oct 2009 16:49:32 -0400
Subject: [PATCH] =?UTF-8?q?Bug=20597041=20=E2=80=93=20Manual=20umount=20triggers=20mount=20request?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We also need to consider logical partitions when determining if a
drive should be ignored.
---
monitor/gdu/ggduvolumemonitor.c | 41 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 40 insertions(+), 1 deletions(-)
diff --git a/monitor/gdu/ggduvolumemonitor.c b/monitor/gdu/ggduvolumemonitor.c
index ac90ba4..83d8fc2 100644
--- a/monitor/gdu/ggduvolumemonitor.c
+++ b/monitor/gdu/ggduvolumemonitor.c
@@ -871,7 +871,7 @@ should_drive_be_ignored (GduPool *pool, GduDrive *d, GList *fstab_mount_points)
/* never ignore a drive if it has volumes that we don't want to ignore */
enclosed = gdu_pool_get_enclosed_presentables (pool, GDU_PRESENTABLE (d));
- for (l = enclosed; l != NULL; l = l->next)
+ for (l = enclosed; l != NULL && all_volumes_are_ignored; l = l->next)
{
GduPresentable *enclosed_presentable = GDU_PRESENTABLE (l->data);
@@ -879,6 +879,7 @@ should_drive_be_ignored (GduPool *pool, GduDrive *d, GList *fstab_mount_points)
if (GDU_IS_VOLUME (enclosed_presentable))
{
GduVolume *volume = GDU_VOLUME (enclosed_presentable);
+ GduDevice *volume_device;
have_volumes = TRUE;
@@ -887,6 +888,44 @@ should_drive_be_ignored (GduPool *pool, GduDrive *d, GList *fstab_mount_points)
all_volumes_are_ignored = FALSE;
break;
}
+
+ /* The volume may be an extended partition - we need to check all logical
+ * partitions as well (#597041)
+ */
+ volume_device = gdu_presentable_get_device (GDU_PRESENTABLE (volume));
+ if (volume_device != NULL)
+ {
+ if (g_strcmp0 (gdu_device_partition_get_scheme (volume_device), "mbr") == 0)
+ {
+ gint type;
+
+ type = strtol (gdu_device_partition_get_type (volume_device), NULL, 0);
+ if (type == 0x05 || type == 0x0f || type == 0x85)
+ {
+ GList *enclosed_logical;
+ GList *ll;
+
+ enclosed_logical = gdu_pool_get_enclosed_presentables (pool, GDU_PRESENTABLE (volume));
+ for (ll = enclosed_logical; ll != NULL && all_volumes_are_ignored; ll = ll->next)
+ {
+ GduPresentable *enclosed_logical_presentable = GDU_PRESENTABLE (ll->data);
+
+ if (GDU_IS_VOLUME (enclosed_logical_presentable))
+ {
+ if (!should_volume_be_ignored (pool,
+ GDU_VOLUME (enclosed_logical_presentable),
+ fstab_mount_points))
+ {
+ all_volumes_are_ignored = FALSE;
+ }
+ }
+ }
+ g_list_foreach (enclosed_logical, (GFunc) g_object_unref, NULL);
+ g_list_free (enclosed_logical);
+ }
+ }
+ g_object_unref (volume_device);
+ }
}
}
--
1.6.4.4

View File

@ -1,26 +0,0 @@
From 7a430e4dc930115b620bf3aa2b9682ee1047dc48 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Thu, 8 Oct 2009 15:48:15 +0200
Subject: [PATCH] Fix creating mount_spec from string
Don't consume the ending character.
---
common/gmountspec.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/gmountspec.c b/common/gmountspec.c
index c55f996..1a9a60a 100644
--- a/common/gmountspec.c
+++ b/common/gmountspec.c
@@ -514,7 +514,7 @@ g_mount_spec_new_from_string (const gchar *str,
if (colon)
{
item.key = g_strdup ("type");
- item.value = g_strndup (str, colon - str - 1);
+ item.value = g_strndup (str, colon - str);
g_array_append_val (items, item);
str = colon + 1;
}
--
1.6.5.rc2

View File

@ -1,53 +0,0 @@
From a8cfac72e68eca250799065c59e3722fc88c5b87 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Mon, 12 Oct 2009 14:31:58 +0000
Subject: Bug 597585 2.28 lists mtp devices as being cameras with gudev backend
Set correct MIME type for MTP music players based on whether it's a camera or a
music player.
Signed-off-by: David Zeuthen <davidz@redhat.com>
---
diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c
index 3edd26f..45d030a 100644
--- a/daemon/gvfsbackendgphoto2.c
+++ b/daemon/gvfsbackendgphoto2.c
@@ -740,7 +740,9 @@ setup_for_device (GVfsBackendGphoto2 *gphoto2_backend)
{
gchar *devname;
char *comma;
+ gboolean is_media_player = FALSE;
char *camera_x_content_types[] = {"x-content/image-dcf", NULL};
+ char *media_player_x_content_types[] = {"x-content/audio-player", NULL};
/* turn usb:001,041 string into an udev device name */
if (!g_str_has_prefix (gphoto2_backend->gphoto2_port, "usb:"))
@@ -763,16 +765,25 @@ setup_for_device (GVfsBackendGphoto2 *gphoto2_backend)
/* determine icon name */
if (g_udev_device_has_property (gphoto2_backend->udev_device, "ID_MEDIA_PLAYER_ICON_NAME"))
+ {
gphoto2_backend->icon_name = g_strdup (g_udev_device_get_property (gphoto2_backend->udev_device, "ID_MEDIA_PLAYER_ICON_NAME"));
+ is_media_player = TRUE;
+ }
else if (g_udev_device_has_property (gphoto2_backend->udev_device, "ID_MEDIA_PLAYER"))
+ {
gphoto2_backend->icon_name = g_strdup ("multimedia-player");
+ is_media_player = TRUE;
+ }
else
gphoto2_backend->icon_name = g_strdup ("camera-photo");
}
else
DEBUG ("-> did not find matching udev device");
- g_vfs_backend_set_x_content_types (G_VFS_BACKEND (gphoto2_backend), camera_x_content_types);
+ if (is_media_player)
+ g_vfs_backend_set_x_content_types (G_VFS_BACKEND (gphoto2_backend), media_player_x_content_types);
+ else
+ g_vfs_backend_set_x_content_types (G_VFS_BACKEND (gphoto2_backend), camera_x_content_types);
}
static void
--
cgit v0.8.2

View File

@ -1,23 +0,0 @@
From 780bae9c28df7e6d5f2463d9621f7db48524ee24 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Fri, 09 Oct 2009 00:26:11 +0000
Subject: Fix return value of gdu_drive_can_poll_for_media()
If a drive doesn't use removable media, we shouldn't advertise that it
can be polled.
---
diff --git a/monitor/gdu/ggdudrive.c b/monitor/gdu/ggdudrive.c
index 9920829..20f8940 100644
--- a/monitor/gdu/ggdudrive.c
+++ b/monitor/gdu/ggdudrive.c
@@ -190,7 +190,7 @@ update_drive (GGduDrive *drive)
*/
drive->can_eject = gdu_device_drive_get_is_media_ejectable (device) || gdu_device_drive_get_requires_eject (device) || gdu_device_is_removable (device);
drive->is_media_check_automatic = gdu_device_is_media_change_detected (device);
- drive->can_poll_for_media = TRUE;
+ drive->can_poll_for_media = gdu_device_is_removable (device);
}
/* determine start/stop type */
--
cgit v0.8.2

View File

@ -1,84 +0,0 @@
From 92bd6869f22bbe582f51f4ffca4d71f65ef9d6a6 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Fri, 09 Oct 2009 00:20:27 +0000
Subject: Bug 597864 Need to separate "Safely Remove Drive" from "Eject"
Some systems use internal USB devices. Automatically detaching such
drives when calling gdu_drive_eject() (triggered by e.g. the eject
button in the Nautilus sidebar) as we do right now leads to loss of
the drive until reboot (since the device is internal). The only viable
option right now is to separate "Safely Remove Drive" and "Eject".
If we gain infrastructure to let us know with 100% accuracy that a
given receptacle is external we can go back to the previous behavior.
See http://bugs.freedesktop.org/show_bug.cgi?id=24343 for details.
---
diff --git a/monitor/gdu/ggdudrive.c b/monitor/gdu/ggdudrive.c
index b99ef6e..9920829 100644
--- a/monitor/gdu/ggdudrive.c
+++ b/monitor/gdu/ggdudrive.c
@@ -212,39 +212,31 @@ update_drive (GGduDrive *drive)
}
else if (device != NULL && gdu_device_drive_get_can_detach (device))
{
- /* If the device is not ejectable, just detach on Eject() and claim to be ejectable.
+ /* Ideally, for non-ejectable devices (e.g. non-cdrom, non-zip)
+ * such as USB sticks we'd display "Eject" instead of "Shutdown"
+ * since it is more familiar and the common case. The way this
+ * should work is that after the Eject() method returns we call
+ * Detach() - see eject_cb() below.
*
- * This is so we get the UI to display "Eject" instead of "Shutdown" since it is
- * more familiar and the common case. The way this works is that after the Eject()
- * method returns we call Detach() - see eject_cb() below.
+ * (Note that it's not enough to just call Detach() since some
+ * devices, such as the Kindle, only works with Eject(). So we
+ * call them both in order).
*
- * (Note that it's not enough to just call Detach() since some devices, such as
- * the Kindle, only works with Eject(). So we call them both in order)
+ * We actually used to do this (and that's why eject_cb() still
+ * has this code) but some systems use internal USB devices for
+ * e.g. SD card readers. If we were to detach these then the
+ * user would have to power-cycle the system to get the device
+ * back. See http://bugs.freedesktop.org/show_bug.cgi?id=24343
+ * for more details.
+ *
+ * In the future, if we know for sure that a port is external
+ * (like, from DMI data) we can go back to doing this. For now
+ * the user will get all the options...
*/
- if (!gdu_device_drive_get_is_media_ejectable (device))
- {
- drive->can_eject = TRUE;
- /* we still set this since
- *
- * a) it helps when debugging things using gvfs-mount(1) output
- * since the tool will print can_stop=0 but start_stop_type=shutdown
- *
- * b) we use it in eject_cb() to determine we need to call Detach()
- * after Eject() successfully completes
- */
- drive->start_stop_type = G_DRIVE_START_STOP_TYPE_SHUTDOWN;
- }
- else
- {
- /* So here the device is ejectable and detachable - for example, a USB CD-ROM
- * drive or a CD-ROM drive in an Ultrabay - for these, we want to offer both
- * "Eject" and "Shutdown" options in the UI
- */
- drive->can_stop = TRUE;
- drive->can_start = FALSE;
- drive->can_start_degraded = FALSE;
- drive->start_stop_type = G_DRIVE_START_STOP_TYPE_SHUTDOWN;
- }
+ drive->can_stop = TRUE;
+ drive->can_start = FALSE;
+ drive->can_start_degraded = FALSE;
+ drive->start_stop_type = G_DRIVE_START_STOP_TYPE_SHUTDOWN;
}
if (device != NULL)
--
cgit v0.8.2

View File

@ -1,65 +0,0 @@
From 0b09cc8e57bc5fa701dd685d648fd338b92b2c48 Mon Sep 17 00:00:00 2001
From: Alexander Larsson <alexl@redhat.com>
Date: Thu, 08 Oct 2009 13:11:10 +0000
Subject: Don't always overwrite on trash restore
We want to get overwrite dialogs when restoring from trash.
https://bugzilla.gnome.org/show_bug.cgi?id=596618
---
diff --git a/daemon/gvfsbackendtrash.c b/daemon/gvfsbackendtrash.c
index 166bd04..e515fb8 100644
--- a/daemon/gvfsbackendtrash.c
+++ b/daemon/gvfsbackendtrash.c
@@ -447,7 +447,7 @@ trash_backend_pull (GVfsBackend *vfs_backend,
destination = g_file_new_for_path (local_path);
if (remove_source)
- it_worked = trash_item_restore (item, destination, &error);
+ it_worked = trash_item_restore (item, destination, flags, &error);
else
it_worked = g_file_copy (real, destination, flags,
G_VFS_JOB (job)->cancellable,
diff --git a/daemon/trashlib/trashitem.c b/daemon/trashlib/trashitem.c
index 335e8d4..bcfc301 100644
--- a/daemon/trashlib/trashitem.c
+++ b/daemon/trashlib/trashitem.c
@@ -486,7 +486,9 @@ trash_item_delete (TrashItem *item,
temp_name = g_file_get_child (expunged, buffer);
/* "restore" the item into the expunged folder */
- if (trash_item_restore (item, temp_name, NULL))
+ if (trash_item_restore (item, temp_name,
+ G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS,
+ NULL))
{
trash_expunge (expunged);
success = TRUE;
@@ -507,11 +509,11 @@ trash_item_delete (TrashItem *item,
gboolean
trash_item_restore (TrashItem *item,
GFile *dest,
+ GFileCopyFlags flags,
GError **error)
{
if (g_file_move (item->file, dest,
- G_FILE_COPY_OVERWRITE |
- G_FILE_COPY_NOFOLLOW_SYMLINKS |
+ flags |
G_FILE_COPY_NO_FALLBACK_FOR_MOVE,
NULL, NULL, NULL, error))
{
diff --git a/daemon/trashlib/trashitem.h b/daemon/trashlib/trashitem.h
index 0fe0938..ad78202 100644
--- a/daemon/trashlib/trashitem.h
+++ b/daemon/trashlib/trashitem.h
@@ -54,6 +54,7 @@ gboolean trash_item_delete (TrashItem *item,
GError **error);
gboolean trash_item_restore (TrashItem *item,
GFile *dest,
+ GFileCopyFlags flags,
GError **error);
#endif /* _trashitem_h_ */
--
cgit v0.8.2

View File

@ -0,0 +1,404 @@
From 48cf9c174f347f92c3fab7ff50b38effda0eb78a Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Fri, 30 Oct 2009 17:06:26 +0000
Subject: Gently handle NULL GduDevice objects
This patch adds bunch of tests for NULL GduDevice objects. According to
gdu docs, there's a possibility to have GduPresentable and no associated
GduDevice. It's not common but true for several special cases -
like GduLinuxMdDrive.
Signed-off-by: David Zeuthen <davidz@redhat.com>
---
diff --git a/monitor/gdu/ggduvolume.c b/monitor/gdu/ggduvolume.c
index 865a7b7..28839fd 100644
--- a/monitor/gdu/ggduvolume.c
+++ b/monitor/gdu/ggduvolume.c
@@ -172,7 +172,7 @@ static gboolean
update_volume (GGduVolume *volume)
{
GduDevice *device;
- GduPool *pool;
+ GduPool *pool = NULL;
time_t now;
gboolean changed;
gboolean old_can_mount;
@@ -217,10 +217,11 @@ update_volume (GGduVolume *volume)
/* in with the new */
device = gdu_presentable_get_device (GDU_PRESENTABLE (volume->gdu_volume));
- pool = gdu_device_get_pool (device);
+ if (device != NULL)
+ pool = gdu_device_get_pool (device);
keep_cleartext_volume = FALSE;
- if (gdu_device_is_luks (device))
+ if (device != NULL && gdu_device_is_luks (device))
{
const gchar *holder_objpath;
@@ -287,13 +288,17 @@ update_volume (GGduVolume *volume)
volume->name = gdu_presentable_get_name (GDU_PRESENTABLE (volume->cleartext_gdu_volume));
g_free (volume->device_file);
- volume->device_file = g_strdup (gdu_device_get_device_file (luks_cleartext_volume_device));
+ if (luks_cleartext_volume_device != NULL)
+ volume->device_file = g_strdup (gdu_device_get_device_file (luks_cleartext_volume_device));
+ else
+ volume->device_file = NULL;
volume->can_mount = TRUE;
volume->should_automount = FALSE;
- g_object_unref (luks_cleartext_volume_device);
+ if (luks_cleartext_volume_device != NULL)
+ g_object_unref (luks_cleartext_volume_device);
}
else
{
@@ -321,7 +326,10 @@ update_volume (GGduVolume *volume)
}
g_free (volume->device_file);
- volume->device_file = g_strdup (gdu_device_get_device_file (device));
+ if (device != NULL)
+ volume->device_file = g_strdup (gdu_device_get_device_file (device));
+ else
+ volume->device_file = NULL;
volume->can_mount = TRUE;
@@ -341,14 +349,16 @@ update_volume (GGduVolume *volume)
* nopolicy is only FALSE for "physical" devices - e.g. only "physical" devices will
* be set to be automounted.
*/
- if (gdu_device_get_presentation_nopolicy (device))
+ if (device != NULL && gdu_device_get_presentation_nopolicy (device))
volume->should_automount = FALSE;
g_free (activation_uri);
}
- g_object_unref (pool);
- g_object_unref (device);
+ if (pool != NULL)
+ g_object_unref (pool);
+ if (device != NULL)
+ g_object_unref (device);
/* ---------------------------------------------------------------------------------------------------- */
@@ -1082,6 +1092,20 @@ g_gdu_volume_mount (GVolume *_volume,
}
device = gdu_presentable_get_device (GDU_PRESENTABLE (volume->gdu_volume));
+
+ if (device == NULL)
+ {
+ simple = g_simple_async_result_new_error (G_OBJECT (volume),
+ callback,
+ user_data,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "Underlying device missing");
+ g_simple_async_result_complete (simple);
+ g_object_unref (simple);
+ goto out;
+ }
+
pool = gdu_device_get_pool (device);
/* Makes no sense to mount
@@ -1129,11 +1153,14 @@ g_gdu_volume_mount (GVolume *_volume,
luks_cleartext_volume_device = gdu_presentable_get_device (GDU_PRESENTABLE (volume->cleartext_gdu_volume));
- object_path_of_cleartext_device = gdu_device_get_object_path (luks_cleartext_volume_device);
+ if (luks_cleartext_volume_device != NULL)
+ {
+ object_path_of_cleartext_device = gdu_device_get_object_path (luks_cleartext_volume_device);
- mount_cleartext_device (data, object_path_of_cleartext_device);
+ mount_cleartext_device (data, object_path_of_cleartext_device);
- g_object_unref (luks_cleartext_volume_device);
+ g_object_unref (luks_cleartext_volume_device);
+ }
goto out;
}
@@ -1551,17 +1578,20 @@ g_gdu_volume_get_identifier (GVolume *_volume,
{
device = gdu_presentable_get_device (GDU_PRESENTABLE (volume->gdu_volume));
- label = gdu_device_id_get_label (device);
- uuid = gdu_device_id_get_uuid (device);
+ if (device != NULL)
+ {
+ label = gdu_device_id_get_label (device);
+ uuid = gdu_device_id_get_uuid (device);
- g_object_unref (device);
+ g_object_unref (device);
- if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) == 0)
- id = g_strdup (volume->device_file);
- else if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_LABEL) == 0)
- id = strlen (label) > 0 ? g_strdup (label) : NULL;
- else if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UUID) == 0)
- id = strlen (uuid) > 0 ? g_strdup (uuid) : NULL;
+ if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) == 0)
+ id = g_strdup (volume->device_file);
+ else if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_LABEL) == 0)
+ id = strlen (label) > 0 ? g_strdup (label) : NULL;
+ else if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UUID) == 0)
+ id = strlen (uuid) > 0 ? g_strdup (uuid) : NULL;
+ }
}
return id;
@@ -1577,19 +1607,24 @@ g_gdu_volume_enumerate_identifiers (GVolume *_volume)
const gchar *uuid;
p = g_ptr_array_new ();
+ label = NULL;
if (volume->gdu_volume != NULL)
{
device = gdu_presentable_get_device (GDU_PRESENTABLE (volume->gdu_volume));
- label = gdu_device_id_get_label (device);
- uuid = gdu_device_id_get_uuid (device);
- g_object_unref (device);
-
- g_ptr_array_add (p, g_strdup (G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE));
- if (strlen (label) > 0)
- g_ptr_array_add (p, g_strdup (G_VOLUME_IDENTIFIER_KIND_LABEL));
- if (strlen (uuid) > 0)
- g_ptr_array_add (p, g_strdup (G_VOLUME_IDENTIFIER_KIND_UUID));
+
+ if (device != NULL)
+ {
+ label = gdu_device_id_get_label (device);
+ uuid = gdu_device_id_get_uuid (device);
+ g_object_unref (device);
+
+ g_ptr_array_add (p, g_strdup (G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE));
+ if (strlen (label) > 0)
+ g_ptr_array_add (p, g_strdup (G_VOLUME_IDENTIFIER_KIND_LABEL));
+ if (strlen (uuid) > 0)
+ g_ptr_array_add (p, g_strdup (G_VOLUME_IDENTIFIER_KIND_UUID));
+ }
}
g_ptr_array_add (p, NULL);
@@ -1638,8 +1673,11 @@ g_gdu_volume_has_device_file (GGduVolume *volume,
{
GduDevice *luks_cleartext_volume_device;
luks_cleartext_volume_device = gdu_presentable_get_device (GDU_PRESENTABLE (volume->cleartext_gdu_volume));
- _device_file = gdu_device_get_device_file (luks_cleartext_volume_device);
- g_object_unref (luks_cleartext_volume_device);
+ if (luks_cleartext_volume_device != NULL)
+ {
+ _device_file = gdu_device_get_device_file (luks_cleartext_volume_device);
+ g_object_unref (luks_cleartext_volume_device);
+ }
}
return g_strcmp0 (_device_file, device_file) == 0;
@@ -1682,8 +1720,11 @@ g_gdu_volume_has_uuid (GGduVolume *volume,
{
GduDevice *luks_cleartext_volume_device;
luks_cleartext_volume_device = gdu_presentable_get_device (GDU_PRESENTABLE (volume->cleartext_gdu_volume));
- _uuid = gdu_device_id_get_uuid (luks_cleartext_volume_device);
- g_object_unref (luks_cleartext_volume_device);
+ if (luks_cleartext_volume_device != NULL)
+ {
+ _uuid = gdu_device_id_get_uuid (luks_cleartext_volume_device);
+ g_object_unref (luks_cleartext_volume_device);
+ }
}
return g_strcmp0 (_uuid, uuid) == 0;
diff --git a/monitor/gdu/ggduvolumemonitor.c b/monitor/gdu/ggduvolumemonitor.c
index e81dce2..398fed4 100644
--- a/monitor/gdu/ggduvolumemonitor.c
+++ b/monitor/gdu/ggduvolumemonitor.c
@@ -779,9 +779,10 @@ should_volume_be_ignored (GduPool *pool, GduVolume *volume, GList *fstab_mount_p
const gchar *type;
ret = TRUE;
- device = NULL;
device = gdu_presentable_get_device (GDU_PRESENTABLE (volume));
+ if (device == NULL)
+ goto out;
if (gdu_device_get_presentation_hide (device))
goto out;
@@ -827,7 +828,8 @@ should_volume_be_ignored (GduPool *pool, GduVolume *volume, GList *fstab_mount_p
out:
- g_object_unref (device);
+ if (device != NULL)
+ g_object_unref (device);
return ret;
}
@@ -1269,15 +1271,18 @@ update_volumes (GGduVolumeMonitor *monitor,
d = gdu_presentable_get_device (p);
- volume = find_volume_for_device_file (monitor, gdu_device_get_device_file (d));
- if (volume != NULL)
+ if (d != NULL)
{
- /*g_debug ("removing volume %s", gdu_device_get_device_file (d));*/
- g_gdu_volume_removed (volume);
- monitor->volumes = g_list_remove (monitor->volumes, volume);
- *removed_volumes = g_list_prepend (*removed_volumes, volume);
+ volume = find_volume_for_device_file (monitor, gdu_device_get_device_file (d));
+ if (volume != NULL)
+ {
+ /*g_debug ("removing volume %s", gdu_device_get_device_file (d));*/
+ g_gdu_volume_removed (volume);
+ monitor->volumes = g_list_remove (monitor->volumes, volume);
+ *removed_volumes = g_list_prepend (*removed_volumes, volume);
+ }
+ g_object_unref (d);
}
- g_object_unref (d);
}
for (l = added; l != NULL; l = l->next)
@@ -1285,9 +1290,12 @@ update_volumes (GGduVolumeMonitor *monitor,
GduPresentable *p = GDU_PRESENTABLE (l->data);
GduDevice *d;
+ volume = NULL;
d = gdu_presentable_get_device (p);
- volume = find_volume_for_device_file (monitor, gdu_device_get_device_file (d));
+ if (d != NULL)
+ volume = find_volume_for_device_file (monitor, gdu_device_get_device_file (d));
+
if (volume == NULL)
{
GduPresentable *toplevel_presentable;
@@ -1297,12 +1305,16 @@ update_volumes (GGduVolumeMonitor *monitor,
{
GduDevice *toplevel_device;
+ drive = NULL;
toplevel_device = gdu_presentable_get_device (toplevel_presentable);
- drive = find_drive_by_device_file (monitor, gdu_device_get_device_file (toplevel_device));
- /*g_debug ("adding volume %s (drive %s)",
- gdu_device_get_device_file (d),
- gdu_device_get_device_file (toplevel_device));*/
- g_object_unref (toplevel_device);
+ if (toplevel_device != NULL)
+ {
+ drive = find_drive_by_device_file (monitor, gdu_device_get_device_file (toplevel_device));
+ /*g_debug ("adding volume %s (drive %s)",
+ gdu_device_get_device_file (d),
+ gdu_device_get_device_file (toplevel_device));*/
+ g_object_unref (toplevel_device);
+ }
g_object_unref (toplevel_presentable);
}
else
@@ -1320,9 +1332,10 @@ update_volumes (GGduVolumeMonitor *monitor,
monitor->volumes = g_list_prepend (monitor->volumes, volume);
*added_volumes = g_list_prepend (*added_volumes, g_object_ref (volume));
}
- }
+ }
- g_object_unref (d);
+ if (d != NULL)
+ g_object_unref (d);
}
g_list_free (added);
@@ -1579,10 +1592,15 @@ update_discs (GGduVolumeMonitor *monitor,
GduPresentable *p = GDU_PRESENTABLE (l->data);
GduDevice *d;
+ volume = NULL;
+ mount = NULL;
d = gdu_presentable_get_device (p);
- volume = find_disc_volume_for_device_file (monitor, gdu_device_get_device_file (d));
- mount = find_disc_mount_for_volume (monitor, volume);
+ if (d != NULL)
+ {
+ volume = find_disc_volume_for_device_file (monitor, gdu_device_get_device_file (d));
+ mount = find_disc_mount_for_volume (monitor, volume);
+ }
if (mount != NULL)
{
@@ -1600,7 +1618,8 @@ update_discs (GGduVolumeMonitor *monitor,
*removed_volumes = g_list_prepend (*removed_volumes, volume);
}
- g_object_unref (d);
+ if (d != NULL)
+ g_object_unref (d);
}
for (l = added; l != NULL; l = l->next)
@@ -1609,11 +1628,16 @@ update_discs (GGduVolumeMonitor *monitor,
GduDevice *d;
gboolean is_blank;
+ volume = NULL;
+ is_blank = TRUE;
d = gdu_presentable_get_device (p);
- is_blank = gdu_device_optical_disc_get_is_blank (d);
+ if (d != NULL)
+ {
+ is_blank = gdu_device_optical_disc_get_is_blank (d);
+ volume = find_disc_volume_for_device_file (monitor, gdu_device_get_device_file (d));
+ }
- volume = find_disc_volume_for_device_file (monitor, gdu_device_get_device_file (d));
if (volume == NULL)
{
GduPresentable *toplevel_presentable;
@@ -1623,12 +1647,16 @@ update_discs (GGduVolumeMonitor *monitor,
{
GduDevice *toplevel_device;
+ drive = NULL;
toplevel_device = gdu_presentable_get_device (toplevel_presentable);
- drive = find_drive_by_device_file (monitor, gdu_device_get_device_file (toplevel_device));
- /*g_debug ("adding volume %s (drive %s)",
- gdu_device_get_device_file (d),
- gdu_device_get_device_file (toplevel_device));*/
- g_object_unref (toplevel_device);
+ if (toplevel_device != NULL)
+ {
+ drive = find_drive_by_device_file (monitor, gdu_device_get_device_file (toplevel_device));
+ /*g_debug ("adding volume %s (drive %s)",
+ gdu_device_get_device_file (d),
+ gdu_device_get_device_file (toplevel_device));*/
+ g_object_unref (toplevel_device);
+ }
g_object_unref (toplevel_presentable);
}
else
@@ -1682,7 +1710,8 @@ update_discs (GGduVolumeMonitor *monitor,
}
}
- g_object_unref (d);
+ if (d != NULL)
+ g_object_unref (d);
}
g_list_free (added);
--
cgit v0.8.2

View File

@ -0,0 +1,66 @@
From cd2afbd07bbcf4e7caee1dd0ca1c65d74974884d Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Fri, 30 Oct 2009 17:03:35 +0000
Subject: Remove dead code
Signed-off-by: David Zeuthen <davidz@redhat.com>
---
diff --git a/monitor/gdu/ggduvolumemonitor.c b/monitor/gdu/ggduvolumemonitor.c
index 83d8fc2..e81dce2 100644
--- a/monitor/gdu/ggduvolumemonitor.c
+++ b/monitor/gdu/ggduvolumemonitor.c
@@ -842,7 +842,6 @@ should_drive_be_ignored (GduPool *pool, GduDrive *d, GList *fstab_mount_points)
GList *l;
ignored = FALSE;
- device = NULL;
enclosed = NULL;
device = gdu_presentable_get_device (GDU_PRESENTABLE (d));
@@ -1074,7 +1073,7 @@ find_disc_volume_for_device_file (GGduVolumeMonitor *monitor,
static GGduVolume *
find_volume_for_device_file (GGduVolumeMonitor *monitor,
- const gchar *device_file)
+ const gchar *device_file)
{
GList *l;
GGduVolume *ret;
@@ -1183,9 +1182,6 @@ update_drives (GGduVolumeMonitor *monitor,
for (l = removed; l != NULL; l = l->next)
{
GduPresentable *p = GDU_PRESENTABLE (l->data);
- GduDevice *d;
-
- d = gdu_presentable_get_device (p);
drive = find_drive_by_presentable (monitor, p);
if (drive != NULL)
@@ -1195,16 +1191,11 @@ update_drives (GGduVolumeMonitor *monitor,
monitor->drives = g_list_remove (monitor->drives, drive);
*removed_drives = g_list_prepend (*removed_drives, drive);
}
- if (d != NULL)
- g_object_unref (d);
}
for (l = added; l != NULL; l = l->next)
{
GduPresentable *p = GDU_PRESENTABLE (l->data);
- GduDevice *d;
-
- d = gdu_presentable_get_device (p);
drive = find_drive_by_presentable (monitor, p);
if (drive == NULL)
@@ -1217,8 +1208,6 @@ update_drives (GGduVolumeMonitor *monitor,
*added_drives = g_list_prepend (*added_drives, g_object_ref (drive));
}
}
- if (d != NULL)
- g_object_unref (d);
}
g_list_free (added);
--
cgit v0.8.2

View File

@ -0,0 +1,57 @@
From 62f7058bec6f96c2dcc8a12431a1114e24eac6e8 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Tue, 10 Nov 2009 17:53:50 +0100
Subject: [PATCH] [SMB] Support querying filesystem size and free space
Requires libsmbclient >= 3.2.0
Fixes rfe bug 565337
---
daemon/gvfsbackendsmb.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index bc8c415..2106a43 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -1591,8 +1591,36 @@ do_query_fs_info (GVfsBackend *backend,
GFileInfo *info,
GFileAttributeMatcher *attribute_matcher)
{
+ GVfsBackendSmb *op_backend = G_VFS_BACKEND_SMB (backend);
+ smbc_statvfs_fn smbc_statvfs;
+ struct statvfs st = {0};
+ char *uri;
+ int res;
+
g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, "cifs");
-
+
+#ifdef DEPRECATED_SMBC_INTERFACE
+ if (g_file_attribute_matcher_matches (attribute_matcher,
+ G_FILE_ATTRIBUTE_FILESYSTEM_SIZE) ||
+ g_file_attribute_matcher_matches (attribute_matcher,
+ G_FILE_ATTRIBUTE_FILESYSTEM_FREE) ||
+ g_file_attribute_matcher_matches (attribute_matcher,
+ G_FILE_ATTRIBUTE_FILESYSTEM_READONLY))
+ {
+ uri = create_smb_uri (op_backend->server, op_backend->share, filename);
+ smbc_statvfs = smbc_getFunctionStatVFS (op_backend->smb_context);
+ res = smbc_statvfs (op_backend->smb_context, uri, &st);
+ g_free (uri);
+
+ if (res == 0)
+ {
+ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE, st.f_bsize * st.f_blocks);
+ g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, st.f_bsize * st.f_bavail);
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, st.f_flag & SMBC_VFS_FEATURE_RDONLY);
+ }
+ }
+#endif
+
g_vfs_job_succeeded (G_VFS_JOB (job));
}
--
1.6.5.2

View File

@ -1,7 +1,7 @@
Summary: Backends for the gio framework in GLib
Name: gvfs
Version: 1.4.0
Release: 9%{?dist}
Version: 1.4.1
Release: 6%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@ -20,7 +20,7 @@ BuildRequires: gnome-keyring-devel
BuildRequires: intltool
BuildRequires: gettext-devel
BuildRequires: GConf2-devel
BuildRequires: gnome-disk-utility-devel >= 2.28.0
BuildRequires: gnome-disk-utility-devel >= 2.28.1-1
BuildRequires: PolicyKit-devel
# This is a hack until the xfce4-notifyd dependency issue is fixed
# https://fedorahosted.org/rel-eng/ticket/1788
@ -39,26 +39,16 @@ Patch0: gvfs-archive-integration.patch
Patch1: 0001-Add-AFC-backend.patch
# from upstream
Patch2: http-icons.patch
# from upstream
Patch3: consider-logical-partitions.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=526892
# Nautilus not displaying friendly icons for SSH-connected system
Patch4: gvfs-1.4.0-mountspec-from-string.patch
# from upstream
Patch5: gvfs-1.4.1-trash-dont-overwrite.patch
Patch6: gvfs-1.4.1-separate-eject-safely-remove-drive.patch
Patch7: gvfs-1.4.1-no-poll-for-media.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=520497
# annoying error dialogs
Patch8: 0001-Disallow-mounting-empty-drives.patch
Patch9: 0002-Disallow-ejecting-empty-drives.patch
Patch10: 0003-Silently-drop-eject-error-messages-when-detaching-dr.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=528181
Patch11: obex-crasher.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=565337
Patch3: gvfs-1.4.2-smb-queryfs.patch
# from upstream
Patch12: gvfs-1.4.1-http-suport-stream-query-info.patch
Patch13: gvfs-1.4.1-http-soup-header-parsing.patch
Patch14: gvfs-1.4.1-mtp-devices-mime.patch
Patch14: gvfs-1.4.2-remove-dead-code.patch
Patch15: gvfs-1.4.2-handle-null-gdudevices.patch
Obsoletes: gnome-mount <= 0.8
Obsoletes: gnome-mount-nautilus-properties <= 0.8
%description
The gvfs package provides backend implementations for the gio
@ -154,18 +144,11 @@ and iPod Touches to applications using gvfs.
%patch0 -p1 -b .archive-integration
%patch1 -p1 -b .afc
%patch2 -p1 -b .http-icons
%patch3 -p1 -b .logical-partitions
%patch4 -p1 -b .favicons
%patch5 -p1 -b .trash-overwrite
%patch6 -p1 -b .separate-eject
%patch7 -p1 -b .no-poll
%patch8 -p1 -b .mount-empty
%patch9 -p1 -b .eject-empty
%patch10 -p1 -b .error-detaching
%patch11 -p1 -b .push-fail
%patch3 -p1 -b .smb-queryfs
%patch12 -p1 -b .http-query-info
%patch13 -p1 -b .http-headers
%patch14 -p1 -b .mtp-mime
%patch14 -p1 -b .dead-code
%patch15 -p1 -b .gdu-null-devices
%build
@ -331,12 +314,24 @@ killall -USR1 gvfsd >&/dev/null || :
%{_datadir}/gvfs/remote-volume-monitors/afc.monitor
%changelog
* Thu Nov 12 2009 Bastien Nocera <bnocera@redhat.com> 1.4.0-9
* Thu Nov 12 2009 Matthias Clasen <mclasen@redhat.com> 1.4.1-6
- Add obsoletes for gnome-mount
* Thu Nov 12 2009 Bastien Nocera <bnocera@redhat.com> 1.4.1-5
- Add obsoletes for gnome-vfs2-obexftp
* Mon Nov 2 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.4.0-8
* Tue Nov 10 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.4.1-4
- SMB: Support querying filesystem size and free space
* Tue Nov 3 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.4.1-3
- gdu-volume-monitor: don't crash on NULL devices (#529982)
* Mon Nov 2 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.4.1-2
- Reload .mount files when single package is installed
* Tue Oct 20 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.4.1-1
- Update to 1.4.1
* Fri Oct 16 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.4.0-7
- HTTP: Support g_file_input_stream_query_info()
- HTTP: Use libsoup header parsing function
@ -344,6 +339,8 @@ killall -USR1 gvfsd >&/dev/null || :
* Wed Oct 14 2009 Bastien Nocera <bnocera@redhat.com> 1.4.0-6
- Fix crasher in ObexFTP (#528181)
* Fri Oct 9 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.4.0-5
- Don't always overwrite on trash restore
- Separate "Safely Remove Drive" from "Eject"
- Don't advertise can_poll for drives not using removable media

View File

@ -1,22 +0,0 @@
commit 59a657175301c5b99bce0ce9a53b14efc202eb8e
Author: Bastien Nocera <hadess@hadess.net>
Date: Wed Oct 14 14:27:43 2009 +0100
Fix crasher in obexftp backend
Spotted by Matthias Clasen
See https://bugzilla.redhat.com/show_bug.cgi?id=528181
diff --git a/daemon/gvfsbackendobexftp.c b/daemon/gvfsbackendobexftp.c
index e658b16..84969db 100644
--- a/daemon/gvfsbackendobexftp.c
+++ b/daemon/gvfsbackendobexftp.c
@@ -1816,6 +1816,7 @@ do_push (GVfsBackend *backend,
push_data_free (job_data);
g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
+ return;
}
push_data_free (job_data);

View File

@ -1 +1 @@
5c5086763873bbc6239af84722bf1afe gvfs-1.4.0.tar.bz2
6eff809d50e618f289d5192724a049de gvfs-1.4.1.tar.bz2