[libvirt] [libvirt-glib] Adjust example to pygobject-3.0

Guido Günther agx at sigxcpu.org
Thu Nov 17 21:38:01 UTC 2011


Hi,
attached patch makes the example work again with recent pygobject-3.0
which doesn't allow to "import gtk" anymore.
Cheers,
 -- Guido

On Thu, Nov 17, 2011 at 10:36:23PM +0100, Guido Günther wrote:
> ---
>  examples/event-test.py |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/examples/event-test.py b/examples/event-test.py
> index 33e7c73..4b06235 100644
> --- a/examples/event-test.py
> +++ b/examples/event-test.py
> @@ -1,5 +1,5 @@
>  
> -import gtk
> +from gi.repository import Gtk
>  import libvirt
>  import getopt
>  import sys
> @@ -47,16 +47,15 @@ def main():
>  
>      print "Using uri:" + uri
>  
> -    LibvirtGLib.init("")
> +    LibvirtGLib.init(0, "")
>      LibvirtGLib.event_register()
> -#    libvirtglib.eventRegister()
>      vc = libvirt.open(uri)
>  
>      #Add 2 callbacks to prove this works with more than just one
>      vc.domainEventRegister(myDomainEventCallback1,None)
>      vc.domainEventRegister(myDomainEventCallback2,None)
>  
> -    gtk.main()
> +    Gtk.main()
>  
>  if __name__ == "__main__":
>      main()
> -- 
> 1.7.7.1




More information about the libvir-list mailing list