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 692306 - shell search doesn't activate VMs
shell search doesn't activate VMs
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: search
unspecified
Other Linux
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks: 686781
 
 
Reported: 2013-01-22 16:44 UTC by Alexander Larsson
Modified: 2016-03-31 14:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add Gtk.Application subclass for minor cleanup (4.55 KB, patch)
2013-01-25 14:44 UTC, Alexander Larsson
committed Details | Review
App: Add call_when_ready (1.48 KB, patch)
2013-01-25 14:44 UTC, Alexander Larsson
committed Details | Review
Proper support for command line args in secondary process (10.62 KB, patch)
2013-01-25 14:44 UTC, Alexander Larsson
committed Details | Review
Split out window code from App to AppWindow (91.29 KB, patch)
2013-01-28 10:53 UTC, Alexander Larsson
reviewed Details | Review

Description Alexander Larsson 2013-01-22 16:44:07 UTC
when i activate a VM from a gnome-shell search nothing happens. It should start that VM.
Comment 1 Alexander Larsson 2013-01-25 14:44:40 UTC
Created attachment 234408 [details] [review]
Add Gtk.Application subclass for minor cleanup

Ideally we'd like Boxes.App do inherit from Gtk.Applicaton, but we can't
as it needs to inherit Boxes.UI. Instead we create a subclass as
a proxy object that calls into Boxes.App. This makes the "app"
callbacks real methods rather than signal connections which look
slightly nicer, and allows later overriding of Gtk.Application vfuncs.
Comment 2 Alexander Larsson 2013-01-25 14:44:43 UTC
Created attachment 234409 [details] [review]
App: Add call_when_ready

This makes it easy to queue calls until the app is in the ready
state.
Comment 3 Alexander Larsson 2013-01-25 14:44:46 UTC
Created attachment 234410 [details] [review]
Proper support for command line args in secondary process

We new handle most of the command line parsing (except a few
specialized things) in the primary instance, by implementing the
command_line signal of GApplication. This means we now support
arguments like --open-uuid in the non-primary instance, as needed
for e.g. gnome-shell search results.

This additionally moves the UI initialization and window to
the activate state so that it only happens in the primary instance,
and it doesn't happen if we exit early in the command_line handler.

Unfortunately we can't use the automatic --help support in GOptions
anymore as that prints to/exists the primary instance rather than
the calling one, so we have to now manually do that.
Comment 4 Zeeshan Ali 2013-01-25 22:53:54 UTC
Review of attachment 234408 [details] [review]:

Looks good.

::: src/app.vala
@@ +11,3 @@
+// Ideally Boxes.App should inherit from, Gtk.Application, but we can't also inherit from Boxes.UI,
+// so we make it a separate object that calls into Boxes.App
+private class Boxes.Application: Gtk.Application {

Normally its OK to keep small private classes in its (main) user module but in case of App, I'd want to avail every opportunity to take code out of this module as its bloated IMO.
Comment 5 Zeeshan Ali 2013-01-25 22:57:32 UTC
Review of attachment 234409 [details] [review]:

ack
Comment 6 Zeeshan Ali 2013-01-25 23:22:10 UTC
Review of attachment 234410 [details] [review]:

typo in commit log: new -> now. Rest looks good.

::: src/app.vala
@@ +145,3 @@
+        string [] args = {};
+        unowned string [] args2 = args;
+        GtkClutter.init (ref args2);

i don't get these 3 lines. We want to disable GtkClutter.init's commandline args?

@@ +192,3 @@
     }
 
+    static bool opt_fullscreen;

If you agree that we should put Boxes.Application in a separate file, I'd recommend we do the commandline parsing in that class as well.
Comment 7 Alexander Larsson 2013-01-28 09:11:00 UTC
Review of attachment 234408 [details] [review]:

::: src/app.vala
@@ +11,3 @@
+// Ideally Boxes.App should inherit from, Gtk.Application, but we can't also inherit from Boxes.UI,
+// so we make it a separate object that calls into Boxes.App
+private class Boxes.Application: Gtk.Application {

I don't agree. I think Boxes.App should really be inherit from Gtk.Application and its primary purpose should be to do things like argument parsing and handle app global things. Unfortunately we can't do this and also inherit from Boxes.UI, as GObject doesn't do multiple inheritance. So, I'm doing this with a proxy object that just calls into the real object.

If anything its the UI code that should be moved out of Boxes.Application. Like, we should subclass Gtk.ApplicationWindow and move a bunch of UI specific code there.
Comment 8 Alexander Larsson 2013-01-28 09:15:09 UTC
Review of attachment 234410 [details] [review]:

::: src/app.vala
@@ +145,3 @@
+        string [] args = {};
+        unowned string [] args2 = args;
+        GtkClutter.init (ref args2);

Since we don't parse early the Gtk initialization is handled inside GtkApplication.startup(), and does not support the Gtk+ arguments. This is i think were we're generally moving with GApplication based single-instance apps anyway, as most of those arguments don't make sense in that model.

However, Gtk.Application just inits Gtk, so we need to manually initit clutter-gtk too.

@@ +192,3 @@
     }
 
+    static bool opt_fullscreen;

I disagree with that :)
Comment 9 Christophe Fergeau 2013-01-28 10:11:40 UTC
Review of attachment 234408 [details] [review]:

::: src/app.vala
@@ +11,3 @@
+// Ideally Boxes.App should inherit from, Gtk.Application, but we can't also inherit from Boxes.UI,
+// so we make it a separate object that calls into Boxes.App
+private class Boxes.Application: Gtk.Application {

Yup, in this specific case, it makes sense to me to keep the class there. app.vala is indeed one of our bigger files, but at less than 1000 lines of code, it's not terribly huge either.
Comment 10 Alexander Larsson 2013-01-28 10:53:44 UTC
Created attachment 234600 [details] [review]
Split out window code from App to AppWindow

Move all UI code out of App into AppWindow, making App derive
from Gtk.Application rather than Boxes.UI. This makes the app.vala
file smaller, and makes things easier to find. It also separates the UI
state from the app global stuff, making way to a possible multi-window
boxes.

Unfortunately a lot of stuff referes to the UI state via App.app (and now
App.app.window) which is rather iffy. It would probably be nicer to push
a reference to the window into all the UI subclasses and use that to get
the UI state. Makes for shorter better isolated code.

This is a not very tested patch and is mostly to show off the possibilities
here.
Comment 11 Zeeshan Ali 2013-01-28 13:58:25 UTC
Review of attachment 234600 [details] [review]:

Yeah, I like the idea of this patch. Ver fond of splits I guess. :) I'll review in detail once you have tested it and renamed 'appwindow.vala' to 'app-window.vala'. :)
Comment 12 Alexander Larsson 2013-01-28 14:39:13 UTC
Attachment 234408 [details] pushed as 1ce5fa8 - Add Gtk.Application subclass for minor cleanup
Attachment 234409 [details] pushed as 7ce3c4e - App: Add call_when_ready
Attachment 234410 [details] pushed as 0d6c295 - Proper support for command line args in secondary process
Comment 13 Alexander Larsson 2013-01-28 14:47:36 UTC
Closing this bug, moving the split app.vala to bug 692708