Fix typo
[platform/upstream/glib.git] / glib / gmain.h
index 90bc035..603fdfc 100644 (file)
@@ -12,9 +12,7 @@
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __G_MAIN_H__
 
 G_BEGIN_DECLS
 
+typedef enum /*< flags >*/
+{
+  G_IO_IN      GLIB_SYSDEF_POLLIN,
+  G_IO_OUT     GLIB_SYSDEF_POLLOUT,
+  G_IO_PRI     GLIB_SYSDEF_POLLPRI,
+  G_IO_ERR     GLIB_SYSDEF_POLLERR,
+  G_IO_HUP     GLIB_SYSDEF_POLLHUP,
+  G_IO_NVAL    GLIB_SYSDEF_POLLNVAL
+} GIOCondition;
+
+
 /**
  * GMainContext:
  *
- * The <structname>GMainContext</structname> struct is an opaque data
+ * The `GMainContext` struct is an opaque data
  * type representing a set of sources to be handled in a main loop.
  */
 typedef struct _GMainContext            GMainContext;
@@ -41,7 +50,7 @@ typedef struct _GMainContext            GMainContext;
 /**
  * GMainLoop:
  *
- * The <structname>GMainLoop</structname> struct is an opaque data type
+ * The `GMainLoop` struct is an opaque data type
  * representing the main event loop of a GLib or GTK+ application.
  */
 typedef struct _GMainLoop               GMainLoop;
@@ -49,7 +58,7 @@ typedef struct _GMainLoop               GMainLoop;
 /**
  * GSource:
  *
- * The <structname>GSource</structname> struct is an opaque data type
+ * The `GSource` struct is an opaque data type
  * representing an event source.
  */
 typedef struct _GSource                 GSource;
@@ -62,7 +71,7 @@ typedef struct _GSourcePrivate          GSourcePrivate;
  * @get: Called to extract the callback function and data from the
  *     callback object.
 
- * The <structname>GSourceCallbackFuncs</structname> struct contains
+ * The `GSourceCallbackFuncs` struct contains
  * functions for managing callback objects.
  */
 typedef struct _GSourceCallbackFuncs    GSourceCallbackFuncs;
@@ -74,12 +83,18 @@ typedef struct _GSourceCallbackFuncs    GSourceCallbackFuncs;
  *     results of the poll() call) it should return %TRUE. It can also return
  *     a @timeout_ value which should be the maximum timeout (in milliseconds)
  *     which should be passed to the poll() call. The actual timeout used will
- *     be -1 if all sources returned -1, or it will be the minimum of all the
- *     @timeout_ values returned which were >= 0.
+ *     be -1 if all sources returned -1, or it will be the minimum of all
+ *     the @timeout_ values returned which were >= 0.  Since 2.36 this may
+ *     be %NULL, in which case the effect is as if the function always returns
+ *     %FALSE with a timeout of -1.  If @prepare returns a
+ *     timeout and the source also has a 'ready time' set then the
+ *     nearer of the two will be used.
  * @check: Called after all the file descriptors are polled. The source
  *     should return %TRUE if it is ready to be dispatched. Note that some
  *     time may have passed since the previous prepare function was called,
- *     so the source should be checked again here.
+ *     so the source should be checked again here.  Since 2.36 this may
+ *     be %NULL, in which case the effect is as if the function always returns
+ *     %FALSE.
  * @dispatch: Called to dispatch the event source, after it has returned
  *     %TRUE in either its @prepare or its @check function. The @dispatch
  *     function is passed in a callback function and data. The callback
@@ -89,7 +104,7 @@ typedef struct _GSourceCallbackFuncs    GSourceCallbackFuncs;
  *     are needed for this type of event source.
  * @finalize: Called when the source is finalized.
  *
- * The <structname>GSourceFuncs</structname> struct contains a table of
+ * The `GSourceFuncs` struct contains a table of
  * functions used to handle event sources in a generic manner.
  *
  * For idle sources, the prepare and check functions always return %TRUE
@@ -132,7 +147,8 @@ typedef struct _GSourceFuncs            GSourceFuncs;
  * Specifies the type of function passed to g_timeout_add(),
  * g_timeout_add_full(), g_idle_add(), and g_idle_add_full().
  *
- * Returns: %FALSE if the source should be removed
+ * Returns: %FALSE if the source should be removed. #G_SOURCE_CONTINUE and
+ * #G_SOURCE_REMOVE are more memorable names for the return value.
  */
 typedef gboolean (*GSourceFunc)       (gpointer user_data);
 
@@ -156,7 +172,7 @@ struct _GSource
   gpointer callback_data;
   GSourceCallbackFuncs *callback_funcs;
 
-  GSourceFuncs *source_funcs;
+  const GSourceFuncs *source_funcs;
   guint ref_count;
 
   GMainContext *context;
@@ -447,6 +463,28 @@ GLIB_AVAILABLE_IN_ALL
 void                 g_source_set_name_by_id (guint           tag,
                                               const char     *name);
 
+GLIB_AVAILABLE_IN_2_36
+void                 g_source_set_ready_time (GSource        *source,
+                                              gint64          ready_time);
+GLIB_AVAILABLE_IN_2_36
+gint64               g_source_get_ready_time (GSource        *source);
+
+#ifdef G_OS_UNIX
+GLIB_AVAILABLE_IN_2_36
+gpointer             g_source_add_unix_fd    (GSource        *source,
+                                              gint            fd,
+                                              GIOCondition    events);
+GLIB_AVAILABLE_IN_2_36
+void                 g_source_modify_unix_fd (GSource        *source,
+                                              gpointer        tag,
+                                              GIOCondition    new_events);
+GLIB_AVAILABLE_IN_2_36
+void                 g_source_remove_unix_fd (GSource        *source,
+                                              gpointer        tag);
+GLIB_AVAILABLE_IN_2_36
+GIOCondition         g_source_query_unix_fd  (GSource        *source,
+                                              gpointer        tag);
+#endif
 
 /* Used to implement g_source_connect_closure and internally*/
 GLIB_AVAILABLE_IN_ALL
@@ -566,6 +604,10 @@ void     g_main_context_invoke      (GMainContext   *context,
 GLIB_VAR GSourceFuncs g_timeout_funcs;
 GLIB_VAR GSourceFuncs g_child_watch_funcs;
 GLIB_VAR GSourceFuncs g_idle_funcs;
+#ifdef G_OS_UNIX
+GLIB_VAR GSourceFuncs g_unix_signal_funcs;
+GLIB_VAR GSourceFuncs g_unix_fd_source_funcs;
+#endif
 
 G_END_DECLS