GNOME Bugzilla – Bug 580779
Remove hard-coded eject in media-keys
Last modified: 2010-03-11 17:14:54 UTC
Should be pretty straight forward to do with gvfs. Get a list of volumes, check which is the first one that can be ejected, and call g_volume_eject on it.
Bastien, What's status the bug now? I'm interesting in this issue. Any ideas to do it?
You'll need to list the drives connected to the computer using g_volume_monitor_get_connected_drives() and for each one, check whether they can be ejected using g_volume_can_eject() (and are an optical drive, though you can leave that one out for now, as it would be pretty hard to do right now). Then call g_volume_eject() on the drive, and dismiss the popup after calling g_volume_eject_finish(). To test, disable the media-keys plugin in GConf, and launch test-media-keys in the plugins/media-keys directory.
Created attachment 155649 [details] [review] Replace "eject" spawn with GIO code
Review of attachment 155649 [details] [review]: ::: plugins/media-keys/gsd-media-keys-manager.c @@ -587,3 @@ - command = gconf_client_get_string (manager->priv->conf_client, - GCONF_MISC_DIR "/eject_command", Is the key in the schema? If so, we should remove it. @@ -592,3 @@ - execute (manager, command, FALSE, FALSE); - } else { - execute (manager, EJECT_COMMAND, FALSE, FALSE); EJECT_COMMAND should go, too.
(In reply to comment #4) > Review of attachment 155649 [details] [review]: > > ::: plugins/media-keys/gsd-media-keys-manager.c > @@ -587,3 @@ > > - command = gconf_client_get_string (manager->priv->conf_client, > - GCONF_MISC_DIR "/eject_command", > > Is the key in the schema? If so, we should remove it. It's not. > @@ -592,3 @@ > - execute (manager, command, FALSE, FALSE); > - } else { > - execute (manager, EJECT_COMMAND, FALSE, FALSE); > > EJECT_COMMAND should go, too. Good point, will do.
Created attachment 155716 [details] [review] Replace "eject" spawn with GIO code
Attachment 155716 [details] pushed as 325f4f4 - Replace "eject" spawn with GIO code