After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 607600 - Make g_unix_mount_guess_type() public
Make g_unix_mount_guess_type() public
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-01-20 21:05 UTC by Mikkel Kamstrup Erlandsen
Modified: 2018-05-24 12:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Initial stab at the bug (5.48 KB, patch)
2010-01-20 22:17 UTC, Mikkel Kamstrup Erlandsen
none Details | Review

Description Mikkel Kamstrup Erlandsen 2010-01-20 21:05:10 UTC
In Zeitgeist we need to store which "type" of storage medium a given file was on when you used it - so one can show dialogs like:

  In order to open foobar.jpg please insert the CD "The Fooest of Bars"

Without knowing the storage type it would be s/CD/volume making the dialog a bit weird.

One would need to make the GUnixMountType enumeration public too of course. It doesn't seem like a big task because all the methods+enums are documented already.

Relevant Zeitgeist bug: https://bugs.launchpad.net/zeitgeist/+bug/489194
Comment 1 Mikkel Kamstrup Erlandsen 2010-01-20 22:17:04 UTC
Created attachment 151876 [details] [review]
Initial stab at the bug

Here's my initial stab at this.

I've moved GUnixMountType into gioenums.h. I am not really sure this is the right thing to do?

Maybe the enum should be renamed to just GMountType - or if we really don't want to specify platform independent mount types, then maybe in a separate giounixenums.h, but that would require a bit of build script tweaking to get GType enum generation working.
Comment 2 David Zeuthen (not reading bugmail) 2010-01-20 22:22:00 UTC
Note that bug 594649 is related.

What you are asking for is a slippery slope though - there are way too many kinds of media / drive / network mounts and I don't really think it's feasible to encode the type in an enumeration. For physical media, for example, there's at least this

 http://hal.freedesktop.org/docs/DeviceKit-disks/Device.html#Device:drive-media-compatibility

many different physical cards - FYI the gnome-disk-utility-based volume monitor in GVfs uses this information to generate the name and icon. Then there's other stuff like eSATA, USB, Firewire, LVM, RAID, sftp://, dav:// etc. to worry about - generating names/icons for devices is very very tricky. Classifying the device is even harder.

Anyway, I hope this makes it clear that GUnixMountType definitely isn't the solution for this - nor the right name. The closest thing I can think of is a GVolumeFormFactor enumeration (and g_{drive,volume,mount}_get_form_factor() methods) with

 UNKNOWN
 FLOPPY
 OPTICAL
 NETWORK
 CAMERA
 MEDIA_PLAYER
 DISK_ENCLOSURE
 USB_STICK

but what about devices that are more than one of these? Not to mention that it's hard to guess if a device connected via USB is a DISK_ENCLOSURE or not. It's a can of worms really. And I really don't want to add API that can't be implemented.

Basically, what you are trying to do is really hard and I seriously doubt that telling the user

  In order to open foobar.jpg please insert the CD "The Fooest of Bars"

instead of

  [CD Icon] In order to open foobar.jpg please insert "The Fooest of Bars"
                         <small>last inserted: about two weeks ago</small>

is going to add a lot of value. E.g. the identifiers you should save for the origin of the file should just be g_mount_get_uuid(), g_mount_get_name() and g_mount_get_icon() and, I guess, the time stamp.

I would suggesting closing this as WONTFIX.
Comment 3 Mikkel Kamstrup Erlandsen 2010-01-21 08:06:44 UTC
I can appreciate your concerns. A full classification of all media types is not gonna fly. However, what we need in Zeitgeist, and I expect a few other apps as well, will not be a fine grained understanding of the devices - the form factor enumeration you suggest would do fine.

We will of course use icons in the dialog (making me think that we'd need a get_icon_for_form_factor()-like method as well). However solely relying on the icons will not be accesible I assume (unless stock icons are somehow represented in the a11y layer)?

Not being able to guess the form factor would also mean that we couldn't log events about insertions/removals of media in Zeitgeist. Which is of course not a paramount feature, but could be a nice thing to do.
Comment 4 GNOME Infrastructure Team 2018-05-24 12:05:45 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/261.