After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 734486 - Allow running multiple boxes, each in its own window
Allow running multiple boxes, each in its own window
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: 3.22
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on: 732098
Blocks: 734877
 
 
Reported: 2014-08-08 14:29 UTC by Zeeshan Ali
Modified: 2016-03-31 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
searchbar: Ensure window is set before connecting to it (1.26 KB, patch)
2014-08-14 07:21 UTC, Adrien Plazas
needs-work Details | Review
app: Replace AppWindow singleton by List<Boxes.AppWindow> (2.82 KB, patch)
2014-08-14 07:21 UTC, Adrien Plazas
needs-work Details | Review
app-window: Closing window removes it from collection (3.43 KB, patch)
2014-08-14 07:21 UTC, Adrien Plazas
needs-work Details | Review
collection-toolbar: Show back button only on main window (1.26 KB, patch)
2014-08-14 07:21 UTC, Adrien Plazas
none Details | Review
display-toolbar: Show back button only on main window (954 bytes, patch)
2014-08-14 07:21 UTC, Adrien Plazas
none Details | Review
app-window: Present window when machine selected (1.48 KB, patch)
2014-08-14 07:21 UTC, Adrien Plazas
none Details | Review
app: Populate new main window's collection (1.71 KB, patch)
2014-08-14 07:21 UTC, Adrien Plazas
none Details | Review
selectionbar: Add 'Open in new windows' button (3.68 KB, patch)
2014-08-14 07:21 UTC, Adrien Plazas
none Details | Review
Add MachineMenu (9.07 KB, patch)
2014-08-14 07:21 UTC, Adrien Plazas
none Details | Review
display-toolbar: Replace properties button by MachineMenu (5.38 KB, patch)
2014-08-14 07:21 UTC, Adrien Plazas
none Details | Review
colection-view: Show MachineMenu on right-click (3.37 KB, patch)
2014-08-14 07:21 UTC, Adrien Plazas
none Details | Review
searchbar: Ensure window is set before connecting to it (1.28 KB, patch)
2014-08-15 11:12 UTC, Adrien Plazas
none Details | Review
app: Replace AppWindow singleton by List<Boxes.AppWindow> (2.80 KB, patch)
2014-08-15 11:12 UTC, Adrien Plazas
none Details | Review
app-window: Closing window removes it from collection (3.19 KB, patch)
2014-08-15 11:12 UTC, Adrien Plazas
none Details | Review
machine: Close window on machine deletion (1.06 KB, patch)
2014-08-15 11:12 UTC, Adrien Plazas
none Details | Review
collection-toolbar: Show back button only on main window (1.26 KB, patch)
2014-08-15 11:12 UTC, Adrien Plazas
none Details | Review
display-toolbar: Show back button only on main window (954 bytes, patch)
2014-08-15 11:12 UTC, Adrien Plazas
none Details | Review
app-window: Present window when machine selected (1.48 KB, patch)
2014-08-15 11:13 UTC, Adrien Plazas
none Details | Review
app: Populate new main window's collection (1.72 KB, patch)
2014-08-15 11:13 UTC, Adrien Plazas
none Details | Review
selectionbar: Add 'Open in new windows' button (3.68 KB, patch)
2014-08-15 11:13 UTC, Adrien Plazas
none Details | Review
Add MachineMenu (9.07 KB, patch)
2014-08-15 11:13 UTC, Adrien Plazas
none Details | Review
display-toolbar: Replace properties button by MachineMenu (5.38 KB, patch)
2014-08-15 11:13 UTC, Adrien Plazas
none Details | Review
colection-view: Show MachineMenu on right-click (3.27 KB, patch)
2014-08-15 11:13 UTC, Adrien Plazas
none Details | Review
searchbar: Ensure window is set before connecting to it (1.28 KB, patch)
2014-08-15 11:43 UTC, Adrien Plazas
reviewed Details | Review
app: Replace main_window by list of windows (2.79 KB, patch)
2014-08-15 11:43 UTC, Adrien Plazas
accepted-commit_now Details | Review
app-window: Closing window removes it from collection (3.19 KB, patch)
2014-08-15 11:43 UTC, Adrien Plazas
needs-work Details | Review
machine: Close window on machine deletion (1.06 KB, patch)
2014-08-15 11:43 UTC, Adrien Plazas
needs-work Details | Review
collection-toolbar: Show back button only on main window (1.26 KB, patch)
2014-08-15 11:43 UTC, Adrien Plazas
accepted-commit_now Details | Review
display-toolbar: Show back button only on main window (954 bytes, patch)
2014-08-15 11:43 UTC, Adrien Plazas
accepted-commit_now Details | Review
app-window: Present window when machine selected (1.48 KB, patch)
2014-08-15 11:43 UTC, Adrien Plazas
needs-work Details | Review
app: Populate new main window's collection (1.72 KB, patch)
2014-08-15 11:43 UTC, Adrien Plazas
accepted-commit_now Details | Review
selectionbar: Add 'Open in new windows' button (3.68 KB, patch)
2014-08-15 11:43 UTC, Adrien Plazas
needs-work Details | Review
Add MachineMenu (9.07 KB, patch)
2014-08-15 11:43 UTC, Adrien Plazas
needs-work Details | Review
display-toolbar: Replace properties button by MachineMenu (5.38 KB, patch)
2014-08-15 11:43 UTC, Adrien Plazas
reviewed Details | Review
colection-view: Show MachineMenu on right-click (3.27 KB, patch)
2014-08-15 11:43 UTC, Adrien Plazas
needs-work Details | Review
searchbar: Ensure window is set before connecting to it (1.33 KB, patch)
2014-08-15 14:08 UTC, Adrien Plazas
committed Details | Review
app: Replace main_window by list of windows (2.79 KB, patch)
2014-08-15 14:08 UTC, Adrien Plazas
committed Details | Review
app-window: Closing window removes it from collection (2.54 KB, patch)
2014-08-15 14:08 UTC, Adrien Plazas
needs-work Details | Review
machine: Close window on machine deletion/not running (1.60 KB, patch)
2014-08-15 14:08 UTC, Adrien Plazas
needs-work Details | Review
collection-toolbar: Show back button only on main window (1.26 KB, patch)
2014-08-15 14:08 UTC, Adrien Plazas
accepted-commit_now Details | Review
display-toolbar: Show back button only on main window (954 bytes, patch)
2014-08-15 14:08 UTC, Adrien Plazas
accepted-commit_now Details | Review
app-window: Present window when machine activated (1.50 KB, patch)
2014-08-15 14:08 UTC, Adrien Plazas
needs-work Details | Review
app: Populate new main window's collection (1.72 KB, patch)
2014-08-15 14:08 UTC, Adrien Plazas
accepted-commit_now Details | Review
selectionbar: Add 'Open in new windows' button (3.50 KB, patch)
2014-08-15 14:08 UTC, Adrien Plazas
needs-work Details | Review
app-window: Closing window removes it from collection (2.40 KB, patch)
2014-08-15 18:01 UTC, Adrien Plazas
none Details | Review
machine: Close window on machine deletion/stopping (1.60 KB, patch)
2014-08-15 18:01 UTC, Adrien Plazas
none Details | Review
collection-toolbar: Show back button only on main window (1.26 KB, patch)
2014-08-15 18:01 UTC, Adrien Plazas
none Details | Review
display-toolbar: Show back button only on main window (954 bytes, patch)
2014-08-15 18:02 UTC, Adrien Plazas
none Details | Review
app-window: Present window when machine activated (1.50 KB, patch)
2014-08-15 18:02 UTC, Adrien Plazas
none Details | Review
app: Populate new main window's collection (1.75 KB, patch)
2014-08-15 18:02 UTC, Adrien Plazas
none Details | Review
selectionbar: Add 'Open in new windows' button (3.37 KB, patch)
2014-08-15 18:02 UTC, Adrien Plazas
none Details | Review
app-window: Closing window removes it from collection (2.40 KB, patch)
2014-08-15 19:10 UTC, Adrien Plazas
committed Details | Review
machine: Close window on machine deletion/stopping (1.60 KB, patch)
2014-08-15 19:10 UTC, Adrien Plazas
needs-work Details | Review
collection-toolbar: Show back button only on main window (1.26 KB, patch)
2014-08-15 19:10 UTC, Adrien Plazas
committed Details | Review
display-toolbar: Show back button only on main window (954 bytes, patch)
2014-08-15 19:10 UTC, Adrien Plazas
committed Details | Review
app-window: Present window when machine activated (1.49 KB, patch)
2014-08-15 19:10 UTC, Adrien Plazas
committed Details | Review
app: Populate new main window's collection (1.75 KB, patch)
2014-08-15 19:10 UTC, Adrien Plazas
committed Details | Review
selectionbar: Add 'Open in new windows' button (3.72 KB, patch)
2014-08-15 19:10 UTC, Adrien Plazas
committed Details | Review

