[gnome-boxes] app: Populate new main window's collection
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] app: Populate new main window's collection
- Date: Sat, 16 Aug 2014 15:47:05 +0000 (UTC)
commit 1f95ac9e4a6606be9c6edb792eefe00c88af56e2
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sun Aug 3 16:51:27 2014 +0200
app: Populate new main window's collection
This is needed to make multiple windows possible.
https://bugzilla.gnome.org/show_bug.cgi?id=734486
src/app.vala | 6 ++++++
src/collection.vala | 5 +++++
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 81eb63a..2917865 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -502,6 +502,7 @@ private class Boxes.App: Gtk.Application {
public new bool remove_window (AppWindow window) {
var initial_windows_count = windows.length ();
+ bool window_was_main = (window == main_window);
if (window.current_item != null)
(window.current_item as Machine).window = null;
@@ -513,6 +514,11 @@ private class Boxes.App: Gtk.Application {
if (windows.length () == 0)
return quit_app ();
+ // If the main window have been removed,
+ // populate the new main window's collection view.
+ if (window_was_main)
+ collection.populate (main_window.view);
+
notify_property ("main-window");
return initial_windows_count != windows.length ();
diff --git a/src/collection.vala b/src/collection.vala
index 8cd089a..975f4ef 100644
--- a/src/collection.vala
+++ b/src/collection.vala
@@ -48,6 +48,11 @@ private class Boxes.Collection: GLib.Object {
items.remove (item);
item_removed (item);
}
+
+ public void populate (CollectionView view) {
+ for (uint i = 0 ; i < items.length ; i++)
+ view.add_item (items[i]);
+ }
}
private class Boxes.CollectionFilter: GLib.Object {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]