Skip to content

Commit

Permalink
Thunar sometimes mounts USB drives with root permission
Browse files Browse the repository at this point in the history
(Bug #14719)
  • Loading branch information
Alexander Schwinn committed Jan 24, 2019
1 parent d952139 commit d73bb5f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions thunar/thunar-device-monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,9 @@ thunar_device_monitor_mount_added (GVolumeMonitor *volume_monitor,
device = g_hash_table_lookup (monitor->devices, volume);
if (device != NULL)
{
/* reload the related ThunarFile */
thunar_device_reload_file (device);

/* notify */
g_signal_emit (G_OBJECT (monitor), device_monitor_signals[DEVICE_CHANGED], 0, device);
}
Expand Down
30 changes: 30 additions & 0 deletions thunar/thunar-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,3 +823,33 @@ thunar_device_eject (ThunarDevice *device,
g_object_unref (G_OBJECT (mount));
}
}



/**
* thunar_device_reload_file:
*
* Reload the related #ThunarFile of the #ThunarDevice
**/
void
thunar_device_reload_file (ThunarDevice *device)
{
ThunarFile *file;
GFile *mount_point;

_thunar_return_if_fail (THUNAR_IS_DEVICE (device));

mount_point = thunar_device_get_root (device);

if (mount_point != NULL)
{
/* try to determine the file for the mount point */
file = thunar_file_get (mount_point, NULL);
if (file != NULL)
{
thunar_file_reload (file);
g_object_unref (file);
}
g_object_unref (mount_point);
}
}
2 changes: 2 additions & 0 deletions thunar/thunar-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ void thunar_device_eject (ThunarDevice *devic
ThunarDeviceCallback callback,
gpointer user_data);

void thunar_device_reload_file (ThunarDevice *device);

G_END_DECLS

#endif /* !__THUNAR_DEVICE_H__ */

0 comments on commit d73bb5f

Please sign in to comment.