Description Zeeshan Ali 2014-08-08 14:29:54 UTC
Its about implementing this mockup:

https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/boxes/wires/multi-window.png

This will require quite a bit of changes in code layout, for which we have a separate bug: bug#732098.
Comment 1 Adrien Plazas 2014-08-14 07:21:12 UTC
Created attachment 283351 [details] [review]
searchbar: Ensure window is set before connecting to it

Until this patch, window was null when trying to connect to it.
Comment 2 Adrien Plazas 2014-08-14 07:21:16 UTC
Created attachment 283352 [details] [review]
app: Replace AppWindow singleton by List<Boxes.AppWindow>

This is needed to make multiple windows possible.
Comment 3 Adrien Plazas 2014-08-14 07:21:20 UTC
Created attachment 283353 [details] [review]
app-window: Closing window removes it from collection

Also, use 'this.window' to refer to Topbar's AppWindow in a closure to
avoid a Vala bug relative to the AppWindow while destroying the closure.

This is needed to make multiple windows possible.
Comment 4 Adrien Plazas 2014-08-14 07:21:24 UTC
Created attachment 283354 [details] [review]
collection-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 5 Adrien Plazas 2014-08-14 07:21:28 UTC
Created attachment 283355 [details] [review]
display-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 6 Adrien Plazas 2014-08-14 07:21:31 UTC
Created attachment 283356 [details] [review]
app-window: Present window when machine selected

