summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2009-02-16 10:07:54 +0000
committerAlexander Larsson <alexl@src.gnome.org>2009-02-16 10:07:54 +0000
commit498596add83ad1ce81c8e712b44a656c0640ee13 (patch)
treeae1c9dcaf7d20bf576d229074b7d712d7f1c4a25
parent3a1e67c82bd4bc3f552dadf829ad422a502114dc (diff)
downloadnautilus-498596add83ad1ce81c8e712b44a656c0640ee13.tar.gz
Don't use shadowed mounts.
2009-02-10 David Zeuthen <davidz@redhat.com> Don't use shadowed mounts. * libnautilus-private/nautilus-desktop-link-monitor.c (has_mount), (create_mount_link), (remove_mount_link), (mount_added_callback), (mount_removed_callback), (mount_changed_callback): * libnautilus-private/nautilus-directory-async.c (get_mount_at): * src/file-manager/fm-tree-view.c (add_root_for_mount): * src/nautilus-pathbar.c (is_file_path_mounted_mount): * src/nautilus-places-sidebar.c (update_places): Honor g_mount_is_shadowed(). svn path=/trunk/; revision=14953
-rw-r--r--ChangeLog13
-rw-r--r--libnautilus-private/nautilus-desktop-link-monitor.c72
-rw-r--r--libnautilus-private/nautilus-directory-async.c9
-rw-r--r--src/file-manager/fm-tree-view.c3
-rw-r--r--src/nautilus-pathbar.c4
-rw-r--r--src/nautilus-places-sidebar.c4
6 files changed, 85 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index d37286514..7fb8b3d60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-02-10 David Zeuthen <davidz@redhat.com>
+
+ Don't use shadowed mounts.
+
+ * libnautilus-private/nautilus-desktop-link-monitor.c (has_mount),
+ (create_mount_link), (remove_mount_link), (mount_added_callback),
+ (mount_removed_callback), (mount_changed_callback):
+ * libnautilus-private/nautilus-directory-async.c (get_mount_at):
+ * src/file-manager/fm-tree-view.c (add_root_for_mount):
+ * src/nautilus-pathbar.c (is_file_path_mounted_mount):
+ * src/nautilus-places-sidebar.c (update_places):
+ Honor g_mount_is_shadowed().
+
2009-02-16 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-info.c:
diff --git a/libnautilus-private/nautilus-desktop-link-monitor.c b/libnautilus-private/nautilus-desktop-link-monitor.c
index 9abdd6424..43f713e2f 100644
--- a/libnautilus-private/nautilus-desktop-link-monitor.c
+++ b/libnautilus-private/nautilus-desktop-link-monitor.c
@@ -182,35 +182,48 @@ nautilus_desktop_link_monitor_make_filename_unique (NautilusDesktopLinkMonitor *
return unique_name;
}
+static gboolean
+has_mount (NautilusDesktopLinkMonitor *monitor,
+ GMount *mount)
+{
+ gboolean ret;
+ GMount *other_mount;
+ GList *l;
+
+ ret = FALSE;
+
+ for (l = monitor->details->mount_links; l != NULL; l = l->next) {
+ other_mount = nautilus_desktop_link_get_mount (l->data);
+ if (mount == other_mount) {
+ g_object_unref (other_mount);
+ ret = TRUE;
+ break;
+ }
+ g_object_unref (other_mount);
+ }
+
+ return ret;
+}
+
static void
create_mount_link (NautilusDesktopLinkMonitor *monitor,
GMount *mount)
{
NautilusDesktopLink *link;
- link = NULL;
+ if (has_mount (monitor, mount))
+ return;
- if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE)) {
+ if ((!g_mount_is_shadowed (mount)) &&
+ eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE)) {
link = nautilus_desktop_link_new_from_mount (mount);
monitor->details->mount_links = g_list_prepend (monitor->details->mount_links, link);
}
}
-
-
-static void
-mount_added_callback (GVolumeMonitor *volume_monitor,
- GMount *mount,
- NautilusDesktopLinkMonitor *monitor)
-{
- create_mount_link (monitor, mount);
-}
-
-
static void
-mount_removed_callback (GVolumeMonitor *volume_monitor,
- GMount *mount,
- NautilusDesktopLinkMonitor *monitor)
+remove_mount_link (NautilusDesktopLinkMonitor *monitor,
+ GMount *mount)
{
GList *l;
NautilusDesktopLink *link;
@@ -233,15 +246,38 @@ mount_removed_callback (GVolumeMonitor *volume_monitor,
}
}
+
+
static void
-mount_changed_callback (GVolumeMonitor *volume_monitor,
+mount_added_callback (GVolumeMonitor *volume_monitor,
+ GMount *mount,
+ NautilusDesktopLinkMonitor *monitor)
+{
+ create_mount_link (monitor, mount);
+}
+
+
+static void
+mount_removed_callback (GVolumeMonitor *volume_monitor,
GMount *mount,
NautilusDesktopLinkMonitor *monitor)
{
- /* TODO: update the mount */
+ remove_mount_link (monitor, mount);
}
static void
+mount_changed_callback (GVolumeMonitor *volume_monitor,
+ GMount *mount,
+ NautilusDesktopLinkMonitor *monitor)
+{
+ /* TODO: update the mount with other details */
+
+ /* remove a mount if it goes into the shadows */
+ if (g_mount_is_shadowed (mount) && has_mount (monitor, mount)) {
+ remove_mount_link (monitor, mount);
+ }}
+
+static void
update_link_visibility (NautilusDesktopLinkMonitor *monitor,
NautilusDesktopLink **link_ref,
NautilusDesktopLinkType link_type,
diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c
index 93e1746ff..283e2f49d 100644
--- a/libnautilus-private/nautilus-directory-async.c
+++ b/libnautilus-private/nautilus-directory-async.c
@@ -4146,10 +4146,15 @@ get_mount_at (GFile *target)
found = NULL;
for (l = mounts; l != NULL; l = l->next) {
- root = g_mount_get_root (l->data);
+ GMount *mount = G_MOUNT (l->data);
+
+ if (g_mount_is_shadowed (mount))
+ continue;
+
+ root = g_mount_get_root (mount);
if (g_file_equal (target, root)) {
- found = g_object_ref (l->data);
+ found = g_object_ref (mount);
break;
}
diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c
index 7419b0ebc..9c3b4d6d9 100644
--- a/src/file-manager/fm-tree-view.c
+++ b/src/file-manager/fm-tree-view.c
@@ -587,6 +587,9 @@ add_root_for_mount (FMTreeView *view,
GFile *root;
GIcon *icon;
+ if (g_mount_is_shadowed (mount))
+ return;
+
icon = g_mount_get_icon (mount);
root = g_mount_get_root (mount);
mount_uri = g_file_get_uri (root);
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index cd692b2f2..f80399ca9 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -1355,6 +1355,10 @@ is_file_path_mounted_mount (GFile *location, ButtonData *button_data)
mounts = g_volume_monitor_get_mounts (volume_monitor);
for (l = mounts; l != NULL; l = l->next) {
mount = l->data;
+ if (g_mount_is_shadowed (mount)) {
+ g_object_unref (mount);
+ continue;
+ }
if (result) {
g_object_unref (mount);
continue;
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index 467475d9c..77d74ec5c 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -451,6 +451,10 @@ update_places (NautilusPlacesSidebar *sidebar)
mounts = g_volume_monitor_get_mounts (volume_monitor);
for (l = mounts; l != NULL; l = l->next) {
mount = l->data;
+ if (g_mount_is_shadowed (mount)) {
+ g_object_unref (mount);
+ continue;
+ }
volume = g_mount_get_volume (mount);
if (volume != NULL) {
g_object_unref (volume);