automounting / autorunning



Hi,

Here's a patch to make Nautilus automount new media as well as handling
autoplay/autorun. This is what gnome-volume-manager currently does,
however there's a few issues with this program

 - it doesn't handle gvfs mounts (e.g. cdda and gphoto2)
   - would practically require a rewrite
 - there's a lot of feature creep in said program
   - input devices, pda's, printers, scanners, web cams
 - mixture of doing actions based on media content and hardware
   classification
   - which is a bit confusing...
   - granted, this was written just when we started looking at
     integrating GNOME more closely with the core OS
 - no good way to associate programs with content
   - it's just text entry boxes

and I think it's more logical to have this functionality natively in the
file manager.

One design choice is that we only look at media content (e.g. look for
files / folders) instead of doing actions based on whether you have
connected a USB or Firewire device. 

There's room for both, but the latter case is getting increasingly
uninteresting because 1) it's better to have a VFS backend for cdda,
gphoto2 etc. (so apps/libraries can use a single code path); and 2) most
devices are moving to using e.g. storage (predominantly USB) anyway.
There's still a few odd cases where you want to start a program if e.g.
a PDA or web cam is connected. (In the short term I suppose people can
keep using g-v-m for this (and not use it for automounting storage
devices); in the long term this ought to move to a dedicated hardware
applet or something else.)

Anyway, here

 http://people.freedesktop.org/~david/nautilus-automount-autorun.patch

is a first pass at doing this; screenshots

 http://people.freedesktop.org/~david/nautilus-utopia.png
 http://people.freedesktop.org/~david/nautilus-utopia-2.png
 http://people.freedesktop.org/~david/nautilus-utopia-3.png
 http://people.freedesktop.org/~david/nautilus-utopia-4.png

The way one associate a program with a media type is through the use of
pseudo x-content/* types. These are not MIME-types per se but it's
pretty close. One notable difference is that one piece of media can have
multiple x-content types associated with it. Another difference is that
you want to configure a given x-content type with more than just what
program to use; you want things like 1) the preference to always ask the
user what to do; 2) the preference to just ignore it. To do 1) and 2) I
use some gconf keys; it's a bit cheesy but it actually works.

In these screenshots I've manually added x-content/* stuff to the
MimeType fields of the following applications

 - nautilus-cd-burner
 - Rhythmbox
 - Banshee
 - and so on...

Apart from that it should be pretty self-evident from the UI how it
works. The Nautilus preferences have grown another tab, Media, where the
most common x-content types can be defined. Note that we don't show all
the possible x-content types; if someone were to invent a new x-content
type tomorrow then, given we have the code to probe media for it, the
code will just work (the user will have to press SHIFT when mounting
such media to configure the defaults). 

I'm a bit torn about the Media tab; I ended up with this design (only
show common media types); another alternative is some design where you
have a combo box to select the x-content type and then once that is
selected you can select the default. I don't know. Thoughts?

There's quite a few TODO items left

 - automount all user-visible media on startup
  - but avoid doing autorun for these
 - unmount all the media we've automounted on shutdown
 - finish x-content/* types
  - finalize the semi-spec
  - add probing/sniffing code
 - clean up code
 - implement missing features
  - "Open Folder when mounted"
  - Autorun spec (e.g. $ROOT/.autostart) 

but nothing major, the patch is pretty feature complete and I thought it
would be good with some feedback and perhaps getting it in before the
feature freeze (if there are major design / code issues we can punt it
to 2.24). If we get it in I'll fix these things this week and will also
file bugs for the most common apps to use the x-content/* stuff.

Also, for 2.24, if this turns out to be a good thing, I want to move the
g_mount media sniffing code into gio and figure out a way to make the
sniffing pluggable. I also want to propose the x-content/* stuff on
xdg-list and get it into a spec (maybe the mime spec).

Some things I'm undecided about

 - what should happen if you double-click an mount icon? Either we open
   the folder; otherwise we launch the configured program. I'm leaning
   to the former and then having a clue-bar in the folder window. I
   don't know.

 - should the available handlers for x-content/* appear in an Open With
   menu when right-clicking a mount icon?  

Thoughts?

Thanks,
David




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]