This presents a machine's window if the machine is selected and is already
running in a window, otherwise it creates a new window for the machine.

This is needed to make multiple windows possible.
Comment 7 Adrien Plazas 2014-08-14 07:21:35 UTC
Created attachment 283357 [details] [review]
app: Populate new main window's collection

This is needed to make multiple windows possible.
Comment 8 Adrien Plazas 2014-08-14 07:21:39 UTC
Created attachment 283358 [details] [review]
selectionbar: Add 'Open in new windows' button

This is needed to make multiple windows possible.
Comment 9 Adrien Plazas 2014-08-14 07:21:43 UTC
Created attachment 283359 [details] [review]
Add MachineMenu

Implements the machine menu shown in  this mockup:
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/
boxes/wires/multi-window.png

This is needed to make multiple windows possible.
Comment 10 Adrien Plazas 2014-08-14 07:21:47 UTC
Created attachment 283360 [details] [review]
display-toolbar: Replace properties button by MachineMenu

This is needed to make multiple windows possible.
Comment 11 Adrien Plazas 2014-08-14 07:21:51 UTC
Created attachment 283361 [details] [review]
colection-view: Show MachineMenu on right-click

This is needed to make multiple windows possible.
Comment 12 Zeeshan Ali 2014-08-14 14:21:28 UTC
Review of attachment 283351 [details] [review]:

I think its a good change but I don't think justification in log is correct. I don't think it was always 'null' at least, maybe it could be 'null' but I don't know if even that is possible right now.
Comment 13 Zeeshan Ali 2014-08-14 14:28:25 UTC
Review of attachment 283352 [details] [review]:

I'd write "Replace main_window by list of windows". And you are not replacing a sigleton but a property.

