Commit Graph

46 Commits

Author SHA1 Message Date
Jim Broadus 01f0727649 giolister: Don't include invalid mountpoint url
If the gvfs mountpoint property for a volume is empty, we add an empty URL to
the devices URL list. This causes errors in duplicate entry detection.
2020-12-06 12:59:50 +00:00
Jim Broadus cca48b1ebf giolister: Ignore mountpoints
Read the G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT attribute (unix::is-mountpoint) to
determine if a volume is a mount that udisks2 has detected. Ignoring these
prevents network mounts from showing up as devices.
2020-12-05 13:24:54 +00:00
Jim Broadus 1a0b288a8f giolister: Remove extra g_object_unref
GioLister::UnmountDevice calls g_object_unref on the GVolume object held by a
DeviceInfo. This appears to be left over from a time before DeviceInfo held
onto the volume.
2020-12-04 22:07:01 +00:00
Jim Broadus abc70554f3 giolister: Append _ to some DeviceInfo class members
Rename drive, mount, and volume to drive_, mount_, and volume_ to
avoid confusion with method arguments.
2020-12-04 22:07:01 +00:00
John Maguire 341dc7326f Reformat all C++ 2020-09-22 14:56:06 +01:00
Jim Broadus 4bb7d41ec9 Fix mtp and gphoto2 device mounts from gvfs.
Using libmtp or libgphoto2 to access a device that gvfs has mounted causes the
connection to fail. libmtp is calling libusb_claim_interface which, according to
libusb documentation, will return LIBUSB_ERROR_BUSY if claimed by a different
program. For mtp and gphoto2 devices discovered by the GioLister, use the file
scheme and access the device through the gvfs mount.
2020-01-16 13:11:49 -08:00
Jim Broadus 5efba58f02 Decode gvfs uris.
The uri returned from g_file_get_uri is percent encoded. This causes the regex
in GioLister::MakeDeviceUrls to fail and causes the URL to be invalid. In this
case, it falls back to the file scheme. Newer versions of gvfs obtain the serial
id from udev instead of using the bus and device IDs.

