On Wed, 18 Jun 2014 02:03:44 +0300
Andrei Macavei <andrei.macave...@gmail.com> wrote:
> On 17.06.2014 12:43, Chris Vine wrote:
> > I do not know python particularly well but you probably first need
> > to explain why you are running two main loops.  Can't your program
> > just use one, so that you can use the default main loop for both?
> >
> > Chris
> >
> 
> Hi,
> I haven't shown the full code of the ServiceDiscover class, I will
> post it here again after my message.
> 
> In the ServiceDiscover class , in the method discover() , a 
> dbus.Interface object is connected to the signal "ItemNew" :
> .....
> self.sbrowser.connect_to_signal("ItemNew", self.handler)
> .....
> 
> Afterwards it must call the main loop or else it cannot use the above 
> signal I suppose. This has to be done inside the ServiceDiscover
> class.
> 
> The code for both the service publishing and service browsing using 
> avahi is taken from avahi website:
> 
> http://avahi.org/wiki/PythonBrowseExample
> http://avahi.org/wiki/PythonPublishExample
> 
> The problem is that I have to use a main loop inside the
> ServiceDiscover class, and another one for the gtk+ main window class.

I cannot really help you, as I would need a greater knowledge of
python's dbus interface and avahi's interfaces than I possess in order
to do so.  When using gio's C interface for dbus, I have never had to
futz around with different main loops - the default program main loop
(the one which gtk+ uses) is automatically used for gio's asynchronous
continuations unless you go out of your way to set up something
different using g_main_context_push_thread_default().  I am also highly
suspicious of the use of two main loops, which amongst other things
requires a thread for each main loop, but maybe this is an avahi
thing.  It begs the question of how the two main loops communicate with
each other, and why.

In addition it looks as if your python library wraps dbus-glib rather
than gio's dbus implementation and I do not know what options that
gives you for main loops, as I don't use it.

Chris
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to