Hello community, here is the log from the commit of package thunar-volman for openSUSE:Factory checked in at 2017-12-09 20:33:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/thunar-volman (Old) and /work/SRC/openSUSE:Factory/.thunar-volman.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "thunar-volman" Sat Dec 9 20:33:21 2017 rev:29 rq:555549 version:0.8.1 Changes: -------- --- /work/SRC/openSUSE:Factory/thunar-volman/thunar-volman.changes 2015-03-09 10:05:52.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.thunar-volman.new/thunar-volman.changes 2017-12-09 20:33:53.039270406 +0100 @@ -1,0 +2,5 @@ +Sun Nov 19 11:13:23 UTC 2017 - [email protected] + +- add thunar-volman-use-udisks-hints.diff (bnc#949808) + +------------------------------------------------------------------- New: ---- thunar-volman-use-udisks-hints.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ thunar-volman.spec ++++++ --- /var/tmp/diff_new_pack.vcZK5X/_old 2017-12-09 20:33:53.627242401 +0100 +++ /var/tmp/diff_new_pack.vcZK5X/_new 2017-12-09 20:33:53.627242401 +0100 @@ -25,6 +25,8 @@ Url: http://goodies.xfce.org/projects/thunar-plugins/thunar-volman Source0: http://archive.xfce.org/src/apps/thunar-volman/0.8/%{name}-%{version}.tar.bz2 Source1: thunar-volman.xml +# PATCH-FIX-OPENSUSE thunar-volman-use-udisks-hints.diff bnc#949808 -- [email protected] +Patch0: thunar-volman-use-udisks-hints.diff BuildRequires: intltool BuildRequires: update-desktop-files BuildRequires: pkgconfig(exo-1) @@ -66,6 +68,7 @@ %prep %setup -q +%patch0 -p1 %build %configure ++++++ thunar-volman-use-udisks-hints.diff ++++++ diff --git a/thunar-volman/tvm-block-device.c b/thunar-volman/tvm-block-device.c index edb6cad..5397bbc 100644 --- a/thunar-volman/tvm-block-device.c +++ b/thunar-volman/tvm-block-device.c @@ -754,7 +754,44 @@ tvm_block_device_mount (TvmContext *context) return FALSE; } - +static gboolean +tvm_block_device_removable (TvmContext *context) +{ + /* traverse sysfs to find out if the device has the removable flag set */ + /* this would be much easier with udisks, but udisks2 dropped the udev */ + /* property settings... */ + const gchar *partn; + gchar *devpath; + gchar *removable; + gboolean ret = TRUE; /* default to handling the device */ + partn = g_udev_device_get_property (context->device, "PARTN"); + devpath = g_strdup(g_udev_device_get_property (context->device, "DEVPATH")); + if (! devpath) + goto out; + if (partn) + { /* partition, one directory up */ + gchar *p = strrchr(devpath, '/'); + if (! p) + goto out; + *p = 0; + } + removable = g_strdup_printf("/sys%s/removable", devpath); + if (removable) + { + gchar *contents; + if (g_file_get_contents(removable, &contents, NULL, NULL)) + { + ret = (*contents == '1'); + g_free (contents); + } + else + g_message("%s: g_file_get_contents of %s failed", __func__, removable); + g_free(removable); + } +out: + g_free(devpath); + return ret; +} void tvm_block_device_added (TvmContext *context) @@ -763,11 +800,13 @@ tvm_block_device_added (TvmContext *context) const gchar *id_type; const gchar *media_state; const gchar *id_fs_usage; + const gchar *udisks_nopolicy; gboolean is_cdrom; gboolean is_partition; gboolean is_volume; gboolean automount; gboolean autoplay; + gboolean u_nopolicy; guint64 audio_tracks; guint64 data_tracks; GError *error = NULL; @@ -779,12 +818,28 @@ tvm_block_device_added (TvmContext *context) devtype = g_udev_device_get_property (context->device, "DEVTYPE"); id_type = g_udev_device_get_property (context->device, "ID_TYPE"); id_fs_usage = g_udev_device_get_property (context->device, "ID_FS_USAGE"); + udisks_nopolicy = g_udev_device_get_property (context->device, "UDISKS_PRESENTATION_NOPOLICY"); /* distinguish device types */ is_cdrom = (g_strcmp0 (id_type, "cd") == 0); is_partition = (g_strcmp0 (devtype, "partition") == 0); is_volume = (g_strcmp0 (devtype, "disk") == 0) && (g_strcmp0 (id_fs_usage, "filesystem") == 0); + u_nopolicy = (g_strcmp0 (udisks_nopolicy, "1") == 0); + + /* if udisks properties are avaible, use them; if not, check the removable flag in sysfs */ + if (udisks_nopolicy == NULL && !tvm_block_device_removable(context)) + { + g_message("%s: non-removable device ignored", __func__); + tvm_device_handler_finished (context); + return; + } + if (u_nopolicy) + { + g_message("%s: ignoring device with UDISKS_PRESENTATION_NOPOLICY=1", __func__); + tvm_device_handler_finished (context); + return; + } if (is_cdrom) {
