Re: [Basic Glib Questions/Help] Unable to create GSource
- From: Owen Taylor <otaylor redhat com>
- To: Ryan McDougall <ryan mcdougall telusplanet net>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: [Basic Glib Questions/Help] Unable to create GSource
- Date: Mon, 22 Dec 2003 14:35:59 -0500
On Mon, 2003-12-22 at 14:04, Ryan McDougall wrote:
On Sun, 2003-12-21 at 21:06, Owen Taylor wrote:
On Sun, 2003-12-21 at 17:27, Ryan McDougall wrote:
Hello,
I am developing a simple console based project using Glib (partly so I
can learn Glib) but I have lots of questions due to the less than
documented nature of Glib. Basically at this point all I want to do is
tie console input to the event loop -- but I have little idea how to go
about it.
Without looking at your code, I strongly suspect you want
g_io_channel_add_watch(), not a custom GSource.
Regards,
Owen
Thank you for your time Owen,
I have already discovered g_io_channel_watch through my meandering
about, but I was wanting to ask you some stuff.
Creating a custom GSource is the most explicit (and overkill for what I
want now) way of listening for input events, but I think I want to learn
how to do this for the sake of knowing how -- is there example code some
where?
GLib contains various sources that you can look at the source of ...
timeouts, idles, IO watches.
Is there a reason why I should derive my source from GSource?
The GSource structure contains various fields that are needed in all
sources. If you need more fields, you add them by creating a larger
structure with the GSource structure as its first element.
Also, currently I use g_io_create_watch and manually attach the GSource
to the GMainContext, which makes sense to me, but how does
g_io_add_watch work if it doesnt take a reference to the GMainContext I
created? Id really like to know more about how this stuff works. :)
g_io_add_watch() creates the source and adds it to the default main
context. Which is all virtually all programs ever need.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]