Commit 498596ad authored by David Zeuthen's avatar David Zeuthen Committed by Alexander Larsson

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
parent 3a1e67c8
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:
......
......@@ -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,14 +246,37 @@ 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,
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment