summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2017-01-04 10:31:08 +0100
committerOndrej Holy <oholy@redhat.com>2017-06-06 09:11:24 +0200
commitceb0daa48bd6b5144873a4984572c2781fa4a7ac (patch)
tree3ef72406e6e921caa0ba7441b6b08c2d8ec6708e /client
parent29872122c87623c77a85869e309f79a50aed8e09 (diff)
downloadgvfs-ceb0daa48bd6b5144873a4984572c2781fa4a7ac.tar.gz
Do not sent user invisible mounts if not needed
g_volume_monitor_get() might be really slow if there is too many mounts, because the list of the mounts is send over D-Bus. It can simply happen due to user invisible mounts, e.g. http. User invisible mounts are ignored by the volume monitor, so it is useless to send them over D-Bus. Improve the D-Bus API and don't send the user invisible mounts if it is not needed. https://bugzilla.gnome.org/show_bug.cgi?id=775600
Diffstat (limited to 'client')
-rw-r--r--client/gdaemonvolumemonitor.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/client/gdaemonvolumemonitor.c b/client/gdaemonvolumemonitor.c
index b73453b2..dc1407d2 100644
--- a/client/gdaemonvolumemonitor.c
+++ b/client/gdaemonvolumemonitor.c
@@ -148,14 +148,11 @@ mount_added (GDaemonVolumeMonitor *daemon_monitor, GMountInfo *mount_info)
return;
}
- if (mount_info->user_visible)
- {
- mount = g_daemon_mount_new (mount_info, G_VOLUME_MONITOR (daemon_monitor));
- daemon_monitor->mounts = g_list_prepend (daemon_monitor->mounts, mount);
+ mount = g_daemon_mount_new (mount_info, G_VOLUME_MONITOR (daemon_monitor));
+ daemon_monitor->mounts = g_list_prepend (daemon_monitor->mounts, mount);
- /* Ref for the signal emission, other ref is owned by volume monitor */
- g_object_ref (mount);
- }
+ /* Ref for the signal emission, other ref is owned by volume monitor */
+ g_object_ref (mount);
G_UNLOCK (daemon_vm);
@@ -177,8 +174,7 @@ mount_removed (GDaemonVolumeMonitor *daemon_monitor, GMountInfo *mount_info)
mount = find_mount_by_mount_info (daemon_monitor, mount_info);
if (!mount)
{
- if (mount_info->user_visible)
- g_warning (G_STRLOC ": An unknown mount was removed!");
+ g_warning (G_STRLOC ": An unknown mount was removed!");
G_UNLOCK (daemon_vm);
return;
@@ -203,7 +199,7 @@ g_daemon_volume_monitor_init (GDaemonVolumeMonitor *daemon_monitor)
_the_daemon_volume_monitor = daemon_monitor;
- daemon_monitor->mount_tracker = g_mount_tracker_new (_g_daemon_vfs_get_async_bus ());
+ daemon_monitor->mount_tracker = g_mount_tracker_new (_g_daemon_vfs_get_async_bus (), TRUE);
g_signal_connect_swapped (daemon_monitor->mount_tracker, "mounted",
(GCallback) mount_added, daemon_monitor);
@@ -215,12 +211,10 @@ g_daemon_volume_monitor_init (GDaemonVolumeMonitor *daemon_monitor)
for (l = mounts; l != NULL; l = l->next) {
info = l->data;
- if (info->user_visible)
- {
- mount = g_daemon_mount_new (info, G_VOLUME_MONITOR (daemon_monitor));
- daemon_monitor->mounts = g_list_prepend (daemon_monitor->mounts, mount);
- }
-
+
+ mount = g_daemon_mount_new (info, G_VOLUME_MONITOR (daemon_monitor));
+ daemon_monitor->mounts = g_list_prepend (daemon_monitor->mounts, mount);
+
g_mount_info_unref (info);
}