summaryrefslogtreecommitdiff
path: root/glib/gmain.h
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2010-11-06 10:11:15 -0400
committerDan Winship <danw@gnome.org>2010-11-26 15:07:28 -0500
commitd15cdbefecc235cfa431ee7de9c35af174bd1552 (patch)
tree1809d3561342666dc36cbb9b21e4797fc8878c1d /glib/gmain.h
parente910205557b2461eaf1b2ce94176c6525cc716d1 (diff)
downloadglib-d15cdbefecc235cfa431ee7de9c35af174bd1552.tar.gz
gmain: add g_source_add_child_source and g_source_remove_child_source
This adds "child source" support to GSource. A child source behaves basically like a GPollFD; when you add a source to a context, all of its child sources are added with the same priority; when you destroy a source, all of its child sources are destroyed; and when a child source triggers, its parent source's dispatch function is run. Use cases include: - adding a GTimeoutSource to another source to cause the source to automatically trigger after a certain timeout. - wrapping an existing source type with a new type that has a different callback signature - creating a source that triggers based on different conditions at different times. https://bugzilla.gnome.org/show_bug.cgi?id=634239
Diffstat (limited to 'glib/gmain.h')
-rw-r--r--glib/gmain.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/glib/gmain.h b/glib/gmain.h
index 3a7bba08f..bd94651cc 100644
--- a/glib/gmain.h
+++ b/glib/gmain.h
@@ -53,6 +53,7 @@ typedef struct _GMainLoop GMainLoop;
* representing an event source.
*/
typedef struct _GSource GSource;
+typedef struct _GSourcePrivate GSourcePrivate;
/**
* GSourceCallbackFuncs:
@@ -157,7 +158,8 @@ struct _GSource
GSource *next;
char *name;
- gpointer reserved2;
+
+ GSourcePrivate *priv;
};
struct _GSourceCallbackFuncs
@@ -358,10 +360,15 @@ void g_source_set_callback_indirect (GSource *source,
gpointer callback_data,
GSourceCallbackFuncs *callback_funcs);
-void g_source_add_poll (GSource *source,
- GPollFD *fd);
-void g_source_remove_poll (GSource *source,
- GPollFD *fd);
+void g_source_add_poll (GSource *source,
+ GPollFD *fd);
+void g_source_remove_poll (GSource *source,
+ GPollFD *fd);
+
+void g_source_add_child_source (GSource *source,
+ GSource *child_source);
+void g_source_remove_child_source (GSource *source,
+ GSource *child_source);
#ifndef G_DISABLE_DEPRECATED
void g_source_get_current_time (GSource *source,