Commit 9b6b282e authored by Ondrej Holy's avatar Ondrej Holy

gio: Update mounts after g_volume_mount

The documentation claims that g_volume_get_mount should	succeed	after
g_volume_mount. Let's update mounts before releasing g_volume_mount to
be sure that the mount is added to the corresponding volume. The same
is done in GVfsUDisks2VolumeMonitor.

#1458
parent e5f87342
Pipeline #22360 passed with stages
in 9 minutes and 13 seconds
......@@ -274,6 +274,7 @@ eject_mount_done (GObject *source,
GTask *task = user_data;
GError *error = NULL;
gchar *stderr_str;
GUnixVolume *unix_volume;
if (!g_subprocess_communicate_utf8_finish (subprocess, result, NULL, &stderr_str, &error))
{
......@@ -286,8 +287,12 @@ eject_mount_done (GObject *source,
/* ...but bad exit code */
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", stderr_str);
else
/* ...and successful exit code */
g_task_return_boolean (task, TRUE);
{
/* ...and successful exit code */
unix_volume = G_UNIX_VOLUME (g_task_get_source_object (task));
_g_unix_volume_monitor_update (G_UNIX_VOLUME_MONITOR (unix_volume->volume_monitor));
g_task_return_boolean (task, TRUE);
}
g_free (stderr_str);
}
......
......@@ -183,15 +183,21 @@ g_unix_volume_monitor_class_init (GUnixVolumeMonitorClass *klass)
native_class->get_mount_for_mount_path = get_mount_for_mount_path;
}
void
_g_unix_volume_monitor_update (GUnixVolumeMonitor *unix_monitor)
{
/* Update both to make sure volumes are created before mounts */
update_volumes (unix_monitor);
update_mounts (unix_monitor);
}
static void
mountpoints_changed (GUnixMountMonitor *mount_monitor,
gpointer user_data)
{
GUnixVolumeMonitor *unix_monitor = user_data;
/* Update both to make sure volumes are created before mounts */
update_volumes (unix_monitor);
update_mounts (unix_monitor);
_g_unix_volume_monitor_update (unix_monitor);
}
static void
......@@ -200,9 +206,7 @@ mounts_changed (GUnixMountMonitor *mount_monitor,
{
GUnixVolumeMonitor *unix_monitor = user_data;
/* Update both to make sure volumes are created before mounts */
update_volumes (unix_monitor);
update_mounts (unix_monitor);
_g_unix_volume_monitor_update (unix_monitor);
}
static void
......@@ -219,8 +223,7 @@ g_unix_volume_monitor_init (GUnixVolumeMonitor *unix_monitor)
"mountpoints-changed", G_CALLBACK (mountpoints_changed),
unix_monitor);
update_volumes (unix_monitor);
update_mounts (unix_monitor);
_g_unix_volume_monitor_update (unix_monitor);
}
GVolumeMonitor *
......
......@@ -55,6 +55,7 @@ GType _g_unix_volume_monitor_get_type (void) G_GN
GVolumeMonitor * _g_unix_volume_monitor_new (void);
GUnixVolume * _g_unix_volume_monitor_lookup_volume_for_mount_path (GUnixVolumeMonitor *monitor,
const char *mount_path);
void _g_unix_volume_monitor_update (GUnixVolumeMonitor *monitor);
G_END_DECLS
......
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