[virt-tools-list] virt-manager handling of Gtk command line arguments
Leonardo Augusto Guimarães Garcia
lagarcia at linux.vnet.ibm.com
Fri Aug 16 18:04:05 UTC 2013
On 08/16/2013 02:10 PM, Daniel P. Berrange wrote:
> 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
Yes, that's exactly what I was talking about when I said "the support
provided by GTK".
I am working on a prototype now and I'll try to send an RFC next week.
Not sure right now if this will work or not because of some of the
ordering stuff Cole was talking about, but I am giving it a try.
Best regards,
Leonardo Garcia
>
> Daniel
More information about the virt-tools-list
mailing list