mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
Make GMainLoop, GMainContext and GSource boxed types
Also add some annotations for better usage of these types in bindings. https://bugzilla.gnome.org/show_bug.cgi?id=657725
This commit is contained in:
parent
3354b02ccd
commit
fe4fc3e8b5
35
glib/gmain.c
35
glib/gmain.c
@ -641,7 +641,7 @@ g_main_context_new (void)
|
||||
* specified, and corresponds to the "main" main loop. See also
|
||||
* g_main_context_get_thread_default().
|
||||
*
|
||||
* Return value: the global default main context.
|
||||
* Return value: (transfer none): the global default main context.
|
||||
**/
|
||||
GMainContext *
|
||||
g_main_context_default (void)
|
||||
@ -782,8 +782,8 @@ g_main_context_pop_thread_default (GMainContext *context)
|
||||
* non-default context, so it is not safe to assume that this will
|
||||
* always return %NULL if threads are not initialized.)
|
||||
*
|
||||
* Returns: the thread-default #GMainContext, or %NULL if the
|
||||
* thread-default context is the global default context.
|
||||
* Returns: (transfer none): the thread-default #GMainContext, or
|
||||
* %NULL if the thread-default context is the global default context.
|
||||
*
|
||||
* Since: 2.22
|
||||
**/
|
||||
@ -1085,9 +1085,9 @@ g_source_get_id (GSource *source)
|
||||
* Gets the #GMainContext with which the source is associated.
|
||||
* Calling this function on a destroyed source is an error.
|
||||
*
|
||||
* Return value: the #GMainContext with which the source is associated,
|
||||
* or %NULL if the context has not yet been added
|
||||
* to a source.
|
||||
* Return value: (transfer none): the #GMainContext with which the
|
||||
* source is associated, or %NULL if the context has not
|
||||
* yet been added to a source.
|
||||
**/
|
||||
GMainContext *
|
||||
g_source_get_context (GSource *source)
|
||||
@ -1740,7 +1740,7 @@ g_source_unref (GSource *source)
|
||||
*
|
||||
* Finds a #GSource given a pair of context and ID.
|
||||
*
|
||||
* Return value: the #GSource if found, otherwise, %NULL
|
||||
* Return value: (transfer none): the #GSource if found, otherwise, %NULL
|
||||
**/
|
||||
GSource *
|
||||
g_main_context_find_source_by_id (GMainContext *context,
|
||||
@ -1779,7 +1779,7 @@ g_main_context_find_source_by_id (GMainContext *context,
|
||||
* multiple sources exist with the same source function and user data,
|
||||
* the first one found will be returned.
|
||||
*
|
||||
* Return value: the source, if one was found, otherwise %NULL
|
||||
* Return value: (transfer none): the source, if one was found, otherwise %NULL
|
||||
**/
|
||||
GSource *
|
||||
g_main_context_find_source_by_funcs_user_data (GMainContext *context,
|
||||
@ -1827,7 +1827,7 @@ g_main_context_find_source_by_funcs_user_data (GMainContext *context,
|
||||
* multiple sources exist with the same user data, the first
|
||||
* one found will be returned.
|
||||
*
|
||||
* Return value: the source, if one was found, otherwise %NULL
|
||||
* Return value: (transfer none): the source, if one was found, otherwise %NULL
|
||||
**/
|
||||
GSource *
|
||||
g_main_context_find_source_by_user_data (GMainContext *context,
|
||||
@ -2254,7 +2254,7 @@ g_main_depth (void)
|
||||
*
|
||||
* Returns the currently firing source for this thread.
|
||||
*
|
||||
* Return value: The currently firing source or %NULL.
|
||||
* Return value: (transfer none): The currently firing source or %NULL.
|
||||
*
|
||||
* Since: 2.12
|
||||
*/
|
||||
@ -2807,8 +2807,9 @@ g_main_context_prepare (GMainContext *context,
|
||||
* g_main_context_query:
|
||||
* @context: a #GMainContext
|
||||
* @max_priority: maximum priority source to check
|
||||
* @timeout_: location to store timeout to be used in polling
|
||||
* @fds: location to store #GPollFD records that need to be polled.
|
||||
* @timeout_: (out): location to store timeout to be used in polling
|
||||
* @fds: (out caller-allocates) (array length=n_fds): location to
|
||||
* store #GPollFD records that need to be polled.
|
||||
* @n_fds: length of @fds.
|
||||
*
|
||||
* Determines information necessary to poll this main loop.
|
||||
@ -2877,8 +2878,8 @@ g_main_context_query (GMainContext *context,
|
||||
* g_main_context_check:
|
||||
* @context: a #GMainContext
|
||||
* @max_priority: the maximum numerical priority of sources to check
|
||||
* @fds: array of #GPollFD's that was passed to the last call to
|
||||
* g_main_context_query()
|
||||
* @fds: (array length=n_fds): array of #GPollFD's that was passed to
|
||||
* the last call to g_main_context_query()
|
||||
* @n_fds: return value of g_main_context_query()
|
||||
*
|
||||
* Passes the results of polling back to the main loop.
|
||||
@ -3355,7 +3356,7 @@ g_main_loop_is_running (GMainLoop *loop)
|
||||
*
|
||||
* Returns the #GMainContext of @loop.
|
||||
*
|
||||
* Return value: the #GMainContext of @loop
|
||||
* Return value: (transfer none): the #GMainContext of @loop
|
||||
**/
|
||||
GMainContext *
|
||||
g_main_loop_get_context (GMainLoop *loop)
|
||||
@ -4906,7 +4907,7 @@ g_idle_remove_by_data (gpointer data)
|
||||
|
||||
/**
|
||||
* g_main_context_invoke:
|
||||
* @context: a #GMainContext, or %NULL
|
||||
* @context: (allow-none): a #GMainContext, or %NULL
|
||||
* @function: function to call
|
||||
* @data: data to pass to @function
|
||||
*
|
||||
@ -4946,7 +4947,7 @@ g_main_context_invoke (GMainContext *context,
|
||||
|
||||
/**
|
||||
* g_main_context_invoke_full:
|
||||
* @context: a #GMainContext, or %NULL
|
||||
* @context: (allow-none): a #GMainContext, or %NULL
|
||||
* @priority: the priority at which to run @function
|
||||
* @function: function to call
|
||||
* @data: data to pass to @function
|
||||
|
@ -125,7 +125,7 @@ typedef struct _GSourceFuncs GSourceFuncs;
|
||||
|
||||
/**
|
||||
* GSourceFunc:
|
||||
* @data: data passed to the function, set when the source was
|
||||
* @user_data: data passed to the function, set when the source was
|
||||
* created with one of the above functions
|
||||
*
|
||||
* Specifies the type of function passed to g_timeout_add(),
|
||||
@ -133,20 +133,20 @@ typedef struct _GSourceFuncs GSourceFuncs;
|
||||
*
|
||||
* Returns: %FALSE if the source should be removed
|
||||
*/
|
||||
typedef gboolean (*GSourceFunc) (gpointer data);
|
||||
typedef gboolean (*GSourceFunc) (gpointer user_data);
|
||||
|
||||
/**
|
||||
* GChildWatchFunc:
|
||||
* @pid: the process id of the child process
|
||||
* @status: Status information about the child process,
|
||||
* see waitpid(2) for more information about this field
|
||||
* @data: user data passed to g_child_watch_add()
|
||||
* @user_data: user data passed to g_child_watch_add()
|
||||
*
|
||||
* The type of functions to be called when a child exists.
|
||||
*/
|
||||
typedef void (*GChildWatchFunc) (GPid pid,
|
||||
gint status,
|
||||
gpointer data);
|
||||
gpointer user_data);
|
||||
struct _GSource
|
||||
{
|
||||
/*< private >*/
|
||||
|
@ -145,6 +145,9 @@ G_DEFINE_BOXED_TYPE (GVariantBuilder, g_variant_builder, g_variant_builder_ref,
|
||||
G_DEFINE_BOXED_TYPE (GError, g_error, g_error_copy, g_error_free)
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GDateTime, g_date_time, g_date_time_ref, g_date_time_unref);
|
||||
G_DEFINE_BOXED_TYPE (GMainLoop, g_main_loop, g_main_loop_ref, g_main_loop_unref)
|
||||
G_DEFINE_BOXED_TYPE (GMainContext, g_main_context, g_main_context_ref, g_main_context_unref)
|
||||
G_DEFINE_BOXED_TYPE (GSource, g_source, g_source_ref, g_source_unref)
|
||||
|
||||
/* This one can't use G_DEFINE_BOXED_TYPE (GStrv, g_strv, g_strdupv, g_strfreev) */
|
||||
GType
|
||||
|
@ -182,6 +182,33 @@ typedef gsize GType;
|
||||
*/
|
||||
#define G_TYPE_VARIANT_BUILDER (g_variant_builder_get_type ())
|
||||
|
||||
/**
|
||||
* G_TYPE_MAIN_LOOP:
|
||||
*
|
||||
* The #GType for a boxed type holding a #GMainLoop.
|
||||
*
|
||||
* Since: 2.30
|
||||
*/
|
||||
#define G_TYPE_MAIN_LOOP (g_main_loop_get_type ())
|
||||
|
||||
/**
|
||||
* G_TYPE_MAIN_CONTEXT:
|
||||
*
|
||||
* The #GType for a boxed type holding a #GMainContext.
|
||||
*
|
||||
* Since: 2.30
|
||||
*/
|
||||
#define G_TYPE_MAIN_CONTEXT (g_main_context_get_type ())
|
||||
|
||||
/**
|
||||
* G_TYPE_SOURCE:
|
||||
*
|
||||
* The #GType for a boxed type holding a #GSource.
|
||||
*
|
||||
* Since: 2.30
|
||||
*/
|
||||
#define G_TYPE_SOURCE (g_source_get_type ())
|
||||
|
||||
GType g_date_get_type (void) G_GNUC_CONST;
|
||||
GType g_strv_get_type (void) G_GNUC_CONST;
|
||||
GType g_gstring_get_type (void) G_GNUC_CONST;
|
||||
@ -197,6 +224,9 @@ GType g_date_time_get_type (void) G_GNUC_CONST;
|
||||
GType g_io_channel_get_type (void) G_GNUC_CONST;
|
||||
GType g_io_condition_get_type (void) G_GNUC_CONST;
|
||||
GType g_variant_builder_get_type (void) G_GNUC_CONST;
|
||||
GType g_main_loop_get_type (void) G_GNUC_CONST;
|
||||
GType g_main_context_get_type (void) G_GNUC_CONST;
|
||||
GType g_source_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#if !defined(G_DISABLE_DEPRECATED) || defined(__GI_SCANNER__)
|
||||
GType g_variant_get_gtype (void) G_GNUC_CONST;
|
||||
|
@ -27,6 +27,9 @@ g_regex_get_type
|
||||
g_match_info_get_type
|
||||
g_variant_builder_get_type
|
||||
g_variant_type_get_gtype
|
||||
g_main_loop_get_type
|
||||
g_main_context_get_type
|
||||
g_source_get_type
|
||||
g_closure_get_type
|
||||
g_value_get_type
|
||||
g_value_array_get_type
|
||||
|
Loading…
Reference in New Issue
Block a user