[gnome-boxes] app-window: Closing window removes it from collection
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] app-window: Closing window removes it from collection
- Date: Sat, 16 Aug 2014 15:46:44 +0000 (UTC)
commit df7751b4e6f631d2f6d1375706845651f9e51d8d
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sun Aug 3 16:16:02 2014 +0200
app-window: Closing window removes it from collection
This is needed to make multiple windows possible.
https://bugzilla.gnome.org/show_bug.cgi?id=734486
src/app-window.vala | 7 ++++++-
src/app.vala | 18 ++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 5e53308..88b2de1 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -305,6 +305,11 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
[GtkCallback]
private bool on_delete_event () {
- return App.app.quit_app ();
+ return_if_fail (current_item == null || current_item is Machine);
+
+ if (current_item != null)
+ (current_item as Machine).window = null;
+
+ return App.app.remove_window (this);
}
}
diff --git a/src/app.vala b/src/app.vala
index 0007331..81eb63a 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -499,4 +499,22 @@ private class Boxes.App: Gtk.Application {
return window;
}
+
+ public new bool remove_window (AppWindow window) {
+ var initial_windows_count = windows.length ();
+
+ if (window.current_item != null)
+ (window.current_item as Machine).window = null;
+
+ window.hide ();
+ windows.remove (window);
+ base.remove_window (window);
+
+ if (windows.length () == 0)
+ return quit_app ();
+
+ notify_property ("main-window");
+
+ return initial_windows_count != windows.length ();
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]