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 321320 - places sidebar should display unmounted cdrom and floppy
places sidebar should display unmounted cdrom and floppy
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Sidebar
2.14.x
Other All
: High normal
: 2.14.x
Assigned To: Federico Mena Quintero
Nautilus Maintainers
: 128625 310048 (view as bug list)
Depends on: 147813
Blocks:
 
 
Reported: 2005-11-12 22:02 UTC by Xavier Claessens
Modified: 2006-05-20 19:22 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
the patch (1.81 KB, patch)
2006-03-31 22:19 UTC, Xavier Claessens
none Details | Review
updated (1.72 KB, patch)
2006-04-01 09:38 UTC, Xavier Claessens
none Details | Review
what it looks like when sorted (51.61 KB, image/png)
2006-04-01 10:17 UTC, Xavier Claessens
  Details
Proposed tree view patch (741 bytes, patch)
2006-04-01 11:16 UTC, Christian Neumair
committed Details | Review
mount the floppy when clicking (6.10 KB, patch)
2006-04-01 13:02 UTC, Xavier Claessens
none Details | Review
add all unmounted drives (7.30 KB, patch)
2006-04-02 19:24 UTC, Xavier Claessens
none Details | Review
fix bug from previous patch, forgotten to give the drive to add_place() (7.30 KB, patch)
2006-04-02 21:40 UTC, Xavier Claessens
none Details | Review
fix a leak (7.64 KB, patch)
2006-04-03 17:56 UTC, Xavier Claessens
none Details | Review
gnome-vfs2-155010-media-check-user-visible-drives.diff (2.28 KB, patch)
2006-04-03 19:33 UTC, Federico Mena Quintero
none Details | Review
fix another leak in row_activated_callback() (7.74 KB, patch)
2006-04-04 11:15 UTC, Xavier Claessens
committed Details | Review
make gnome-panel uses gnome_vfs_volume_compare (1.20 KB, patch)
2006-04-07 20:48 UTC, Xavier Claessens
none Details | Review
A simple mock-up of my proposed unmounted media solution. (47.73 KB, image/png)
2006-05-08 16:01 UTC, Justin Stark (old account)
  Details

Description Xavier Claessens 2005-11-12 22:02:19 UTC
Please describe the problem:
The GtkFilechooser displays unmounted cdroms and floppies. Nautilus place
sidebar doesn't. I think both shoud display same thinks. Displaying cdroms if
unmounted isn't very useful, I agree, because if there is a cdrom it is
automaticaly mounted, but for the floppy it isn't the same, with a floppy entry
in the sidebar we can easily mount the floppy just by clicking on it. just like
in computer:///. Filechooser already do like that.

Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Federico Mena Quintero 2006-03-31 19:45:38 UTC
This needs to be made consistent between GtkFileChooser, the Places sidebar in Nautilus, and the Nautilus desktop.

Right now:

1. The file chooser shows all user-visible drives, and all user-visible volumes with no associated drives.

2. The computer:/// method does the same as (1)

3. The desktop shows only user-visible modules (so e.g. you don't get a floppy icon for unmounted floppies).

4. The Places sidebar in Nautilus does the same as (3).

The most visible inconsistency is (1) vs. (4).

(3) is inconvenient in that you expect to have a floppy icon, but there is none.
Comment 2 Federico Mena Quintero 2006-03-31 19:53:08 UTC
Showing all user-visible drives is inconvenient because if you plug in (say) a USB multicard reader, you get N different items:

  SanDisk Card Reader
  SanDisk Card Rader (2)
  SanDisk Card Reader (3)
  ...

I think we should just have a special case for floppies.  This way, (1), (3), and (4) would display the same thing:  user-visible volumes *and* drives of type FLOPPY.  It's probably fine to have the computer:/// method list everything.

The question is how to know that a GnomeVFSDrive is of type FLOPPY; the drive may not have a volume if it's unmounted, and we only get GnomeVFSDeviceType out of volumes, not drives...
Comment 3 Xavier Claessens 2006-03-31 20:20:21 UTC
HAL knows what kind of driver it is, can't we ask directly to him ? I don't know how HAL and gnomeVFS works together...

I just read the gnomeVFS doc and I see:
GnomeVFSDeviceType gnome_vfs_drive_get_device_type (GnomeVFSDrive *drive);
So it returns what we want from a GnomeVFSDrive, not a volume... Or I don't understand something ?
Comment 4 Federico Mena Quintero 2006-03-31 22:16:28 UTC
Oh, you are right!  I had totally missed that function :)