Note that this bug covers a different issue where mtp is failing to connect. The
result is actually desired behavior. The follow-up change will address this.
2020-01-16 13:11:44 -08:00
Jonas Kvinge d772c8078d Fix formatting 2019-01-18 01:49:17 +01:00
Jonas Kvinge 89f40ee88f Use QUrlQuery 2019-01-18 01:47:26 +01:00
Jim Broadus 74fa386c90 Try to obtain USB bus and device number from device name if unavailable in URI. (#6243)
In 1.37.2, gvfs switched to URIs that remain consistent across USB device
re-enumerations. This removed the usb bus and device numbers from the URI. In
the case that these values aren't found in the URI, try to parse Unix device
name property and pass results as query params on the URL. Pay attention to
these params in MtpConnection.

See gvfs commits 3a7bb06b and efc76d0c for reference.
2019-01-02 15:06:22 +00:00
Jim Broadus 95187ed0a1 Fix encoding of GError messages when logging. (#6228)
GError messages contain non-ascii characters. This normally just produces some garbage when we use the default QString contructor that assumes ASCII for logging. However, when a message includes the right double quote, UTF-8 sequence 0xE2 0x80 0x9D, the final byte is OSC. VT100 expects a command sequence to follow and stops echoing output until it sees ST or BEL character, which may never come. Thus, the console output is halted.

This change uses QString::fromLocal8Bit instead of depending on the default constructor. About half of the sites in the codebase had already been converted.

One side effect is that log messages are quoted. There are additional options to control this, but those were only introduced in Qt 5.4.
2018-12-02 09:51:19 +00:00
Morris Hafner 8a6cc8b506 Add missing <functional> includes (#5630) 2017-02-13 16:46:46 +00:00
Valeriy cbc7092ed9 fix code style 2016-05-17 14:47:02 +03:00
Valeriy 806e689d1d replace foreach with range-based for 2016-05-11 19:00:30 +03:00
Valeriy 948140fab5 disconnect GVolumeMonitor signals from GioLister before destroying it
fixes #5369
2016-05-11 17:58:12 +03:00
John Maguire 3323c2d094 Convert all instances of foreach() to a C++11 for
find ext src -name '*.cpp' -exec \
    sed -i -e 's/foreach(\([^,]\+\),/for (\1 :/' {} \;
2014-02-10 14:43:32 +01:00
John Maguire bebd781fdf Reformat all non-3rd-party C/C++/Objective-C++.
Command line:
find src ext -regex '.*\.\(h\|cpp\|mm\)' -exec clang-format -i
 -style='{BasedOnStyle: Google, DerivePointerBinding: false}' {} \;
2014-02-07 16:34:20 +01:00
John Maguire 71893e4847 Use nullptr instead of NULL everywhere. 2014-02-06 17:29:59 +01:00
John Maguire d309d4ab27 Use c++11 instead of boost where possible. 2014-02-06 16:51:39 +01:00
John Maguire cbc650f44b Use CHECKED_GCONNECT instead of g_signal_connect everywhere. 2012-06-08 15:34:00 +02:00
John Maguire 9c6964da2c Remove another deprecated glib function call. 2011-10-26 12:06:51 +02:00
John Maguire 01f3f5c5ea Stop using deprecated glib eject functions. 2011-10-26 11:51:11 +02:00
Arnaud Bienner f33b62a877 Oops... Actually, it's better like this :) 2011-08-18 22:10:09 +02:00
Arnaud Bienner 299f15b7ee Allow GIO to handle CD devices if libcdio isn't installed 2011-08-18 21:41:14 +02:00
Arnaud Bienner 91537777c8 Ignore cdda devices detected via gio ealier, to avoid crash when getting device's filesystem info. This seems to happen because both giolister and cddadevice try to access to the device at the same time 2011-08-18 21:34:45 +02:00
Arnaud Bienner f7859f591c Adding CD devices in devices tab. Fixes issue 701. 2011-08-05 02:15:16 +02:00
David Sansome 3eedc916ad Add a new logging system 2011-04-22 16:50:29 +00:00
David Sansome eddc47cc64 Recognise iPods correctly when using GIO. 2011-04-12 17:27:01 +00:00
David Sansome 9f04aa7bb2 Remove an unused variable. 2011-03-28 12:52:20 +00:00
David Sansome ed1a25693c Add missing licenses to debian/copyright, and add copyright information to each source file 2010-11-20 13:27:10 +00:00
David Sansome ac90d74a28 Don't show CD drives in the devices tab 2010-10-17 20:52:07 +00:00
David Sansome c65a687678 Remove GIO devices from the list that are unmounted outside clementine 2010-09-12 19:20:06 +00:00
David Sansome c2ac3f8f32 Don't mount GIO devices automatically, instead put them in a "not mounted" state in the GUI and mount them when double-clicked on. Fixes issue #719. Probably fixes issue #723. 2010-09-11 12:29:44 +00:00
David Sansome bb4bb28c04 Automatically mount GIO volumes that get plugged in. Nautilus already does this for us in Gnome, this makes it work as expected in KDE too. 2010-09-04 12:34:01 +00:00
David Sansome 78db71c02c Semi-working WMDM device lister 2010-08-15 23:26:04 +00:00
David Sansome 3f5e188045 Initial support for MTP devices 2010-08-14 15:57:05 +00:00
David Sansome 2e646494aa Update a device's free space after copying or removing files from it 2010-08-11 18:47:53 +00:00
David Sansome 23c02830de Don't display ssh mounts in the devices list 2010-08-07 16:30:42 +00:00
David Sansome 3c6f48bd4c Ignore mounted samba shares and CDs from the GIO lister 2010-08-01 12:00:50 +00:00
David Sansome 6faa1aa1a6 Merge iLister devices with GIO devices 2010-08-01 11:55:01 +00:00
John Maguire 6358198b06 Use correct icon for Nexus One. 2010-07-25 13:32:47 +00:00
David Sansome a9d75e628b Remove the connect/disconnect actions and replace them with an eject device action. Implement eject on devicekit and gio. 2010-07-25 01:07:51 +00:00
John Maguire fa923a254e iPod colour/model detection -> icon name. 2010-07-25 00:20:18 +00:00
David Sansome d704680579 Show some more information for GIO devices 2010-07-17 22:06:19 +00:00
David Sansome 43a73555db Implement the rest of the GIO backend. Devices are now keyed off "mount URLs" as well as backend-specific device IDs, if two or more devices share the same mount URL then the metadata gets taken from the most reliable backend. 2010-07-17 17:18:02 +00:00
David Sansome 0dcdf36535 Start of work on a GIO/GVFS device backend. 2010-07-17 14:22:07 +00:00