GNOME Bugzilla – Bug 652724
prevent nautilus "close all" from closing the Desktop window
Last modified: 2011-07-25 10:35:09 UTC
Created attachment 190037 [details] [review] Prevent nautilus_application_close_all_windows to close the Desktop window Hi. By default, nautilus_application_close_all_windows() would close all nautilus windows regardless of their type. If we configured nautilus to manage the Desktop (e.g. in fallback mode), we want to make sure NAUTILUS_IS_DESKTOP_WINDOW is not closed. Thoughts?
Hi Antoine, yes, this is a bug, thanks for the patch. I think NautilusApplication and NautilusWindow code already has too many of these special cases, and I would like to try making that code a bit more clean instead. 1. You can turn nautilus_window_close() into a virtual method on NautilusWindowClass, with a default implementation in NautilusWindow that does what the current method does, and an implementation in NautilusDesktopWindow that doesn't do anything. 2. This clashes a bit with the hide-and-then-destroy dance we're trying to do in _close_all_windows(). I don't think gaining a few ms is worth complicating that code, so you can remove the double loop there, and just call nautilus_window_close() on each window instead. Does that sound OK to you?
(In reply to comment #1) > Does that sound OK to you? Sure I'll give it a shot. Just give me several days as I'm leaving for the week-end ;-) I'll keep you posted.
(In reply to comment #2) > Sure I'll give it a shot. Just give me several days as I'm leaving for the > week-end ;-) I'll keep you posted. Yep, no hurries! Have a good weekend :)
Hi Cosimo. Thanks again for the offline help. Hopefully this patch does what you requested. It "works for me" (tm) ;-)
Created attachment 190283 [details] [review] turn nautilus_window_close() into a virtual method
Review of attachment 190283 [details] [review]: Hi Antoine, the patch looks good! Just a couple of coding style details and we're good to go; feel free to push to git master with these fixed. ::: src/nautilus-window.c @@ +864,3 @@ nautilus_window_close (NautilusWindow *window) { + NAUTILUS_WINDOW_CLASS (G_OBJECT_GET_CLASS(window))->window_close(window); Coding style: make sure to put spaces before braces here. </nitpick> ::: src/nautilus-window.h @@ +94,2 @@ void (* prompt_for_location) (NautilusWindow *window, const char *initial); + void (* window_close) (NautilusWindow *window); You don't usually repeat the class name in the virtual method names, so this should be just (* close).
Created attachment 190288 [details] [review] turn nautilus_window_close() into a virtual method v2
Fixed patch. Regarding the 'window_close' vs 'close' I was just mimicking window_type ;-) As for "pushing to git master", you're not the first one to tell me to do it but I have no commit bit so feel free to do it for me. Thanks, it's been a pleasure working with you on this!
Hi Cosimo. Any news about this being committed? Thanks.
Thanks again for the patch; I just pushed this to git master now.