diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2008-12-01 05:42:28 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2008-12-01 05:42:28 +0000 |
commit | 43c0ce8971bba8d1606a6312ee7d32d5c149042e (patch) | |
tree | 151d4388271c7c0ec42eef1215c31e15a6ed431e /gtk/gtkfilesystem.c | |
parent | eb56320d4e66c888a4750f0464d906bb3d916666 (diff) | |
download | gtk+-43c0ce8971bba8d1606a6312ee7d32d5c149042e.tar.gz |
Filter out shadow mounts
svn path=/trunk/; revision=21838
Diffstat (limited to 'gtk/gtkfilesystem.c')
-rw-r--r-- | gtk/gtkfilesystem.c | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/gtk/gtkfilesystem.c b/gtk/gtkfilesystem.c index 3960be29bb..a46f60c620 100644 --- a/gtk/gtkfilesystem.c +++ b/gtk/gtkfilesystem.c @@ -362,6 +362,39 @@ bookmarks_file_changed (GFileMonitor *monitor, } } +static gboolean +mount_referenced_by_volume_activation_root (GList *volumes, GMount *mount) +{ + GList *l; + GFile *mount_root; + gboolean ret; + + ret = FALSE; + + mount_root = g_mount_get_root (mount); + + for (l = volumes; l != NULL; l = l->next) + { + GVolume *volume = G_VOLUME (l->data); + GFile *volume_activation_root; + + volume_activation_root = g_volume_get_activation_root (volume); + if (volume_activation_root != NULL) + { + if (g_file_has_prefix (volume_activation_root, mount_root)) + { + ret = TRUE; + g_object_unref (volume_activation_root); + break; + } + g_object_unref (volume_activation_root); + } + } + + g_object_unref (mount_root); + return ret; +} + static void get_volumes_list (GtkFileSystem *file_system) { @@ -468,8 +501,6 @@ get_volumes_list (GtkFileSystem *file_system) } } - g_list_free (volumes); - /* add mounts that has no volume (/etc/mtab mounts, ftp, sftp,...) */ mounts = g_volume_monitor_get_mounts (priv->volume_monitor); @@ -484,10 +515,20 @@ get_volumes_list (GtkFileSystem *file_system) continue; } + /* if there's exists one or more volumes with an activation root inside the mount, + * don't display the mount + */ + if (mount_referenced_by_volume_activation_root (volumes, mount)) + { + continue; + } + /* show this mount */ priv->volumes = g_slist_prepend (priv->volumes, g_object_ref (mount)); } + g_list_free (volumes); + g_list_free (mounts); } |