I'll implement this right away.
Comment 5 Xavier Claessens 2006-03-31 22:19:19 UTC
Created attachment 62487 [details] [review]
the patch

This patch isn't already perfect I get a NULL for the mout_uri, I think it's because the floppy isn't mouted yet... Don't know how to fix that.
Comment 6 Federico Mena Quintero 2006-03-31 23:36:40 UTC
Fantastic!  Just don't select the row if the floppy is not mounted.  You don't know where it will get mounted (that location may change each time).

I'll just patch the file chooser based on your code :)
Comment 7 Xavier Claessens 2006-04-01 09:38:03 UTC
Created attachment 62516 [details] [review]
updated

Ok so I removed the row selection, I fixed drives not being freed. So far I see one problem with the patch:

Clicking on the floppy icon doesn't mount it ! The problem is that mount_uri is NULL so nautilus don't know what to mount. I tried with gnome_vfs_drive_get_device_path which returns "/dev/fd0" but when mounting nautilus says that /dev/fd0 isn't a folder. The problem is maybe that I have no entry in my fstab for the floppy and no mount point in /media but it works when clicking on the floppy in computer:/// (/media/floppy folder is automatically created).
Comment 8 Christian Neumair 2006-04-01 09:45:28 UTC
While we're at it, please sort the list of drives and volumes using gnome_vfs_drive_compare and gnome_vfs_volume_compare before adding them. I will create a gnome-panel patch.
Comment 9 Xavier Claessens 2006-04-01 10:17:03 UTC
Created attachment 62517 [details]
what it looks like when sorted

I added «volumes = g_list_sort (volumes, gnome_vfs_volume_compare);» but as you can see in screenshot nautilus's places and GtkFileChooser doesn't sort items the same way. I think that having items in the same order is very important for desktop integration !

Another thing: gnome-panel as to be patched to add the floppy entry in the places menu.

Is that going to be part of nautilus-2.14.x or 2.15.x ?
Comment 10 Christian Neumair 2006-04-01 11:02:19 UTC
Xavier: I think it will make it into the 2.14 series.
Note that the current sorting algorithm (i.e. GnomeVFS' _compare functions) are NOT correct, but that will be fixed for 2.14.1 as well, I have a patch that makes it use a case-insensitive and locale-dependant sorting algorithm for the display names.
Comment 11 Christian Neumair 2006-04-01 11:13:25 UTC
*** Bug 128625 has been marked as a duplicate of this bug. ***
Comment 12 Christian Neumair 2006-04-01 11:14:29 UTC
*** Bug 310048 has been marked as a duplicate of this bug. ***
Comment 13 Christian Neumair 2006-04-01 11:16:24 UTC
Bug 147813 has the relevant GnomeVFS patch, I've marked this one as dependant on bug 147813.

Xavier: I will handle the gnome-panel patch, and the tree sidebar.
Comment 14 Christian Neumair 2006-04-01 11:16:53 UTC
Created attachment 62522 [details] [review]
Proposed tree view patch
Comment 15 Xavier Claessens 2006-04-01 13:02:37 UTC
Created attachment 62534 [details] [review]
mount the floppy when clicking

I think it's not the right way to mount the floppy but I post here what I have. As I see gnome-panel will have the same problem than nautilus to mount the drive. computer:// has a window popup that says the drive is being mounted, I think I should call the same function but I can't find where this code is, can someone tell me where I can find the computer:// code ?
Comment 16 David Zeuthen (not reading bugmail) 2006-04-01 14:20:31 UTC
Regarding comment 1 and comment 2: It sounds like you want the Mac OS X behavior where only mounted volumes are shown... However, you really do need to show drives that have no media

1. User may disable automounting
2. Impossible to remount volumes you unmounted
3. It applies to more than floppy drives; for example IDE Zip Drives and broken optical drives we cannot poll (though for the latter I *think* at least the Linux kernel is already fixed)
4. Passworded media for which you don't have the password when the dialog pops up (see http://blog.fubar.dk/?p=64 for details)
5. It's considered nice to show volumes for which we don't have a file system driver as clicking them is an easy way to ask the user whether we should download the file system driver (e.g. NTFS on a multi boot system)
6. If you don't use HAL and g-v-m there is no guarantee of automounting

Now, you may argue 1. and 2. is stupid and I would agree. We can fix 3. by just looking at the storage.media_detection_enabled flag in HAL (gnome-vfs exposes the HAL UDI). For 4. I would just say the user needs to reinsert the drive. 5. I'm not sure, we can ask on device insertion but that doesn't work nice on a multi-boot laptop. I think 6. is the show stopper.

Btw, I disagree that we should have a volume icon on the desktop if there is no media in the drive. I think SUSE used to do this through the terrible subfs hack but it's still bad IMO.

> SanDisk Card Reader
> SanDisk Card Reader (2)
> SanDisk Card Reader (3)

This is fixed by just teaching HAL about the device and instead you get

 Compact Flash Drive
 Smart Media Drive
 SD/MMC Drive
 MemoryStick Drive

instead (yes, we despearately need a way for users to teach HAL about this and automatically send that device information to a website for inclusion in the HAL distribution tarballs... but that is another problem... ideally we have a real hal-device-manager program and an easy shortcut from the Properties page in Nautilus or something)
Comment 17 David Zeuthen (not reading bugmail) 2006-04-01 14:24:58 UTC
Btw, the question of displaying only mounted volumes was discussed on gnome-vfs-list a while ago (like 1-2 years ago, I think around the summer of 2004)... I argued that we should do it the OS X way and only show mounted volumes however Alex shot it down and today I think there are even more reasons for not doing so.

I think a good compromise might be only to show drives without volumes in computer:/// only... after all, everything else "just works" and the cases where you need the drives are not that many and we can expect the user to go to computer:///. It's just a tradeoff.
Comment 18 Xavier Claessens 2006-04-01 14:57:08 UTC
I think the most important is that everywhere we get the same things (except for computer:/// that need to diplay everything). So if we don't want unmounted volumes in nautilus's sidebar we have to patch GtkFileChooser to not display them.  The problemes I see:

1) GTK can be used in systems without g-v-m, HAL and other automount magic, so GTK will always want to display unmounted volumes.

2) There is drives that can't be mounted automatically (like floppy). Diplaying them in nautilus'sidebar is easier for users but not vital since they have computer:// to mount them. Here is a case: I'm writing something in abiword and want to save it on my floppy, I choose "save as" option and get a GtkFileChooser, I insert my floppy and then I really need a floppy icon on the filechooser, it is not intuitive if I have to go to computer:/// to mount the floppy then come back to my filechooser and see the floppy icon appeared and then save the file.

