GNOME Bugzilla – Bug 693682
Make it possible to invoke the format dialog
Last modified: 2013-11-19 14:29:58 UTC
The following patchset introduces two command line options, --format-device and --xid. When --format-device is used, a format dialog is shown for the device specified by --block-device. When --xid is specified in addition to that, the dialog will be parented to the passed-in foreign window instead of the main Disks window.
Created attachment 235823 [details] [review] Add a --format-device command line option To spawn Disks directly with a Format dialog open.
Created attachment 235824 [details] [review] Resolve backing crypto device when selecting object This is needed to have --block-device from the command line also work with encrypted volumes.
Created attachment 235825 [details] [review] utils: move code to ensure unused volume to gduutils.c We'll need this when the format dialog is run headless, and it's a good idea to reduce code duplication anyway.
Created attachment 235826 [details] [review] Add a --xid command line option for the format dialog When --format-device is used together with --xid, the dialog is made transient for the passed in window.
Created attachment 235835 [details] [review] Add a --xid command line option for the format dialog When --format-device is used together with --xid, the dialog is made transient for the passed in window.
Committed, thanks! I also added a patch to document the new options in the gnome-disks(1) man page. This will be in the g-d-u 3.7.2 release (later today). This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Hi, I was looking at this bug: https://bugzilla.gnome.org/show_bug.cgi?id=703424 and came here :-) It seems it's not a bug of nautilus, but maybe one in g-d-u when invoked with the xid parameter. In gduformatvolumedialog.c there is a callback set to ensure_unused_cb(). This is never called when in xid mode from what I can see in some tests I did. ensure_unused_cb() is eventually called in gduutils.c from unuse_data_complete() using: g_simple_async_result_complete_in_idle (data->simple); I'm not sure why this doesn't work, but it might be because the application exits before it gets a change to run the callback. I'm guessing that in NOT xid mode, the main window acts as the idle thread, so it gets called then. When in xid mode, there is maybe no such thread? If the above is replaced with: g_simple_async_result_complete (data->simple); ensure_unused_cb() gets called and format completes. It might be a simple case of checking for NULL in data->parent_window, and execute g_simple_async_result_complete (data->simple) instead of in_idle(). But I'm not sure if it's the correct way of doing things. I think there might be also another problem, when the filesystem to format is mounted, again when in xid mode. Although the processes completes up to unmounting it using udisks (with udisks_filesystem_call_unmount()), it doesn't seem to call unuse_data_complete() at all. The next invocation with the same parameters (and the filesystem unmounted now) gets the job done. But this might be a problem with my test enviroment, not sure. I could provide a patch for the first issue if you think it's the correct way to solve this. I'm not very familiar with how GIO works, so I can't be certain. Thanks!
Created attachment 260242 [details] [review] Force running callback in xid mode This is a proposed patch for the first issue mentioned above. It calls g_simple_async_result_complete when there is not a parent window.