[virt-tools-list] virt-manager handling of Gtk command line arguments

Daniel P. Berrange berrange at redhat.com
Fri Aug 16 17:10:20 UTC 2013


On Fri, Aug 16, 2013 at 12:50:23PM -0400, Cole Robinson wrote:
> On 08/12/2013 05:10 PM, Leonardo Augusto Guimarães Garcia wrote:
> > Hello everyone,
> > 
> > Right now, when someone tries to start a second instance of virt-manager, the
> > primary instance will be brought to front. This is managed by Gtk and I am
> > really fine with that for the majority of the use cases.
> > 
> > When someone specifies a --show-* option and there is already a virt-manager
> > instance running, however, it would be desirable that the running instance of
> > virt-manager opens the corresponding window, as suggested by Cole some time
> > ago. I want to do a major refactoring on how we handle command line arguments
> > in virt-manager (using the support provided by Gtk)
> 
> What does 'the support provided by GTK' mean ? Can you give an example. As in,
> does this throw out optparse ?

Virt-manager already uses the GtkApplication class, but doesn't really
make use of much of its features.

With GApplication (parent of GtkApplication), you can have the primary
instance register support for any number of actions.  You would then
make the '--show-xxxx' flag activate the corresponding action. This
will cause it to make a dbus call to the primary instance todo the
actual work

There's a C example of this kind of thing here ("Example 19. A 
GApplication with actions")

  https://developer.gnome.org/gio/stable/GApplication.html

In doing this, you'd likely want to move all command line handling
code into the GApplication framework

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the virt-tools-list mailing list