org.freedesktop.UDisks2.Drive.Model shouldn't be empty
(A longer discussion is towards the end of https://gitlab.xfce.org/xfce/thunar/-/merge_requests/64)
With Linux's udisks, the drive vendor can be empty, but its model is always set. Possibly due to a bug in it, libudisks relies on this when generating the drive name, and if we return a vendor but not a model, the drive name has a trailing space. This ends up being shown to the user in notifications, like when the drive is safe to remove.
This fixes it:
diff -r 210f6cd027a2 drive.cpp
--- a/drive.cpp Tue Feb 23 12:45:20 2021 +0300
+++ b/drive.cpp Thu Feb 25 05:58:42 2021 +0200
@@ -77,10 +77,14 @@
QString Drive::vendor() const
{
+ return "";
+}
+
+QString Drive::model() const
+{
return description;
}
-
qulonglong Drive::driveSize() const
{
return size;
diff -r 210f6cd027a2 drive.h
--- a/drive.h Tue Feb 23 12:45:20 2021 +0300
+++ b/drive.h Thu Feb 25 05:58:42 2021 +0200
@@ -57,6 +57,9 @@
Q_PROPERTY(QString Vendor READ vendor)
QString vendor() const;
+ Q_PROPERTY(QString Model READ model)
+ QString model() const;
+
qulonglong size;
Q_PROPERTY(qulonglong Size READ driveSize)
qulonglong driveSize() const;