So with those 2 cases we see that GtkFileChooser need unmounted drives, so I think nautilus'sidebar should also have them just to be consistent and in the same way make the live of users easier with drives like floppy that can't be mounted automatically.
Comment 19 Xavier Claessens 2006-04-02 19:24:34 UTC
Created attachment 62626 [details] [review]
add all unmounted drives

Here is a patch to show all unmouted drives. My proposed order is:
1) build-in special bookmarks like home,etc...
2) for each drives (sorted list) add all his volumes (sorted list), if no volumes just add the drive.
3) add all volumes that have no drives, like ftp,etc...

With this patch GtkFilechooser and nautils'sidebar displays de same items but not yet in the same order but I think it's a matter of tweak in gnome_vfs_{drive,volume}_compare().

The only bug I see is when I unmount a volume "volume_unmounted" signal of GnomeVFSVolumeMonitor is emited too early, gnome-vfs still says that the drive is mounted. I see that GtkFileChooser has the same bug.

I'm waiting for comments...
Comment 20 Xavier Claessens 2006-04-02 21:40:04 UTC
Created attachment 62636 [details] [review]
fix bug from previous patch, forgotten to give the drive to add_place()
Comment 21 Federico Mena Quintero 2006-04-03 17:28:29 UTC
(In reply to comment #16)
> Regarding comment 1 and comment 2: It sounds like you want the Mac OS X
> behavior where only mounted volumes are shown... However, you really do need to
> show drives that have no media

Basically, I want to access all the drives in my computer without cluttering my desktop, the file chooser, or the Places sidebar.  And some ice-cream would be nice, too :)

