Re: interrupting gtk_main



On Sat, 2004-05-01 at 14:18, Marisa DeMeglio wrote:
Thank you very much for the ideas.  I think GSignal
might be useful.
What I am wondering now is if I can implement this
while still having the server-type part of the
application (let's call this the gateway) be unaware
of GTK?
Basically the application is set up as an EXE (the
gateway) with a bunch of DLLs (interfaces, including
GTK, and backend logic stuff).  Everything is able to
communicate because all DLLs expose an object that is
written to our simple API.  The idea is that a user
can choose to run the application with whatever types
of interfaces suit them best - it is aimed at disabled
users so some may want a gamepad interface or large
font or just a command line.  others will want to use
a standard GUI.  The toughest scenario is if a user is
running a joystick along with the GUI, and sends a
command (like "next chapter") using the joystick.  The
GUI should be updated to reflect this.
But since the GUI is not a requisite component, the
Gateway (which syncs everything) is unaware of GTK and
GSignals.

The simple API looks like this:
AmisComponentBaseObj->ReceiveData(const char* data,
AmisComponentBase* pSender);

This is the function that needs to cause an
interruption of gtk_main.  So when something in the
system has triggered a new data event, the gateway
broadcasts data to all listeners by calling their
instance of this function.  Seems simple...!

It seems now that my path should be to make a special
version of the gateway which emits GSignals, along
with regular ReceiveData events.  But I would be
grateful for a way around this.

GSignals is not part of GTK per se; it's part of the underlying glib
library.  You might consider using the glib part in all the aspects of
your project.  Glib is a powerful utility library (I use it in all my C
applications) and the signaling interface can be used directly by your
modules.

Another possibility is to put the GUI in another thread, then write a
routine that intercepts your ReceiveData calls and then sends a GSignal
into the GUI thread.  (A Thunk layer).

Michael



Thanks again
Marisa
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
-- 
Michael Torrie <torriem chem byu edu>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]