[Xfce4-commits] [xfce/thunar] 01/01: Thunar sometimes mounts USB drives with root permission (Bug #14719)

noreply at xfce.org noreply at xfce.org
Thu Jan 24 22:00:02 CET 2019


This is an automated email from the git hooks/post-receive script.

a   l   e   x       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   4   
   in repository xfce/thunar.

commit d73bb5fb601a761744f05c213f70b6cddce889f3
Author: Alexander Schwinn <alexxcons at xfce.org>
Date:   Sat Jan 12 21:46:45 2019 +0100

    Thunar sometimes mounts USB drives with root permission
    (Bug #14719)
---
 thunar/thunar-device-monitor.c |  3 +++
 thunar/thunar-device.c         | 30 ++++++++++++++++++++++++++++++
 thunar/thunar-device.h         |  2 ++
 3 files changed, 35 insertions(+)

diff --git a/thunar/thunar-device-monitor.c b/thunar/thunar-device-monitor.c
index 0e4da60..a825e1c 100644
--- a/thunar/thunar-device-monitor.c
+++ b/thunar/thunar-device-monitor.c
@@ -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);
         }
diff --git a/thunar/thunar-device.c b/thunar/thunar-device.c
index a310912..4933e34 100644
--- a/thunar/thunar-device.c
+++ b/thunar/thunar-device.c
@@ -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);
+    }
+}
diff --git a/thunar/thunar-device.h b/thunar/thunar-device.h
index bd5f16d..536a4ea 100644
--- a/thunar/thunar-device.h
+++ b/thunar/thunar-device.h
@@ -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__ */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list