> Now, you may argue 1. and 2. is stupid and I would agree. We can fix 3. by just
> looking at the storage.media_detection_enabled flag in HAL (gnome-vfs exposes

Ah, interesting.  You mean storage.media_check_enabled, right?

> Btw, I disagree that we should have a volume icon on the desktop if there is no
> media in the drive. I think SUSE used to do this through the terrible subfs
> hack but it's still bad IMO.

Subfs is gone now, thankfully.  You have no idea how happy it made me to see it die.

Since we don't have media detection for floppies, the desktop can't know when there is media in the drive.  Then it cannot display an icon through which you can access a floppy which you just inserted, so you can't access your floppy drive at all.

I guess a more or less robust test for drives is

  drive_is_user_visible() && !drive_mounted() && libhal_get_bool(drive.udi, "storage.media_check_enabled") == FALSE

I'll massage Xavier's patch from comment #20 a bit and use it (it leaks the GnomeVFSDrive after testing for gnome_vfs_volume_get_drive(), but that's a minor fix).
Comment 22 Xavier Claessens 2006-04-03 17:56:21 UTC
Created attachment 62682 [details] [review]
fix a leak

thanks Federico to point me this leak.
Comment 23 Federico Mena Quintero 2006-04-03 18:18:39 UTC
Actually...

Neither Nautilus nor GtkFileSystemGnomeVFS have a direct dependency on HAL, and it's good to keep them that way.  So, I think it should be GnomeVFSDrive itself who should say whether it should be displayed in the GUI.

I think we should include the media_check_enabled condition in the basic GnomeVFSDrive.is_user_visible.  The following patch makes this happen.
Comment 24 Federico Mena Quintero 2006-04-03 19:33:49 UTC
Created attachment 62695 [details] [review]
gnome-vfs2-155010-media-check-user-visible-drives.diff

Patch for gnome-vfs.  This makes gnome-vfs-hal-mounts set Drive.is_user_visible to TRUE if the drive doesn't support media checks, instead of setting it for all drives.
Comment 25 Xavier Claessens 2006-04-04 11:15:28 UTC
Created attachment 62728 [details] [review]
fix another leak in row_activated_callback()

We shouldn't wait too much if we want that for GNOME 2.14.1, it's in 6 days I think.

I think the proposed patch will be useful for bug #316184
Comment 26 David Zeuthen (not reading bugmail) 2006-04-04 14:18:51 UTC
In reply to comment 21
> Ah, interesting.  You mean storage.media_check_enabled, right?

Yup

> I guess a more or less robust test for drives is
>
>  drive_is_user_visible() && !drive_mounted() && 
> libhal_get_bool(drive.udi, "storage.media_check_enabled") == FALSE

Sounds good to me; I'll add some API to libhal-storage so later versions of gnome-vfs-daemon will export this value and the daemon won't have to do another roundtrip to get it.

You also want to make sure you set Drive.is_user_visible in the fstab/mtab backend and I guess you need to rely on heuristics here (like the /etc/fstab name containing floppy or zip).

(btw, for testing that backend just stop the hal daemon and gnome-vfs-daemon will revert to using that)
Comment 27 Martin Wehner 2006-04-07 00:20:11 UTC
Comment on attachment 62728 [details] [review]
fix another leak in row_activated_callback()

So, great patch here. I changed some tiny details and committed it to HEAD. Thanks!

2006-04-07  Martin Wehner  <martin.wehner@gmail.com>

	* src/nautilus-places-sidebar.c: (add_place), (update_places),
	(mount_volume_callback), (row_activated_callback),
	(bookmarks_popup_menu_detach_cb), (nautilus_places_sidebar_init):
	Adapt the same policy for showing drives and volumes in the places
	sidebar as in computer:/// and the gtk filechooser: Show unmounted
	but user-visible drives and mount them on activation. (#321320)

	Patch from Xavier Claessens <xclaesse@gmail.com>
Comment 28 Martin Wehner 2006-04-07 00:31:55 UTC
Comment on attachment 62522 [details] [review]
Proposed tree view patch

That's fine too, as soon as the patch it depends on gets in.
Comment 29 Xavier Claessens 2006-04-07 20:48:00 UTC
Created attachment 62953 [details] [review]
make gnome-panel uses gnome_vfs_volume_compare

we should commit patch from bug #147813 because now nautilus-place-sidebar uses _compare(). The patch for gnome_vfs should also be commited to avoid having useless icons for drives that can be auto-mounted.

And finaly here is a patch to make gnome-panel use _compare() function to have the same order than in nautilus. I'll try to update this patch to display icon for unmounted (but user-visible) volumes in the gnome-panel.
Comment 30 Martin Wehner 2006-04-07 21:24:50 UTC
You should probably post the gnome-panel patch in a separate gnome-panel bug report. It won't get the attention of the panel maintainers here.
Comment 31 Xavier Claessens 2006-04-07 21:54:20 UTC
Ok so I opened bug #337685 for gnome-panel stuffs.
Comment 32 Christian Neumair 2006-04-25 12:20:31 UTC
Marking attachment 62953 [details] [review] as obsolete, it is was reattached to bug 336815.

Federico: (re comment 24): Maybe you could commit attachment 62695 [details] [review], David seems to be fine with it?
Comment 33 Christian Neumair 2006-04-25 12:26:06 UTC
Note that I just committed attachment 62522 [details] [review], and raised the required GnomeVFS version to 2.14.2, because it contains the required gnome_vfs_volume_compare fixes.
Comment 34 Alexander Larsson 2006-04-26 12:45:37 UTC
I commited  attachment 62695 [details] [review] to gnome-vfs HEAD.
Is there any other outstanding part of this bug left?
Comment 35 Christian Neumair 2006-04-26 12:51:14 UTC
I don't think so. Marking as FIXED.
Comment 36 Xavier Claessens 2006-04-26 13:17:38 UTC
All patches are commited to branch 2.14, why attachment 62695 [details] [review] is only on HEAD ?
Comment 37 Justin Stark (old account) 2006-05-08 16:00:24 UTC
I am absolutely against unmounted media in nautilus's sidebar.  It is providing functionality that already exists elsewhere.

It is, however, obvious that there needs to be a way to incorporate the mount function into nautilus 1) for media that does not mount automatically (such as floppies) and 2) to be able to mount media in save/open dialogs so as not to have to open new windows.