::: src/app.vala
@@ +259,2 @@
     public bool quit_app () {
+        foreach (var window in windows) {

no need for braces.
Comment 14 Zeeshan Ali 2014-08-14 16:19:17 UTC
Review of attachment 283353 [details] [review]:

You also want to mention the diff with existing code in the details.

::: src/app-window.vala
@@ +306,3 @@
     [GtkCallback]
     private bool on_delete_event () {
+        return_if_fail ((current_item == null) || (current_item is Machine));

inner brackets are redundant IMO and makes it less readable.

::: src/app.vala
@@ +502,3 @@
     }
+
+    public bool remove_app_window (AppWindow window) {

_app_ is pretty redundant in the name due to context and argument type.

@@ +503,3 @@
+
+    public bool remove_app_window (AppWindow window) {
+        var windows_nb = windows.length ();

what does nb stands for? coding style is not to use known or nonobvious abbreviations.

@@ +510,3 @@
+        window.hide ();
+        windows.remove (window);
+        remove_window (window);

oh I see that you are already using 'remove_window'. Since both take AppWindow argument, adding '_app_' in the name of this function helps avoid the conflict but OTOH its confusing still what exactly is the diff between these two functions.

::: src/machine.vala
@@ +505,3 @@
             debug("Could not delete screenshot: %s", e.message);
         }
+

These changes seem to be about deletion of window on deletion of machine rather than about removal of window from collection on deletion so I think they need to be in separate patch.

::: src/topbar.vala
@@ +103,2 @@
         window.notify["selection-mode"].connect (() => {
+            page = this.window.selection_mode ?

* Please always add a FIXME comment above work arounds for bugs with a URL to the bug.
* This is unrelated to this patch so you know what to do. :)
Comment 15 Adrien Plazas 2014-08-15 11:12:37 UTC
Created attachment 283448 [details] [review]
searchbar: Ensure window is set before connecting to it

Until this patch, window was in an uncertain state when trying to connect to it.
Comment 16 Adrien Plazas 2014-08-15 11:12:42 UTC
Created attachment 283449 [details] [review]
app: Replace AppWindow singleton by List<Boxes.AppWindow>

This is needed to make multiple windows possible.
Comment 17 Adrien Plazas 2014-08-15 11:12:46 UTC
Created attachment 283450 [details] [review]
app-window: Closing window removes it from collection

Also, use 'this.window' to refer to Topbar's AppWindow in a closure to
avoid a Vala bug relative to the AppWindow while destroying the closure.

This is needed to make multiple windows possible.
Comment 18 Adrien Plazas 2014-08-15 11:12:50 UTC
Created attachment 283451 [details] [review]
machine: Close window on machine deletion

If a machine haves a window and the machine is deleted, the window will be
closed.

This is needed to make multiple windows possible.
Comment 19 Adrien Plazas 2014-08-15 11:12:54 UTC
Created attachment 283452 [details] [review]
collection-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 20 Adrien Plazas 2014-08-15 11:12:59 UTC
Created attachment 283453 [details] [review]
display-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 21 Adrien Plazas 2014-08-15 11:13:03 UTC
Created attachment 283454 [details] [review]
app-window: Present window when machine selected

This presents a machine's window if the machine is selected and is already
running in a window, otherwise it creates a new window for the machine.

This is needed to make multiple windows possible.
Comment 22 Adrien Plazas 2014-08-15 11:13:07 UTC
Created attachment 283455 [details] [review]
app: Populate new main window's collection

This is needed to make multiple windows possible.
Comment 23 Adrien Plazas 2014-08-15 11:13:12 UTC
Created attachment 283456 [details] [review]
selectionbar: Add 'Open in new windows' button

This is needed to make multiple windows possible.
Comment 24 Adrien Plazas 2014-08-15 11:13:16 UTC
Created attachment 283457 [details] [review]
Add MachineMenu

Implements the machine menu shown in  this mockup:
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/
boxes/wires/multi-window.png

This is needed to make multiple windows possible.
Comment 25 Adrien Plazas 2014-08-15 11:13:21 UTC
Created attachment 283458 [details] [review]
display-toolbar: Replace properties button by MachineMenu

This is needed to make multiple windows possible.
Comment 26 Adrien Plazas 2014-08-15 11:13:25 UTC
Created attachment 283460 [details] [review]
colection-view: Show MachineMenu on right-click

This is needed to make multiple windows possible.
Comment 27 Adrien Plazas 2014-08-15 11:43:07 UTC
Created attachment 283461 [details] [review]
searchbar: Ensure window is set before connecting to it

Until this patch, window was in an uncertain state when trying to connect to it.
Comment 28 Adrien Plazas 2014-08-15 11:43:12 UTC
Created attachment 283462 [details] [review]
app: Replace main_window by list of windows

This is needed to make multiple windows possible.
Comment 29 Adrien Plazas 2014-08-15 11:43:16 UTC
Created attachment 283463 [details] [review]
app-window: Closing window removes it from collection

Also, use 'this.window' to refer to Topbar's AppWindow in a closure to
avoid a Vala bug relative to the AppWindow while destroying the closure.

This is needed to make multiple windows possible.
Comment 30 Adrien Plazas 2014-08-15 11:43:20 UTC
Created attachment 283464 [details] [review]
machine: Close window on machine deletion

If a machine haves a window and the machine is deleted, the window will be
closed.

This is needed to make multiple windows possible.
Comment 31 Adrien Plazas 2014-08-15 11:43:24 UTC
Created attachment 283465 [details] [review]
collection-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 32 Adrien Plazas 2014-08-15 11:43:28 UTC
Created attachment 283466 [details] [review]
display-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 33 Adrien Plazas 2014-08-15 11:43:32 UTC
Created attachment 283467 [details] [review]
app-window: Present window when machine selected

This presents a machine's window if the machine is selected and is already
running in a window, otherwise it creates a new window for the machine.

This is needed to make multiple windows possible.
Comment 34 Adrien Plazas 2014-08-15 11:43:36 UTC
Created attachment 283468 [details] [review]
app: Populate new main window's collection

This is needed to make multiple windows possible.
Comment 35 Adrien Plazas 2014-08-15 11:43:41 UTC
Created attachment 283469 [details] [review]
selectionbar: Add 'Open in new windows' button

This is needed to make multiple windows possible.
Comment 36 Adrien Plazas 2014-08-15 11:43:45 UTC
Created attachment 283470 [details] [review]
Add MachineMenu

Implements the machine menu shown in  this mockup:
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/
boxes/wires/multi-window.png

This is needed to make multiple windows possible.
Comment 37 Adrien Plazas 2014-08-15 11:43:49 UTC
Created attachment 283471 [details] [review]
display-toolbar: Replace properties button by MachineMenu

This is needed to make multiple windows possible.
Comment 38 Adrien Plazas 2014-08-15 11:43:54 UTC
Created attachment 283472 [details] [review]
colection-view: Show MachineMenu on right-click

This is needed to make multiple windows possible.
Comment 39 Zeeshan Ali 2014-08-15 12:18:04 UTC
Review of attachment 283461 [details] [review]:

"Until this patch, window was in an uncertain state when trying to connect to it."

As I asked previously, how so?
Comment 40 Zeeshan Ali 2014-08-15 12:20:10 UTC
Review of attachment 283462 [details] [review]:

ack
Comment 41 Zeeshan Ali 2014-08-15 12:37:47 UTC
Review of attachment 283463 [details] [review]:

almost there. :)

::: src/machine.vala
@@ +78,3 @@
+                else {
+                    window.destroy ();
+                    window = null;

I thought it would be obvious but I was wrong. These changes also qualify for my comment for rest of the changes in this module:

"These changes seem to be about deletion of window on deletion of machine rather than about removal of window from collection on deletion so I think they need to be in separate patch."

::: src/topbar.vala
@@ +104,3 @@
+            // FIXME: Usage of 'this' is a work around to avoid double
+            // deletion of the window when destroying the closure.
+            // It is either caused by a Vala bug or an ownership problem.

if you can't find out the issue right now, please file a separate bug for this. Also (I think i mentioned last time), this change doesn't belong in this patch even if this is the patch that realizes the issue.
Comment 42 Zeeshan Ali 2014-08-15 12:52:32 UTC
Review of attachment 283464 [details] [review]:

typo: haves. Looks fine otherwise.
Comment 43 Zeeshan Ali 2014-08-15 12:54:49 UTC
Review of attachment 283465 [details] [review]:

ack
Comment 44 Zeeshan Ali 2014-08-15 12:56:15 UTC
Review of attachment 283466 [details] [review]:

ack
Comment 45 Zeeshan Ali 2014-08-15 13:03:45 UTC
Review of attachment 283467 [details] [review]:

I'd use the term 'activation' and 'activate' instead of 'selection' and 'select' to avoid confusion with selection as in selection mode. Also I'd just replace "if the machine is selected and " with " on activation if machine "

::: src/app-window.vala
@@ +226,1 @@
+            if (machine.window != this) {

shouldn't we also check if its non-null?
Comment 46 Zeeshan Ali 2014-08-15 13:05:46 UTC
Review of attachment 283468 [details] [review]:

ack
Comment 47 Zeeshan Ali 2014-08-15 13:23:23 UTC
Review of attachment 283469 [details] [review]:

Good otherwise.

::: data/ui/selectionbar.ui
@@ +59,3 @@
+            <property name="valign">center</property>
+            <property name="use-underline">True</property>
+            <property name="label" translatable="yes">_Open in new window(s)</property>

Since we set this from code, either maybe we shouldn't set it here or use one of the strings we use in the code. Translators could do with one less string to translate. :)

::: src/app.vala
@@ +323,3 @@
+    }
+
+    public void open_in_new_window (Machine machine) {

Lets keep it private until/unless we need it public.

::: src/selectionbar.vala
@@ +162,3 @@
+
+        open_btn.sensitive = items > 0;
+        // This goes with the "Click on items to select them" string and is about selection of items (boxes)

I tend to prefix comments for translators as "Translators: ". Without that, this is confusing since this button is not in the same place as "Click on items.." string at all. Actually I don't think we need the part before "and" here. Actually I'd just write:

"Translators: This is a button to open box(es) in new window(s)".
Comment 48 Zeeshan Ali 2014-08-15 13:41:04 UTC
Review of attachment 283470 [details] [review]:

Firstly, I'll want to separate out this menu from mult-windows since you already provide a means to launch item in new windows.

Secondly, I'm not sure this approach is what we want to take. I'd think we should:

1. Define a context menu completely in UI file(s).
2. On right click, we check if there is any item under the cursor (I believe we already have code for that since currently item is automatically selected when going to selection mode through right click).
3. If there is item under cursor, we show the context menu instead of going to selection mode. You'll need code to find out coordinates of the item. We might have deleted that code at some point but git remembers everything. :)

::: src/util.vala
@@ +278,3 @@
     }
 
+    public Variant object_to_variant (Object object) {

Let put addition of general utils in a separate patch.
Comment 49 Zeeshan Ali 2014-08-15 13:44:02 UTC
Review of attachment 283471 [details] [review]:

Looks fine, apart from "This is needed to make multiple windows possible." is not true and just like previous patch, I think we should put it in separate bug which would be about adding of menu.
Comment 50 Zeeshan Ali 2014-08-15 13:52:03 UTC
Review of attachment 283472 [details] [review]:

same as last patch.

::: src/collection-view.vala
@@ +45,3 @@
         notify["ui-state"].connect (ui_state_changed);
+
+        icon_view = get_generic_view () as Gtk.IconView;

I think there is other users of 'get_generic_view () as Gtk.IconView;' so I'd put addition of icon_view in a separate (before this one) patch and update existing uses.

@@ +322,3 @@
+
+                    machine_menu.machine = machine;
+                    machine_menu.set_pointing_to (rect);

ah good, you already got code to do this. I'm a bit confused now why you need to convert items to variant and viceversa if you can find out the item under cursor anyway.
Comment 51 Adrien Plazas 2014-08-15 13:59:26 UTC
Review of attachment 283470 [details] [review]:

1. I didn't achieve to do this and have actions with the machine as a parameter, unfortunately, do you know how to do it properly?
2. Unfortunately it's not as simple as it looks like, as the right-click event is phagocytosed by the view to create the selection_mode_request signal, which gives no information.
3. Good to know, it will certainly be needed to make the implementation cleaner!
Comment 52 Adrien Plazas 2014-08-15 14:08:04 UTC
Created attachment 283493 [details] [review]
searchbar: Ensure window is set before connecting to it

Until this patch, window was in an uncertain state when trying to connect
to it, because on_app_ready() was called before setup_ui().
Comment 53 Adrien Plazas 2014-08-15 14:08:09 UTC
Created attachment 283494 [details] [review]
app: Replace main_window by list of windows

This is needed to make multiple windows possible.
Comment 54 Adrien Plazas 2014-08-15 14:08:14 UTC
Created attachment 283495 [details] [review]
app-window: Closing window removes it from collection

Also, use 'this.window' to refer to Topbar's AppWindow in a closure to
avoid a Vala bug relative to the AppWindow while destroying the closure.

This is needed to make multiple windows possible.
Comment 55 Adrien Plazas 2014-08-15 14:08:19 UTC
Created attachment 283496 [details] [review]
machine: Close window on machine deletion/not running

If a machine have a window and the machine is deleted or stops running,
the window will be closed.

This is needed to make multiple windows possible.
Comment 56 Adrien Plazas 2014-08-15 14:08:24 UTC
Created attachment 283497 [details] [review]
collection-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 57 Adrien Plazas 2014-08-15 14:08:29 UTC
Created attachment 283498 [details] [review]
display-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 58 Adrien Plazas 2014-08-15 14:08:34 UTC
Created attachment 283499 [details] [review]
app-window: Present window when machine activated

This presents a machine's window if the machine is activated and is
already running in a window, otherwise it creates a new window for the
machine.

This is needed to make multiple windows possible.
Comment 59 Adrien Plazas 2014-08-15 14:08:39 UTC
Created attachment 283500 [details] [review]
app: Populate new main window's collection

This is needed to make multiple windows possible.
Comment 60 Adrien Plazas 2014-08-15 14:08:45 UTC
Created attachment 283501 [details] [review]
selectionbar: Add 'Open in new windows' button

This is needed to make multiple windows possible.
Comment 61 Zeeshan Ali 2014-08-15 16:28:13 UTC
Review of attachment 283493 [details] [review]:

ack
Comment 62 Zeeshan Ali 2014-08-15 16:33:47 UTC
Review of attachment 283494 [details] [review]:

ack
Comment 63 Zeeshan Ali 2014-08-15 16:37:41 UTC
Review of attachment 283495 [details] [review]:

::: src/app.vala
@@ +511,3 @@
+        base.remove_window (window);
+
+        bool removed = initial_windows_count != windows.length ();

* i'd declare/define it here just before its first use below.
* Use 'var'

::: src/topbar.vala
@@ +104,3 @@
+            // FIXME: Usage of 'this' is a work around to avoid double
+            // deletion of the window when destroying the closure.
+            // It is either caused by a Vala bug or an ownership problem.

You missed my comment from last review on this line.
Comment 64 Zeeshan Ali 2014-08-15 16:39:05 UTC
Review of attachment 283495 [details] [review]:

::: src/app.vala
@@ +511,3 @@
+        base.remove_window (window);
+
+        bool removed = initial_windows_count != windows.length ();

In fact, you don't need the variable just do:

return (condition);
Comment 65 Zeeshan Ali 2014-08-15 16:40:55 UTC
Review of attachment 283496 [details] [review]:

Good. One nitpick though: "not running" -> "stopping" in shortlog.
Comment 66 Zeeshan Ali 2014-08-15 16:44:12 UTC
Review of attachment 283497 [details] [review]:

ack
Comment 67 Zeeshan Ali 2014-08-15 16:44:47 UTC
Review of attachment 283498 [details] [review]:

ack
Comment 68 Zeeshan Ali 2014-08-15 16:46:48 UTC
Review of attachment 283499 [details] [review]:

ack apart from one nitpick.

::: src/app-window.vala
@@ +226,1 @@
+            if (machine.window != this && machine.window != null) {

probobly won't matter in practice but better haven the null check before comparison.
Comment 69 Zeeshan Ali 2014-08-15 16:48:29 UTC
Review of attachment 283500 [details] [review]:

still ack
Comment 70 Zeeshan Ali 2014-08-15 16:55:32 UTC
Review of attachment 283501 [details] [review]:

you did as I asked so sorry that still changes are still needed. Not a lot though. :)

::: src/selectionbar.vala
@@ +163,3 @@
+        open_btn.sensitive = items > 0;
+        // Translators: This is a button to open box(es) in new window(s)
+        open_btn.label = ngettext ("_Open in %d new window", "_Open in %d new windows", items).printf (items);

Just realized this: We dont' want to show number of boxes for singular case. Also since its a button, we want to keep its label short. So how about just a singlular shorter form like "Open in new window"? In which case we can just set it from UI file once. Sorry for not thinking this thoroughly before.
Comment 71 Adrien Plazas 2014-08-15 18:01:43 UTC
Created attachment 283542 [details] [review]
app-window: Closing window removes it from collection

Also, use 'this.window' to refer to Topbar's AppWindow in a closure to
avoid a Vala bug relative to the AppWindow while destroying the closure.

This is needed to make multiple windows possible.
Comment 72 Adrien Plazas 2014-08-15 18:01:48 UTC
Created attachment 283543 [details] [review]
machine: Close window on machine deletion/stopping

If a machine have a window and the machine is deleted or stops running,
the window will be closed.

This is needed to make multiple windows possible.
Comment 73 Adrien Plazas 2014-08-15 18:01:54 UTC
Created attachment 283544 [details] [review]
collection-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 74 Adrien Plazas 2014-08-15 18:02:02 UTC
Created attachment 283545 [details] [review]
display-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 75 Adrien Plazas 2014-08-15 18:02:08 UTC
Created attachment 283546 [details] [review]
app-window: Present window when machine activated

This presents a machine's window if the machine is activated and is
already running in a window, otherwise it creates a new window for the
machine.

This is needed to make multiple windows possible.
Comment 76 Adrien Plazas 2014-08-15 18:02:13 UTC
Created attachment 283548 [details] [review]
app: Populate new main window's collection

This is needed to make multiple windows possible.
Comment 77 Adrien Plazas 2014-08-15 18:02:19 UTC
Created attachment 283549 [details] [review]
selectionbar: Add 'Open in new windows' button

This is needed to make multiple windows possible.
Comment 78 Adrien Plazas 2014-08-15 19:10:18 UTC
Created attachment 283555 [details] [review]
app-window: Closing window removes it from collection

Also, use 'this.window' to refer to Topbar's AppWindow in a closure to
avoid a Vala bug relative to the AppWindow while destroying the closure.

This is needed to make multiple windows possible.
Comment 79 Adrien Plazas 2014-08-15 19:10:25 UTC
Created attachment 283556 [details] [review]
machine: Close window on machine deletion/stopping

If a machine have a window and the machine is deleted or stops running,
the window will be closed.

This is needed to make multiple windows possible.
Comment 80 Adrien Plazas 2014-08-15 19:10:31 UTC
Created attachment 283557 [details] [review]
collection-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 81 Adrien Plazas 2014-08-15 19:10:38 UTC
Created attachment 283558 [details] [review]
display-toolbar: Show back button only on main window

This forbids non-main windows to access the collection view.

This is needed to make multiple windows possible.
Comment 82 Adrien Plazas 2014-08-15 19:10:44 UTC
Created attachment 283559 [details] [review]
app-window: Present window when machine activated

This presents a machine's window if the machine is activated and is
already running in a window, otherwise it creates a new window for the
machine.

This is needed to make multiple windows possible.
Comment 83 Adrien Plazas 2014-08-15 19:10:50 UTC
Created attachment 283560 [details] [review]
app: Populate new main window's collection

This is needed to make multiple windows possible.
Comment 84 Adrien Plazas 2014-08-15 19:10:56 UTC
Created attachment 283561 [details] [review]
selectionbar: Add 'Open in new windows' button

This is needed to make multiple windows possible.
Comment 85 Zeeshan Ali 2014-08-16 15:01:17 UTC
Review of attachment 283555 [details] [review]:

Good otherwise. Your log will obviously also need some change.

::: src/topbar.vala
@@ +103,3 @@
         window.notify["selection-mode"].connect (() => {
+            // FIXME: Usage of 'this' is a work around for https://bugzilla.gnome.org/show_bug.cgi?id=734877
+            page = this.window.selection_mode ?

I think I should repeat myself so you don't miss it again :)

"..this change doesn't belong in this patch even if this is the patch that realizes the issue."
Comment 86 Zeeshan Ali 2014-08-16 15:01:51 UTC
Review of attachment 283555 [details] [review]:

oops wrong status.
Comment 87 Zeeshan Ali 2014-08-16 15:09:29 UTC
Review of attachment 283556 [details] [review]:

ack. Although when i tested, I had the following:

1. launched a VM in new window
2. Click Properties
3. Change RAM
4. Go back
5. Got notification about shutdown needed and chose 'yes'
6. Since the VM has booting issues, shutdown request wasn't entertained so
5. got notification for force shutdown.
7. Clicked force shutdown
8. Although VM was shutdown, the window stayed around (all grey) and got a notification about 'failed to connect'.
9. Went back to the main window and was able to start the VM fine from collection view but it started in that window.

I'm not sure this is the patch thats responsible to make sure that doesn't happen but likely that it is.
Comment 88 Zeeshan Ali 2014-08-16 15:10:17 UTC
Review of attachment 283557 [details] [review]:

ack
Comment 89 Zeeshan Ali 2014-08-16 15:10:36 UTC
Review of attachment 283558 [details] [review]:

ack
Comment 90 Zeeshan Ali 2014-08-16 15:13:43 UTC
Review of attachment 283559 [details] [review]:

ack
Comment 91 Zeeshan Ali 2014-08-16 15:14:18 UTC
Review of attachment 283560 [details] [review]:

still ack
Comment 92 Zeeshan Ali 2014-08-16 15:18:33 UTC
Review of attachment 283561 [details] [review]:

Good otherwise.

::: src/selectionbar.vala
@@ +163,3 @@
+        open_btn.sensitive = items > 0;
+        // Translators: This is a button to open box(es) in new window(s)
+        if (items ==0)

nitpick: space before 0
Comment 93 Zeeshan Ali 2014-08-16 15:19:41 UTC
Review of attachment 283556 [details] [review]:

Infact I can reproduce this with proper shutdown from within guest too so pretty sure its this patch that needs fixing.
Comment 94 Zeeshan Ali 2014-08-16 15:33:42 UTC
Review of attachment 283556 [details] [review]:

And now I got some crashes too while testing this:

(gnome-boxes:16984): Gtk-CRITICAL **: gtk_widget_get_window: assertion 'GTK_IS_WIDGET (widget)' failed

(gnome-boxes:16984): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(gnome-boxes:16984): GLib-GObject-CRITICAL **: g_signal_handler_disconnect: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
Segmentation fault (core dumped)

I think this code needs some more testing and fixing.
Comment 95 Zeeshan Ali 2014-08-16 15:47:27 UTC
Pushing all but the patch to close window on machine deletion/stopping. I'm hopeful you'll fix that early next week. :)

Attachment 283493 [details] pushed as 3a4f0b2 - searchbar: Ensure window is set before connecting to it
Attachment 283494 [details] pushed as 18c44dc - app: Replace main_window by list of windows
Attachment 283555 [details] pushed as df7751b - app-window: Closing window removes it from collection
Attachment 283557 [details] pushed as c7ad053 - collection-toolbar: Show back button only on main window
Attachment 283558 [details] pushed as c390167 - display-toolbar: Show back button only on main window
Attachment 283559 [details] pushed as b2c41b0 - app-window: Present window when machine activated
Attachment 283560 [details] pushed as 1f95ac9 - app: Populate new main window's collection
Attachment 283561 [details] pushed as b0e2fc3 - selectionbar: Add 'Open in new windows' button
Comment 96 Lasse Schuirmann 2014-08-16 16:52:48 UTC
I cant close the window regularly anymore since this commit:

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
Comment 97 Zeeshan Ali 2014-08-16 17:15:54 UTC
(In reply to comment #96)
> I cant close the window regularly anymore since this commit:
> 
> 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

Thanks for bisecting. I'm able to close the window fine so I think you'll have to debug this on your own unless Kekun can also reproduce.
Comment 98 Lasse Schuirmann 2014-08-16 20:44:55 UTC
Review of attachment 283556 [details] [review]:

I dont know if its the best solution that the machine closes the window where it belongs. Can't we tell the AppWindow that its a secondary one and check on change of the ui_state property for invalid states for secondary windows? This way we dont have to worry what causes the VM to go away, we just let the window disappear if it changes to COLLECTION state and show the main window, which has the COLLECTION state.

Just my humble opinion, I'm not really in the code so I can't tell whats possible or not.
Comment 99 Zeeshan Ali 2014-08-19 11:11:03 UTC
(In reply to comment #98)
> Review of attachment 283556 [details] [review]:
> 
> I dont know if its the best solution that the machine closes the window where
> it belongs. Can't we tell the AppWindow that its a secondary one and check on
> change of the ui_state property for invalid states for secondary windows? This
> way we dont have to worry what causes the VM to go away, we just let the window
> disappear if it changes to COLLECTION state and show the main window, which has
> the COLLECTION state.

Makes sense actually. Since we already have multi-window support (which this bug is about), lets move this issue into another bug (bug#735045) and resolve this one.