So, here are some proposed solutions:

1) The sidebar currently has different items of information that can be selected with a drop-down menu (Places, Information, Tree, etc). Why not include a Media category and display unmounted media there? It would keep things clean but still allow people to manually mount media.
2) Include a button to mount media in the toolbar. Upon being pressed, a dialog would open asking which media to mount (cdrom, floppy, etc). Once the media is mounted, it can be displayed in the nautilus sidebar. This would provide an easy way to mount media as well as provide easy integration into open/save dialogs.
3) Create a panel applet that would open when clicked and display unmounted media (much like a drawer). Then there would be no need to open a new window just to mount media.

I am all for #2 as it seems to be the most reasonable solution and can be widely integrated into save/open dialogs, nautilus, and any other dialog that may need to save/open a file on removable media.

I have made a simple mock-up that I will attach.  It could be beautified with icons and such but it displays an alternative method that I think would be superior to polluting nautilus's sidebar.

At the very least, there needs to be an option in gconf-editor to change nautilus's default behavior for unmounted media.
Comment 38 Justin Stark (old account) 2006-05-08 16:01:46 UTC
Created attachment 65034 [details]
A simple mock-up of my proposed unmounted media solution.
Comment 39 Xavier Claessens 2006-05-08 16:36:06 UTC
GtkFileChooser shows unmounted media, so discution goes to GTK poeple. The places sidebar just has to be the same as in GTK. That's my point of view.

attachment 62695 [details] [review] prevent to display auto-mounted drives, so it adds only one icon for the floppy drive, that's not too much. (again, please commit this patch to 2.14 branch !!!)

By adding the floppy drive in place sidebar, the user just click on it and see it works, he don't want to know what "mount" means. If you don't add the floppy icon there, he has to know that he must mount the floppy before accessing it, that's not gnome-spirit !

I reopen the bug to have someone with CVS access to commit attachment 62695 [details] [review] to 2.14 branch. (or to say why that's not a good idea to commit to the stable branch...)
Comment 40 Justin Stark (old account) 2006-05-09 04:53:01 UTC
And what about a gconf-editor option like I suggested earlier.  A downstream bug in launchpad(ubuntu) as well as the ubuntu dapper drake community forums have been plagued with people complaining about nautilus's new behavior.  We need to give people an option to change it.
Comment 41 Alexander Larsson 2006-05-11 14:45:16 UTC
attachment 62695 [details] [review] commited to gnome-2-14.
Comment 42 Xavier Claessens 2006-05-20 06:11:27 UTC
For me this bug is now close. I think a gconf key is useless, for most users it adds only one line for the floppy, that's not too much and is useful.
Comment 43 Justin Stark (old account) 2006-05-20 19:22:48 UTC
I meant a gconf key to completely remove ALL unmounted media from the sidebar including unmounted cds.