Increments the reference count of a #GIOChannel.
a #GIOChannel
the @channel that was passed in (since 2.6)
Converts a string to a hash value.
It can be passed to g_hash_table_new() as the @hash_func
parameter, when using strings as keys in a #GHashTable.
a string key
a hash value corresponding to the key
Removes a source from its #GMainContext, if any, and mark it as
destroyed. The source cannot be subsequently added to another
context.
a #GSource
Determines whether a character is numeric (i.e. a digit). This
covers ASCII 0-9 and also digits in other languages/scripts. Given
some UTF-8 text, obtain a character value with g_utf8_get_char().
a Unicode character
%TRUE if @c is a digit
Returns: the first #GFlagsValue which is set in @value, or %NULL if
a #GFlagsClass
the value
the first #GFlagsValue which is set in @value, or %NULL if
none is set
Unquotes a string as the shell (/bin/sh) would. Only handles
quotes; if a string contains file globs, arithmetic operators,
variables, backticks, redirections, or other special-to-the-shell
features, the result will be different from the result a real shell
would produce (the variables, backticks, etc. will be passed
through literally instead of being expanded). This function is
guaranteed to succeed if applied to the result of
g_shell_quote(). If it fails, it returns %NULL and sets the
error. The @quoted_string need not actually contain quoted or
escaped text; g_shell_unquote() simply goes through the string and
unquotes/unescapes anything that the shell would. Both single and
double quotes are handled, as are escapes including escaped
newlines. The return value must be freed with g_free(). Possible
errors are in the #G_SHELL_ERROR domain.
Shell quoting rules are a bit strange. Single quotes preserve the
literal string exactly. escape sequences are not allowed; not even
\' - if you want a ' in the quoted text, you have to do something
like 'foo'\''bar'. Double quotes allow $, `, ", \, and newline to
be escaped with backslash. Otherwise double quotes preserve things
literally.
shell-quoted string
error return location or NULL
an unquoted string
Removes a previously installed #GTypeClassCacheFunc. The cache
maintained by @cache_func has to be empty when calling
g_type_remove_class_cache_func() to avoid leaks.
data that was given when adding @cache_func
a #GTypeClassCacheFunc
Behaves exactly like g_build_path(), but takes the path elements
as a string array, instead of varargs. This function is mainly
meant for language bindings.
a string used to separator the elements of the path.
%NULL-terminated array of strings containing the path elements.
a newly-allocated string that must be freed with g_free().
Since: 2.8
Sort @value_array using @compare_func to compare the elements accoring
to the semantics of #GCompareDataFunc.
The current implementation uses Quick-Sort as sorting algorithm.
#GValueArray to sort
function to compare elements
extra data argument provided for @compare_func
the #GValueArray passed in as @value_array
If @dest is %NULL, free @src; otherwise, moves @src into *@dest.
The error variable @dest points to must be %NULL.
error return location
error to move into the return location
Return value: the number of threads currently running
a #GThreadPool
the number of threads currently running
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, guchar arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #guchar parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Creates a new closure which invokes the function found at the offset
@struct_offset in the class structure of the interface or classed type
identified by @itype.
the #GType identifier of an interface or classed type
the offset of the member function of @itype's class
structure which is to be invoked by the new closure
a new #GCClosure
Emits a signal.
Note that g_signal_emit() resets the return value to the default
if no handlers are connected, in contrast to g_signal_emitv().
the instance the signal is being emitted on.
the signal id
the detail
parameters to be passed to the signal, followed by a
location for the return value. If the return type of the signal
is #G_TYPE_NONE, the return value location can be omitted.
Retrieves the names of the applications that have registered the
bookmark for @uri.
In the event the URI cannot be found, %NULL is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
a #GBookmarkFile
a valid URI
return location of the length of the returned list, or %NULL
return location for a #GError, or %NULL
a newly allocated %NULL-terminated array of strings.
Use g_strfreev() to free it.
Since: 2.12
Close an IO channel. Any pending data to be written will be
flushed, ignoring errors. The channel will not be freed until the
last reference is dropped using g_io_channel_unref().
Deprecated:2.2: Use g_io_channel_shutdown() instead.
A #GIOChannel
Compares two strings for equality, returning %TRUE if they are equal.
For use with #GHashTable.
a #GString
another #GString
%TRUE if they strings are the same length and contain the
same bytes
Gets the length in bytes of digests of type @checksum_type
a #GChecksumType
the checksum length, or -1 if @checksum_type is
not supported.
Since: 2.16
Reverses a #GSList.
a #GSList
the start of the reversed #GSList
Gets whether the private flag of the bookmark for @uri is set.
In the event the URI cannot be found, %FALSE is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
event that the private flag cannot be found, %FALSE is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
a #GBookmarkFile
a valid URI
return location for a #GError, or %NULL
%TRUE if the private flag is set, %FALSE otherwise.
Since: 2.12
Return value: The currently firing source or %NULL.
The currently firing source or %NULL.
Since: 2.12
Returns: a canonical representation for the string
a string
a canonical representation for the string
Since: 2.10
Set the callback for a source as a #GClosure.
If the source is not one of the standard GLib types, the @closure_callback
and @closure_marshal fields of the #GSourceFuncs structure must have been
filled in with pointers to appropriate functions.
the source
a #GClosure
Returns: The corresponding #GTypeInterface structure of the parent
A #GTypeInterface structure.
The corresponding #GTypeInterface structure of the parent
type of the instance type to which @g_iface belongs, or
%NULL if the parent type doesn't conform to the interface.
Associates a list of double values with @key under
@group_name. If @key cannot be found then it is created.
Since: 2.12
a #GKeyFile
a group name
a key
an array of double values
number of double values in @list
Creates a new closure which invokes @callback_func with @user_data as
the last parameter.
the function to invoke
user data to pass to @callback_func
destroy notify to be called when @user_data is no longer used
a new #GCClosure
Return value: the position of @iter
a #GSequenceIter
the position of @iter
Since: 2.14
Creates a new #GSource structure. The size is specified to
allow creating structures derived from #GSource that contain
additional data. The size passed in must be at least
<literal>sizeof (GSource)</literal>.
The source will not initially be associated with any #GMainContext
and must be added to one with g_source_attach() before it will be
executed.
structure containing functions that implement
the sources behavior.
size of the #GSource structure to create.
the newly-created #GSource.
Get the contents of a %G_TYPE_ULONG #GValue.
a valid #GValue of type %G_TYPE_ULONG
unsigned long integer contents of @value
Sets the encoding for the input/output of the channel.
The internal encoding is always UTF-8. The default encoding
for the external file is UTF-8.
The encoding %NULL is safe to use with binary data.
The encoding can only be set if one of the following conditions
is true:
<itemizedlist>
<listitem><para>
The channel was just created, and has not been written to or read
from yet.
</para></listitem>
<listitem><para>
The channel is write-only.
</para></listitem>
<listitem><para>
The channel is a file, and the file pointer was just
repositioned by a call to g_io_channel_seek_position().
(This flushes all the internal buffers.)
</para></listitem>
<listitem><para>
The current encoding is %NULL or UTF-8.
</para></listitem>
<listitem><para>
One of the (new API) read functions has just returned %G_IO_STATUS_EOF
(or, in the case of g_io_channel_read_to_end(), %G_IO_STATUS_NORMAL).
</para></listitem>
<listitem><para>
One of the functions g_io_channel_read_chars() or
g_io_channel_read_unichar() has returned %G_IO_STATUS_AGAIN or
%G_IO_STATUS_ERROR. This may be useful in the case of
%G_CONVERT_ERROR_ILLEGAL_SEQUENCE.
Returning one of these statuses from g_io_channel_read_line(),
g_io_channel_read_line_string(), or g_io_channel_read_to_end()
does <emphasis>not</emphasis> guarantee that the encoding can
be changed.
</para></listitem>
</itemizedlist>
Channels which do not meet one of the above conditions cannot call
g_io_channel_seek_position() with an offset of %G_SEEK_CUR, and, if
they are "seekable", cannot call g_io_channel_write_chars() after
calling one of the API "read" functions.
a #GIOChannel
the encoding type
location to store an error of type #GConvertError
%G_IO_STATUS_NORMAL if the encoding was successfully set.
Looks up a #GFlagsValue by name.
a #GFlagsClass
the name to look up
the #GFlagsValue with name @name, or %NULL if there is no
flag with that name
Gets the number of children of a #GNode.
a #GNode
the number of children of @node
Frees a #GMarkupParseContext. Can't be called from inside
one of the #GMarkupParser functions. Can't be called while
a subparser is pushed.
a #GMarkupParseContext
Creates a new #GStringChunk.
the default size of the blocks of memory which are
allocated to store the strings. If a particular string
is larger than this default size, a larger block of
memory will be allocated for it.
a new #GStringChunk
Converts a string into canonical form, standardizing
such issues as whether a character with an accent
is represented as a base character and combining
accent or as a single precomposed character. The
string has to be valid UTF-8, otherwise %NULL is
returned. You should generally call g_utf8_normalize()
before comparing two Unicode strings.
The normalization mode %G_NORMALIZE_DEFAULT only
standardizes differences that do not affect the
text content, such as the above-mentioned accent
representation. %G_NORMALIZE_ALL also standardizes
the "compatibility" characters in Unicode, such
as SUPERSCRIPT THREE to the standard forms
(in this case DIGIT THREE). Formatting information
may be lost but for most text operations such
characters should be considered the same.
%G_NORMALIZE_DEFAULT_COMPOSE and %G_NORMALIZE_ALL_COMPOSE
are like %G_NORMALIZE_DEFAULT and %G_NORMALIZE_ALL,
but returned a result with composed forms rather
than a maximally decomposed form. This is often
useful if you intend to convert the string to
a legacy encoding or pass it to a system with
less capable Unicode handling.
a UTF-8 encoded string.
length of @str, in bytes, or -1 if @str is nul-terminated.
the type of normalization to perform.
a newly allocated string, that is the
normalized form of @str, or %NULL if @str is not
valid UTF-8.
Returns: a newly-allocated zero-terminated array of #GType containing
an interface type
location to return the number of prerequisites, or %NULL
a newly-allocated zero-terminated array of #GType containing
the prerequisites of @interface_type
Scans for the next match using the same parameters of the previous
call to g_regex_match_full() or g_regex_match() that returned
@match_info.
The match is done on the string passed to the match function, so you
cannot free it before calling this function.
a #GMatchInfo structure
location to store the error occuring, or %NULL to ignore errors
%TRUE is the string matched, %FALSE otherwise
Since: 2.14
Connects a closure to a signal for a particular object.
the instance to connect to.
the id of the signal.
the detail.
the closure to connect.
whether the handler should be called before or after the
default handler of the signal.
the handler id
This is just like the standard C qsort() function, but
the comparison routine accepts a user data argument.
start of array to sort
elements in the array
size of each element
function to compare elements
data to pass to @compare_func
Retrieves the name of the next entry in the directory. The '.' and
'..' entries are omitted. On Windows, the returned name is in
UTF-8. On Unix, it is in the on-disk encoding.
a #GDir* created by g_dir_open()
The entry's name or %NULL if there are no
more entries. The return value is owned by GLib and
must not be modified or freed.
If @context is currently waiting in a poll(), interrupt
the poll(), and continue the iteration process.
a #GMainContext
Gets a human-readable name for the application, as set by
g_set_application_name(). This name should be localized if
possible, and is intended for display to the user. Contrast with
g_get_prgname(), which gets a non-localized name. If
g_set_application_name() has not been called, returns the result of
g_get_prgname() (which may be %NULL if g_set_prgname() has also not
been called).
human-readable application name. may return %NULL
Since: 2.2
Get the contents of a %G_TYPE_STRING #GValue.
a valid #GValue of type %G_TYPE_STRING
string content of @value
Gets the directory to use for temporary files. This is found from
inspecting the environment variables <envar>TMPDIR</envar>,
<envar>TMP</envar>, and <envar>TEMP</envar> in that order. If none
of those are defined "/tmp" is returned on UNIX and "C:\" on Windows.
The encoding of the returned string is system-defined. On Windows,
it is always UTF-8. The return value is never %NULL.
the directory to use for temporary files.
A safer form of the standard sprintf() function. The output is guaranteed
to not exceed @n characters (including the terminating nul character), so
it is easy to ensure that a buffer overflow cannot occur.
See also g_strdup_printf().
In versions of GLib prior to 1.2.3, this function may return -1 if the
output was truncated, and the truncated string may not be nul-terminated.
In versions prior to 1.3.12, this function returns the length of the output
string.
The return value of g_snprintf() conforms to the snprintf()
function as standardized in ISO C99. Note that this is different from
traditional snprintf(), which returns the length of the output string.
The format string may contain positional parameters, as specified in
the Single Unix Specification.
the buffer to hold the output.
the maximum number of bytes to produce (including the
terminating nul character).
a standard printf() format string, but notice
<link linkend="string-precision">string precision pitfalls</link>.
the arguments to insert in the output.
the number of bytes which would be produced if the buffer
was large enough.
Retrieves the text matching the @match_num<!-- -->'th capturing
parentheses. 0 is the full text of the match, 1 is the first paren
set, 2 the second, and so on.
If @match_num is a valid sub pattern but it didn't match anything
(e.g. sub pattern 1, matching "b" against "(a)?b") then an empty
string is returned.
If the match was obtained using the DFA algorithm, that is using
g_regex_match_all() or g_regex_match_all_full(), the retrieved
string is not that of a set of parentheses but that of a matched
substring. Substrings are matched in reverse order of length, so
0 is the longest match.
The string is fetched from the string passed to the match function,
so you cannot call this function after freeing the string.
#GMatchInfo structure
number of the sub expression
The matched substring, or %NULL if an error occurred.
You have to free the string yourself
Since: 2.14
Increases the reference count on a #GMainContext object by one.
a #GMainContext
the @context that was passed in (since 2.6)
The GType API is the foundation of the GObject system. It provides the
facilities for registering and managing all fundamental data types,
user-defined object and interface types. Before using any GType
or GObject functions, g_type_init() must be called to initialize the
type system.
For type creation and registration purposes, all types fall into one of
two categories: static or dynamic. Static types are never loaded or
unloaded at run-time as dynamic types may be. Static types are created
with g_type_register_static() that gets type specific information passed
in via a #GTypeInfo structure.
Dynamic types are created with g_type_register_dynamic() which takes a
#GTypePlugin structure instead. The remaining type information (the
#GTypeInfo structure) is retrieved during runtime through #GTypePlugin
and the g_type_plugin_*() API.
These registration functions are usually called only once from a
function whose only purpose is to return the type identifier for a
specific class. Once the type (or class or interface) is registered,
it may be instantiated, inherited, or implemented depending on exactly
what sort of type it is.
There is also a third registration function for registering fundamental
types called g_type_register_fundamental() which requires both a #GTypeInfo
structure and a #GTypeFundamentalInfo structure but it is seldom used
since most fundamental types are predefined rather than user-defined.
A final word about type names.
Such an identifier needs to be at least three characters long. There is no
upper length limit. The first character needs to be a letter (a-z or A-Z)
or an underscore '_'. Subsequent characters can be letters, numbers or
any of '-_+'.
The GLib Runtime type identification and
management system
Type Information
Sets a human-readable name for the application. This name should be
localized if possible, and is intended for display to the user.
Contrast with g_set_prgname(), which sets a non-localized name.
g_set_prgname() will be called automatically by gtk_init(),
but g_set_application_name() will not.
Note that for thread safety reasons, this function can only
be called once.
The application name will be used in contexts such as error messages,
or when displaying an application's name in the task list.
Since: 2.2
localized name of the application
Tries to become the owner of the specified context.
If some other thread is the owner of the context,
Return value: %TRUE if the operation succeeded, and
a #GMainContext
%TRUE if the operation succeeded, and
this thread is now the owner of @context.
Start a timing test. Call g_test_timer_elapsed() when the task is supposed
to be done. Call this function again to restart the timer.
Since: 2.16
Returns: the string searched with @match_info
a #GMatchInfo
the string searched with @match_info
Since: 2.14
Writes all of @contents to a file named @filename, with good error checking.
If a file called @filename already exists it will be overwritten.
This write is atomic in the sense that it is first written to a temporary
file which is then renamed to the final name. Notes:
<itemizedlist>
<listitem>
On Unix, if @filename already exists hard links to @filename will break.
Also since the file is recreated, existing permissions, access control
lists, metadata etc. may be lost. If @filename is a symbolic link,
the link itself will be replaced, not the linked file.
</listitem>
<listitem>
On Windows renaming a file will not remove an existing file with the
new name, so on Windows there is a race condition between the existing
file being removed and the temporary file being renamed.
</listitem>
<listitem>
On Windows there is no way to remove a file that is open to some
process, or mapped into memory. Thus, this function will fail if
@filename already exists and is open.
</listitem>
</itemizedlist>
If the call was sucessful, it returns %TRUE. If the call was not successful,
it returns %FALSE and sets @error. The error domain is #G_FILE_ERROR.
Possible error codes are those in the #GFileError enumeration.
name of a file to write @contents to, in the GLib file name
encoding
string to write to the file
length of @contents, or -1 if @contents is a nul-terminated string
return location for a #GError, or %NULL
%TRUE on success, %FALSE if an error occurred
Since: 2.8
Emits a signal.
Note that g_signal_emit_by_name() resets the return value to the default
if no handlers are connected, in contrast to g_signal_emitv().
the instance the signal is being emitted on.
a string of the form "signal-name::detail".
parameters to be passed to the signal, followed by a
location for the return value. If the return type of the signal
is #G_TYPE_NONE, the return value location can be omitted.
Set the contents of a pointer #GValue to @v_pointer.
a valid #GValue of %G_TYPE_POINTER
pointer value to be set
Adds a function to be called whenever there are no higher priority
events pending. If the function returns %FALSE it is automatically
removed from the list of event sources and will not be called again.
This internally creates a main loop source using g_idle_source_new()
and attaches it to the main loop context using g_source_attach().
You can do these steps manually if you need greater control.
the priority of the idle source. Typically this will be in the
range btweeen #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.
function to call
data to pass to @function
function to call when the idle is removed, or %NULL
the ID (greater than 0) of the event source.
Returns: The depth of @type.
A #GType value.
The depth of @type.
Registers a new static enumeration type with the name @name.
It is normally more convenient to let <link
linkend="glib-mkenums">glib-mkenums</link> generate a
my_enum_get_type() function from a usual C enumeration definition
than to write one yourself using g_enum_register_static().
A nul-terminated string used as the name of the new type.
An array of #GEnumValue structs for the possible
enumeration values. The array is terminated by a struct with all
members being 0. GObject keeps a reference to the data, so it cannot
be stack-allocated.
The new type identifier.
Resets the given directory. The next call to g_dir_read_name()
will return the first entry again.
a #GDir* created by g_dir_open()
Retrieves every key inside @hash_table. The returned data is valid
until @hash_table is modified.
a #GHashTable
a #GList containing all the keys inside the hash
table. The content of the list is owned by the hash table and
should not be modified or freed. Use g_list_free() when done
using the list.
Since: 2.14
Return value: a %NULL-terminated array of strings owned by GLib that must
a %NULL-terminated array of strings owned by GLib that must
not be modified or freed.
Since: 2.6
Set the contents of a %G_TYPE_PARAM #GValue to @param.
a valid #GValue of type %G_TYPE_PARAM
the #GParamSpec to be set
Removes the @n'th element of @queue.
a #GQueue
the position of the element.
the element's data, or %NULL if @n is off the end of @queue.
Since: 2.4
Looks whether the key file has the key @key in the group
@group_name.
a #GKeyFile
a group name
a key name
return location for a #GError
%TRUE if @key is a part of @group_name, %FALSE
otherwise.
Since: 2.6
Replacement for g_io_channel_read() with the new API.
a #GIOChannel
a buffer to read data into
the size of the buffer. Note that the buffer may
not be complelely filled even if there is data
in the buffer if the remaining data is not a
complete character.
The number of bytes read. This may be zero even on
success if count < 6 and the channel's encoding is non-%NULL.
This indicates that the next UTF-8 character is too wide for
the buffer.
a location to return an error of type #GConvertError
or #GIOChannelError.
the status of the operation.
Adds a new element on to the start of the list.
<note><para>
The return value is the new start of the list, which
may have changed, so make sure you store the new value.
</para></note>
|[
/* Notice that it is initialized to the empty list. */
GSList *list = NULL;
list = g_slist_prepend (list, "last");
list = g_slist_prepend (list, "first");
]|
a #GSList
the data for the new element
the new start of the #GSList
Associates a list of boolean values with @key under @group_name.
If @key cannot be found then it is created.
If @group_name is %NULL, the start_group is used.
Since: 2.6
a #GKeyFile
a group name
a key
an array of boolean values
length of @list
This is an internal function introduced mainly for C marshallers.
Deprecated: 2.4: Use g_value_take_object() instead.
a valid #GValue of %G_TYPE_OBJECT derived type
object value to be set
Return value: A random number.
a #GRand.
A random number.
Like g_object_set_data() except it adds notification
for when the association is destroyed, either by setting it
to a different value or when the object is destroyed.
Note that the @destroy callback is not called if @data is %NULL.
#GObject containing the associations
name of the key
data to associate with that key
function to call when the association is destroyed
Feed some data to the #GMarkupParseContext. The data need not
be valid UTF-8; an error will be signaled if it's invalid.
The data need not be an entire document; you can feed a document
into the parser incrementally, via multiple calls to this function.
Typically, as you receive data from a network connection or file,
you feed each received chunk of data into this function, aborting
the process if an error occurs. Once an error is reported, no further
data may be fed to the #GMarkupParseContext; all errors are fatal.
a #GMarkupParseContext
chunk of text to parse
length of @text in bytes
return location for a #GError
%FALSE if an error occurred, %TRUE on success
Sets the function to use to handle polling of file descriptors. It
will be used instead of the poll() system call
(or GLib's replacement function, which is used where
poll() isn't available).
This function could possibly be used to integrate the GLib event
loop with an external event loop.
a #GMainContext
the function to call to poll all file descriptors
Runs a single iteration for the given main loop. This involves
checking to see if any event sources are ready to be processed,
then if no events sources are ready and @may_block is %TRUE, waiting
for a source to become ready, then dispatching the highest priority
events sources that are ready. Otherwise, if @may_block is %FALSE
sources are not waited to become ready, only those highest priority
events sources will be dispatched (if any), that are ready at this
given moment without further waiting.
Note that even when @may_block is %TRUE, it is still possible for
g_main_context_iteration() to return %FALSE, since the the wait may
be interrupted for other reasons than an event source becoming ready.
a #GMainContext (if %NULL, the default context will be used)
whether the call may block.
%TRUE if events were dispatched.
Reads the contents of the symbolic link @filename like the POSIX
readlink() function. The returned string is in the encoding used
for filenames. Use g_filename_to_utf8() to convert it to UTF-8.
the symbolic link
return location for a #GError
A newly-allocated string with the contents of the symbolic link,
or %NULL if an error occurred.
Since: 2.4
Gets an array of all #GParamSpec<!-- -->s owned by @owner_type in
the pool.
a #GParamSpecPool
the owner to look for
return location for the length of the returned array
a newly allocated array containing pointers to all
#GParamSpec<!-- -->s owned by @owner_type in the pool
Converts a character to the titlecase.
a Unicode character
the result of converting @c to titlecase.
If @c is not an uppercase or lowercase character,
@c is returned unchanged.
Given the name of the signal and the type of object it connects to, gets
the signal's identifying integer. Emitting the signal by number is
somewhat faster than using the name each time.
Also tries the ancestors of the given type.
See g_signal_new() for details on allowed signal names.
the signal's name.
the type that the signal operates on.
the signal's identifying number, or 0 if no signal was found.
Creates a new GSequence. The @data_destroy function, if non-%NULL will
be called on all items when the sequence is destroyed and on items that
are removed from the sequence.
a #GDestroyNotify function, or %NULL
a new #GSequence
Since: 2.14
Decreases the reference count on a #GMainLoop object by one. If
the result is zero, free the loop and free all associated memory.
a #GMainLoop
Emits a signal.
Note that g_signal_emit_valist() resets the return value to the default
if no handlers are connected, in contrast to g_signal_emitv().
the instance the signal is being emitted on.
the signal id
the detail
a list of parameters to be passed to the signal, followed by a
location for the return value. If the return type of the signal
is #G_TYPE_NONE, the return value location can be omitted.
Allocate and initialize a new #GValueArray, optionally preserve space
for @n_prealloced elements. New arrays always contain 0 elements,
regardless of the value of @n_prealloced.
number of values to preallocate space for
a newly allocated #GValueArray with 0 values
Decreases the reference count of the asynchronous @queue by 1 and
releases the lock. This function must be called while holding the
@queue's lock. If the reference count went to 0, the @queue will be
destroyed and the memory allocated will be freed.
@Deprecated: Since 2.8, reference counting is done atomically
so g_async_queue_unref() can be used regardless of the @queue's
lock.
a #GAsyncQueue.
Gets the time the bookmark for @uri was added to @bookmark
In the event the URI cannot be found, -1 is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
a #GBookmarkFile
a valid URI
return location for a #GError, or %NULL
a timestamp
Since: 2.12
Finds a source with the given source functions and user data. If
multiple sources exist with the same source function and user data,
the first one found will be returned.
a #GMainContext (if %NULL, the default context will be used).
the @source_funcs passed to g_source_new().
the user data from the callback.
the source, if one was found, otherwise %NULL
This function looks for a desktop bookmark file named @file in the
paths returned from g_get_user_data_dir() and g_get_system_data_dirs(),
loads the file into @bookmark and returns the file's full path in
@full_path. If the file could not be loaded then an %error is
set to either a #GFileError or #GBookmarkFileError.
a #GBookmarkFile
a relative path to a filename to open and parse
return location for a string containing the full path
of the file, or %NULL
return location for a #GError, or %NULL
%TRUE if a key file could be loaded, %FALSE othewise
Since: 2.12
Incrementally decode a sequence of binary data from its Base-64 stringified
representation. By calling this function multiple times you can convert
data in chunks to avoid having to have the full encoded data in memory.
The output buffer must be large enough to fit all the data that will
be written to it. Since base64 encodes 3 bytes in 4 chars you need
at least: @len * 3 / 4 bytes.
binary input data
max length of @in data to decode
output buffer
Saved state between steps, initialize to 0
Saved state between steps, initialize to 0
The number of bytes of output that was written
Since: 2.12
Converts a string from one character set to another.
Note that you should use g_iconv() for streaming
conversions<footnoteref linkend="streaming-state"/>.
the string to convert
the length of the string, or -1 if the string is
nul-terminated<footnote id="nul-unsafe">
<para>
Note that some encodings may allow nul bytes to
occur inside strings. In that case, using -1 for
the @len parameter is unsafe.
</para>
</footnote>.
name of character set into which to convert @str
character set of @str.
location to store the number of bytes in the
input string that were successfully converted, or %NULL.
Even if the conversion was successful, this may be
less than @len if there were partial characters
at the end of the input. If the error
#G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value
stored will the byte offset after the last valid
input sequence.
the number of bytes stored in the output buffer (not
including the terminating nul).
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError may occur.
If the conversion was successful, a newly allocated
nul-terminated string, which must be freed with
g_free(). Otherwise %NULL and @error will be set.
Get the contents of a %G_TYPE_UINT64 #GValue.
a valid #GValue of type %G_TYPE_UINT64
unsigned 64bit integer contents of @value
Finds an iterator somewhere in the range (@begin, @end). This
iterator will be close to the middle of the range, but is not
guaranteed to be <emphasis>exactly</emphasis> in the middle.
The @begin and @end iterators must both point to the same sequence and
@begin must come before or be equal to @end in the sequence.
a #GSequenceIter
a #GSequenceIter
A #GSequenceIter pointing somewhere in the
(@begin, @end) range.
Since: 2.14
Adds a file descriptor to the set of file descriptors polled for
this context. This will very seldomly be used directly. Instead
a typical event source will use g_source_add_poll() instead.
a #GMainContext (or %NULL for the default context)
a #GPollFD structure holding information about a file
descriptor to watch.
the priority for this file descriptor which should be
the same as the priority used for g_source_attach() to ensure that the
file descriptor is polled whenever the results may be needed.
Execute the tests within @suite and all nested #GTestSuites.
The test suites to be executed are filtered according to
test path arguments (-p <replaceable>testpath</replaceable>)
as parsed by g_test_init().
g_test_run_suite() or g_test_run() may only be called once
in a program.
a #GTestSuite
0 on success
Since: 2.16
A convenience function to use gettext() for translating
user-visible strings.
Since: 2.6
a #GOptionGroup
the domain to use
Return value: the main group of @context, or %NULL if @context doesn't
a #GOptionContext
the main group of @context, or %NULL if @context doesn't
have a main group. Note that group belongs to @context and should
not be modified or freed.
Since: 2.6
Gets the element at the given position in a #GSList.
a #GSList
the position of the element, counting from 0
the element, or %NULL if the position is off
the end of the #GSList
Fork the current test program to execute a test case that might
not return or that might abort. The forked test case is aborted
and considered failing if its run time exceeds @usec_timeout.
The forking behavior can be configured with the #GTestTrapFlags flags.
In the following example, the test code forks, the forked child
process produces some sample output and exits successfully.
The forking parent process then asserts successful child program
termination and validates child program outputs.
|[
static void
test_fork_patterns (void)
{
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
{
g_print ("some stdout text: somagic17\n");
g_printerr ("some stderr text: semagic43\n");
exit (0); /* successful test run */
}
g_test_trap_assert_passed();
g_test_trap_assert_stdout ("*somagic17*");
g_test_trap_assert_stderr ("*semagic43*");
}
]|
This function is implemented only on Unix platforms.
Timeout for the forked test in micro seconds.
Flags to modify forking behaviour.
%TRUE for the forked child and %FALSE for the executing parent process.
Since: 2.16
Computes the canonical ordering of a string in-place.
This rearranges decomposed characters in the string
according to their combining classes. See the Unicode
manual for more information.
a UCS-4 encoded string.
the maximum length of @string to use.
Converts all upper case ASCII letters to lower case ASCII letters.
a string.
length of @str in bytes, or -1 if @str is nul-terminated.
a newly-allocated string, with all the upper case
characters in @str converted to lower case, with
semantics that exactly match g_ascii_tolower(). (Note
that this is unlike the old g_strdown(), which modified
the string in place.)
Searches a #GTree using @search_func.
The @search_func is called with a pointer to the key of a key/value pair in
the tree, and the passed in @user_data. If @search_func returns 0 for a
key/value pair, then g_tree_search_func() will return the value of that
pair. If @search_func returns -1, searching will proceed among the
key/value pairs that have a smaller key; if @search_func returns 1,
searching will proceed among the key/value pairs that have a larger key.
a #GTree.
a function used to search the #GTree.
the data passed as the second argument to the @search_func
function.
the value corresponding to the found key, or %NULL if the key
was not found.
Retrieves the list of group names of the bookmark for @uri.
In the event the URI cannot be found, %NULL is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
The returned array is %NULL terminated, so @length may optionally
be %NULL.
a #GBookmarkFile
a valid URI
return location for the length of the returned string, or %NULL
return location for a #GError, or %NULL
a newly allocated %NULL-terminated array of group names.
Use g_strfreev() to free it.
Since: 2.12
Gets the position of the given element
in the #GSList (starting from 0).
a #GSList
an element in the #GSList
the position of the element in the #GSList,
or -1 if the element is not found
A wrapper for the POSIX freopen() function. The freopen() function
opens a file and associates it with an existing stream.
See your C library manual for more details about freopen().
a pathname in the GLib file name encoding (UTF-8 on Windows)
a string describing the mode in which the file should be
opened
an existing stream which will be reused, or %NULL
A <type>FILE</type> pointer if the file was successfully
opened, or %NULL if an error occurred.
Since: 2.6
Calls @func for each element in the queue passing @user_data to the
function.
Since: 2.4
a #GQueue
the function to call for each element's data
user data to pass to @func
Removes the first element in @queue that contains @data.
Since: 2.4
a #GQueue
data to remove.
Compares @value1 with @value2 according to @pspec, and return -1, 0 or +1,
if @value1 is found to be less than, equal to or greater than @value2,
respectively.
a valid #GParamSpec
a #GValue of correct type for @pspec
a #GValue of correct type for @pspec
-1, 0 or +1, for a less than, equal to or greater than result
Compares two strings for byte-by-byte equality and returns %TRUE
if they are equal. It can be passed to g_hash_table_new() as the
@key_equal_func parameter, when using strings as keys in a #GHashTable.
a key
a key to compare with @v1
%TRUE if the two keys match
Return value: The start group of the key file.
a #GKeyFile
The start group of the key file.
Since: 2.6
Increments the reference count of the class structure belonging to
@type. This function will demand-create the class if it doesn't
exist already.
Type ID of a classed type.
The #GTypeClass structure for the given type ID.
Gets the value corresponding to the given key. Since a #GTree is
automatically balanced as key/value pairs are added, key lookup is very
fast.
a #GTree.
the key to look up.
the value corresponding to the key, or %NULL if the key was
not found.
Sets the name for a #GTypeModule
a #GTypeModule.
a human-readable name to use in error messages.
Return value: the #GHashTable associated with @iter.
an initialized #GHashTableIter.
the #GHashTable associated with @iter.
Since: 2.16
Destroys all keys and values in the #GHashTable and decrements its
reference count by 1. If keys and/or values are dynamically allocated,
you should either free them first or create the #GHashTable with destroy
notifiers using g_hash_table_new_full(). In the latter case the destroy
functions you supplied will be called on all keys and values during the
destruction phase.
a #GHashTable.
Return value: the value associated with the key as a double, or
a #GKeyFile
a group name
a key
return location for a #GError
the value associated with the key as a double, or
0.0 if the key was not found or could not be parsed.
Since: 2.12
Removes all the elements in @queue. If queue elements contain
dynamically-allocated memory, they should be freed first.
Since: 2.14
a #GQueue
This function will return the maximum @interval that a thread will
wait in the thread pool for new tasks before being stopped.
If this function returns 0, threads waiting in the thread pool for
new work are not stopped.
the maximum @interval to wait for new tasks in the
thread pool before stopping the thread (1/1000ths of a second).
Since: 2.10
Gets the height of a #GTree.
If the #GTree contains no nodes, the height is 0.
If the #GTree contains only one root node the height is 1.
If the root node has children the height is 2, etc.
a #GTree.
the height of the #GTree.
Removes @len bytes from a #GString, starting at position @pos.
The rest of the #GString is shifted down to fill the gap.
a #GString
the position of the content to remove
the number of bytes to remove, or -1 to remove all
following bytes
@string
Report the last result of g_test_timer_elapsed().
the last result of g_test_timer_elapsed(), as a double
Since: 2.16
Internal function for gtester to free test log messages, no ABI guarantees provided.
Creates a new signal. (This is usually done in the class initializer.)
See g_signal_new() for details on allowed signal names.
the name for the signal
the type this signal pertains to. It will also pertain to
types which are derived from this type
a combination of #GSignalFlags specifying detail of when
the default handler is to be invoked. You should at least specify
%G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST
The closure to invoke on signal emission; may be %NULL
the accumulator for this signal; may be %NULL
user data for the @accumulator
the function to translate arrays of parameter values to
signal emissions into C language callback invocations
the type of return value, or #G_TYPE_NONE for a signal
without a return value
the length of @param_types
an array of types, one for each parameter
the signal id
Finds an element in a #GSList, using a supplied function to
find the desired element. It iterates over the list, calling
the given function which should return 0 when the desired
element is found. The function takes two #gconstpointer arguments,
the #GSList element's data as the first argument and the
given user data.
a #GSList
user data passed to the function
the function to call for each element.
It should return 0 when the desired element is found
the found #GSList element, or %NULL if it is not found
Return value: a string owned by GLib that must not be modified
a string owned by GLib that must not be modified
or freed.
Since: 2.6
This function is a wrapper of dgettext() which does not translate
the message if the default domain as set with textdomain() has no
translations for the current locale.
The advantage of using this function over dgettext() proper is that
libraries using this function (like GTK+) will not use translations
if the application using the library does not have translations for
the current locale. This results in a consistent English-only
interface instead of one having partial translations. For this
feature to work, the call to textdomain() and setlocale() should
precede any g_dgettext() invocations. For GTK+, it means calling
textdomain() before gtk_init or its variants.
This function disables translations if and only if upon its first
call all the following conditions hold:
<itemizedlist>
<listitem>@domain is not %NULL</listitem>
<listitem>textdomain() has been called to set a default text domain</listitem>
<listitem>there is no translations available for the default text domain
and the current locale</listitem>
<listitem>current locale is not "C" or any English locales (those
starting with "en_")</listitem>
</itemizedlist>
Note that this behavior may not be desired for example if an application
has its untranslated messages in a language other than English. In those
cases the application should call textdomain() after initializing GTK+.
Applications should normally not use this function directly,
but use the _() macro for translations.
the translation domain to use, or %NULL to use
the domain set with textdomain()
message to translate
The translated string
Since: 2.18
Compare @s1 and @s2, ignoring the case of ASCII characters and any
characters after the first @n in each string.
Unlike the BSD strcasecmp() function, this only recognizes standard
ASCII letters and ignores the locale, treating all non-ASCII
characters as if they are not letters.
The same warning as in g_ascii_strcasecmp() applies: Use this
function only on strings known to be in encodings where bytes
corresponding to ASCII letters always represent themselves.
string to compare with @s2.
string to compare with @s1.
number of characters to compare.
0 if the strings match, a negative value if @s1 < @s2,
or a positive value if @s1 > @s2.
Decreases the reference count of a source by one. If the
resulting reference count is zero the source and associated
memory will be destroyed.
a #GSource
Same as the standard UNIX routine iconv_close(), but
may be implemented via libiconv on UNIX flavors that lack
a native implementation. Should be called to clean up
the conversion descriptor from g_iconv_open() when
you are done converting things.
GLib provides g_convert() and g_locale_to_utf8() which are likely
more convenient than the raw iconv wrappers.
a conversion descriptor from g_iconv_open()
-1 on error, 0 on success
Returns: %TRUE if automatic help generation is turned on.
a #GOptionContext
%TRUE if automatic help generation is turned on.
Since: 2.6
Runs a main loop until g_main_loop_quit() is called on the loop.
If this is called for the thread of the loop's #GMainContext,
it will process events from the loop, otherwise it will
simply wait.
a #GMainLoop
Adds a new element at the head of the queue.
a #GQueue.
a single #GList element, <emphasis>not</emphasis> a list with
more than one element.
Returns: The corresponding plugin if @type is a dynamic type,
The #GType to retrieve the plugin for.
The corresponding plugin if @type is a dynamic type,
%NULL otherwise.
Determines if a character is typically rendered in a double-width
cell.
a Unicode character
%TRUE if the character is wide
Removes an element from a #GSList, without
freeing the element. The removed element's next
link is set to %NULL, so that it becomes a
self-contained list with one element.
a #GSList
an element in the #GSList
the new start of the #GSList, without the element
Converts a string to lower case.
the string to convert.
the string
Deprecated:2.2: This function is totally broken for the reasons discussed
in the g_strncasecmp() docs - use g_ascii_strdown() or g_utf8_strdown()
instead.
Finds an element in a #GQueue, using a supplied function to find the
desired element. It iterates over the queue, calling the given function
which should return 0 when the desired element is found. The function
takes two gconstpointer arguments, the #GQueue element's data as the
first argument and the given user data as the second argument.
a #GQueue
user data passed to @func
a #GCompareFunc to call for each element. It should return 0
when the desired element is found
The found link, or %NULL if it wasn't found
Since: 2.4
Set the contents of a %G_TYPE_INT64 #GValue to @v_int64.
a valid #GValue of type %G_TYPE_INT64
64bit integer value to be set
Set the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed.
a valid #GValue of %G_TYPE_BOXED derived type
boxed value to be set
Returns: the number of capturing subpatterns
a #GRegex
the number of capturing subpatterns
Since: 2.14
Associates a function with @group which will be called
from g_option_context_parse() when an error occurs.
Note that the user data to be passed to @error_func can be
specified when constructing the group with g_option_group_new().
Since: 2.6
a #GOptionGroup
a function to call when an error occurs
Checks whether @ch is a valid Unicode character. Some possible
integer values of @ch will not be valid. 0 is considered a valid
character, though it's normally a string terminator.
a Unicode character
%TRUE if @ch is a valid Unicode character
Frees one #GSList element.
It is usually used after g_slist_remove_link().
a #GSList element
Reverts the effect of a previous call to
g_object_freeze_notify(). The freeze count is decreased on @object
and when it reaches zero, all queued "notify" signals are emitted.
It is an error to call this function when the freeze count is zero.
a #GObject
Initializes a key/value pair iterator and associates it with
@hash_table. Modifying the hash table after calling this function
invalidates the returned iterator.
|[
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init (&iter, hash_table);
while (g_hash_table_iter_next (&iter, &key, &value))
{
/* do something with key and value */
}
]|
Since: 2.16
an uninitialized #GHashTableIter.
a #GHashTable.
Frees all resources allocated for @pool.
If @immediate is %TRUE, no new task is processed for
@pool. Otherwise @pool is not freed before the last task is
processed. Note however, that no thread of this pool is
interrupted, while processing a task. Instead at least all still
running threads can finish their tasks before the @pool is freed.
If @wait_ is %TRUE, the functions does not return before all tasks
to be processed (dependent on @immediate, whether all or only the
currently running) are ready. Otherwise the function returns immediately.
After calling this function @pool must not be used anymore.
a #GThreadPool
should @pool shut down immediately?
should the function wait for all tasks to be finished?
Looks up a #GFlagsValue by nickname.
a #GFlagsClass
the nickname to look up
the #GFlagsValue with nickname @nick, or %NULL if there is
no flag with that nickname
Gets the time when the bookmark for @uri was last modified.
In the event the URI cannot be found, -1 is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
a #GBookmarkFile
a valid URI
return location for a #GError, or %NULL
a timestamp
Since: 2.12
Sets the contents of a %G_TYPE_STRING #GValue to @v_string.
Since: 2.4
a valid #GValue of type %G_TYPE_STRING
string to take ownership of
Decrements the reference count for the type corresponding to the
interface default vtable @g_iface. If the type is dynamic, then
when no one is using the interface and all references have
been released, the finalize function for the interface's default
vtable (the <structfield>class_finalize</structfield> member of
#GTypeInfo) will be called.
Since: 2.4
the default vtable structure for a interface, as
returned by g_type_default_interface_ref()
Finds the previous UTF-8 character in the string before @p.
@p does not have to be at the beginning of a UTF-8 character. No check
is made to see if the character found is actually valid other than
it starts with an appropriate byte. If @p might be the first
character of the string, you must use g_utf8_find_prev_char() instead.
a pointer to a position within a UTF-8 encoded string
a pointer to the found character.
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
1
a #GValue array holding only the instance
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Creates a new #GParamSpecInt64 instance specifying a %G_TYPE_INT64 property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
An implementation of the standard fprintf() function which supports
positional parameters, as specified in the Single Unix Specification.
the stream to write to.
a standard printf() format string, but notice
<link linkend="string-precision">string precision pitfalls</link>.
the arguments to insert in the output.
the number of bytes printed.
Since: 2.2
Set the contents of a %G_TYPE_DOUBLE #GValue to @v_double.
a valid #GValue of type %G_TYPE_DOUBLE
double value to be set
Writes a Unicode character to @channel.
This function cannot be called on a channel with %NULL encoding.
a #GIOChannel
a character
location to return an error of type #GConvertError
or #GIOChannelError
a #GIOStatus
Get the unique name that is assigned to a type ID. Note that this
function (like all other GType API) cannot cope with invalid type
IDs. %G_TYPE_INVALID may be passed to this function, as may be any
other validly registered type ID, but randomized type IDs should
not be passed in and will most likely lead to a crash.
Type to return name for.
Static type name or %NULL.
Converts a string from UTF-8 to the encoding GLib uses for
filenames. Note that on Windows GLib uses UTF-8 for filenames;
on other platforms, this function indirectly depends on the
<link linkend="setlocale">current locale</link>.
a UTF-8 encoded string.
the length of the string, or -1 if the string is
nul-terminated.
location to store the number of bytes in the
input string that were successfully converted, or %NULL.
Even if the conversion was successful, this may be
less than @len if there were partial characters
at the end of the input. If the error
#G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value
stored will the byte offset after the last valid
input sequence.
the number of bytes stored in the output buffer (not
including the terminating nul).
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError may occur.
The converted string, or %NULL on an error.
A simple version of g_spawn_async() that parses a command line with
g_shell_parse_argv() and passes it to g_spawn_async(). Runs a
command line in the background. Unlike g_spawn_async(), the
%G_SPAWN_SEARCH_PATH flag is enabled, other flags are not. Note
that %G_SPAWN_SEARCH_PATH can have security implications, so
consider using g_spawn_async() directly if appropriate. Possible
errors are those from g_shell_parse_argv() and g_spawn_async().
The same concerns on Windows apply as for g_spawn_command_line_sync().
a command line
return location for errors
%TRUE on success, %FALSE if error is set.
Sets @value from an instantiatable type via the
value_table's collect_value() function.
An initialized #GValue structure.
the instance
Frees an instance of a type, returning it to the instance pool for
the type, if there is one.
Like g_type_create_instance(), this function is reserved for
implementors of fundamental types.
an instance of a type.
Emits a signal.
Note that g_signal_emitv() doesn't change @return_value if no handlers are
connected, in contrast to g_signal_emit() and g_signal_emit_valist().
argument list for the signal emission. The first
element in the array is a #GValue for the instance the signal is
being emitted on. The rest are any arguments to be passed to the
signal.
the signal id
the detail
Location to store the return value of the signal emission.
Looks up a key in a #GHashTable. Note that this function cannot
distinguish between a key that is not present and one which is present
and has the value %NULL. If you need this distinction, use
g_hash_table_lookup_extended().
a #GHashTable.
the key to look up.
the associated value, or %NULL if the key is not found.
Calls the @complete_interface_info function from the
#GTypePluginClass of @plugin. There should be no need to use this
function outside of the GObject type system itself.
the #GTypePlugin
the #GType of an instantiable type to which the interface
is added
the #GType of the interface whose info is completed
the #GInterfaceInfo to fill in
Return value: A random number.
lower closed bound of the interval.
upper open bound of the interval.
A random number.
Calls the original class closure of a signal. This function should only
be called from an overridden class closure; see
g_signal_override_class_closure() and
g_signal_override_class_handler().
the argument list of the signal emission. The first
element in the array is a #GValue for the instance the signal is being
emitted on. The rest are any arguments to be passed to the signal.
Location for the return value.
Gets the last component of the filename. If @file_name ends with a
directory separator it gets the component before the last slash. If
@file_name consists only of directory separators (and on Windows,
possibly a drive letter), a single separator is returned. If
@file_name is empty, it gets ".".
the name of the file.
a newly allocated string containing the last component of
the filename.
Adds the given number of microseconds to @time_. @microseconds can
also be negative to decrease the value of @time_.
a #GTimeVal
number of microseconds to add to @time
Associates a new double value with @key under @group_name.
If @key cannot be found then it is created.
Since: 2.12
a #GKeyFile
a group name
a key
an double value
Set the contents of a %G_TYPE_GTYPE #GValue to @v_gtype.
Since: 2.12
a valid #GValue of type %G_TYPE_GTYPE
#GType to be set
Create a new test case, similar to g_test_create_case(). However
the test is assumed to use no fixture, and test suites are automatically
created on the fly and added to the root fixture, based on the
slash-separated portions of @testpath. The @test_data argument
will be passed as first argument to @test_func.
Since: 2.16
Slash-separated test case path name for the test.
Test data argument for the test function.
The test function to invoke for this test.
Determines if @value will fit inside the size of a pointer value.
This is an internal function introduced mainly for C marshallers.
An initialized #GValue structure.
%TRUE if @value will fit inside a pointer value.
Encode a sequence of binary data into its Base-64 stringified
representation.
the binary data to encode
the length of @data
a newly allocated, zero-terminated Base-64 encoded
string representing @data. The returned string must
be freed with g_free().
Since: 2.12
A wrapper for the POSIX rename() function. The rename() function
renames a file, moving it between directories if required.
See your C library manual for more details about how rename() works
on your system. It is not possible in general on Windows to rename
a file that is open to some process.
a pathname in the GLib file name encoding (UTF-8 on Windows)
a pathname in the GLib file name encoding
0 if the renaming succeeded, -1 if an error occurred
Since: 2.6
Gets the position of the given element
in the #GList (starting from 0).
a #GList
an element in the #GList
the position of the element in the #GList,
or -1 if the element is not found
Creates a new option context.
The @parameter_string can serve multiple purposes. It can be used
to add descriptions for "rest" arguments, which are not parsed by
the #GOptionContext, typically something like "FILES" or
"FILE1 FILE2...". If you are using #G_OPTION_REMAINING for
collecting "rest" arguments, GLib handles this automatically by
using the @arg_description of the corresponding #GOptionEntry in
the usage summary.
Another usage is to give a short summary of the program
functionality, like " - frob the strings", which will be displayed
in the same line as the usage. For a longer description of the
program functionality that should be displayed as a paragraph
below the usage line, use g_option_context_set_summary().
Note that the @parameter_string is translated using the
function set with g_option_context_set_translate_func(), so
it should normally be passed untranslated.
a string which is displayed in
the first line of <option>--help</option> output, after the
usage summary
<literal><replaceable>programname</replaceable> [OPTION...]</literal>
a newly created #GOptionContext, which must be
freed with g_option_context_free() after use.
Since: 2.6
A variant of g_closure_new_simple() which stores @object in the
@data field of the closure and calls g_object_watch_closure() on
@object and the created closure. This function is mainly useful
when implementing new types of closures.
the size of the structure to allocate, must be at least
<literal>sizeof (GClosure)</literal>
a #GObject pointer to store in the @data field of the newly
allocated #GClosure
a newly allocated #GClosure
Sets a function to be called when the child indicated by @pid
exits, at a default priority, #G_PRIORITY_DEFAULT.
If you obtain @pid from g_spawn_async() or g_spawn_async_with_pipes()
you will need to pass #G_SPAWN_DO_NOT_REAP_CHILD as flag to
the spawn function for the child watching to work.
Note that on platforms where #GPid must be explicitly closed
(see g_spawn_close_pid()) @pid must not be closed while the
source is still active. Typically, you will want to call
g_spawn_close_pid() in the callback function for the source.
GLib supports only a single callback per process id.
This internally creates a main loop source using
g_child_watch_source_new() and attaches it to the main loop context
using g_source_attach(). You can do these steps manually if you
need greater control.
process id to watch. On POSIX the pid of a child process. On
Windows a handle for a process (which doesn't have to be a child).
function to call
data to pass to @function
the ID (greater than 0) of the event source.
Since: 2.4
Increases the use count of a #GTypeModule by one. If the
use count was zero before, the plugin will be loaded.
a #GTypeModule
%FALSE if the plugin needed to be loaded and
loading the plugin failed.
Creates and initializes an instance of @type if @type is valid and
can be instantiated. The type system only performs basic allocation
and structure setups for instances: actual instance creation should
happen through functions supplied by the type's fundamental type
implementation. So use of g_type_create_instance() is reserved for
implementators of fundamental types only. E.g. instances of the
#GObject hierarchy should be created via g_object_new() and
<emphasis>never</emphasis> directly through
g_type_create_instance() which doesn't handle things like singleton
objects or object construction. Note: Do <emphasis>not</emphasis>
use this function, unless you're implementing a fundamental
type. Also language bindings should <emphasis>not</emphasis> use
this function but g_object_new() instead.
An instantiatable type to create an instance for.
An allocated and initialized instance, subject to further
treatment by the fundamental type implementation.
Frees all of the memory used by a #GList.
The freed elements are returned to the slice allocator.
<note><para>
If list elements contain dynamically-allocated memory,
they should be freed first.
</para></note>
a #GList
Converts a #gdouble to a string, using the '.' as
decimal point. To format the number you pass in
a printf()-style format string. Allowed conversion
specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.
If you just want to want to serialize the value into a
string, use g_ascii_dtostr().
A buffer to place the resulting string in
The length of the buffer.
The printf()-style format to use for the
code to use for converting.
The #gdouble to convert
The pointer to the buffer with the converted string.
Sets the buffer size.
a #GIOChannel
the size of the buffer, or 0 to let GLib pick a good size
The notify signal is emitted on an object when one of its
properties has been changed. Note that getting this signal
doesn't guarantee that the value of the property has actually
changed, it may also be emitted when the setter for the property
is called to reinstate the previous value.
This signal is typically used to obtain change notification for a
single property, by specifying the property name as a detail in the
g_signal_connect() call, like this:
|[
g_signal_connect (text_view->buffer, "notify::paste-target-list",
G_CALLBACK (gtk_text_view_target_list_notify),
text_view)
]|
It is important to note that you must use
<link linkend="canonical-parameter-name">canonical</link> parameter names as
detail strings for the notify signal.
the #GParamSpec of the property which changed
the object which received the signal.
Removes @root and its children from the tree, freeing any memory
allocated.
the root of the tree/subtree to destroy
Given the signal's identifier, finds its name.
Two different signals may have the same name, if they have differing types.
the signal's identifying number.
the signal name, or %NULL if the signal number was invalid.
Sets the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed
and takes over the ownership of the callers reference to @v_boxed;
the caller doesn't have to unref it any more.
Since: 2.4
a valid #GValue of %G_TYPE_BOXED derived type
duplicated unowned boxed value to be set
Locates the first executable named @program in the user's path, in the
same way that execvp() would locate it. Returns an allocated string
with the absolute path name, or %NULL if the program is not found in
the path. If @program is already an absolute path, returns a copy of
@program if @program exists and is executable, and %NULL otherwise.
On Windows, if @program does not have a file type suffix, tries
with the suffixes .exe, .cmd, .bat and .com, and the suffixes in
the <envar>PATHEXT</envar> environment variable.
On Windows, it looks for the file in the same way as CreateProcess()
would. This means first in the directory where the executing
program was loaded from, then in the current directory, then in the
Windows 32-bit system directory, then in the Windows directory, and
finally in the directories in the <envar>PATH</envar> environment
variable. If the program is found, the return value contains the
full name including the type suffix.
a program name in the GLib file name encoding
absolute path, or %NULL
A variant of g_cclosure_new_swap() which uses @object as @user_data
and calls g_object_watch_closure() on @object and the created
closure. This function is useful when you have a callback closely
associated with a #GObject, and want the callback to no longer run
after the object is is freed.
the function to invoke
a #GObject pointer to pass to @callback_func
a new #GCClosure
Set the contents of a %G_TYPE_UINT #GValue to @v_uint.
a valid #GValue of type %G_TYPE_UINT
unsigned integer value to be set
Sets the (writeable) flags in @channel to (@flags & %G_IO_CHANNEL_SET_MASK).
a #GIOChannel
the flags to set on the IO channel
A location to return an error of type #GIOChannelError
the status of the operation.
Adds a function to be called whenever there are no higher priority
events pending to the default main loop. The function is given the
default idle priority, #G_PRIORITY_DEFAULT_IDLE. If the function
Return value: the ID (greater than 0) of the event source.
function to call
data to pass to @function.
the ID (greater than 0) of the event source.
Appends a formatted string onto the end of a #GString.
This function is similar to g_string_printf() except
that the text is appended to the #GString.
a #GString
the string format. See the printf() documentation
the parameters to insert into the format string
The buffering state can only be set if the channel's encoding
is %NULL. For any other encoding, the channel must be buffered.
A buffered channel can only be set unbuffered if the channel's
internal buffers have been flushed. Newly created channels or
channels which have returned %G_IO_STATUS_EOF
not require such a flush. For write-only channels, a call to
g_io_channel_flush () is sufficient. For all other channels,
the buffers may be flushed by a call to g_io_channel_seek_position ().
This includes the possibility of seeking with seek type %G_SEEK_CUR
and an offset of zero. Note that this means that socket-based
channels cannot be set unbuffered once they have had data
read from them.
On unbuffered channels, it is safe to mix read and write
calls from the new and old APIs, if this is necessary for
maintaining old code.
The default state of the channel is buffered.
a #GIOChannel
whether to set the channel buffered or unbuffered
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, GParamSpec *arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #GParamSpec* parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Formats arguments according to @format, escaping
all string and character arguments in the fashion
of g_markup_escape_text(). This is useful when you
want to insert literal strings into XML-style markup
output, without having to worry that the strings
might themselves contain markup.
|[
const char *store = "Fortnum & Mason";
const char *item = "Tea";
char *output;
output = g_markup_printf_escaped ("<purchase>"
"<store>%s</store>"
"<item>%s</item>"
"</purchase>",
store, item);
]|
printf() style format string
the arguments to insert in the format string
newly allocated result from formatting
operation. Free with g_free().
Since: 2.4
Looks up a #GEnumValue by nickname.
a #GEnumClass
the nickname to look up
the #GEnumValue with nickname @nick, or %NULL if the
enumeration doesn't have a member with that nickname
Get the contents of a %G_TYPE_FLOAT #GValue.
a valid #GValue of type %G_TYPE_FLOAT
float contents of @value
Adds an emission hook for a signal, which will get called for any emission
of that signal, independent of the instance. This is possible only
for signals which don't have #G_SIGNAL_NO_HOOKS flag set.
the signal identifier, as returned by g_signal_lookup().
the detail on which to call the hook.
a #GSignalEmissionHook function.
user data for @hook_func.
a #GDestroyNotify for @hook_data.
the hook id, for later use with g_signal_remove_emission_hook().
Given a position @p with a UTF-8 encoded string @str, find the start
of the previous UTF-8 character starting before @p. Returns %NULL if no
UTF-8 characters are present in @str before @p.
@p does not have to be at the beginning of a UTF-8 character. No check
is made to see if the character found is actually valid other than
it starts with an appropriate byte.
pointer to the beginning of a UTF-8 encoded string
pointer to some position within @str
a pointer to the found character or %NULL.
Inserts a #GNode beneath the parent before the given sibling.
the #GNode to place @node under
the sibling #GNode to place @node before.
If sibling is %NULL, the node is inserted as the last child of @parent.
the #GNode to insert
the inserted #GNode
Get an array of #GParamSpec* for all properties of a class.
a #GObjectClass
return location for the length of the returned array
an array of #GParamSpec* which should be freed after use
Like g_sequence_search(), but uses
a #GSequenceIterCompareFunc instead of a #GCompareDataFunc as
the compare function.
a #GSequence
data for the new item
the #GSequenceIterCompare function used to compare iterators
in the sequence. It is called with two iterators pointing into @seq.
It should return 0 if the iterators are equal, a negative value if the
first iterator comes before the second, and a positive value if the
second iterator comes before the first.
user data passed to @iter_cmp
a #GSequenceIter pointing to the position in @seq
where @data would have been inserted according to @iter_cmp and @cmp_data.
Since: 2.14
Moves the item pointed to by @src to the position indicated by @dest.
After calling this function @dest will point to the position immediately
after @src. It is allowed for @src and @dest to point into different
sequences.
Since: 2.14
a #GSequenceIter pointing to the item to move
a #GSequenceIter pointing to the position to which
the item is moved.
Writes a formatted string into a #GString.
This function is similar to g_string_printf() except that
the arguments to the format string are passed as a va_list.
Since: 2.14
a #GString
the string format. See the printf() documentation
the parameters to insert into the format string
Decreases the reference count on a #GMainContext object by one. If
the result is zero, free the context and free all associated memory.
a #GMainContext
This function is meant to be called from the complete_type_info()
function of a #GTypePlugin implementation, as in the following
example:
|[
static void
my_enum_complete_type_info (GTypePlugin *plugin,
GType g_type,
GTypeInfo *info,
GTypeValueTable *value_table)
{
static const GEnumValue values[] = {
{ MY_ENUM_FOO, "MY_ENUM_FOO", "foo" },
{ MY_ENUM_BAR, "MY_ENUM_BAR", "bar" },
{ 0, NULL, NULL }
};
g_enum_complete_type_info (type, info, values);
}
]|
the type identifier of the type being completed
the #GTypeInfo struct to be filled in
An array of #GEnumValue structs for the possible
enumeration values. The array is terminated by a struct with all
members being 0.
Gets the names of all variables set in the environment.
a %NULL-terminated list of strings which must be freed
with g_strfreev().
Programs that want to be portable to Windows should typically use
this function and g_getenv() instead of using the environ array
from the C library directly. On Windows, the strings in the environ
array are in system codepage encoding, while in most of the typical
use cases for environment variables in GLib-using programs you want
the UTF-8 encoding that this function and g_getenv() provide.
Since: 2.8
Registers a new static flags type with the name @name.
It is normally more convenient to let <link
linkend="glib-mkenums">glib-mkenums</link> generate a
my_flags_get_type() function from a usual C enumeration definition
than to write one yourself using g_flags_register_static().
A nul-terminated string used as the name of the new type.
An array of #GFlagsValue structs for the possible
flags values. The array is terminated by a struct with all members being 0.
GObject keeps a reference to the data, so it cannot be stack-allocated.
The new type identifier.
Sets a function to be called at regular intervals with the default
priority, #G_PRIORITY_DEFAULT. The function is called repeatedly until
it returns %FALSE, at which point the timeout is automatically destroyed
and the function will not be called again.
This internally creates a main loop source using
g_timeout_source_new_seconds() and attaches it to the main loop context
using g_source_attach(). You can do these steps manually if you need
greater control. Also see g_timout_add_seconds_full().
the time between calls to the function, in seconds
function to call
data to pass to @function
the ID (greater than 0) of the event source.
Since: 2.14
This function is a variant of g_dgettext() which supports
a disambiguating message context. GNU gettext uses the
'\004' character to separate the message context and
message id in @msgctxtid.
If 0 is passed as @msgidoffset, this function will fall back to
trying to use the deprecated convention of using "|" as a separation
character.
This uses g_dgettext() internally. See that functions for differences
with dgettext() proper.
Applications should normally not use this function directly,
but use the C_() macro for translations with context.
the translation domain to use, or %NULL to use
the domain set with textdomain()
a combined message context and message id, separated
by a \004 character
the offset of the message id in @msgctxid
The translated string
Since: 2.16
Initializes @value with the default value of @type.
A zero-filled (uninitialized) #GValue structure.
Type the #GValue should hold values of.
the #GValue structure that has been passed in
Get the contents of a %G_TYPE_CHAR #GValue.
a valid #GValue of type %G_TYPE_CHAR
character contents of @value
Sets the time the bookmark for @uri was added into @bookmark.
If no bookmark for @uri is found then it is created.
Since: 2.12
a #GBookmarkFile
a valid URI
a timestamp or -1 to use the current time
Signals to the #GMarkupParseContext that all data has been
fed into the parse context with g_markup_parse_context_parse().
This function reports an error if the document isn't complete,
for example if elements are still open.
a #GMarkupParseContext
return location for a #GError
%TRUE on success, %FALSE if an error was set
Changes the data for the item pointed to by @iter to be @data. If
the sequence has a data destroy function associated with it, that
function is called on the existing data that @iter pointed to.
Since: 2.14
a #GSequenceIter
new data for the item
Determines whether this thread holds the (recursive)
ownership of this #GMaincontext. This is useful to
know before waiting on another thread that may be
blocking to get ownership of @context.
a #GMainContext
%TRUE if current thread is owner of @context.
Since: 2.10
Return a random #guint32 equally distributed over the range
[0..2^32-1].
A random number.
Equivalent to the UNIX gettimeofday() function, but portable.
#GTimeVal structure in which to store current time.
Obtains data which has previously been attached to @type
with g_type_set_qdata().
a #GType
a #GQuark id to identify the data
the data, or %NULL if no data was found
Determines the break type of @c. @c should be a Unicode character
(to derive a character from UTF-8 encoded text, use
g_utf8_get_char()). The break type is used to find word and line
breaks ("text boundaries"), Pango implements the Unicode boundary
resolution algorithms and normally you would use a function such
as pango_break() instead of caring about break types yourself.
a Unicode character
the break type of @c
Removes a key and its associated value from a #GHashTable without
calling the key and value destroy functions.
a #GHashTable.
the key to remove.
%TRUE if the key was found and removed from the #GHashTable.
Return value: the length of @seq
a #GSequence
the length of @seq
Since: 2.14
Sets the callback function storing the data as a refcounted callback
"object". This is used internally. Note that calling
g_source_set_callback_indirect() assumes
an initial reference count on @callback_data, and thus
@callback_funcs->unref will eventually be called once more
than @callback_funcs->ref.
the source
pointer to callback data "object"
functions for reference counting @callback_data
and getting the callback and data
Sets the value of a date from a #GTime value.
The time to date conversion is done using the user's current timezone.
@Deprecated:2.10: Use g_date_set_time_t() instead.
a #GDate.
#GTime value to set.
Get the time since the last start of the timer with g_test_timer_start().
the time since the last start of the timer, as a double
Since: 2.16
Creates a new #GString with @len bytes of the @init buffer.
Because a length is provided, @init need not be nul-terminated,
and can contain embedded nul bytes.
Since this function does not stop at nul bytes, it is the caller's
responsibility to ensure that @init has at least @len addressable
bytes.
initial contents of the string
length of @init to use
a new #GString
Sorts a #GSList using the given comparison function.
a #GSList
the comparison function used to sort the #GSList.
This function is passed the data from 2 elements of the #GSList
and should return 0 if they are equal, a negative value if the
first element comes before the second, or a positive value if
the first element comes after the second.
the start of the sorted #GSList
Like g_sequence_insert_sorted(), but uses
a #GSequenceIterCompareFunc instead of a #GCompareDataFunc as
the compare function.
a #GSequence
data for the new item
the #GSequenceItercompare used to compare iterators in the
sequence. It is called with two iterators pointing into @seq. It should
return 0 if the iterators are equal, a negative value if the first
iterator comes before the second, and a positive value if the second
iterator comes before the first.
user data passed to @cmp_func
a #GSequenceIter pointing to the new item
Since: 2.14
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gfloat arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gfloat parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Adds a new element at the tail of the queue.
a #GQueue.
the data for the new element.
A wrapper for the POSIX access() function. This function is used to
test a pathname for one or several of read, write or execute
permissions, or just existence.
On Windows, the file protection mechanism is not at all POSIX-like,
and the underlying function in the C library only checks the
FAT-style READONLY attribute, and does not look at the ACL of a
file at all. This function is this in practise almost useless on
Windows. Software that needs to handle file permissions on Windows
more exactly should use the Win32 API.
See your C library manual for more details about access().
a pathname in the GLib file name encoding (UTF-8 on Windows)
as in access()
zero if the pathname refers to an existing file system
object that has all the tested permissions, or -1 otherwise or on
error.
Since: 2.8
Creates a new #GParamSpecGType instance specifying a
%G_TYPE_GTYPE property.
See g_param_spec_internal() for details on property names.
Since: 2.10
canonical name of the property specified
nick name for the property specified
description of the property specified
a #GType whose subtypes are allowed as values
of the property (use %G_TYPE_NONE for any type)
flags for the property specified
a newly created parameter specification
Copies a #GSList.
<note><para>
Note that this is a "shallow" copy. If the list elements
consist of pointers to data, the pointers are copied but
the actual data isn't.
</para></note>
a #GSList
a copy of @list
Frees all the memory associated with the #GMatchInfo structure.
Since: 2.14
a #GMatchInfo
Each object carries around a table of associations from
strings to pointers. This function lets you set an association.
If the object already had an association with that name,
the old association will be destroyed.
#GObject containing the associations.
name of the key
data to associate with that key
Creates a new signal. (This is usually done in the class initializer.)
This is a variant of g_signal_new() that takes a C callback instead
off a class offset for the signal's class handler. This function
doesn't need a function pointer exposed in the class structure of
an object definition, instead the function pointer is passed
directly and can be overriden by derived classes with
g_signal_override_class_closure() or
g_signal_override_class_handler()and chained to with
g_signal_chain_from_overridden() or
g_signal_chain_from_overridden_handler().
See g_signal_new() for information about signal names.
the name for the signal
the type this signal pertains to. It will also pertain to
types which are derived from this type.
a combination of #GSignalFlags specifying detail of when
the default handler is to be invoked. You should at least specify
%G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
a #GCallback which acts as class implementation of
this signal. Used to invoke a class method generically. Pass %NULL to
not associate a class method with this signal.
the accumulator for this signal; may be %NULL.
user data for the @accumulator.
the function to translate arrays of parameter values to
signal emissions into C language callback invocations.
the type of return value, or #G_TYPE_NONE for a signal
without a return value.
the number of parameter types to follow.
a list of types, one for each parameter.
the signal id
Since: 2.18
Looks whether the key file has the group @group_name.
a #GKeyFile
a group name
%TRUE if @group_name is a part of @key_file, %FALSE
otherwise.
Since: 2.6
Ensures that the contents of @value comply with the specifications
set out by @pspec. For example, a #GParamSpecInt might require
that integers stored in @value may not be smaller than -42 and not be
greater than +42. If @value contains an integer outside of this range,
it is modified accordingly, so the resulting value will fit into the
range -42 .. +42.
a valid #GParamSpec
a #GValue of correct type for @pspec
whether modifying @value was necessary to ensure validity
Copies a block of memory @len bytes long, from @src to @dest.
The source and destination areas may overlap.
In order to use this function, you must include
<filename>string.h</filename> yourself, because this macro will
typically simply resolve to memmove() and GLib does not include
<filename>string.h</filename> for you.
the destination address to copy the bytes to.
the source address to copy the bytes from.
the number of bytes to copy.
Removes the first element of the queue.
a #GQueue.
the data of the first element in the queue, or %NULL if the queue
is empty.
Finds the first signal handler that matches certain selection criteria.
The criteria mask is passed as an OR-ed combination of #GSignalMatchType
flags, and the criteria values are passed as arguments.
The match @mask has to be non-0 for successful matches.
If no handler was found, 0 is returned.
The instance owning the signal handler to be found.
Mask indicating which of @signal_id, @detail, @closure, @func
and/or @data the handler has to match.
Signal the handler has to be connected to.
Signal detail the handler has to be connected to.
The closure the handler will invoke.
The C closure callback of the handler (useless for non-C closures).
The closure data of the handler's closure.
A valid non-0 signal handler id for a successful match.
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, const gchar *arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gchar* parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Returns: the data of the first element in the queue, or %NULL if the queue
a #GQueue.
the data of the first element in the queue, or %NULL if the queue
is empty.
Associates two functions with @group which will be called
from g_option_context_parse() before the first option is parsed
and after the last option has been parsed, respectively.
Note that the user data to be passed to @pre_parse_func and
@post_parse_func can be specified when constructing the group
with g_option_group_new().
Since: 2.6
a #GOptionGroup
a function to call before parsing, or %NULL
a function to call after parsing, or %NULL
Replaces all occurances of the pattern in @regex with the
replacement text. Backreferences of the form '\number' or
'\g<number>' in the replacement text are interpolated by the
number-th captured subexpression of the match, '\g<name>' refers
to the captured subexpression with the given name. '\0' refers to the
complete match, but '\0' followed by a number is the octal representation
of a character. To include a literal '\' in the replacement, write '\\'.
There are also escapes that changes the case of the following text:
<variablelist>
<varlistentry><term>\l</term>
<listitem>
<para>Convert to lower case the next character</para>
</listitem>
</varlistentry>
<varlistentry><term>\u</term>
<listitem>
<para>Convert to upper case the next character</para>
</listitem>
</varlistentry>
<varlistentry><term>\L</term>
<listitem>
<para>Convert to lower case till \E</para>
</listitem>
</varlistentry>
<varlistentry><term>\U</term>
<listitem>
<para>Convert to upper case till \E</para>
</listitem>
</varlistentry>
<varlistentry><term>\E</term>
<listitem>
<para>End case modification</para>
</listitem>
</varlistentry>
</variablelist>
If you do not need to use backreferences use g_regex_replace_literal().
The @replacement string must be UTF-8 encoded even if #G_REGEX_RAW was
passed to g_regex_new(). If you want to use not UTF-8 encoded stings
you can use g_regex_replace_literal().
Setting @start_position differs from just passing over a shortened
string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern that
begins with any kind of lookbehind assertion, such as "\b".
a #GRegex structure
the string to perform matches against
the length of @string, or -1 if @string is nul-terminated
starting index of the string to match
text to replace each match with
options for the match
location to store the error occuring, or %NULL to ignore errors
a newly allocated string containing the replacements
Since: 2.14
Return value: a %NULL-terminated array of strings owned by GLib that must
a %NULL-terminated array of strings owned by GLib that must
not be modified or freed.
Since: 2.6
Adds the application with @name and @exec to the list of
applications that have registered a bookmark for @uri into
@bookmark.
Every bookmark inside a #GBookmarkFile must have at least an
application registered. Each application must provide a name, a
command line useful for launching the bookmark, the number of times
the bookmark has been registered by the application and the last
time the application registered this bookmark.
If @name is %NULL, the name of the application will be the
same returned by g_get_application(); if @exec is %NULL, the
command line will be a composition of the program name as
returned by g_get_prgname() and the "%u" modifier, which will be
expanded to the bookmark's URI.
This function will automatically take care of updating the
registrations count and timestamping in case an application
with the same @name had already registered a bookmark for
@uri inside @bookmark.
If no bookmark for @uri is found, one is created.
Since: 2.12
a #GBookmarkFile
a valid URI
the name of the application registering the bookmark
or %NULL
command line to be used to launch the bookmark or %NULL
Decrements the reference count of a #GIOChannel.
a #GIOChannel
A wrapper for the POSIX utime() function. The utime() function
sets the access and modification timestamps of a file.
See your C library manual for more details about how utime() works
on your system.
a pathname in the GLib file name encoding (UTF-8 on Windows)
a pointer to a struct utimbuf.
0 if the operation was successful, -1 if an error
occurred
Since: 2.18
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, GBoxed *arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #GBoxed* parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Registers an additional interface for a type, whose interface lives
in the given type plugin. If the interface was already registered
for the type in this plugin, nothing will be done.
As long as any instances of the type exist, the type plugin will
not be unloaded.
a #GTypeModule
type to which to add the interface.
interface type to add
type information structure
Destroys the #GTree. If keys and/or values are dynamically allocated, you
should either free them first or create the #GTree using g_tree_new_full().
In the latter case the destroy functions you supplied will be called on
all keys and values before destroying the #GTree.
a #GTree.
Closes the directory and deallocates all related resources.
a #GDir* created by g_dir_open()
This is a convenience function often needed in class initializers.
It returns the class structure of the immediate parent type of the
class passed in. Since derived classes hold a reference count on
their parent classes as long as they are instantiated, the returned
class will always exist. This function is essentially equivalent
to:
<programlisting>
g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)));
</programlisting>
The #GTypeClass structure to retrieve the parent class for.
The parent class of @g_class.
Appends @len bytes of @val to @string. Because @len is
provided, @val may contain embedded nuls and need not
be nul-terminated.
Since this function does not stop at nul bytes, it is
the caller's responsibility to ensure that @val has at
least @len addressable bytes.
a #GString
bytes to append
number of bytes of @val to use
@string
Returns: A newly allocated string containing the help text
a #GOptionContext
if %TRUE, only include the main group
the #GOptionGroup to create help for, or %NULL
A newly allocated string containing the help text
Since: 2.14
Queries the signal system for in-depth information about a
specific signal. This function will fill in a user-provided
structure to hold signal-specific information. If an invalid
signal id is passed in, the @signal_id member of the #GSignalQuery
is 0. All members filled into the #GSignalQuery structure should
be considered constant and have to be left untouched.
The signal id of the signal to query information for.
A user provided structure that is filled in with constant
values upon success.
Returns: %TRUE if a handler is connected to the signal, %FALSE
the object whose signal handlers are sought.
the signal id.
the detail.
whether blocked handlers should count as match.
%TRUE if a handler is connected to the signal, %FALSE
otherwise.
Returns: the #GEnumValue for @value, or %NULL if @value is not a
a #GEnumClass
the value to look up
the #GEnumValue for @value, or %NULL if @value is not a
member of the enumeration
Creates a new #GParamSpecEnum instance specifying a %G_TYPE_ENUM
property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
a #GType derived from %G_TYPE_ENUM
default value for the property specified
flags for the property specified
a newly created parameter specification
Sets a #GOptionGroup as main group of the @context.
This has the same effect as calling g_option_context_add_group(),
the only difference is that the options in the main group are
treated differently when generating <option>--help</option> output.
Since: 2.6
a #GOptionContext
the group to set as main group
Inserts a new element into @queue at the given position
Since: 2.4
a #GQueue
the data for the new element
the position to insert the new element. If @n is negative or
larger than the number of elements in the @queue, the element is
added to the end of the queue.
Inserts @data into @queue after @sibling
@sibling must be part of @queue
Since: 2.4
a #GQueue
a #GList link that <emphasis>must</emphasis> be part of @queue
the data to insert
Determines whether a character is alphanumeric.
Given some UTF-8 text, obtain a character value
with g_utf8_get_char().
a Unicode character
%TRUE if @c is an alphanumeric character
Incrementally encode a sequence of binary data into it's Base-64 stringified
representation. By calling this function multiple times you can convert
data in chunks to avoid having to have the full encoded data in memory.
When all of the data has been converted you must call
g_base64_encode_close() to flush the saved state.
The output buffer must be large enough to fit all the data that will
be written to it. Due to the way base64 encodes you will need
at least: @len * 4 / 3 + 6 bytes. If you enable line-breaking you will
need at least: @len * 4 / 3 + @len * 4 / (3 * 72) + 7 bytes.
@break_lines is typically used when putting base64-encoded data in emails.
It breaks the lines at 72 columns instead of putting all of the text on
the same line. This avoids problems with long lines in the email system.
the binary data to encode
the length of @in
whether to break long lines
pointer to destination buffer
Saved state between steps, initialize to 0
Saved state between steps, initialize to 0
The number of bytes of output that was written
Since: 2.12
Creates a new #GMainContext structure.
the new #GMainContext
A safer form of the standard vsprintf() function. The output is guaranteed
to not exceed @n characters (including the terminating nul character), so
it is easy to ensure that a buffer overflow cannot occur.
See also g_strdup_vprintf().
In versions of GLib prior to 1.2.3, this function may return -1 if the
output was truncated, and the truncated string may not be nul-terminated.
In versions prior to 1.3.12, this function returns the length of the output
string.
The return value of g_vsnprintf() conforms to the vsnprintf() function
as standardized in ISO C99. Note that this is different from traditional
vsnprintf(), which returns the length of the output string.
The format string may contain positional parameters, as specified in
the Single Unix Specification.
the buffer to hold the output.
the maximum number of bytes to produce (including the
terminating nul character).
a standard printf() format string, but notice
<link linkend="string-precision">string precision pitfalls</link>.
the list of arguments to insert in the output.
the number of bytes which would be produced if the buffer
was large enough.
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gdouble arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gdouble parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Sets properties on an object.
a #GObject
name of the first property to set
value for the first property, followed optionally by more
name/value pairs, followed by %NULL
Converts a string containing an ISO 8601 encoded date and time
to a #GTimeVal and puts it into @time_.
an ISO 8601 encoded date string
a #GTimeVal
%TRUE if the conversion was successful.
Since: 2.12
Like g_slist_sort(), but the sort function accepts a user data argument.
a #GSList
comparison function
data to pass to comparison function
new head of the list
Return value: a newly allocated string or %NULL if the specified
a #GKeyFile
a group name
a key
return location for a #GError, or %NULL
a newly allocated string or %NULL if the specified
key cannot be found.
Since: 2.6
Converts all lower case ASCII letters to upper case ASCII letters.
a string.
length of @str in bytes, or -1 if @str is nul-terminated.
a newly allocated string, with all the lower case
characters in @str converted to upper case, with
semantics that exactly match g_ascii_toupper(). (Note
that this is unlike the old g_strup(), which modified
the string in place.)
Does nothing if @err is %NULL; if @err is non-%NULL, then *@err must
be %NULL. A new #GError is created and assigned to *@err.
Unlike g_set_error(), @message is not a printf()-style format string.
Use this function if @message contains text you don't have control over,
that could include printf() escape sequences.
Since: 2.18
a return location for a #GError, or %NULL
error domain
error code
error message
Pushes the @data into the @queue. @data must not be %NULL.
a #GAsyncQueue.
@data to push into the @queue.
Converts a string to a #gdouble value.
It calls the standard strtod() function to handle the conversion, but
if the string is not completely converted it attempts the conversion
again with g_ascii_strtod(), and returns the best match.
This function should seldomly be used. The normal situation when reading
numbers not for human consumption is to use g_ascii_strtod(). Only when
you know that you must expect both locale formatted and C formatted numbers
should you use this. Make sure that you don't pass strings such as comma
separated lists of values, since the commas may be interpreted as a decimal
point in some locales, causing unexpected results.
the string to convert to a numeric value.
if non-%NULL, it returns the character after
the last character used in the conversion.
the #gdouble value.
Provide a copy of a boxed structure @src_boxed which is of type @boxed_type.
The type of @src_boxed.
The boxed structure to be copied.
The newly created copy of the boxed structure.
Sets an opaque, named pointer on a #GParamSpec. The name is
specified through a #GQuark (retrieved e.g. via
g_quark_from_static_string()), and the pointer can be gotten back
from the @pspec with g_param_spec_get_qdata(). Setting a
previously set user data pointer, overrides (frees) the old pointer
set, using %NULL as pointer essentially removes the data stored.
the #GParamSpec to set store a user data pointer
a #GQuark, naming the user data pointer
an opaque user data pointer
Creates a new #GParamSpecValueArray instance specifying a
%G_TYPE_VALUE_ARRAY property. %G_TYPE_VALUE_ARRAY is a
%G_TYPE_BOXED type, as such, #GValue structures for this property
can be accessed with g_value_set_boxed() and g_value_get_boxed().
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
a #GParamSpec describing the elements contained in
arrays of this property, may be %NULL
flags for the property specified
a newly created parameter specification
Convenience function to ref and sink a #GParamSpec.
Since: 2.10
a valid #GParamSpec
the #GParamSpec that was passed into this function
Return value: A negative number if @a comes before @b, 0 if they are
a #GSequenceIter
a #GSequenceIter
A negative number if @a comes before @b, 0 if they are
equal, and a positive number if @a comes after @b.
Since: 2.14
Adds a string on to the start of a #GString,
expanding it if necessary.
a #GString
the string to prepend on the start of @string
@string
A marshaller for a #GCClosure with a callback of type
<literal>gboolean (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter
denotes a flags type.
the #GClosure to which the marshaller belongs
a #GValue which can store the returned #gboolean
2
a #GValue array holding instance and arg1
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Get the corresponding quark of the type IDs name.
Type to return quark of type name for.
The type names quark or 0.
Converts a Unicode character into UTF-8, and appends it
to the string.
a #GString
a Unicode character
@string
Advances @iter and retrieves the key and/or value that are now
pointed to as a result of this advancement. If %FALSE is returned,
@key and @value are not set, and the iterator becomes invalid.
an initialized #GHashTableIter.
a location to store the key, or %NULL.
a location to store the value, or %NULL.
%FALSE if the end of the #GHashTable has been reached.
Since: 2.16
Creates a new #GParamSpecUInt64 instance specifying a %G_TYPE_UINT64
property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Returns: %TRUE if unknown options are ignored.
a #GOptionContext
%TRUE if unknown options are ignored.
Since: 2.6
Removes a weak reference from @object that was previously added
using g_object_add_weak_pointer(). The @weak_pointer_location has
to match the one used with g_object_add_weak_pointer().
The object that is weak referenced.
The memory address of a pointer.
Breaks the string on the pattern, and returns an array of the tokens.
If the pattern contains capturing parentheses, then the text for each
of the substrings will also be returned. If the pattern does not match
anywhere in the string, then the whole string is returned as the first
token.
As a special case, the result of splitting the empty string "" is an
empty vector, not a vector containing a single string. The reason for
this special case is that being able to represent a empty vector is
typically more useful than consistent handling of empty elements. If
you do need to represent empty elements, you'll need to check for the
empty string before calling this function.
A pattern that can match empty strings splits @string into separate
characters wherever it matches the empty string between characters.
For example splitting "ab c" using as a separator "\s*", you will get
"a", "b" and "c".
Setting @start_position differs from just passing over a shortened
string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
that begins with any kind of lookbehind assertion, such as "\b".
a #GRegex structure
the string to split with the pattern
the length of @string, or -1 if @string is nul-terminated
starting index of the string to match
match time option flags
the maximum number of tokens to split @string into.
If this is less than 1, the string is split completely
return location for a #GError
a %NULL-terminated gchar ** array. Free it using g_strfreev()
Since: 2.14
Set the contents of a %G_TYPE_BOOLEAN #GValue to @v_boolean.
a valid #GValue of type %G_TYPE_BOOLEAN
boolean value to be set
Creates a new #GParamSpecBoxed instance specifying a %G_TYPE_BOXED
derived property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
%G_TYPE_BOXED derived type of this property
flags for the property specified
a newly created parameter specification
Converts from an integer character offset to a pointer to a position
within the string.
Since 2.10, this function allows to pass a negative @offset to
step backwards. It is usually worth stepping backwards from the end
instead of forwards if @offset is in the last fourth of the string,
since moving forward is about 3 times faster than moving backward.
a UTF-8 encoded string
a character offset within @str
the resulting pointer
Gets the encoding for the input/output of the channel.
The internal encoding is always UTF-8. The encoding %NULL
makes the channel safe for binary data.
a #GIOChannel
A string containing the encoding, this string is
owned by GLib and must not be freed.
This function tries to determine the installation directory of a
software package based on the location of a DLL of the software
package.
@hmodule should be the handle of a loaded DLL or %NULL. The
function looks up the directory that DLL was loaded from. If
@hmodule is NULL, the directory the main executable of the current
process is looked up. If that directory's last component is "bin"
or "lib", its parent directory is returned, otherwise the directory
itself.
It thus makes sense to pass only the handle to a "public" DLL of a
software package to this function, as such DLLs typically are known
to be installed in a "bin" or occasionally "lib" subfolder of the
installation folder. DLLs that are of the dynamically loaded module
or plugin variety are often located in more private locations
deeper down in the tree, from which it is impossible for GLib to
deduce the root of the package installation.
The typical use case for this function is to have a DllMain() that
saves the handle for the DLL. Then when code in the DLL needs to
construct names of files in the installation tree it calls this
function passing the DLL handle.
The Win32 handle for a DLL loaded into the current process, or %NULL
a string containing the guessed installation directory for
the software package @hmodule is from. The string is in the GLib
file name encoding, i.e. UTF-8. The return value should be freed
with g_free() when not needed any longer. If the function fails
%NULL is returned.
Since: 2.16
Return value: a newly allocated string or %NULL if the specified
a #GKeyFile
a group name
a key
a locale identifier or %NULL
return location for a #GError, or %NULL
a newly allocated string or %NULL if the specified
key cannot be found.
Since: 2.6
Inserts a new item just before the item pointed to by @iter.
a #GSequenceIter
the data for the new item
an iterator pointing to the new item
Since: 2.14
Loads a desktop bookmark file into an empty #GBookmarkFile structure.
If the file could not be loaded then @error is set to either a #GFileError
or #GBookmarkFileError.
an empty #GBookmarkFile struct
the path of a filename to load, in the GLib file name encoding
return location for a #GError, or %NULL
%TRUE if a desktop bookmark file could be loaded
Since: 2.12
Connects a #GCallback function to a signal for a particular object. Similar
to g_signal_connect(), but allows to provide a #GClosureNotify for the data
which will be called when the signal handler is disconnected and no longer
used. Specify @connect_flags if you need <literal>..._after()</literal> or
<literal>..._swapped()</literal> variants of this function.
the instance to connect to.
a string of the form "signal-name::detail".
the #GCallback to connect.
data to pass to @c_handler calls.
a #GClosureNotify for @data.
a combination of #GConnectFlags.
the handler id
A wrapper for the POSIX chmod() function. The chmod() function is
used to set the permissions of a file system object.
On Windows the file protection mechanism is not at all POSIX-like,
and the underlying chmod() function in the C library just sets or
clears the FAT-style READONLY attribute. It does not touch any
ACL. Software that needs to manage file permissions on Windows
exactly should use the Win32 API.
See your C library manual for more details about chmod().
a pathname in the GLib file name encoding (UTF-8 on Windows)
as in chmod()
zero if the operation succeeded, -1 on error.
Since: 2.8
Retrieves the text matching the capturing parentheses named @name.
If @name is a valid sub pattern name but it didn't match anything
(e.g. sub pattern "X", matching "b" against "(?P<X>a)?b")
then an empty string is returned.
The string is fetched from the string passed to the match function,
so you cannot call this function after freeing the string.
#GMatchInfo structure
name of the subexpression
The matched substring, or %NULL if an error occurred.
You have to free the string yourself
Since: 2.14
Determines if a character is a hexidecimal digit.
a Unicode character.
%TRUE if the character is a hexadecimal digit
Creates a new parse context. A parse context is used to parse
marked-up documents. You can feed any number of documents into
a context, as long as no errors occur; once an error occurs,
the parse context can't continue to parse text (you have to free it
and create a new parse context).
a #GMarkupParser
one or more #GMarkupParseFlags
user data to pass to #GMarkupParser functions
user data destroy notifier called when the parse context is freed
a new #GMarkupParseContext
Associates a new boolean value with @key under @group_name.
If @key cannot be found then it is created.
Since: 2.6
a #GKeyFile
a group name
a key
%TRUE or %FALSE
Frees all strings contained within the #GStringChunk.
After calling g_string_chunk_clear() it is not safe to
access any of the strings which were contained within it.
Since: 2.14
a #GStringChunk
Adds @group to the list of groups to which the bookmark for @uri
belongs to.
If no bookmark for @uri is found then it is created.
Since: 2.12
a #GBookmarkFile
a valid URI
the group name to be added
Set the contents of a %G_TYPE_CHAR #GValue to @v_char.
a valid #GValue of type %G_TYPE_CHAR
character value to be set
Looks up the #GUnicodeScript for a particular character (as defined
by Unicode Standard Annex #24). No check is made for @ch being a
valid Unicode character; if you pass in invalid character, the
result is undefined.
This function is equivalent to pango_script_for_unichar() and the
two are interchangeable.
a Unicode character
the #GUnicodeScript for the character.
Since: 2.14
Gets the number of elements in a #GList.
<note><para>
This function iterates over the whole list to
count its elements.
</para></note>
a #GList
the number of elements in the #GList
Internal function for gtester to retrieve test log messages, no ABI guarantees provided.
Convert a string from a 32-bit fixed width representation as UCS-4.
to UTF-8. The result will be terminated with a 0 byte.
a UCS-4 encoded string
the maximum length (number of characters) of @str to use.
If @len < 0, then the string is nul-terminated.
location to store number of characters read, or %NULL.
location to store number of bytes written or %NULL.
The value here stored does not include the trailing 0
byte.
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError other than
%G_CONVERT_ERROR_NO_CONVERSION may occur.
a pointer to a newly allocated UTF-8 string.
This value must be freed with g_free(). If an
error occurs, %NULL will be returned and
@error set. In that case, @items_read will be
set to the position of the first invalid input
character.
Splits an URI list conforming to the text/uri-list
mime type defined in RFC 2483 into individual URIs,
discarding any comments. The URIs are not validated.
an URI list
a newly allocated %NULL-terminated list of
strings holding the individual URIs. The array should
be freed with g_strfreev().
Since: 2.6
Attempts to complete the string @prefix using the #GCompletion target items.
In contrast to g_completion_complete(), this function returns the largest common
prefix that is a valid UTF-8 string, omitting a possible common partial
character.
You should use this function instead of g_completion_complete() if your
items are UTF-8 strings.
the #GCompletion
the prefix string, typically used by the user, which is compared
with each of the items
if non-%NULL, returns the longest prefix which is common to all
items that matched @prefix, or %NULL if no items matched @prefix.
This string should be freed when no longer needed.
the list of items whose strings begin with @prefix. This should
not be changed.
Since: 2.4
Finds a #GNode in a tree.
the root #GNode of the tree to search
the order in which nodes are visited - %G_IN_ORDER,
%G_PRE_ORDER, %G_POST_ORDER, or %G_LEVEL_ORDER
which types of children are to be searched, one of
%G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
the data to find
the found #GNode, or %NULL if the data is not found
Adds a new item to the front of @seq
a #GSequence
the data for the new item
an iterator pointing to the new item
Since: 2.14
Convert a string from UTF-8 to UTF-16. A 0 character will be
added to the result after the converted text.
a UTF-8 encoded string
the maximum length (number of characters) of @str to use.
If @len < 0, then the string is nul-terminated.
location to store number of bytes read, or %NULL.
If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
returned in case @str contains a trailing partial
character. If an error occurs then the index of the
invalid input is stored here.
location to store number of <type>gunichar2</type> written,
or %NULL.
The value stored here does not include the trailing 0.
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError other than
%G_CONVERT_ERROR_NO_CONVERSION may occur.
a pointer to a newly allocated UTF-16 string.
This value must be freed with g_free(). If an
error occurs, %NULL will be returned and
@error set.
Internal function, used to extract the fundamental type ID portion.
use G_TYPE_FUNDAMENTAL() instead.
valid type ID
fundamental type ID
Add a property to an interface; this is only useful for interfaces
that are added to GObject-derived types. Adding a property to an
interface forces all objects classes with that interface to have a
compatible property. The compatible property could be a newly
created #GParamSpec, but normally
g_object_class_override_property() will be used so that the object
class only needs to provide an implementation and inherits the
property description, default value, bounds, and so forth from the
interface property.
This function is meant to be called from the interface's default
vtable initialization function (the @class_init member of
#GTypeInfo.) It must not be called after after @class_init has
been called for any object types implementing this interface.
Since: 2.4
any interface vtable for the interface, or the default
vtable for the interface.
the #GParamSpec for the new property
This function is a variant of g_dgettext() which supports
a disambiguating message context. GNU gettext uses the
'\004' character to separate the message context and
message id in @msgctxtid.
This uses g_dgettext() internally. See that functions for differences
with dgettext() proper.
This function differs from C_() in that it is not a macro and
thus you may use non-string-literals as context and msgid arguments.
the translation domain to use, or %NULL to use
the domain set with textdomain()
the message context
the message
The translated string
Since: 2.18
Inserts @link into @queue at the given position.
Since: 2.4
a #GQueue
the position to insert the link. If this is negative or larger than
the number of elements in @queue, the link is added to the end of
@queue.
the link to add to @queue
Removes an element from a #GSList.
If two elements contain the same data, only the first is removed.
If none of the elements contain the data, the #GSList is unchanged.
a #GSList
the data of the element to remove
the new start of the #GSList
Returns: the data of the last element in the queue, or %NULL if the queue
a #GQueue.
the data of the last element in the queue, or %NULL if the queue
is empty.
Formats a size (for example the size of a file) into a human readable string.
Sizes are rounded to the nearest size prefix (KB, MB, GB) and are displayed
rounded to the nearest tenth. E.g. the file size 3292528 bytes will be
converted into the string "3.1 MB".
The prefix units base is 1024 (i.e. 1 KB is 1024 bytes).
This string should be freed with g_free() when not needed any longer.
a size in bytes.
a newly-allocated formatted string containing a human readable
file size.
Since: 2.16
Removes an element from a #GList.
If two elements contain the same data, only the first is removed.
If none of the elements contain the data, the #GList is unchanged.
a #GList
the data of the element to remove
the new start of the #GList
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gpointer arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gpointer parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Adds a new element at the head of the queue.
a #GQueue.
the data for the new element.
Decreases the reference count of the asynchronous @queue by 1. If
the reference count went to 0, the @queue will be destroyed and the
memory allocated will be freed. So you are not allowed to use the
@queue afterwards, as it might have disappeared. You do not need to
hold the lock to call this function.
a #GAsyncQueue.
Looks up a #GEnumValue by name.
a #GEnumClass
the name to look up
the #GEnumValue with name @name, or %NULL if the
enumeration doesn't have a member with that name
Sets a function to be called when the child indicated by @pid
exits, at the priority @priority.
If you obtain @pid from g_spawn_async() or g_spawn_async_with_pipes()
you will need to pass #G_SPAWN_DO_NOT_REAP_CHILD as flag to
the spawn function for the child watching to work.
Note that on platforms where #GPid must be explicitly closed
(see g_spawn_close_pid()) @pid must not be closed while the
source is still active. Typically, you will want to call
g_spawn_close_pid() in the callback function for the source.
GLib supports only a single callback per process id.
This internally creates a main loop source using
g_child_watch_source_new() and attaches it to the main loop context
using g_source_attach(). You can do these steps manually if you
need greater control.
the priority of the idle source. Typically this will be in the
range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.
process to watch. On POSIX the pid of a child process. On
Windows a handle for a process (which doesn't have to be a child).
function to call
data to pass to @function
function to call when the idle is removed, or %NULL
the ID (greater than 0) of the event source.
Since: 2.4
Gets the position of the element containing
the given data (starting from 0).
a #GSList
the data to find
the index of the element containing the data,
or -1 if the data is not found
Return value: the values associated with the key as a list of
a #GKeyFile
a group name
a key
the number of doubles returned
return location for a #GError
the values associated with the key as a list of
doubles, or %NULL if the key was not found or could not be parsed.
Since: 2.12
Return value: a #GSequenceIter pointing to the previous position before
a #GSequenceIter
a #GSequenceIter pointing to the previous position before
@iter.
Since: 2.14
Frees context and all the groups which have been
added to it.
Since: 2.6
a #GOptionContext
Sets the current position in the #GIOChannel, similar to the standard
library function fseek().
a #GIOChannel
an offset, in bytes, which is added to the position specified
by @type
the position in the file, which can be %G_SEEK_CUR (the current
position), %G_SEEK_SET (the start of the file), or %G_SEEK_END
(the end of the file)
%G_IO_ERROR_NONE if the operation was successful.
Deprecated:2.2: Use g_io_channel_seek_position() instead.
Converts all Unicode characters in the string that have a case
to lowercase. The exact manner that this is done depends
on the current locale, and may result in the number of
characters in the string changing.
a UTF-8 encoded string
length of @str, in bytes, or -1 if @str is nul-terminated.
a newly allocated string, with all characters
converted to lowercase.
A wrapper for the POSIX stat() function. The stat() function
Returns: 0 if the information was successfully retrieved, -1 if an error
a pathname in the GLib file name encoding (UTF-8 on Windows)
a pointer to a <structname>stat</structname> struct, which
will be filled with the file information
0 if the information was successfully retrieved, -1 if an error
occurred
Since: 2.6
Retrieves the number of matched substrings (including substring 0,
that is the whole matched text), so 1 is returned if the pattern
has no substrings in it and 0 is returned if the match failed.
If the last match was obtained using the DFA algorithm, that is
using g_regex_match_all() or g_regex_match_all_full(), the retrieved
count is not that of the number of capturing parentheses but that of
the number of matched substrings.
a #GMatchInfo structure
Number of matched substrings, or -1 if an error occurred
Since: 2.14
Sets @description as the description of the bookmark for @uri.
If @uri is %NULL, the description of @bookmark is set.
If a bookmark for @uri cannot be found then it is created.
Since: 2.12
a #GBookmarkFile
a valid URI or %NULL
a string
Converts a string into a form that is independent of case. The
result will not correspond to any particular case, but can be
compared for equality or ordered with the results of calling
g_utf8_casefold() on other strings.
Note that calling g_utf8_casefold() followed by g_utf8_collate() is
only an approximation to the correct linguistic case insensitive
ordering, though it is a fairly good one. Getting this exactly
right would require a more sophisticated collation function that
takes case sensitivity into account. GLib does not currently
provide such a function.
a UTF-8 encoded string
length of @str, in bytes, or -1 if @str is nul-terminated.
a newly allocated string, that is a
case independent form of @str.
This function outputs @bookmark into a file. The write process is
guaranteed to be atomic by using g_file_set_contents() internally.
a #GBookmarkFile
path of the output file
return location for a #GError, or %NULL
%TRUE if the file was successfully written.
Since: 2.12
Set the contents of a %G_TYPE_STRING #GValue to @v_string.
The string is assumed to be static, and is thus not duplicated
when setting the #GValue.
a valid #GValue of type %G_TYPE_STRING
static string to be set
Turns on flag values for a data list. This function is used
to keep a small number of boolean flags in an object with
a data list without using any additional space. It is
not generally useful except in circumstances where space
is very tight. (It is used in the base #GObject type, for
example.)
Since: 2.8
pointer to the location that holds a list
the flags to turn on. The values of the flags are
restricted by %G_DATALIST_FLAGS_MASK (currently
3; giving two possible boolean flags).
A value for @flags that doesn't fit within the mask is
an error.
Validates UTF-8 encoded text. @str is the text to validate;
if @str is nul-terminated, then @max_len can be -1, otherwise
@max_len should be the number of bytes to validate.
If @end is non-%NULL, then the end of the valid range
will be stored there (i.e. the start of the first invalid
character if some bytes were invalid, or the end of the text
being validated otherwise).
Note that g_utf8_validate() returns %FALSE if @max_len is
positive and NUL is met before @max_len bytes have been read.
Return value: %TRUE if the text was valid UTF-8
a pointer to character data
max bytes to validate, or -1 to go until NUL
return location for end of valid data
%TRUE if the text was valid UTF-8
Increments the reference count for the interface type @g_type,
and returns the default interface vtable for the type.
If the type is not currently in use, then the default vtable
for the type will be created and initalized by calling
the base interface init and default vtable init functions for
the type (the @<structfield>base_init</structfield>
and <structfield>class_init</structfield> members of #GTypeInfo).
Calling g_type_default_interface_ref() is useful when you
want to make sure that signals and properties for an interface
have been installed.
Since: 2.4
an interface type
the default vtable for the interface; call
g_type_default_interface_unref() when you are done using
the interface.
Decrements the reference count of a @pspec.
a valid #GParamSpec
This function works like g_param_spec_set_qdata(), but in addition,
a <literal>void (*destroy) (gpointer)</literal> function may be
specified which is called with @data as argument when the @pspec is
finalized, or the data is being overwritten by a call to
g_param_spec_set_qdata() with the same @quark.
the #GParamSpec to set store a user data pointer
a #GQuark, naming the user data pointer
an opaque user data pointer
function to invoke with @data as argument, when @data needs to
be freed
Atomically decrements the reference count of @hash_table by one.
If the reference count drops to 0, all keys and values will be
destroyed, and all memory allocated by the hash table is released.
This function is MT-safe and may be called from any thread.
Since: 2.10
a valid #GHashTable.
Creates a new timeout source.
The source will not initially be associated with any #GMainContext
and must be added to one with g_source_attach() before it will be
executed.
The scheduling granularity/accuracy of this timeout source will be
in seconds.
the timeout interval in seconds
the newly-created timeout source
Since: 2.14
Converts a string into a collation key that can be compared
with other collation keys produced by the same function using
strcmp().
The results of comparing the collation keys of two strings
with strcmp() will always be the same as comparing the two
original keys with g_utf8_collate().
Note that this function depends on the
<link linkend="setlocale">current locale</link>.
a UTF-8 encoded string.
length of @str, in bytes, or -1 if @str is nul-terminated.
a newly allocated string. This string should
be freed with g_free() when you are done with it.
Creates a new string @length bytes long filled with @fill_char.
The returned string should be freed when no longer needed.
the length of the new string
the byte to fill the string with
a newly-allocated string filled the @fill_char
Return value: the value associated with the key as an integer, or
a #GKeyFile
a group name
a key
return location for a #GError
the value associated with the key as an integer, or
0 if the key was not found or could not be parsed.
Since: 2.6
In Unicode, some characters are <firstterm>mirrored</firstterm>. This
means that their images are mirrored horizontally in text that is laid
out from right to left. For instance, "(" would become its mirror image,
")", in right-to-left text.
If @ch has the Unicode mirrored property and there is another unicode
character that typically has a glyph that is the mirror image of @ch's
glyph and @mirrored_ch is set, it puts that character in the address
pointed to by @mirrored_ch. Otherwise the original character is put.
a Unicode character
location to store the mirrored character
%TRUE if @ch has a mirrored character, %FALSE otherwise
Since: 2.4
Creates a filename from a series of elements using the correct
separator for filenames.
On Unix, this function behaves identically to <literal>g_build_path
(G_DIR_SEPARATOR_S, first_element, ....)</literal>.
On Windows, it takes into account that either the backslash
(<literal>\</literal> or slash (<literal>/</literal>) can be used
as separator in filenames, but otherwise behaves as on Unix. When
file pathname separators need to be inserted, the one that last
previously occurred in the parameters (reading from left to right)
is used.
No attempt is made to force the resulting filename to be an absolute
path. If the first element is a relative path, the result will
be a relative path.
the first element in the path
remaining elements in path, terminated by %NULL
a newly-allocated string that must be freed with g_free().
Determines the canonical combining class of a Unicode character.
a Unicode character
the combining class of the character
Since: 2.14
Converts a string from one character set to another.
Note that you should use g_iconv() for streaming
conversions<footnote id="streaming-state">
<para>
Despite the fact that @byes_read can return information about partial
characters, the <literal>g_convert_...</literal> functions
are not generally suitable for streaming. If the underlying converter
being used maintains internal state, then this won't be preserved
across successive calls to g_convert(), g_convert_with_iconv() or
g_convert_with_fallback(). (An example of this is the GNU C converter
for CP1255 which does not emit a base character until it knows that
the next character is not a mark that could combine with the base
character.)
</para>
</footnote>.
the string to convert
the length of the string, or -1 if the string is
nul-terminated<footnoteref linkend="nul-unsafe"/>.
conversion descriptor from g_iconv_open()
location to store the number of bytes in the
input string that were successfully converted, or %NULL.
Even if the conversion was successful, this may be
less than @len if there were partial characters
at the end of the input. If the error
#G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value
stored will the byte offset after the last valid
input sequence.
the number of bytes stored in the output buffer (not
including the terminating nul).
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError may occur.
If the conversion was successful, a newly allocated
nul-terminated string, which must be freed with
g_free(). Otherwise %NULL and @error will be set.
Copies %NULL-terminated array of strings. The copy is a deep copy;
the new array should be freed by first freeing each string, then
the array itself. g_strfreev() does this for you. If called
on a %NULL value, g_strdupv() simply returns %NULL.
%NULL-terminated array of strings.
a new %NULL-terminated array of strings.
Adds a string onto the end of a #GString, expanding
it if necessary.
a #GString
the string to append onto the end of @string
@string
Converts a #gdouble to a string, using the '.' as
decimal point.
This functions generates enough precision that converting
the string back using g_ascii_strtod() gives the same machine-number
(on machines with IEEE compatible 64bit doubles). It is
guaranteed that the size of the resulting string will never
be larger than @G_ASCII_DTOSTR_BUF_SIZE bytes.
A buffer to place the resulting string in
The length of the buffer.
The #gdouble to convert
The pointer to the buffer with the converted string.
Gets the number of bookmarks inside @bookmark.
a #GBookmarkFile
the number of bookmarks
Since: 2.12
Return value: a newly allocated %NULL-terminated array of strings.
a #GBookmarkFile
return location for the number of returned URIs, or %NULL
a newly allocated %NULL-terminated array of strings.
Use g_strfreev() to free it.
Since: 2.12
Checks that the GLib library in use is compatible with the
given version. Generally you would pass in the constants
#GLIB_MAJOR_VERSION, #GLIB_MINOR_VERSION, #GLIB_MICRO_VERSION
as the three arguments to this function; that produces
a check that the library in use is compatible with
the version of GLib the application or module was compiled
against.
Compatibility is defined by two things: first the version
of the running library is newer than the version
@required_major.required_minor.@required_micro. Second
the running library must be binary compatible with the
version @required_major.required_minor.@required_micro
(same major version.)
the required major version.
the required minor version.
the required micro version.
%NULL if the GLib library is compatible with the
given version, or a string describing the version mismatch.
The returned string is owned by GLib and must not be modified
or freed.
Since: 2.6
Hook up a new test case at @testpath, similar to g_test_add_func().
A fixture data structure with setup and teardown function may be provided
though, similar to g_test_create_case().
g_test_add() is implemented as a macro, so that the fsetup(), ftest() and
fteardown() callbacks can expect a @Fixture pointer as first argument in
a type safe manner.
Since: 2.16
The test path for a new test case.
The type of a fixture data structure.
Data argument for the test functions.
The function to set up the fixture data.
The actual test function.
The function to tear down the fixture data.
Adds @test_case to @suite.
Since: 2.16
a #GTestSuite
a #GTestCase
Set the contents of a %G_TYPE_UCHAR #GValue to @v_uchar.
a valid #GValue of type %G_TYPE_UCHAR
unsigned character value to be set
Writes data to a #GIOChannel.
a #GIOChannel
the buffer containing the data to write
the number of bytes to write
the number of bytes actually written
%G_IO_ERROR_NONE if the operation was successful.
Deprecated:2.2: Use g_io_channel_write_chars() instead.
Get the name of a #GParamSpec.
a valid #GParamSpec
the name of @pspec.
This function looks for a key file named @file in the paths
returned from g_get_user_data_dir() and g_get_system_data_dirs(),
loads the file into @key_file and returns the file's full path in
@full_path. If the file could not be loaded then an %error is
set to either a #GFileError or #GKeyFileError.
an empty #GKeyFile struct
a relative path to a filename to open and parse
return location for a string containing the full path
of the file, or %NULL
flags from #GKeyFileFlags
return location for a #GError, or %NULL
%TRUE if a key file could be loaded, %FALSE othewise
Since: 2.6
This function adds a message to test reports that
associates a bug URI with a test case.
Bug URIs are constructed from a base URI set with g_test_bug_base()
and @bug_uri_snippet.
Since: 2.16
Bug specific bug tracker URI portion.
Finds a source with the given user data for the callback. If
multiple sources exist with the same user data, the first
one found will be returned.
a #GMainContext
the user_data for the callback.
the source, if one was found, otherwise %NULL
Adds a new element at the tail of the queue.
a #GQueue.
a single #GList element, <emphasis>not</emphasis> a list with
more than one element.
Creates a hash code for @str; for use with #GHashTable.
a string to hash
hash code for @str
An implementation of the standard vsprintf() function which supports
positional parameters, as specified in the Single Unix Specification.
the buffer to hold the output.
a standard printf() format string, but notice
<link linkend="string-precision">string precision pitfalls</link>.
the list of arguments to insert in the output.
the number of bytes printed.
Since: 2.2
Tries to pop data from the @queue. If no data is available, %NULL is
returned.
a #GAsyncQueue.
data from the queue or %NULL, when no data is
available immediately.
See g_spawn_async_with_pipes() for a full description; this function
simply calls the g_spawn_async_with_pipes() without any pipes.
You should call g_spawn_close_pid() on the returned child process
reference when you don't need it any more.
<note><para>
If you are writing a GTK+ application, and the program you
are spawning is a graphical application, too, then you may
want to use gdk_spawn_on_screen() instead to ensure that
the spawned program opens its windows on the right screen.
</para></note>
<note><para> Note that the returned @child_pid on Windows is a
handle to the child process and not its identifier. Process handles
and process identifiers are different concepts on Windows.
</para></note>
child's current working directory, or %NULL to inherit parent's
child's argument vector
child's environment, or %NULL to inherit parent's
flags from #GSpawnFlags
function to run in the child just before exec()
user data for @child_setup
return location for child process reference, or %NULL
return location for error
%TRUE on success, %FALSE if error is set
Looks up the #GParamSpec for a property of a class.
a #GObjectClass
the name of the property to look up
the #GParamSpec for the property, or %NULL if the class
doesn't have a property of that name
Adds the second #GSList onto the end of the first #GSList.
Note that the elements of the second #GSList are not copied.
They are used directly.
a #GSList
the #GSList to add to the end of the first #GSList
the start of the new #GSList
Converts a filename from UTF-8 to the system codepage.
On NT-based Windows, on NTFS file systems, file names are in
Unicode. It is quite possible that Unicode file names contain
characters not representable in the system codepage. (For instance,
Greek or Cyrillic characters on Western European or US Windows
installations, or various less common CJK characters on CJK Windows
installations.)
In such a case, and if the filename refers to an existing file, and
the file system stores alternate short (8.3) names for directory
entries, the short form of the filename is returned. Note that the
"short" name might in fact be longer than the Unicode name if the
Unicode name has very short pathname components containing
non-ASCII characters. If no system codepage name for the file is
possible, %NULL is returned.
The return value is dynamically allocated and should be freed with
g_free() when no longer needed.
a UTF-8 encoded filename.
The converted filename, or %NULL on conversion
failure and lack of short names.
Since: 2.8
Reads a line from a #GIOChannel, using a #GString as a buffer.
a #GIOChannel
a #GString into which the line will be written.
If @buffer already contains data, the old data will
be overwritten.
location to store position of line terminator, or %NULL
a location to store an error of type #GConvertError
or #GIOChannelError
the status of the operation.
Does nothing if @err is %NULL; if @err is non-%NULL, then *@err must
be %NULL. A new #GError is created and assigned to *@err.
a return location for a #GError, or %NULL
error domain
error code
printf()-style format
args for @format
Return value: the first link in @queue, or %NULL if @queue is empty
a #GQueue
the first link in @queue, or %NULL if @queue is empty
Since: 2.4
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, GOBject *arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #GObject* parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Sets the seed for the global random number generator, which is used
by the <function>g_random_*</function> functions, to @seed.
a value to reinitialize the global random number generator.
Creates a new #GOptionGroup.
the name for the option group, this is used to provide
help for the options in this group with <option>--help-</option>@name
a description for this group to be shown in
<option>--help</option>. This string is translated using the translation
domain or translation function of the group
a description for the <option>--help-</option>@name option.
This string is translated using the translation domain or translation function
of the group
user data that will be passed to the pre- and post-parse hooks,
the error hook and to callbacks of %G_OPTION_ARG_CALLBACK options, or %NULL
a function that will be called to free @user_data, or %NULL
a newly created option group. It should be added
to a #GOptionContext or freed with g_option_group_free().
Since: 2.6
Looks up or registers a flags type that is implemented with a particular
type plugin. If a type with name @type_name was previously registered,
the #GType identifier for the type is returned, otherwise the type
is newly registered, and the resulting #GType identifier returned.
As long as any instances of the type exist, the type plugin will
not be unloaded.
Since: 2.6
a #GTypeModule
name for the type
an array of #GFlagsValue structs for the
possible flags values. The array is
terminated by a struct with all members being
0.
the new or existing type ID
Inserts a node before @sibling containing @data.
a #GSList
node to insert @data before
data to put in the newly-inserted node
the new head of the list.
Unmaps the buffer of @file and frees it.
Since: 2.8
a #GMappedFile
Return value: the maximal number of unused threads
the maximal number of unused threads
Recursively copies a #GNode and its data.
a #GNode
the function which is called to copy the data inside each node,
or %NULL to use the original data.
data to pass to @copy_func
a new #GNode containing copies of the data in @node.
Since: 2.4
Converts an <literal>errno</literal> error number to a #GIOChannelError.
an <literal>errno</literal> error number, e.g. %EINVAL
a #GIOChannelError error number, e.g.
%G_IO_CHANNEL_ERROR_INVAL.
Tries to cast the contents of @src_value into a type appropriate
to store in @dest_value, e.g. to transform a %G_TYPE_INT value
into a %G_TYPE_FLOAT value. Performing transformations between
value types might incur precision lossage. Especially
transformations into strings might reveal seemingly arbitrary
results and shouldn't be relied upon for production code (such
as rcfile value or object property serialization).
Source value.
Target value.
Whether a transformation rule was found and could be applied.
Upon failing transformations, @dest_value is left untouched.
Compares the two #gint values being pointed to and returns
%TRUE if they are equal.
It can be passed to g_hash_table_new() as the @key_equal_func
parameter, when using pointers to integers as keys in a #GHashTable.
a pointer to a #gint key.
a pointer to a #gint key to compare with @v1.
%TRUE if the two keys match.
This function creates a new %G_TYPE_BOXED derived type id for a new
boxed type with name @name. Boxed type handling functions have to be
provided to copy and free opaque boxed structures of this type.
Name of the new boxed type.
Boxed structure copy function.
Boxed structure free function.
New %G_TYPE_BOXED derived type id for @name.
A mixed enumerated type and flags field. You must specify one type
(string, strdup, boolean, tristate). Additionally, you may
optionally bitwise OR the type with the flag
%G_MARKUP_COLLECT_OPTIONAL.
It is likely that this enum will be extended in the future to
support other types.
used to terminate the list of attributes
to collect.
collect the string pointer directly from
the attribute_values[] array. Expects a
parameter of type (const char **). If
%G_MARKUP_COLLECT_OPTIONAL is specified
and the attribute isn't present then the
pointer will be set to %NULL.
as with %G_MARKUP_COLLECT_STRING, but
expects a paramter of type (char **) and
g_strdup()s the returned pointer. The
pointer must be freed with g_free().
expects a parameter of type (gboolean *)
and parses the attribute value as a
boolean. Sets %FALSE if the attribute
isn't present. Valid boolean values
consist of (case insensitive) "false",
"f", "no", "n", "0" and "true", "t",
"yes", "y", "1".
as with %G_MARKUP_COLLECT_BOOLEAN, but
in the case of a missing attribute a
value is set that compares equal to
neither %FALSE nor %TRUE.
G_MARKUP_COLLECT_OPTIONAL is implied.
can be bitwise ORed with the other
fields. If present, allows the
attribute not to appear. A default
value is set depending on what value
type is used.
Creates a new idle source.
The source will not initially be associated with any #GMainContext
and must be added to one with g_source_attach() before it will be
executed. Note that the default priority for idle sources is
%G_PRIORITY_DEFAULT_IDLE, as compared to other sources which
have a default priority of %G_PRIORITY_DEFAULT.
the newly-created idle source
Finds the element in a #GList which
contains the given data.
a #GList
the element data to find
the found #GList element,
or %NULL if it is not found
Adds a copy of the first @len bytes of @string to the #GStringChunk.
The copy is nul-terminated.
Since this function does not stop at nul bytes, it is the caller's
responsibility to ensure that @string has at least @len addressable
bytes.
The characters in the returned string can be changed, if necessary,
though you should not change anything after the end of the string.
a #GStringChunk
bytes to insert
number of bytes of @string to insert, or -1 to insert a
nul-terminated string
a pointer to the copy of @string within the #GStringChunk
Since: 2.4
Removes the node link_ from the list and frees it.
Compare this to g_list_remove_link() which removes the node
without freeing it.
a #GList
node to delete from @list
the new head of @list
Like g_sequence_sort_changed(), but uses
a #GSequenceIterCompareFunc instead of a #GCompareDataFunc as
the compare function.
Since: 2.14
a #GSequenceIter
the #GSequenceItercompare used to compare iterators in the
sequence. It is called with two iterators pointing into @seq. It should
return 0 if the iterators are equal, a negative value if the first
iterator comes before the second, and a positive value if the second
iterator comes before the first.
user data passed to @cmp_func
Get the contents of a %G_TYPE_UCHAR #GValue.
a valid #GValue of type %G_TYPE_UCHAR
unsigned character contents of @value
Get the contents of a %G_TYPE_PARAM #GValue.
a valid #GValue whose type is derived from %G_TYPE_PARAM
#GParamSpec content of @value
Get the contents of a %G_TYPE_ENUM #GValue.
a valid #GValue whose type is derived from %G_TYPE_ENUM
enum contents of @value
Determines if a given character is assigned in the Unicode
standard.
a Unicode character
%TRUE if the character has an assigned value
Formats the data in @args according to @format, escaping
all string and character arguments in the fashion
of g_markup_escape_text(). See g_markup_printf_escaped().
printf() style format string
variable argument list, similar to vprintf()
newly allocated result from formatting
operation. Free with g_free().
Since: 2.4
Sets the private flag of the bookmark for @uri.
If a bookmark for @uri cannot be found then it is created.
Since: 2.12
a #GBookmarkFile
a valid URI
%TRUE if the bookmark should be marked as private
Return value: the value associated with the key as a boolean,
a #GKeyFile
a group name
a key
return location for a #GError
the value associated with the key as a boolean,
or %FALSE if the key was not found or could not be parsed.
Since: 2.6
Sorts @queue using @func.
This function will lock @queue before it sorts the queue and unlock
it when it is finished.
If you were sorting a list of priority numbers to make sure the
lowest priority would be at the top of the queue, you could use:
|[
gint32 id1;
gint32 id2;
id1 = GPOINTER_TO_INT (element1);
id2 = GPOINTER_TO_INT (element2);
return (id1 > id2 ? +1 : id1 == id2 ? 0 : -1);
]|
Since: 2.10
a #GAsyncQueue
the #GCompareDataFunc is used to sort @queue. This
function is passed two elements of the @queue. The function
should return 0 if they are equal, a negative value if the
first element should be higher in the @queue or a positive
value if the first element should be lower in the @queue than
the second element.
user data passed to @func
Returns: %TRUE if @file_name is an absolute path.
a file name.
%TRUE if @file_name is an absolute path.
Creates a new #GHashTable with a reference count of 1.
a function to create a hash value from a key.
Hash values are used to determine where keys are stored within the
#GHashTable data structure. The g_direct_hash(), g_int_hash() and
g_str_hash() functions are provided for some common types of keys.
If hash_func is %NULL, g_direct_hash() is used.
a function to check two keys for equality. This is
used when looking up keys in the #GHashTable. The g_direct_equal(),
g_int_equal() and g_str_equal() functions are provided for the most
common types of keys. If @key_equal_func is %NULL, keys are compared
directly in a similar fashion to g_direct_equal(), but without the
overhead of a function call.
a new #GHashTable.
Prepends @len bytes of @val to @string.
Because @len is provided, @val may contain
embedded nuls and need not be nul-terminated.
Since this function does not stop at nul bytes,
it is the caller's responsibility to ensure that
@val has at least @len addressable bytes.
a #GString
bytes to prepend
number of bytes in @val to prepend
@string
Overwrites part of a string, lengthening it if necessary.
This function will work with embedded nuls.
a #GString
the position at which to start overwriting
the string that will overwrite the @string starting at @pos
the number of bytes to write from @val
@string
Since: 2.14
Checks to see if the main loop is currently being run via g_main_loop_run().
a #GMainLoop.
%TRUE if the mainloop is currently being run.
Return value: a newly allocated string or %NULL if the specified
a #GBookmarkFile
a valid URI or %NULL
return location for a #GError, or %NULL
a newly allocated string or %NULL if the specified
URI cannot be found.
Since: 2.12
Creates a new #GString, initialized with the given string.
the initial text to copy into the string
the new #GString
Get a reproducible random integer number.
The random numbers generated by the g_test_rand_*() family of functions
change with every new test program start, unless the --seed option is
given when starting test programs.
For individual test cases however, the random number generator is
reseeded, to avoid dependencies between tests and to make --seed
effective for all test cases.
a random number from the seeded random number generator.
Since: 2.16
Converts a #GString to lowercase.
a #GString
the #GString.
Deprecated:2.2: This function uses the locale-specific
tolower() function, which is almost never the right thing.
Use g_string_ascii_down() or g_utf8_strdown() instead.
Converts a string to upper case.
the string to convert.
the string
Deprecated:2.2: This function is totally broken for the reasons discussed
in the g_strncasecmp() docs - use g_ascii_strup() or g_utf8_strup() instead.
Returns: ISO 8601 week number of the year.
a valid #GDate
ISO 8601 week number of the year.
Since: 2.6
Set the contents of a %G_TYPE_FLOAT #GValue to @v_float.
a valid #GValue of type %G_TYPE_FLOAT
float value to be set
Retrieves the element stack from the internal state of the parser.
The returned #GSList is a list of strings where the first item is
the currently open tag (as would be returned by
g_markup_parse_context_get_element()) and the next item is its
immediate parent.
This function is intended to be used in the start_element and
end_element handlers where g_markup_parse_context_get_element()
would merely return the name of the element that is being
processed.
a #GMarkupParseContext
the element stack, which must not be modified
Since: 2.16
Try to determine the installation directory for a software package.
This function is deprecated. Use
g_win32_get_package_installation_directory_of_module() instead.
The use of @package is deprecated. You should always pass %NULL. A
warning is printed if non-NULL is passed as @package.
The original intended use of @package was for a short identifier of
the package, typically the same identifier as used for
<literal>GETTEXT_PACKAGE</literal> in software configured using GNU
autotools. The function first looks in the Windows Registry for the
value <literal>#InstallationDirectory</literal> in the key
<literal>#HKLM\Software\@package</literal>, and if that value
exists and is a string, returns that.
It is strongly recommended that packagers of GLib-using libraries
for Windows do not store installation paths in the Registry to be
used by this function as that interfers with having several
parallel installations of the library. Enabling multiple
installations of different versions of some GLib-using library, or
GLib itself, is desirable for various reasons.
For this reason it is recommeded to always pass %NULL as
@package to this function, to avoid the temptation to use the
Registry. In version 2.20 of GLib the @package parameter
will be ignored and this function won't look in the Registry at all.
If @package is %NULL, or the above value isn't found in the
Registry, but @dll_name is non-%NULL, it should name a DLL loaded
into the current process. Typically that would be the name of the
DLL calling this function, looking for its installation
directory. The function then asks Windows what directory that DLL
was loaded from. If that directory's last component is "bin" or
"lib", the parent directory is returned, otherwise the directory
itself. If that DLL isn't loaded, the function proceeds as if
@dll_name was %NULL.
If both @package and @dll_name are %NULL, the directory from where
the main executable of the process was loaded is used instead in
the same way as above.
You should pass %NULL for this.
The name of a DLL that a package provides in UTF-8, or %NULL.
a string containing the installation directory for
@package. The string is in the GLib file name encoding,
i.e. UTF-8. The return value should be freed with g_free() when not
needed any longer. If the function fails %NULL is returned.
@Deprecated:2.18: Pass the HMODULE of a DLL or EXE to
g_win32_get_package_installation_directory_of_module() instead.
Creates a new #GParamSpecUChar instance specifying a %G_TYPE_UCHAR property.
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Stops all currently unused threads. This does not change the
maximal number of unused threads. This function can be used to
regularly stop all unused threads e.g. from g_timeout_add().
Get the contents of a %G_TYPE_OBJECT derived #GValue, increasing
its reference count.
a valid #GValue whose type is derived from %G_TYPE_OBJECT
object content of @value, should be unreferenced when no
longer needed.
Return value: the number of key/value pairs in the #GHashTable.
a #GHashTable.
the number of key/value pairs in the #GHashTable.
Removes @key in @group_name from the key file.
a #GKeyFile
a group name
a key name to remove
return location for a #GError or %NULL
%TRUE if the key was removed, %FALSE otherwise
Since: 2.6
Gets the priority of a source.
a #GSource
the priority of the source
Creates a new signal. (This is usually done in the class initializer.)
See g_signal_new() for details on allowed signal names.
the name for the signal
the type this signal pertains to. It will also pertain to
types which are derived from this type.
a combination of #GSignalFlags specifying detail of when
the default handler is to be invoked. You should at least specify
%G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
The closure to invoke on signal emission; may be %NULL.
the accumulator for this signal; may be %NULL.
user data for the @accumulator.
the function to translate arrays of parameter values to
signal emissions into C language callback invocations.
the type of return value, or #G_TYPE_NONE for a signal
without a return value.
the number of parameter types in @args.
va_list of #GType, one for each parameter.
the signal id
Replaces all occurances of the pattern in @regex with the
replacement text. @replacement is replaced literally, to
include backreferences use g_regex_replace().
Setting @start_position differs from just passing over a
shortened string and setting #G_REGEX_MATCH_NOTBOL in the
case of a pattern that begins with any kind of lookbehind
assertion, such as "\b".
a #GRegex structure
the string to perform matches against
the length of @string, or -1 if @string is nul-terminated
starting index of the string to match
text to replace each match with
options for the match
location to store the error occuring, or %NULL to ignore errors
a newly allocated string containing the replacements
Since: 2.14
This function is essentially the same as g_type_class_ref(), except that
the classes reference count isn't incremented. As a consequence, this function
may return %NULL if the class of the type passed in does not currently
exist (hasn't been referenced before).
Type ID of a classed type.
The #GTypeClass structure for the given type ID or %NULL
if the class does not currently exist.
Sets the callback function for a source. The callback for a source is
called from the source's dispatch function.
The exact type of @func depends on the type of source; ie. you
should not count on @func being called with @data as its first
parameter.
Typically, you won't use this function. Instead use functions specific
to the type of source you are using.
the source
a callback function
the data to pass to callback function
a function to call when @data is no longer in use, or %NULL.
Gets an #GList of all #GParamSpec<!-- -->s owned by @owner_type in
the pool.
a #GParamSpecPool
the owner to look for
a #GList of all #GParamSpec<!-- -->s owned by @owner_type
in the pool#GParamSpec<!-- -->s.
Creates a new empty #GBookmarkFile object.
Use g_bookmark_file_load_from_file(), g_bookmark_file_load_from_data()
or g_bookmark_file_load_from_data_dirs() to read an existing bookmark
file.
an empty #GBookmarkFile
Since: 2.12
Checks whether the bookmark for @uri inside @bookmark has been
registered by application @name.
In the event the URI cannot be found, %FALSE is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
a #GBookmarkFile
a valid URI
the name of the application
return location for a #GError or %NULL
%TRUE if the application @name was found
Since: 2.12
Removes and returns the link at the given position.
a #GQueue
the link's position
The @n'th link, or %NULL if @n is off the end of @queue.
Since: 2.4
Setting this flag to %TRUE for a channel you have already closed
can cause problems.
a #GIOChannel
Whether to close the channel on the final unref of
the GIOChannel data structure. The default value of
this is %TRUE for channels created by g_io_channel_new_file (),
and %FALSE for all other channels.
Insert a copy of @value at specified position into @value_array.
#GValueArray to add an element to
insertion position, must be <= value_array->n_values
#GValue to copy into #GValueArray
the #GValueArray passed in as @value_array
Pops data from the @queue. This function blocks until data become
available.
a #GAsyncQueue.
data from the queue.
Return value: the values associated with the key as a list of
a #GKeyFile
a group name
a key
the number of integers returned
return location for a #GError
the values associated with the key as a list of
integers, or %NULL if the key was not found or could not be parsed.
Since: 2.6
Returns: the description
a #GOptionContext
the description
Since: 2.12
Returns: the transation of @str to the current locale
The string to be translated
the transation of @str to the current locale
Copies a nul-terminated string into the dest buffer, include the
trailing nul, and return a pointer to the trailing nul byte.
This is useful for concatenating multiple strings together
without having to repeatedly scan for the end.
destination buffer.
source string.
a pointer to trailing nul byte.
Inserts a byte into a #GString, expanding it if necessary.
a #GString
the position to insert the byte
the byte to insert
@string
Escapes a string for use in a URI.
Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical
characters plus dash, dot, underscore and tilde) are escaped.
But if you specify characters in @reserved_chars_allowed they are not
escaped. This is useful for the "reserved" characters in the URI
specification, since those are allowed unescaped in some portions of
a URI.
the unescaped input string.
a string of reserved characters that are
allowed to be used.
%TRUE if the result can include UTF-8 characters.
an escaped version of @unescaped. The returned string should be
freed when no longer needed.
Since: 2.16
Get the contents of a %G_TYPE_PARAM #GValue, increasing its
reference count.
a valid #GValue whose type is derived from %G_TYPE_PARAM
#GParamSpec content of @value, should be unreferenced when
no longer needed.
Gets a #GFileError constant based on the passed-in @errno.
For example, if you pass in %EEXIST this function returns
#G_FILE_ERROR_EXIST. Unlike @errno values, you can portably
assume that all #GFileError values will exist.
Normally a #GFileError value goes into a #GError returned
from a function that manipulates files. So you would use
g_file_error_from_errno() when constructing a #GError.
an "errno" value
#GFileError corresponding to the given @errno
Close an IO channel. Any pending data to be written will be
flushed if @flush is %TRUE. The channel will not be freed until the
last reference is dropped using g_io_channel_unref().
a #GIOChannel
if %TRUE, flush pending
location to store a #GIOChannelError
the status of the operation.
This function essentially limits the life time of the @closure to
the life time of the object. That is, when the object is finalized,
the @closure is invalidated by calling g_closure_invalidate() on
it, in order to prevent invocations of the closure with a finalized
(nonexisting) object. Also, g_object_ref() and g_object_unref() are
added as marshal guards to the @closure, to ensure that an extra
reference count is held on @object during invocation of the
@closure. Usually, this function will be called on closures that
use this @object as closure data.
GObject restricting lifetime of @closure
GClosure to watch
Convert a string from UCS-4 to UTF-16. A 0 character will be
added to the result after the converted text.
a UCS-4 encoded string
the maximum length (number of characters) of @str to use.
If @len < 0, then the string is nul-terminated.
location to store number of bytes read, or %NULL.
If an error occurs then the index of the invalid input
is stored here.
location to store number of <type>gunichar2</type>
written, or %NULL. The value stored here does not
include the trailing 0.
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError other than
%G_CONVERT_ERROR_NO_CONVERSION may occur.
a pointer to a newly allocated UTF-16 string.
This value must be freed with g_free(). If an
error occurs, %NULL will be returned and
@error set.
Copies a #GList.
<note><para>
Note that this is a "shallow" copy. If the list elements
consist of pointers to data, the pointers are copied but
the actual data is not.
</para></note>
a #GList
a copy of @list
Return value: the number of unprocessed tasks
a #GThreadPool
the number of unprocessed tasks
Same as the standard UNIX routine iconv_open(), but
may be implemented via libiconv on UNIX flavors that lack
a native implementation.
GLib provides g_convert() and g_locale_to_utf8() which are likely
more convenient than the raw iconv wrappers.
destination codeset
source codeset
a "conversion descriptor", or (GIConv)-1 if
opening the converter failed.
Opens a temporary file. See the mkstemp() documentation
on most UNIX-like systems.
The parameter is a string that should follow the rules for
mkstemp() templates, i.e. contain the string "XXXXXX".
g_mkstemp() is slightly more flexible than mkstemp()
in that the sequence does not have to occur at the very end of the
template. The X string will
be modified to form the name of a file that didn't exist.
The string should be in the GLib file name encoding. Most importantly,
on Windows it should be in UTF-8.
template filename
A file handle (as from open()) to the file
opened for reading and writing. The file is opened in binary mode
on platforms where there is a difference. The file handle should be
closed with close(). In case of errors, -1 is returned.
Inserts a key/value pair into a #GTree. If the given key already exists
in the #GTree its corresponding value is set to the new value. If you
supplied a value_destroy_func when creating the #GTree, the old value is
freed using that function. If you supplied a @key_destroy_func when
creating the #GTree, the passed key is freed using that function.
The tree is automatically 'balanced' as new key/value pairs are added,
so that the distance from the root to every leaf is as small as possible.
a #GTree.
the key to insert.
the value corresponding to the key.
Convert a string from UTF-8 to a 32-bit fixed width
representation as UCS-4, assuming valid UTF-8 input.
This function is roughly twice as fast as g_utf8_to_ucs4()
but does no error checking on the input.
a UTF-8 encoded string
the maximum length of @str to use, in bytes. If @len < 0,
then the string is nul-terminated.
location to store the number of characters in the
result, or %NULL.
a pointer to a newly allocated UCS-4 string.
This value must be freed with g_free().
Inserts a new key and value into a #GHashTable similar to
g_hash_table_insert(). The difference is that if the key already exists
in the #GHashTable, it gets replaced by the new key. If you supplied a
@value_destroy_func when creating the #GHashTable, the old value is freed
using that function. If you supplied a @key_destroy_func when creating the
#GHashTable, the old key is freed using that function.
a #GHashTable.
a key to insert.
the value to associate with the key.
Connects a closure to a signal for a particular object.
the instance to connect to.
a string of the form "signal-name::detail".
the closure to connect.
whether the handler should be called before or after the
default handler of the signal.
the handler id
Inserts a #GNode beneath the parent after the given sibling.
the #GNode to place @node under
the sibling #GNode to place @node after.
If sibling is %NULL, the node is inserted as the first child of @parent.
the #GNode to insert
the inserted #GNode
Removes the source with the given id from the default main context.
The id of
a #GSource is given by g_source_get_id(), or will be returned by the
functions g_source_attach(), g_idle_add(), g_idle_add_full(),
g_timeout_add(), g_timeout_add_full(), g_child_watch_add(),
g_child_watch_add_full(), g_io_add_watch(), and g_io_add_watch_full().
See also g_source_destroy(). You must use g_source_destroy() for sources
added to a non-default main context.
the ID of the source to remove.
%TRUE if the source was found and removed.
Sets a function to be called at regular intervals, with @priority.
The function is called repeatedly until it returns %FALSE, at which
point the timeout is automatically destroyed and the function will
not be called again.
Unlike g_timeout_add(), this function operates at whole second granularity.
The initial starting point of the timer is determined by the implementation
and the implementation is expected to group multiple timers together so that
they fire all at the same time.
To allow this grouping, the @interval to the first timer is rounded
and can deviate up to one second from the specified interval.
Subsequent timer iterations will generally run at the specified interval.
Note that timeout functions may be delayed, due to the processing of other
event sources. Thus they should not be relied on for precise timing.
After each call to the timeout function, the time of the next
timeout is recalculated based on the current time and the given @interval
If you want timing more precise than whole seconds, use g_timeout_add()
instead.
The grouping of timers to fire at the same time results in a more power
and CPU efficient behavior so if your timer is in multiples of seconds
and you don't require the first timer exactly one second from now, the
use of g_timeout_add_seconds() is preferred over g_timeout_add().
This internally creates a main loop source using
g_timeout_source_new_seconds() and attaches it to the main loop context
using g_source_attach(). You can do these steps manually if you need
greater control.
the priority of the timeout source. Typically this will be in
the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
the time between calls to the function, in seconds
function to call
data to pass to @function
function to call when the timeout is removed, or %NULL
the ID (greater than 0) of the event source.
Since: 2.14
Inserts @data into @queue using @func to determine the new position.
Since: 2.4
a #GQueue
the data to insert
the #GCompareDataFunc used to compare elements in the queue. It is
called with two elements of the @queue and @user_data. It should
return 0 if the elements are equal, a negative value if the first
element comes before the second, and a positive value if the second
element comes before the first.
user data passed to @func.
Queries the type system for information about a specific type.
This function will fill in a user-provided structure to hold
type-specific information. If an invalid #GType is passed in, the
@type member of the #GTypeQuery is 0. All members filled into the
#GTypeQuery structure should be considered constant and have to be
left untouched.
the #GType value of a static, classed type.
A user provided structure that is filled in with constant values
upon success.
Inserts a copy of a string into a #GString,
expanding it if necessary.
a #GString
the position to insert the copy of the string
the string to insert
@string
Return value: a string owned by GLib that must not be modified
a string owned by GLib that must not be modified
or freed.
Since: 2.6
Pops data from the @queue. This function blocks until data become
available. This function must be called while holding the @queue's
lock.
a #GAsyncQueue.
data from the queue.
Registers @type_name as the name of a new static type derived from
@parent_type. The type system uses the information contained in the
#GTypeInfo structure pointed to by @info to manage the type and its
instances (if not abstract). The value of @flags determines the nature
(e.g. abstract or not) of the type.
Type from which this type will be derived.
0-terminated string used as the name of the new type.
The #GTypeInfo structure for this type.
Bitwise combination of #GTypeFlags values.
The new type identifier.
Gets properties of an object.
In general, a copy is made of the property contents and the caller
is responsible for freeing the memory in the appropriate manner for
the type, for instance by calling g_free() or g_object_unref().
See g_object_get().
a #GObject
name of the first property to get
return location for the first property, followed optionally by more
name/return location pairs, followed by %NULL
Creates a new #GError; unlike g_error_new(), @message is not
a printf()-style format string. Use this
function if @message contains text you don't have control over,
that could include printf() escape sequences.
error domain
error code
error message
a new #GError
Frees a #GOptionGroup. Note that you must <emphasis>not</emphasis>
free groups which have been added to a #GOptionContext.
Since: 2.6
a #GOptionGroup
Remove the value at position @index_ from @value_array.
#GValueArray to remove an element from
position of value to remove, must be < value_array->n_values
the #GValueArray passed in as @value_array
Return value: length of @str_array.
a %NULL-terminated array of strings.
length of @str_array.
Since: 2.6
This function gets back user data pointers stored via
g_object_set_qdata().
The GObject to get a stored user data pointer from
A #GQuark, naming the user data pointer
The user data pointer set, or %NULL
Return value: The position of @link_, or -1 if the link is
a #Gqueue
A #GList link
The position of @link_, or -1 if the link is
not part of @queue
Since: 2.4
Gets the poll function set by g_main_context_set_poll_func().
a #GMainContext
the poll function
Runs all tests under the toplevel suite which can be retrieved
with g_test_get_root(). Similar to g_test_run_suite(), the test
cases to be run are filtered according to
test path arguments (-p <replaceable>testpath</replaceable>) as
parsed by g_test_init().
g_test_run_suite() or g_test_run() may only be called once
in a program.
0 on success
Since: 2.16
Calls the @unuse_plugin function from the #GTypePluginClass of
@plugin. There should be no need to use this function outside of
the GObject type system itself.
a #GTypePlugin
Inserts a #GNode beneath the parent at the given position.
the #GNode to place @node under
the position to place @node at, with respect to its siblings
If position is -1, @node is inserted as the last child of @parent
the #GNode to insert
the inserted #GNode
A convenience function to disconnect multiple signals at once.
The signal specs expected by this function have the form
"any_signal", which means to disconnect any signal with matching
callback and data, or "any_signal::signal_name", which only
disconnects the signal named "signal_name".
a #GObject
the spec for the first signal
#GCallback for the first signal, followed by data for the first signal,
followed optionally by more signal spec/callback/data triples,
followed by %NULL
Sets the maximal number of unused threads to @max_threads. If
@max_threads is -1, no limit is imposed on the number of unused
threads.
maximal number of unused threads
Adds a weak reference callback to an object. Weak references are
used for notification when an object is finalized. They are called
"weak references" because they allow you to safely hold a pointer
to an object without calling g_object_ref() (g_object_ref() adds a
strong reference, that is, forces the object to stay alive).
#GObject to reference weakly
callback to invoke before the object is freed
extra data to pass to notify
Computes the checksum of a string.
a #GChecksumType
the string to compute the checksum of
the length of the string, or -1 if the string is null-terminated.
the checksum as a hexadecimal string. The returned string
should be freed with g_free() when done using it.
Since: 2.16
Frees the memory allocated for the #GRand.
a #GRand.
Internal function for gtester to decode test log messages, no ABI guarantees provided.
Adds the options specified in @entries to @group.
Since: 2.6
a #GOptionGroup
a %NULL-terminated array of #GOptionEntry<!-- -->s
Increases the freeze count on @object. If the freeze count is
non-zero, the emission of "notify" signals on @object is
stopped. The signals are queued until the freeze count is decreased
to zero.
This is necessary for accessors that modify multiple properties to prevent
premature notification while the object is still being modified.
a #GObject
Sets a list of group names for the item with URI @uri. Each previously
set group name list is removed.
If @uri cannot be found then an item for it is created.
Since: 2.12
a #GBookmarkFile
an item's URI
an array of group names, or %NULL to remove all groups
number of group name values in @groups
Return value: Whether the channel will be closed on the final unref of
a #GIOChannel.
Whether the channel will be closed on the final unref of
the GIOChannel data structure.
Gets the number of nodes in a tree.
a #GNode
which types of children are to be counted, one of
%G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
the number of nodes in the tree
Increases the reference count on a source by one.
a #GSource
@source
Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:
<programlisting>
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
</programlisting>
Common schemes include "file", "http", "svn+ssh", etc.
a valid URI.
The "Scheme" component of the URI, or %NULL on error.
The returned string should be freed when no longer needed.
Since: 2.16
Classifies a Unicode character by type.
a Unicode character
the type of the character.
Searches the string @haystack for the last occurrence
of the string @needle.
a nul-terminated string.
the nul-terminated string to search for.
a pointer to the found occurrence, or
%NULL if not found.
Returns: #GRegex object used in @match_info
a #GMatchInfo
#GRegex object used in @match_info
Since: 2.14
Calls @func for each item in the range (@begin, @end) passing
@user_data to the function.
Since: 2.14
a #GSequenceIter
a #GSequenceIter
a #GFunc
user data passed to @func
Increments the reference count of @pspec.
a valid #GParamSpec
the #GParamSpec that was passed into this function
Tries to become the owner of the specified context,
as with g_main_context_acquire(). But if another thread
is the owner, atomically drop @mutex and wait on @cond until
that owner releases ownership or until @cond is signaled, then
try again (once) to become the owner.
a #GMainContext
a condition variable
a mutex, currently held
%TRUE if the operation succeeded, and
this thread is now the owner of @context.
Call @thread_func on all existing #GThread structures. Note that
threads may decide to exit while @thread_func is running, so
without intimate knowledge about the lifetime of foreign threads,
@thread_func shouldn't access the GThread* pointer passed in as
first argument. However, @thread_func will not be called for threads
which are known to have exited already.
Due to thread lifetime checks, this function has an execution complexity
which is quadratic in the number of existing threads.
Since: 2.10
function to call for all GThread structures
second argument to @thread_func
Places a comment above @key from @group_name.
If @key is %NULL then @comment will be written above @group_name.
If both @key and @group_name are %NULL, then @comment will be
written above the first group in the file.
a #GKeyFile
a group name, or %NULL
a key
a comment
return location for a #GError
%TRUE if the comment was written, %FALSE otherwise
Since: 2.6
the quark used as %G_IO_CHANNEL_ERROR
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter denotes an enumeration type..
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the enumeration parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Returns: whether @handler_id identifies a handler connected to @instance.
The instance where a signal handler is sought.
the handler id.
whether @handler_id identifies a handler connected to @instance.
Creates a new #GParamSpecBoolean instance specifying a %G_TYPE_BOOLEAN
property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Private helper function to aid implementation of the G_TYPE_CHECK_INSTANCE()
macro.
@Returns: #TRUE if @instance is valid, #FALSE otherwise.
A valid #GTypeInstance structure.
Adds a #GOptionGroup to the @context, so that parsing with @context
will recognize the options in the group. Note that the group will
be freed together with the context when g_option_context_free() is
called, so you must not free the group yourself after adding it
to a context.
Since: 2.6
a #GOptionContext
the group to add
Creates a new %G_TYPE_POINTER derived type id for a new
pointer type with name @name.
the name of the new pointer type.
a new %G_TYPE_POINTER derived type id for @name.
Creates a new #GHashTable like g_hash_table_new() with a reference count
of 1 and allows to specify functions to free the memory allocated for the
key and value that get called when removing the entry from the #GHashTable.
a function to create a hash value from a key.
a function to check two keys for equality.
a function to free the memory allocated for the key
used when removing the entry from the #GHashTable or %NULL if you
don't want to supply such a function.
a function to free the memory allocated for the
value used when removing the entry from the #GHashTable or %NULL if
you don't want to supply such a function.
a new #GHashTable.
Calls the given function for each key/value pair in the #GHashTable.
If the function returns %TRUE, then the key/value pair is removed from the
#GHashTable. If you supplied key or value destroy functions when creating
the #GHashTable, they are used to free the memory allocated for the removed
keys and values.
See #GHashTableIter for an alternative way to loop over the
key/value pairs in the hash table.
a #GHashTable.
the function to call for each key/value pair.
user data to pass to the function.
the number of key/value pairs removed.
Creates a new random number generator initialized with @seed.
an array of seeds to initialize the random number generator.
an array of seeds to initialize the random number generator.
the new #GRand.
Since: 2.4
Return value: a newly-allocated %NULL-terminated array of strings.
a #GKeyFile
return location for the number of returned groups, or %NULL
a newly-allocated %NULL-terminated array of strings.
Use g_strfreev() to free it.
Since: 2.6
Get the toplevel test suite for the test path API.
the toplevel #GTestSuite
Since: 2.16
Converts a Unicode character into UTF-8, and prepends it
to the string.
a #GString
a Unicode character
@string
Initializes the random number generator by an array of
longs. Array can be of arbitrary size, though only the
first 624 values are taken. This function is useful
if you have many low entropy seeds, or if you require more then
32bits of actual entropy for your application.
Since: 2.4
a #GRand.
array to initialize with
length of array
Scans for a match in @string for @pattern.
This function is equivalent to g_regex_match() but it does not
require to compile the pattern with g_regex_new(), avoiding some
lines of code when you need just to do a match without extracting
substrings, capture counts, and so on.
If this function is to be called on the same @pattern more than
once, it's more efficient to compile the pattern once with
g_regex_new() and then use g_regex_match().
the regular expression
the string to scan for matches
compile options for the regular expression, or 0
match options, or 0
%TRUE if the string matched, %FALSE otherwise
Since: 2.14
Set the contents of a %G_TYPE_ENUM #GValue to @v_enum.
a valid #GValue whose type is derived from %G_TYPE_ENUM
enum value to be set
Gets back user data pointers stored via g_param_spec_set_qdata()
and removes the @data from @pspec without invoking it's destroy()
function (if any was set). Usually, calling this function is only
required to update user data pointers with a destroy notifier.
the #GParamSpec to get a stored user data pointer from
a #GQuark, naming the user data pointer
the user data pointer set, or %NULL
Takes over the initial ownership of a closure. Each closure is
initially created in a <firstterm>floating</firstterm> state, which
means that the initial reference count is not owned by any caller.
g_closure_sink() checks to see if the object is still floating, and
if so, unsets the floating state and decreases the reference
count. If the closure is not floating, g_closure_sink() does
nothing. The reason for the existance of the floating state is to
prevent cumbersome code sequences like:
|[
closure = g_cclosure_new (cb_func, cb_data);
g_source_set_closure (source, closure);
g_closure_unref (closure); // XXX GObject doesn't really need this
]|
Because g_source_set_closure() (and similar functions) take ownership of the
initial reference count, if it is unowned, we instead can write:
|[
g_source_set_closure (source, g_cclosure_new (cb_func, cb_data));
]|
Generally, this function is used together with g_closure_ref(). Ane example
of storing a closure for later notification looks like:
|[
static GClosure *notify_closure = NULL;
void
foo_notify_set_closure (GClosure *closure)
{
if (notify_closure)
g_closure_unref (notify_closure);
notify_closure = closure;
if (notify_closure)
{
g_closure_ref (notify_closure);
g_closure_sink (notify_closure);
}
}
]|
Because g_closure_sink() may decrement the reference count of a closure
(if it hasn't been called on @closure yet) just like g_closure_unref(),
g_closure_ref() should be called prior to this function.
#GClosure to decrement the initial reference count on, if it's
still being held
Get the contents of a %G_TYPE_GTYPE #GValue.
Since: 2.12
a valid #GValue of type %G_TYPE_GTYPE
the #GType stored in @value
Internal function for gtester to free test log messages, no ABI guarantees provided.
Return value: a newly allocated string or %NULL if the specified
a #GKeyFile
a group name
a key
return location for a #GError, or %NULL
a newly allocated string or %NULL if the specified
key cannot be found.
Since: 2.6
Removes a file descriptor from the set of file descriptors polled for
this source.
a #GSource
a #GPollFD structure previously passed to g_source_add_poll().
Using the standard algorithm for regular expression matching only
the longest match in the string is retrieved, it is not possibile
to obtain all the available matches. For instance matching
"<a> <b> <c>" against the pattern "<.*>"
you get "<a> <b> <c>".
This function uses a different algorithm (called DFA, i.e. deterministic
finite automaton), so it can retrieve all the possible matches, all
starting at the same point in the string. For instance matching
"<a> <b> <c>" against the pattern "<.*>"
you would obtain three matches: "<a> <b> <c>",
"<a> <b>" and "<a>".
The number of matched strings is retrieved using
g_match_info_get_match_count(). To obtain the matched strings and
their position you can use, respectively, g_match_info_fetch() and
g_match_info_fetch_pos(). Note that the strings are returned in
reverse order of length; that is, the longest matching string is
given first.
Note that the DFA algorithm is slower than the standard one and it
is not able to capture substrings, so backreferences do not work.
Setting @start_position differs from just passing over a shortened
string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
that begins with any kind of lookbehind assertion, such as "\b".
A #GMatchInfo structure, used to get information on the match, is
stored in @match_info if not %NULL. Note that if @match_info is
not %NULL then it is created even if the function returns %FALSE,
i.e. you must free it regardless if regular expression actually
matched.
a #GRegex structure from g_regex_new()
the string to scan for matches
the length of @string, or -1 if @string is nul-terminated
starting index of the string to match
match options
pointer to location where to store the #GMatchInfo,
or %NULL if you do not need it
location to store the error occuring, or %NULL to ignore errors
%TRUE is the string matched, %FALSE otherwise
Since: 2.14
Gets the real name of the user. This usually comes from the user's entry
in the <filename>passwd</filename> file. The encoding of the returned
string is system-defined. (On Windows, it is, however, always UTF-8.)
If the real user name cannot be determined, the string "Unknown" is
returned.
the user's real name.
Frees a %NULL-terminated array of strings, and the array itself.
If called on a %NULL value, g_strfreev() simply returns.
a %NULL-terminated array of strings to free.
Converts a string from one character set to another, possibly
including fallback sequences for characters not representable
in the output. Note that it is not guaranteed that the specification
for the fallback sequences in @fallback will be honored. Some
systems may do an approximate conversion from @from_codeset
to @to_codeset in their iconv() functions,
in which case GLib will simply return that approximate conversion.
Note that you should use g_iconv() for streaming
conversions<footnoteref linkend="streaming-state"/>.
the string to convert
the length of the string, or -1 if the string is
nul-terminated<footnoteref linkend="nul-unsafe"/>.
name of character set into which to convert @str
character set of @str.
UTF-8 string to use in place of character not
present in the target encoding. (The string must be
representable in the target encoding).
If %NULL, characters not in the target encoding will
be represented as Unicode escapes \uxxxx or \Uxxxxyyyy.
location to store the number of bytes in the
input string that were successfully converted, or %NULL.
Even if the conversion was successful, this may be
less than @len if there were partial characters
at the end of the input.
the number of bytes stored in the output buffer (not
including the terminating nul).
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError may occur.
If the conversion was successful, a newly allocated
nul-terminated string, which must be freed with
g_free(). Otherwise %NULL and @error will be set.
Adds a byte onto the end of a #GString, expanding
it if necessary.
a #GString
the byte to append onto the end of @string
@string
Removes a weak reference callback to an object.
#GObject to remove a weak reference from
callback to search for
data to search for
An implementation of the standard printf() function which supports
positional parameters, as specified in the Single Unix Specification.
a standard printf() format string, but notice
<link linkend="string-precision">string precision pitfalls</link>.
the arguments to insert in the output.
the number of bytes printed.
Since: 2.2
Set the pointer at the specified location to %NULL.
the memory address of the pointer.
Converts a string to a #gdouble value.
This function behaves like the standard strtod() function
does in the C locale. It does this without actually changing
the current locale, since that would not be thread-safe.
A limitation of the implementation is that this function
will still accept localized versions of infinities and NANs.
This function is typically used when reading configuration
files or other non-user input that should be locale independent.
To handle input from the user you should normally use the
locale-sensitive system strtod() function.
To convert from a #gdouble to a string in a locale-insensitive
way, use g_ascii_dtostr().
If the correct value would cause overflow, plus or minus %HUGE_VAL
is returned (according to the sign of the value), and %ERANGE is
stored in %errno. If the correct value would cause underflow,
zero is returned and %ERANGE is stored in %errno.
This function resets %errno before calling strtod() so that
you can reliably detect overflow and underflow.
the string to convert to a numeric value.
if non-%NULL, it returns the character after
the last character used in the conversion.
the #gdouble value.
Set the contents of a %G_TYPE_ULONG #GValue to @v_ulong.
a valid #GValue of type %G_TYPE_ULONG
unsigned long integer value to be set
Gets the depth of a #GNode.
If @node is %NULL the depth is 0. The root node has a depth of 1.
For the children of the root node the depth is 2. And so on.
a #GNode
the depth of the #GNode
Returns: a pointer into @file_name after the root component.
a file name.
a pointer into @file_name after the root component.
Adds the static @interface_type to @instantiable_type. The information
contained in the #GTypeInterfaceInfo structure pointed to by @info
is used to manage the relationship.
#GType value of an instantiable type.
#GType value of an interface type.
The #GInterfaceInfo structure for this
(@instance_type, @interface_type) combination.
Return value: the length of the string in characters
pointer to the start of a UTF-8 encoded string.
the maximum number of bytes to examine. If @max
is less than 0, then the string is assumed to be
nul-terminated. If @max is 0, @p will not be examined and
may be %NULL.
the length of the string in characters
Same as the standard UNIX routine iconv(), but
may be implemented via libiconv on UNIX flavors that lack
a native implementation.
GLib provides g_convert() and g_locale_to_utf8() which are likely
more convenient than the raw iconv wrappers.
conversion descriptor from g_iconv_open()
bytes to convert
inout parameter, bytes remaining to convert in @inbuf
converted output bytes
inout parameter, bytes available to fill in @outbuf
count of non-reversible conversions, or -1 on error
Dispatches all pending sources.
a #GMainContext
Swaps the items pointed to by @a and @b. It is allowed for @a and @b
to point into difference sequences.
Since: 2.14
a #GSequenceIter
a #GSequenceIter
Determines the numeric value of a character as a hexidecimal
digit.
a Unicode character
If @c is a hex digit (according to
g_unichar_isxdigit()), its numeric value. Otherwise, -1.
Gets the position of a #GNode with respect to its siblings.
@child must be a child of @node. The first child is numbered 0,
the second 1, and so on.
a #GNode
a child of @node
the position of @child with respect to its siblings
Sets a property on an object.
a #GObject
the name of the property to set
the value
Calls a function for each element of a #GList.
a #GList
the function to call with each element's data
user data to pass to the function
Remove all elemeents in @queue which contains @data.
Since: 2.4
a #GQueue
data to remove
Gets a child of a #GNode, using the given index.
The first child is at index 0. If the index is
too big, %NULL is returned.
a #GNode
the index of the desired child
the child of @node at index @n
Inserts @data into @queue using @func to determine the new
position.
This function requires that the @queue is sorted before pushing on
new elements.
This function is called while holding the @queue's lock.
For an example of @func see g_async_queue_sort().
Since: 2.10
a #GAsyncQueue
the @data to push into the @queue
the #GCompareDataFunc is used to sort @queue. This function
is passed two elements of the @queue. The function should return
0 if they are equal, a negative value if the first element
should be higher in the @queue or a positive value if the first
element should be lower in the @queue than the second element.
user data passed to @func.
Enables or disables automatic generation of <option>--help</option>
output. By default, g_option_context_parse() recognizes
<option>--help</option>, <option>-?</option>, <option>--help-all</option>
and <option>--help-</option><replaceable>groupname</replaceable> and creates
suitable output to stdout.
Since: 2.6
a #GOptionContext
%TRUE to enable <option>--help</option>, %FALSE to disable it
Adds a new element on to the end of the list.
<note><para>
The return value is the new start of the list, which
may have changed, so make sure you store the new value.
</para></note>
<note><para>
Note that g_list_append() has to traverse the entire list
to find the end, which is inefficient when adding multiple
elements. A common idiom to avoid the inefficiency is to prepend
the elements and reverse the list when all elements have been added.
</para></note>
|[
/* Notice that these are initialized to the empty list. */
GList *list = NULL, *number_list = NULL;
/* This is a list of strings. */
list = g_list_append (list, "first");
list = g_list_append (list, "second");
/* This is a list of integers. */
number_list = g_list_append (number_list, GINT_TO_POINTER (27));
number_list = g_list_append (number_list, GINT_TO_POINTER (14));
]|
a pointer to a #GList
the data for the new element
the new start of the #GList
Find the rightmost occurrence of the given Unicode character
in a UTF-8 encoded string, while limiting the search to @len bytes.
If @len is -1, allow unbounded search.
a nul-terminated UTF-8 encoded string
the maximum length of @p
a Unicode character
%NULL if the string does not contain the character,
otherwise, a pointer to the start of the rightmost occurrence of the
character in the string.
Removes the node link_ from the list and frees it.
Compare this to g_slist_remove_link() which removes the node
without freeing it.
a #GSList
node to delete
the new head of @list
Frees a #GKeyFile.
Since: 2.6
a #GKeyFile
Calls the given function for each node in the #GTree.
Deprecated:2.2: The order of a balanced tree is somewhat arbitrary. If you
just want to visit all nodes in sorted order, use g_tree_foreach()
instead. If you really need to visit nodes in a different order, consider
using an <link linkend="glib-N-ary-Trees">N-ary Tree</link>.
a #GTree.
the function to call for each node visited. If this
function returns %TRUE, the traversal is stopped.
the order in which nodes are visited, one of %G_IN_ORDER,
%G_PRE_ORDER and %G_POST_ORDER.
user data to pass to the function.
Gets the number of elements in a #GSList.
<note><para>
This function iterates over the whole list to
count its elements.
</para></note>
a #GSList
the number of elements in the #GSList
Frees the memory allocated for @checksum.
Since: 2.16
a #GChecksum
Overwrites part of a string, lengthening it if necessary.
a #GString
the position at which to start overwriting
the string that will overwrite the @string starting at @pos
@string
Since: 2.14
Insert a copy of @value as first element of @value_array.
#GValueArray to add an element to
#GValue to copy into #GValueArray
the #GValueArray passed in as @value_array
Temporarily redirects markup data to a sub-parser.
This function may only be called from the start_element handler of
a #GMarkupParser. It must be matched with a corresponding call to
g_markup_parse_context_pop() in the matching end_element handler
(except in the case that the parser aborts due to an error).
All tags, text and other data between the matching tags is
redirected to the subparser given by @parser. @user_data is used
as the user_data for that parser. @user_data is also passed to the
error callback in the event that an error occurs. This includes
errors that occur in subparsers of the subparser.
The end tag matching the start tag for which this call was made is
handled by the previous parser (which is given its own user_data)
which is why g_markup_parse_context_pop() is provided to allow "one
last access" to the @user_data provided to this function. In the
case of error, the @user_data provided here is passed directly to
the error callback of the subparser and g_markup_parse_context()
should not be called. In either case, if @user_data was allocated
then it ought to be freed from both of these locations.
This function is not intended to be directly called by users
interested in invoking subparsers. Instead, it is intended to be
used by the subparsers themselves to implement a higher-level
interface.
As an example, see the following implementation of a simple
parser that counts the number of tags encountered.
|[
typedef struct
{
gint tag_count;
} CounterData;
static void
counter_start_element (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
GError **error)
{
CounterData *data = user_data;
data->tag_count++;
}
static void
counter_error (GMarkupParseContext *context,
GError *error,
gpointer user_data)
{
CounterData *data = user_data;
g_slice_free (CounterData, data);
}
static GMarkupParser counter_subparser =
{
counter_start_element,
NULL,
NULL,
NULL,
counter_error
};
]|
In order to allow this parser to be easily used as a subparser, the
following interface is provided:
|[
void
start_counting (GMarkupParseContext *context)
{
CounterData *data = g_slice_new (CounterData);
data->tag_count = 0;
g_markup_parse_context_push (context, &counter_subparser, data);
}
gint
end_counting (GMarkupParseContext *context)
{
CounterData *data = g_markup_parse_context_pop (context);
int result;
result = data->tag_count;
g_slice_free (CounterData, data);
return result;
}
]|
The subparser would then be used as follows:
|[
static void start_element (context, element_name, ...)
{
if (strcmp (element_name, "count-these") == 0)
start_counting (context);
/* else, handle other tags... */
}
static void end_element (context, element_name, ...)
{
if (strcmp (element_name, "count-these") == 0)
g_print ("Counted %d tags\n", end_counting (context));
/* else, handle other tags... */
}
]|
Since: 2.18
a #GMarkupParseContext
a #GMarkupParser
user data to pass to #GMarkupParser functions
Return value: A random number.
a #GRand.
lower closed bound of the interval.
upper open bound of the interval.
A random number.
Quotes a string so that the shell (/bin/sh) will interpret the
quoted string to mean @unquoted_string. If you pass a filename to
the shell, for example, you should first quote it with this
function. The return value must be freed with g_free(). The
quoting style used is undefined (single or double quotes may be
used).
a literal string
quoted string
Return a name for the machine.
The returned name is not necessarily a fully-qualified domain name,
or even present in DNS or some other name service at all. It need
not even be unique on your local network or site, but usually it
is. Callers should not rely on the return value having any specific
properties like uniqueness for security purposes. Even if the name
of the machine is changed while an application is running, the
return value from this function does not change. The returned
string is owned by GLib and should not be modified or freed. If no
name can be determined, a default fixed string "localhost" is
returned.
the host name of the machine.
Since: 2.8
Gets the pattern string associated with @regex, i.e. a copy of
the string passed to g_regex_new().
a #GRegex structure
the pattern of @regex
Since: 2.14
Gets the "current time" to be used when checking
this source. The advantage of calling this function over
calling g_get_current_time() directly is that when
checking multiple sources, GLib can cache a single value
instead of having to repeatedly get the system time.
a #GSource
#GTimeVal structure in which to store current time.
Pushes the @data into the @queue. @data must not be %NULL. This
function must be called while holding the @queue's lock.
a #GAsyncQueue.
@data to push into the @queue.
Blocks a handler of an instance so it will not be called during any
signal emissions unless it is unblocked again. Thus "blocking" a
signal handler means to temporarily deactive it, a signal handler
has to be unblocked exactly the same amount of times it has been
blocked before to become active again.
The @handler_id has to be a valid signal handler id, connected to a
signal of @instance.
The instance to block the signal handler of.
Handler id of the handler to be blocked.
Returns: the number of the highest back reference
a #GRegex
the number of the highest back reference
Since: 2.14
Gets the maximum height of all branches beneath a #GNode.
This is the maximum distance from the #GNode to all leaf nodes.
If @root is %NULL, 0 is returned. If @root has no children,
1 is returned. If @root has children, 2 is returned. And so on.
a #GNode
the maximum height of the tree beneath @root
Initializes a #GIOChannel struct.
This is called by each of the above functions when creating a
#GIOChannel, and so is not often needed by the application
programmer (unless you are creating a new type of #GIOChannel).
a #GIOChannel
Find the next conversion in a printf-style format string.
Partially based on code from printf-parser.c,
Copyright (C) 1999-2000, 2002-2003 Free Software Foundation, Inc.
a printf-style format string
location to store a pointer to the character after
the returned conversion. On a %NULL return, returns the
pointer to the trailing NUL in the string
pointer to the next conversion in @format,
or %NULL, if none.
Prior to any use of the type system, g_type_init() has to be called
to initialize the type system and assorted other code portions
(such as the various fundamental type implementations or the signal
system).
Return value: the last link in @queue, or %NULL if @queue is empty
a #GQueue
the last link in @queue, or %NULL if @queue is empty
Since: 2.4
Creates a path from a series of elements using @separator as the
separator between elements. At the boundary between two elements,
any trailing occurrences of separator in the first element, or
leading occurrences of separator in the second element are removed
and exactly one copy of the separator is inserted.
Empty elements are ignored.
The number of leading copies of the separator on the result is
the same as the number of leading copies of the separator on
the first non-empty element.
The number of trailing copies of the separator on the result is
the same as the number of trailing copies of the separator on
the last non-empty element. (Determination of the number of
trailing copies is done without stripping leading copies, so
if the separator is <literal>ABA</literal>, <literal>ABABA</literal>
has 1 trailing copy.)
However, if there is only a single non-empty element, and there
are no characters in that element not part of the leading or
trailing separators, then the result is exactly the original value
of that element.
Other than for determination of the number of leading and trailing
copies of the separator, elements consisting only of copies
of the separator are ignored.
a string used to separator the elements of the path.
the first element in the path
remaining elements in path, terminated by %NULL
a newly-allocated string that must be freed with g_free().
Gets back user data pointers stored via g_param_spec_set_qdata().
a valid #GParamSpec
a #GQuark, naming the user data pointer
the user data pointer set, or %NULL
Return the value contents as pointer. This function asserts that
g_value_fits_pointer() returned %TRUE for the passed in value.
This is an internal function introduced mainly for C marshallers.
An initialized #GValue structure.
%TRUE if @value will fit inside a pointer value.
Determines the numeric value of a character as a hexidecimal
digit. Differs from g_unichar_xdigit_value() because it takes
a char, so there's no worry about sign extension if characters
are signed.
an ASCII character.
If @c is a hex digit (according to
g_ascii_isxdigit()), its numeric value. Otherwise, -1.
Registers @name as the name of a new static type derived from
#G_TYPE_PARAM. The type system uses the information contained in
the #GParamSpecTypeInfo structure pointed to by @info to manage the
#GParamSpec type and its instances.
0-terminated string used as the name of the new #GParamSpec type.
The #GParamSpecTypeInfo for this #GParamSpec type.
The new type identifier.
Retrieves the description of the bookmark for @uri.
In the event the URI cannot be found, %NULL is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
a #GBookmarkFile
a valid URI
return location for a #GError, or %NULL
a newly allocated string or %NULL if the specified
URI cannot be found.
Since: 2.12
Frees the memory allocated for @seq. If @seq has a data destroy
function associated with it, that function is called on all items in
@seq.
Since: 2.14
a #GSequence
A case-insensitive string comparison, corresponding to the standard
strcasecmp() function on platforms which support it.
a string.
a string to compare with @s1.
0 if the strings match, a negative value if @s1 < @s2,
or a positive value if @s1 > @s2.
Deprecated:2.2: See g_strncasecmp() for a discussion of why this function
is deprecated and how to replace it.
Sets properties on an object.
a #GObject
name of the first property to set
value for the first property, followed optionally by more
name/value pairs, followed by %NULL
An implementation of the standard sprintf() function which supports
positional parameters, as specified in the Single Unix Specification.
A pointer to a memory buffer to contain the resulting string. It
is up to the caller to ensure that the allocated buffer is large
enough to hold the formatted result
a standard printf() format string, but notice
<link linkend="string-precision">string precision pitfalls</link>.
the arguments to insert in the output.
the number of bytes printed.
Since: 2.2
Searches the string @haystack for the first occurrence
of the string @needle, limiting the length of the search
to @haystack_len.
a string.
the maximum length of @haystack. Note that -1 is
a valid length, if @haystack is nul-terminated, meaning it will
search through the whole string.
the string to search for.
a pointer to the found occurrence, or
%NULL if not found.
Sets the priority of a source. While the main loop is being
run, a source will be dispatched if it is ready to be dispatched and no sources
at a higher (numerically smaller) priority are ready to be dispatched.
a #GSource
the new priority.
Breaks the string on the pattern, and returns an array of
the tokens. If the pattern contains capturing parentheses,
then the text for each of the substrings will also be returned.
If the pattern does not match anywhere in the string, then the
whole string is returned as the first token.
This function is equivalent to g_regex_split() but it does
not require to compile the pattern with g_regex_new(), avoiding
some lines of code when you need just to do a split without
extracting substrings, capture counts, and so on.
If this function is to be called on the same @pattern more than
once, it's more efficient to compile the pattern once with
g_regex_new() and then use g_regex_split().
As a special case, the result of splitting the empty string ""
is an empty vector, not a vector containing a single string.
The reason for this special case is that being able to represent
a empty vector is typically more useful than consistent handling
of empty elements. If you do need to represent empty elements,
you'll need to check for the empty string before calling this
function.
A pattern that can match empty strings splits @string into
separate characters wherever it matches the empty string between
characters. For example splitting "ab c" using as a separator
"\s*", you will get "a", "b" and "c".
the regular expression
the string to scan for matches
compile options for the regular expression, or 0
match options, or 0
a %NULL-terminated array of strings. Free it using g_strfreev()
Since: 2.14
Gets the digest from @checksum as a raw binary vector and places it
into @buffer. The size of the digest depends on the type of checksum.
Once this function has been called, the #GChecksum is closed and can
no longer be updated with g_checksum_update().
Since: 2.16
a #GChecksum
output buffer
an inout parameter. The caller initializes it to the size of @buffer.
After the call it contains the length of the digest.
Report the result of a performance or measurement test.
The test should generally strive to minimize the reported
quantities (smaller values are better than larger ones),
this and @minimized_quantity can determine sorting
order for test result reports.
Since: 2.16
the reported value
the format string of the report message
arguments to pass to the printf() function
Similar to g_type_init(), but additionally sets debug flags.
Bitwise combination of #GTypeDebugFlags values for
debugging purposes.
Determines whether a character is a control character.
Given some UTF-8 text, obtain a character value with
g_utf8_get_char().
a Unicode character
%TRUE if @c is a control character
Set the contents of a %G_TYPE_OBJECT derived #GValue to @v_object.
g_value_set_object() increases the reference count of @v_object
(the #GValue holds a reference to @v_object). If you do not wish
to increase the reference count of the object (i.e. you wish to
pass your current reference to the #GValue because you no longer
need it), use g_value_take_object() instead.
It is important that your #GValue holds a reference to @v_object (either its
own, or one it has taken) to ensure that the object won't be destroyed while
the #GValue still exists).
a valid #GValue of %G_TYPE_OBJECT derived type
object value to be set
A case-insensitive string comparison, corresponding to the standard
strncasecmp() function on platforms which support it.
It is similar to g_strcasecmp() except it only compares the first @n
characters of the strings.
a string.
a string to compare with @s1.
the maximum number of characters to compare.
0 if the strings match, a negative value if @s1 < @s2,
or a positive value if @s1 > @s2.
Deprecated:2.2: The problem with g_strncasecmp() is that it does the
comparison by calling toupper()/tolower(). These functions are
locale-specific and operate on single bytes. However, it is impossible
to handle things correctly from an I18N standpoint by operating on
bytes, since characters may be multibyte. Thus g_strncasecmp() is
broken if your string is guaranteed to be ASCII, since it's
locale-sensitive, and it's broken if your string is localized, since
it doesn't work on many encodings at all, including UTF-8, EUC-JP,
etc.
There are therefore two replacement functions: g_ascii_strncasecmp(),
which only works on ASCII and is not locale-sensitive, and
g_utf8_casefold(), which is good for case-insensitive sorting of UTF-8.
Creates a new #GParamSpecFlags instance specifying a %G_TYPE_FLAGS
property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
a #GType derived from %G_TYPE_FLAGS
default value for the property specified
flags for the property specified
a newly created parameter specification
Get the contents of a %G_TYPE_BOOLEAN #GValue.
a valid #GValue of type %G_TYPE_BOOLEAN
boolean contents of @value
Calls @func for each item in the sequence passing @user_data
to the function.
Since: 2.14
a #GSequence
the function to call for each item in @seq
user data passed to @func
Removes all keys and their associated values from a #GHashTable
without calling the key and value destroy functions.
Since: 2.12
a #GHashTable.
Opens a file for writing in the preferred directory for temporary
files (as returned by g_get_tmp_dir()).
@tmpl should be a string in the GLib file name encoding containing
a sequence of six 'X' characters, as the parameter to g_mkstemp().
However, unlike these functions, the template should only be a
basename, no directory components are allowed. If template is
%NULL, a default template is used.
Note that in contrast to g_mkstemp() (and mkstemp())
@tmpl is not modified, and might thus be a read-only literal string.
The actual name used is returned in @name_used if non-%NULL. This
string should be freed with g_free() when not needed any longer.
The returned name is in the GLib file name encoding.
Template for file name, as in g_mkstemp(), basename only,
or %NULL, to a default template
location to store actual name used, or %NULL
return location for a #GError
A file handle (as from open()) to
the file opened for reading and writing. The file is opened in binary
mode on platforms where there is a difference. The file handle should be
closed with close(). In case of errors, -1 is returned
and @error will be set.
Checks wether @object has a <link linkend="floating-ref">floating</link>
reference.
Since: 2.10
a #GObject
%TRUE if @object has a floating reference
Removes file descriptor from the set of file descriptors to be
polled for a particular context.
a #GMainContext
a #GPollFD descriptor previously added with g_main_context_add_poll()
Return value: the ID (greater than 0) for the source
a #GSource
the ID (greater than 0) for the source
Returns: the contents of @file.
a #GMappedFile
the contents of @file.
Since: 2.8
If the interface type @g_type is currently in use, returns its
default interface vtable.
Since: 2.4
an interface type
the default vtable for the interface, or %NULL
if the type is not currently in use.
Compares two #gpointer arguments and returns %TRUE if they are equal.
It can be passed to g_hash_table_new() as the @key_equal_func
parameter, when using pointers as keys in a #GHashTable.
a key.
a key to compare with @v1.
%TRUE if the two keys match.
A more efficient version of g_type_class_peek() which works only for
static types.
Since: 2.4
Type ID of a classed type.
The #GTypeClass structure for the given type ID or %NULL
if the class does not currently exist or is dynamically loaded.
Creates a new #GParamSpecUnichar instance specifying a %G_TYPE_UINT
property. #GValue structures for this property can be accessed with
g_value_set_uint() and g_value_get_uint().
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Creates a new #GParamSpecPoiner instance specifying a pointer property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
flags for the property specified
a newly created parameter specification
Calls a function for each of the children of a #GNode.
Note that it doesn't descend beneath the child nodes.
a #GNode
which types of children are to be visited, one of
%G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
the function to call for each visited node
user data to pass to the function
Gets the number of nodes in a #GTree.
a #GTree.
the number of nodes in the #GTree.
Loads a bookmark file from memory into an empty #GBookmarkFile
structure. If the object cannot be created then @error is set to a
#GBookmarkFileError.
an empty #GBookmarkFile struct
desktop bookmarks loaded in memory
the length of @data in bytes
return location for a #GError, or %NULL
%TRUE if a desktop bookmark could be loaded.
Since: 2.12
Converts an absolute filename to an escaped ASCII-encoded URI, with the path
component following Section 3.3. of RFC 2396.
an absolute filename specified in the GLib file name encoding,
which is the on-disk file name bytes on Unix, and UTF-8 on
Windows
A UTF-8 encoded hostname, or %NULL for none.
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError may occur.
a newly-allocated string holding the resulting
URI, or %NULL on an error.
Sets @value to its default value as specified in @pspec.
a valid #GParamSpec
a #GValue of correct type for @pspec
A convenience function to use gettext() for translating
user-visible strings.
Since: 2.12
a #GOptionContext
the domain to use
The setlocale() function in the Microsoft C library uses locale
names of the form "English_United States.1252" etc. We want the
UNIXish standard form "en_US", "zh_TW" etc. This function gets the
current thread locale from Windows - without any encoding info -
and returns it as a string of the above form for use in forming
file names etc. The returned string should be deallocated with
g_free().
newly-allocated locale name.
If @is_a_type is a derivable type, check whether @type is a
descendant of @is_a_type. If @is_a_type is an interface, check
whether @type conforms to it.
Type to check anchestry for.
Possible anchestor of @type or interface @type could conform to.
%TRUE if @type is_a @is_a_type holds true.
Creates a new #GTree with a comparison function that accepts user data.
See g_tree_new() for more details.
qsort()-style comparison function.
data to pass to comparison function.
a new #GTree.
Return value: the #GSequence that @iter points into.
a #GSequenceIter
the #GSequence that @iter points into.
Since: 2.14
Retrieves the name of the currently open element.
If called from the start_element or end_element handlers this will
give the element_name as passed to those functions. For the parent
elements, see g_markup_parse_context_get_element_stack().
Since: 2.2
a #GMarkupParseContext
the name of the currently open element, or %NULL
Increases the reference count of the object by one and sets a
callback to be called when all other references to the object are
dropped, or when this is already the last reference to the object
and another reference is established.
This functionality is intended for binding @object to a proxy
object managed by another memory manager. This is done with two
paired references: the strong reference added by
g_object_add_toggle_ref() and a reverse reference to the proxy
object which is either a strong reference or weak reference.
The setup is that when there are no other references to @object,
only a weak reference is held in the reverse direction from @object
to the proxy object, but when there are other references held to
@object, a strong reference is held. The @notify callback is called
when the reference from @object to the proxy object should be
<firstterm>toggled</firstterm> from strong to weak (@is_last_ref
true) or weak to strong (@is_last_ref false).
Since a (normal) reference must be held to the object before
calling g_object_toggle_ref(), the initial state of the reverse
link is always strong.
Multiple toggle references may be added to the same gobject,
however if there are multiple toggle references to an object, none
of them will ever be notified until all but one are removed. For
this reason, you should only ever use a toggle reference if there
is important state in the proxy object.
Since: 2.8
a #GObject
a function to call when this reference is the
last reference to the object, or is no longer
the last reference.
data to pass to @notify
Undoes the effect of a previous g_signal_handler_block() call. A
blocked handler is skipped during signal emissions and will not be
invoked, unblocking it (for exactly the amount of times it has been
blocked before) reverts its "blocked" state, so the handler will be
recognized by the signal system and is called upon future or
currently ongoing signal emissions (since the order in which
handlers are called during signal emissions is deterministic,
whether the unblocked handler in question is called as part of a
currently ongoing emission depends on how far that emission has
proceeded yet).
The @handler_id has to be a valid id of a signal handler that is
connected to a signal of @instance and is currently blocked.
The instance to unblock the signal handler of.
Handler id of the handler to be unblocked.
Create a directory if it doesn't already exist. Create intermediate
parent directories as needed, too.
a pathname in the GLib file name encoding
permissions to use for newly created directories
0 if the directory already exists, or was successfully
created. Returns -1 if an error occurred, with errno set.
Since: 2.8
Calls the original class closure of a signal. This function should
only be called from an overridden class closure; see
g_signal_override_class_closure() and
g_signal_override_class_handler().
Since: 2.18
the instance the signal is being emitted on.
parameters to be passed to the parent class closure, followed by a
location for the return value. If the return type of the signal
is #G_TYPE_NONE, the return value location can be omitted.
Inserts a #GParamSpec in the pool.
a #GParamSpecPool.
the #GParamSpec to insert
a #GType identifying the owner of @pspec
Gets the buffer size.
a #GIOChannel
the size of the buffer.
Registers @type_name as the name of a new static type derived from
@parent_type. The value of @flags determines the nature (e.g.
abstract or not) of the type. It works by filling a #GTypeInfo
struct and calling g_type_register_static().
Since: 2.12
Type from which this type will be derived.
0-terminated string used as the name of the new type.
Size of the class structure (see #GTypeInfo)
Location of the class initialization function (see #GTypeInfo)
Size of the instance structure (see #GTypeInfo)
Location of the instance initialization function (see #GTypeInfo)
Bitwise combination of #GTypeFlags values.
The new type identifier.
Creates a new #GParamSpecFloat instance specifying a %G_TYPE_FLOAT property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Copies a @queue. Note that is a shallow copy. If the elements in the
queue consist of pointers to data, the pointers are copied, but the
actual data is not.
a #GQueue
A copy of @queue
Since: 2.4
Sorts @queue using @compare_func.
Since: 2.4
a #GQueue
the #GCompareDataFunc used to sort @queue. This function
is passed two elements of the queue and should return 0 if they are
equal, a negative value if the first comes before the second, and
a positive value if the second comes before the first.
user data passed to @compare_func
Returns: a canonical representation for the string
a static string
a canonical representation for the string
Since: 2.10
Determines if a character is uppercase.
a Unicode character
%TRUE if @c is an uppercase character
Determines the numeric value of a character as a decimal
digit.
a Unicode character
If @c is a decimal digit (according to
g_unichar_isdigit()), its numeric value. Otherwise, -1.
Removes application registered with @name from the list of applications
that have registered a bookmark for @uri inside @bookmark.
In the event the URI cannot be found, %FALSE is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
In the event that no application with name @app_name has registered
a bookmark for @uri, %FALSE is returned and error is set to
#G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED.
a #GBookmarkFile
a valid URI
the name of the application
return location for a #GError or %NULL
%TRUE if the application was successfully removed.
Since: 2.12
Get the contents of a %G_TYPE_INT64 #GValue.
a valid #GValue of type %G_TYPE_INT64
64bit integer contents of @value
Calls a function for each element of a #GPtrArray.
Since: 2.4
a #GPtrArray
the function to call for each array element
user data to pass to the function
Disconnects a handler from an instance so it will not be called during
any future or currently ongoing emissions of the signal it has been
connected to. The @handler_id becomes invalid and may be reused.
The @handler_id has to be a valid signal handler id, connected to a
signal of @instance.
The instance to remove the signal handler from.
Handler id of the handler to be disconnected.
Copies the bytes from a string into a #GString,
destroying any previous contents. It is rather like
the standard strcpy() function, except that you do not
have to worry about having enough space to copy the string.
the destination #GString. Its current contents
are destroyed.
the string to copy into @string
@string
Get the contents of a %G_TYPE_BOXED derived #GValue.
a valid #GValue of %G_TYPE_BOXED derived type
boxed contents of @value
Unescapes a segment of an escaped string.
If any of the characters in @illegal_characters or the character zero appears
as an escaped character in @escaped_string then that is an error and %NULL
will be returned. This is useful it you want to avoid for instance having a
slash being expanded in an escaped path element, which might confuse pathname
handling.
a string.
a string.
an optional string of illegal characters not to be allowed.
an unescaped version of @escaped_string or %NULL on error.
The returned string should be freed when no longer needed.
Since: 2.16
Reads an entire file into allocated memory, with good error
checking.
If the call was successful, it returns %TRUE and sets @contents to the file
contents and @length to the length of the file contents in bytes. The string
stored in @contents will be nul-terminated, so for text files you can pass
%NULL for the @length argument. If the call was not successful, it returns
%FALSE and sets @error. The error domain is #G_FILE_ERROR. Possible error
codes are those in the #GFileError enumeration. In the error case,
@contents is set to %NULL and @length is set to zero.
name of a file to read contents from, in the GLib file name encoding
location to store an allocated string
location to store length in bytes of the contents, or %NULL
return location for a #GError, or %NULL
%TRUE on success, %FALSE if an error occurred
Return value: the number of currently unused threads
the number of currently unused threads
Cuts off the end of the GString, leaving the first @len bytes.
a #GString
the new size of @string
@string
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gchar arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gchar parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Associates a new string value with @key under @group_name.
If @key cannot be found then it is created.
If @group_name cannot be found then it is created.
Since: 2.6
a #GKeyFile
a group name
a key
a string
Return value: the values associated with the key as a list of
a #GKeyFile
a group name
a key
the number of booleans returned
return location for a #GError
the values associated with the key as a list of
booleans, or %NULL if the key was not found or could not be parsed.
Since: 2.6
A wrapper for the stdio fopen() function. The fopen() function
opens a file and associates a new stream with it.
Because file descriptors are specific to the C library on Windows,
and a file descriptor is partof the <type>FILE</type> struct, the
<type>FILE</type> pointer returned by this function makes sense
only to functions in the same C library. Thus if the GLib-using
code uses a different C library than GLib does, the
<type>FILE</type> pointer returned by this function cannot be
passed to C library functions like fprintf() or fread().
See your C library manual for more details about fopen().
a pathname in the GLib file name encoding (UTF-8 on Windows)
a string describing the mode in which the file should be
opened
A <type>FILE</type> pointer if the file was successfully
opened, or %NULL if an error occurred
Since: 2.6
Adds the second #GList onto the end of the first #GList.
Note that the elements of the second #GList are not copied.
They are used directly.
a #GList
the #GList to add to the end of the first #GList
the start of the new #GList
Create a new test case, similar to g_test_create_case(). However
the test is assumed to use no fixture, and test suites are automatically
created on the fly and added to the root fixture, based on the
slash-separated portions of @testpath.
Since: 2.16
Slash-separated test case path name for the test.
The test function to invoke for this test.
Removes an element from a #GList, without freeing the element.
The removed element's prev and next links are set to %NULL, so
that it becomes a self-contained list with one element.
a #GList
an element in the #GList
the new start of the #GList, without the element
Retrieves the position of the capturing parentheses named @name.
If @name is a valid sub pattern name but it didn't match anything
(e.g. sub pattern "X", matching "b" against "(?P<X>a)?b")
then @start_pos and @end_pos are set to -1 and %TRUE is returned.
#GMatchInfo structure
name of the subexpression
pointer to location where to store the start position
pointer to location where to store the end position
%TRUE if the position was fetched, %FALSE otherwise. If
the position cannot be fetched, @start_pos and @end_pos are left
unchanged
Since: 2.14
Removes a #GParamSpec from the pool.
a #GParamSpecPool
the #GParamSpec to remove
Create a new #GTestCase, named @test_name, this API is fairly
low level, calling g_test_add() or g_test_add_func() is preferable.
When this test is executed, a fixture structure of size @data_size
will be allocated and filled with 0s. Then data_setup() is called
to initialize the fixture. After fixture setup, the actual test
function data_test() is called. Once the test run completed, the
fixture structure is torn down by calling data_teardown() and
after that the memory is released.
Splitting up a test run into fixture setup, test function and
fixture teardown is most usful if the same fixture is used for
multiple tests. In this cases, g_test_create_case() will be
called with the same fixture, but varying @test_name and
@data_test arguments.
the name for the test case
the size of the fixture data structure
test data argument for the test functions
the function to set up the fixture data
the actual test function
the function to teardown the fixture data
a newly allocated #GTestCase.
Since: 2.16
Internal function for gtester to decode test log messages, no ABI guarantees provided.
This function is meant to be called from the complete_type_info()
function of a #GTypePlugin implementation, see the example for
g_enum_complete_type_info() above.
the type identifier of the type being completed
the #GTypeInfo struct to be filled in
An array of #GFlagsValue structs for the possible
enumeration values. The array is terminated by a struct with all
members being 0.
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, guint arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #guint parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Breaks the string on the pattern, and returns an array of the tokens.
If the pattern contains capturing parentheses, then the text for each
of the substrings will also be returned. If the pattern does not match
anywhere in the string, then the whole string is returned as the first
token.
As a special case, the result of splitting the empty string "" is an
empty vector, not a vector containing a single string. The reason for
this special case is that being able to represent a empty vector is
typically more useful than consistent handling of empty elements. If
you do need to represent empty elements, you'll need to check for the
empty string before calling this function.
A pattern that can match empty strings splits @string into separate
characters wherever it matches the empty string between characters.
For example splitting "ab c" using as a separator "\s*", you will get
"a", "b" and "c".
a #GRegex structure
the string to split with the pattern
match time option flags
a %NULL-terminated gchar ** array. Free it using g_strfreev()
Since: 2.14
Removes a comment above @key from @group_name.
If @key is %NULL then @comment will be removed above @group_name.
If both @key and @group_name are %NULL, then @comment will
be removed above the first group in the file.
a #GKeyFile
a group name, or %NULL
a key
return location for a #GError
%TRUE if the comment was removed, %FALSE otherwise
Since: 2.6
Maps a file into memory. On UNIX, this is using the mmap() function.
If @writable is %TRUE, the mapped buffer may be modified, otherwise
it is an error to modify the mapped buffer. Modifications to the buffer
are not visible to other processes mapping the same file, and are not
written back to the file.
Note that modifications of the underlying file might affect the contents
of the #GMappedFile. Therefore, mapping should only be used if the file
will not be modified, or if all modifications of the file are done
atomically (e.g. using g_file_set_contents()).
The path of the file to load, in the GLib filename encoding
whether the mapping should be writable
return location for a #GError, or %NULL
a newly allocated #GMappedFile which must be freed
with g_mapped_file_free(), or %NULL if the mapping failed.
Since: 2.8
Reads data from a #GIOChannel.
a #GIOChannel
a buffer to read the data into (which should be at least
count bytes long)
the number of bytes to read from the #GIOChannel
returns the number of bytes actually read
%G_IO_ERROR_NONE if the operation was successful.
Deprecated:2.2: Use g_io_channel_read_chars() instead.
Returns: the provided user_data. The returned data belongs to
a #GMarkupParseContext
the provided user_data. The returned data belongs to
the markup context and will be freed when g_markup_context_free()
is called.
Since: 2.18
Removes the bookmark for @uri from the bookmark file @bookmark.
a #GBookmarkFile
a valid URI
return location for a #GError, or %NULL
%TRUE if the bookmark was removed successfully.
Since: 2.12
Calls the @complete_type_info function from the #GTypePluginClass of @plugin.
There should be no need to use this function outside of the GObject
type system itself.
a #GTypePlugin
the #GType whose info is completed
the #GTypeInfo struct to fill in
the #GTypeValueTable to fill in
Determines whether a character is printable.
Unlike g_unichar_isgraph(), returns %TRUE for spaces.
Given some UTF-8 text, obtain a character value with
g_utf8_get_char().
a Unicode character
%TRUE if @c is printable
Finds the first link in @queue which contains @data.
a #GQueue
data to find
The first link in @queue which contains @data.
Since: 2.4
Like g_sequence_sort(), but uses a #GSequenceIterCompareFunc instead
of a GCompareDataFunc as the compare function
Since: 2.14
a #GSequence
the #GSequenceItercompare used to compare iterators in the
sequence. It is called with two iterators pointing into @seq. It should
return 0 if the iterators are equal, a negative value if the first
iterator comes before the second, and a positive value if the second
iterator comes before the first.
user data passed to @cmp_func
Gets the digest as an hexadecimal string.
Once this function has been called the #GChecksum can no longer be
updated with g_checksum_update().
a #GChecksum
the hexadecimal representation of the checksum. The
returned string is owned by the checksum and should not be modified
or freed.
Since: 2.16
Return a pointer to the value at @index_ containd in @value_array.
#GValueArray to get a value from
index of the value of interest
pointer to a value at @index_ in @value_array
Creates a new #GChecksum, using the checksum algorithm @checksum_type.
If the @checksum_type is not known, %NULL is returned.
A #GChecksum can be used to compute the checksum, or digest, of an
arbitrary binary blob, using different hashing algorithms.
A #GChecksum works by feeding a binary blob through g_checksum_update()
until there is data to be checked; the digest can then be extracted
using g_checksum_get_string(), which will return the checksum as a
hexadecimal string; or g_checksum_get_digest(), which will return a
vector of raw bytes. Once either g_checksum_get_string() or
g_checksum_get_digest() have been called on a #GChecksum, the checksum
will be closed and it won't be possible to call g_checksum_update()
on it anymore.
the desired type of checksum
the newly created #GChecksum, or %NULL.
Use g_checksum_free() to free the memory allocated by it.
Since: 2.16
This function outputs @bookmark as a string.
a #GBookmarkFile
return location for the length of the returned string, or %NULL
return location for a #GError, or %NULL
a newly allocated string holding
the contents of the #GBookmarkFile
Since: 2.12
Return value: the #GMainContext of @loop
a #GMainLoop.
the #GMainContext of @loop
Acquires the @queue's lock. After that you can only call the
<function>g_async_queue_*_unlocked()</function> function variants on that
@queue. Otherwise it will deadlock.
a #GAsyncQueue.
Inserts a new element into the list, using the given
comparison function to determine its position.
a #GSList
the data for the new element
the function to compare elements in the list.
It should return a number > 0 if the first parameter
comes after the second parameter in the sort order.
data to pass to comparison function
the new start of the #GSList
Since: 2.10
Converts all Unicode characters in the string that have a case
to uppercase. The exact manner that this is done depends
on the current locale, and may result in the number of
characters in the string increasing. (For instance, the
German ess-zet will be changed to SS.)
a UTF-8 encoded string
length of @str, in bytes, or -1 if @str is nul-terminated.
a newly allocated string, with all characters
converted to uppercase.
Sets whether a source can be called recursively. If @can_recurse is
%TRUE, then while the source is being dispatched then this source
will be processed normally. Otherwise, all processing of this
source is blocked until the dispatch function returns.
a #GSource
whether recursion is allowed for this source
Replacement for g_io_channel_seek() with the new API.
a #GIOChannel
The offset in bytes from the position specified by @type
a #GSeekType. The type %G_SEEK_CUR is only allowed in those
cases where a call to g_io_channel_set_encoding ()
is allowed. See the documentation for
g_io_channel_set_encoding () for details.
A location to return an error of type #GIOChannelError
the status of the operation.
Return the direct parent type of the passed in type. If the passed
in type has no parent, i.e. is a fundamental type, 0 is returned.
The derived type.
The parent type.
Gets the last sibling of a #GNode.
This could possibly be the node itself.
a #GNode
the last sibling of @node
Open a file @filename as a #GIOChannel using mode @mode. This
channel will be closed when the last reference to it is dropped,
so there is no need to call g_io_channel_close() (though doing
so will not cause problems, as long as no attempt is made to
access the channel after it is closed).
A string containing the name of a file
One of "r", "w", "a", "r+", "w+", "a+". These have
the same meaning as in fopen()
A location to return an error of type %G_FILE_ERROR
A #GIOChannel on success, %NULL on failure.
Inserts @data into @queue before @sibling.
@sibling must be part of @queue.
Since: 2.4
a #GQueue
a #GList link that <emphasis>must</emphasis> be part of @queue
the data to insert
Looks whether the desktop bookmark has an item with its URI set to @uri.
a #GBookmarkFile
a valid URI
%TRUE if @uri is inside @bookmark, %FALSE otherwise
Since: 2.12
Sets an environment variable. Both the variable's name and value
should be in the GLib file name encoding. On UNIX, this means that
they can be any sequence of bytes. On Windows, they should be in
UTF-8.
Note that on some systems, when variables are overwritten, the memory
used for the previous variables and its value isn't reclaimed.
the environment variable to set, must not contain '='.
the value for to set the variable to.
whether to change the variable if it already exists.
%FALSE if the environment variable couldn't be set.
Since: 2.4
Replaces occurances of the pattern in regex with the output of
@eval for that occurance.
Setting @start_position differs from just passing over a shortened
string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
that begins with any kind of lookbehind assertion, such as "\b".
a #GRegex structure from g_regex_new()
string to perform matches against
the length of @string, or -1 if @string is nul-terminated
starting index of the string to match
options for the match
a function to call for each match
user data to pass to the function
location to store the error occuring, or %NULL to ignore errors
a newly allocated string containing the replacements
Since: 2.14
Looks up a key in the #GHashTable, returning the original key and the
associated value and a #gboolean which is %TRUE if the key was found. This
is useful if you need to free the memory allocated for the original key,
for example before calling g_hash_table_remove().
You can actually pass %NULL for @lookup_key to test
whether the %NULL key exists.
a #GHashTable
the key to look up
return location for the original key, or %NULL
return location for the value associated with the key, or %NULL
%TRUE if the key was found in the #GHashTable.
Unblocks all handlers on an instance that match a certain selection
criteria. The criteria mask is passed as an OR-ed combination of
#GSignalMatchType flags, and the criteria values are passed as arguments.
Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
If no handlers were found, 0 is returned, the number of unblocked handlers
otherwise. The match criteria should not apply to any handlers that are
not currently blocked.
The instance to unblock handlers from.
Mask indicating which of @signal_id, @detail, @closure, @func
and/or @data the handlers have to match.
Signal the handlers have to be connected to.
Signal detail the handlers have to be connected to.
The closure the handlers will invoke.
The C closure callback of the handlers (useless for non-C closures).
The closure data of the handlers' closures.
The number of handlers that matched.
Retrieves the MIME type of the resource pointed by @uri.
In the event the URI cannot be found, %NULL is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
event that the MIME type cannot be found, %NULL is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
a #GBookmarkFile
a valid URI
return location for a #GError, or %NULL
a newly allocated string or %NULL if the specified
URI cannot be found.
Since: 2.12
Get the contents of a %G_TYPE_INT #GValue.
a valid #GValue of type %G_TYPE_INT
integer contents of @value
Inserts a new element into the list at the given position.
a #GSList
the data for the new element
the position to insert the element.
If this is negative, or is larger than the number
of elements in the list, the new element is added on
to the end of the list.
the new start of the #GSList
Turns off flag values for a data list. See g_datalist_unset_flags()
Since: 2.8
pointer to the location that holds a list
the flags to turn off. The values of the flags are
restricted by %G_DATALIST_FLAGS_MASK (currently
3: giving two possible boolean flags).
A value for @flags that doesn't fit within the mask is
an error.
The initial reference count of a newly created #GParamSpec is 1,
even though no one has explicitly called g_param_spec_ref() on it
yet. So the initial reference count is flagged as "floating", until
someone calls <literal>g_param_spec_ref (pspec); g_param_spec_sink
(pspec);</literal> in sequence on it, taking over the initial
reference count (thus ending up with a @pspec that has a reference
count of 1 still, but is not flagged "floating" anymore).
a valid #GParamSpec
Returns: %TRUE if @node is an ancestor of @descendant
a #GNode
a #GNode
%TRUE if @node is an ancestor of @descendant
Converts a string into a collation key that can be compared
with other collation keys produced by the same function using strcmp().
In order to sort filenames correctly, this function treats the dot '.'
as a special case. Most dictionary orderings seem to consider it
insignificant, thus producing the ordering "event.c" "eventgenerator.c"
"event.h" instead of "event.c" "event.h" "eventgenerator.c". Also, we
would like to treat numbers intelligently so that "file1" "file10" "file5"
is sorted as "file1" "file5" "file10".
Note that this function depends on the
<link linkend="setlocale">current locale</link>.
a UTF-8 encoded string.
length of @str, in bytes, or -1 if @str is nul-terminated.
a newly allocated string. This string should
be freed with g_free() when you are done with it.
Since: 2.8
Feeds @data into an existing #GChecksum. The checksum must still be
open, that is g_checksum_get_string() or g_checksum_get_digest() must
not have been called on @checksum.
Since: 2.16
a #GChecksum
buffer used to compute the checksum
size of the buffer, or -1 if it is a null-terminated string.
Adds a weak reference from weak_pointer to @object to indicate that
the pointer located at @weak_pointer_location is only valid during
the lifetime of @object. When the @object is finalized,
@weak_pointer will be set to %NULL.
The object that should be weak referenced.
The memory address of a pointer.
Duplicates the first @n bytes of a string, returning a newly-allocated
buffer @n + 1 bytes long which will always be nul-terminated.
If @str is less than @n bytes long the buffer is padded with nuls.
If @str is %NULL it returns %NULL.
The returned value should be freed when no longer needed.
<note><para>
To copy a number of characters from a UTF-8 encoded string, use
g_utf8_strncpy() instead.
</para></note>
the string to duplicate
the maximum number of bytes to copy from @str
a newly-allocated buffer containing the first @n bytes
of @str, nul-terminated
Sets the last time the bookmark for @uri was last modified.
If no bookmark for @uri is found then it is created.
The "modified" time should only be set when the bookmark's meta-data
was actually changed. Every function of #GBookmarkFile that
modifies a bookmark also changes the modification time, except for
g_bookmark_file_set_visited().
Since: 2.12
a #GBookmarkFile
a valid URI
a timestamp or -1 to use the current time
Searches the string @haystack for the last occurrence
of the string @needle, limiting the length of the search
to @haystack_len.
a nul-terminated string.
the maximum length of @haystack.
the nul-terminated string to search for.
a pointer to the found occurrence, or
%NULL if not found.
Releases all references to other objects. This can be used to break
reference cycles.
This functions should only be called from object system implementations.
a #GObject
Return value: the value of the environment variable, or %NULL if
the environment variable to get, in the GLib file name encoding.
the value of the environment variable, or %NULL if
the environment variable is not found. The returned string may be
overwritten by the next call to g_getenv(), g_setenv() or
g_unsetenv().
Inserts a new element into the list at the given position.
a pointer to a #GList
the data for the new element
the position to insert the element. If this is
negative, or is larger than the number of elements in the
list, the new element is added on to the end of the list.
the new start of the #GList
Creates a #GSource that's dispatched when @condition is met for the
given @channel. For example, if condition is #G_IO_IN, the source will
be dispatched when there's data available for reading.
g_io_add_watch() is a simpler interface to this same functionality, for
the case where you want to add the source to the default main loop context
at the default priority.
On Windows, polling a #GSource created to watch a channel for a socket
puts the socket in non-blocking mode. This is a side-effect of the
implementation and unavoidable.
a #GIOChannel to watch
conditions to watch for
a new #GSource
Releases ownership of a context previously acquired by this thread
with g_main_context_acquire(). If the context was acquired multiple
times, the ownership will be released only when g_main_context_release()
is called as many times as it was acquired.
a #GMainContext
Decreases the use count of a #GTypeModule by one. If the
result is zero, the module will be unloaded. (However, the
#GTypeModule will not be freed, and types associated with the
#GTypeModule are not unregistered. Once a #GTypeModule is
initialized, it must exist forever.)
a #GTypeModule
This function is a wrapper of dngettext() which does not translate
the message if the default domain as set with textdomain() has no
translations for the current locale.
See g_dgettext() for details of how this differs from dngettext()
proper.
the translation domain to use, or %NULL to use
the domain set with textdomain()
message to translate
plural form of the message
the quantity for which translation is needed
The translated string
Since: 2.18
Attaches arbitrary data to a type.
a #GType
a #GQuark id to identify the data
the data
Sorts a #GList using the given comparison function.
a #GList
the comparison function used to sort the #GList.
This function is passed the data from 2 elements of the #GList
and should return 0 if they are equal, a negative value if the
first element comes before the second, or a positive value if
the first element comes after the second.
the start of the sorted #GList
Get the short description of a #GParamSpec.
a valid #GParamSpec
the short description of @pspec.
Converts all upper case ASCII letters to lower case ASCII letters.
a GString
passed-in @string pointer, with all the upper case
characters converted to lower case in place, with
semantics that exactly match g_ascii_tolower().
Return value: The data for the @n'th element of @queue, or %NULL if @n is
a #GQueue
the position of the element.
The data for the @n'th element of @queue, or %NULL if @n is
off the end of @queue.
Since: 2.4
Removes all list nodes with data equal to @data.
Returns: new head of @list
a #GSList
data to remove
new head of @list
Gets the icon of the bookmark for @uri.
In the event the URI cannot be found, %FALSE is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
a #GBookmarkFile
a valid URI
return location for the icon's location or %NULL
return location for the icon's MIME type or %NULL
return location for a #GError or %NULL
%TRUE if the icon for the bookmark for the URI was found.
You should free the returned strings.
Since: 2.12
Flushes the write buffer for the GIOChannel.
a #GIOChannel
location to store an error of type #GIOChannelError
the status of the operation: One of
#G_IO_CHANNEL_NORMAL, #G_IO_CHANNEL_AGAIN, or
#G_IO_CHANNEL_ERROR.
Looks whether the string @str ends with @suffix.
a nul-terminated string.
the nul-terminated suffix to look for.
%TRUE if @str end with @suffix, %FALSE otherwise.
Since: 2.2
Removes @link_ from @queue and frees it.
@link_ must be part of @queue.
Since: 2.4
a #GQueue
a #GList link that <emphasis>must</emphasis> be part of @queue
Gets properties of an object.
In general, a copy is made of the property contents and the caller
is responsible for freeing the memory in the appropriate manner for
the type, for instance by calling g_free() or g_object_unref().
<example>
<title>Using g_object_get(<!-- -->)</title>
An example of using g_object_get() to get the contents
of three properties - one of type #G_TYPE_INT,
one of type #G_TYPE_STRING, and one of type #G_TYPE_OBJECT:
<programlisting>
gint intval;
gchar *strval;
GObject *objval;
g_object_get (my_object,
"int-property", &intval,
"str-property", &strval,
"obj-property", &objval,
NULL);
// Do something with intval, strval, objval
g_free (strval);
g_object_unref (objval);
</programlisting>
</example>
a #GObject
name of the first property to get
return location for the first property, followed optionally by more
name/return location pairs, followed by %NULL
Scans for a match in string for the pattern in @regex.
The @match_options are combined with the match options specified
when the @regex structure was created, letting you have more
flexibility in reusing #GRegex structures.
A #GMatchInfo structure, used to get information on the match,
is stored in @match_info if not %NULL. Note that if @match_info
is not %NULL then it is created even if the function returns %FALSE,
i.e. you must free it regardless if regular expression actually matched.
To retrieve all the non-overlapping matches of the pattern in
string you can use g_match_info_next().
|[
static void
print_uppercase_words (const gchar *string)
{
/* Print all uppercase-only words. */
GRegex *regex;
GMatchInfo *match_info;
regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
g_regex_match (regex, string, 0, &match_info);
while (g_match_info_matches (match_info))
{
gchar *word = g_match_info_fetch (match_info, 0);
g_print ("Found: %s\n", word);
g_free (word);
g_match_info_next (match_info, NULL);
}
g_match_info_free (match_info);
g_regex_unref (regex);
}
]|
a #GRegex structure from g_regex_new()
the string to scan for matches
match options
pointer to location where to store the #GMatchInfo,
or %NULL if you do not need it
%TRUE is the string matched, %FALSE otherwise
Since: 2.14
Sets the seed for the random number generator #GRand to @seed.
a #GRand.
a value to reinitialize the random number generator.
Free a #GValueArray including its contents.
#GValueArray to free
Adds the #GIOChannel into the default main loop context
with the default priority.
a #GIOChannel
the condition to watch for
the function to call when the condition is satisfied
user data to pass to @func
the event source id
Determines if a character is titlecase. Some characters in
Unicode which are composites, such as the DZ digraph
have three case variants instead of just two. The titlecase
form is used at the beginning of a word where only the
first letter is capitalized. The titlecase form of the DZ
digraph is U+01F2 LATIN CAPITAL LETTTER D WITH SMALL LETTER Z.
a Unicode character
%TRUE if the character is titlecase
Set the contents of a %G_TYPE_LONG #GValue to @v_long.
a valid #GValue of type %G_TYPE_LONG
long integer value to be set
Increases the reference count on a #GMainLoop object by one.
a #GMainLoop
@loop
Gets a named field from the objects table of associations (see g_object_set_data()).
#GObject containing the associations
name of the key for that association
the data if found, or %NULL if no such data exists.
Return value: a newly-allocated %NULL-terminated array of strings.
a #GKeyFile
a group name
return location for the number of keys returned, or %NULL
return location for a #GError, or %NULL
a newly-allocated %NULL-terminated array of strings.
Use g_strfreev() to free it.
Since: 2.6
Changes the URI of a bookmark item from @old_uri to @new_uri. Any
existing bookmark for @new_uri will be overwritten. If @new_uri is
%NULL, then the bookmark is removed.
In the event the URI cannot be found, %FALSE is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
a #GBookmarkFile
a valid URI
a valid URI, or %NULL
return location for a #GError or %NULL
%TRUE if the URI was successfully changed
Since: 2.12
Inserts the (@begin, @end) range at the destination pointed to by ptr.
The @begin and @end iters must point into the same sequence. It is
allowed for @dest to point to a different sequence than the one pointed
into by @begin and @end.
If @dest is NULL, the range indicated by @begin and @end is
removed from the sequence. If @dest iter points to a place within
the (@begin, @end) range, the range does not move.
Since: 2.14
a #GSequenceIter
a #GSequenceIter
a #GSequenceIter
A wrapper for the POSIX open() function. The open() function is
used to convert a pathname into a file descriptor.
On POSIX systems file descriptors are implemented by the operating
system. On Windows, it's the C library that implements open() and
file descriptors. The actual Win32 API for opening files is quite
different, see MSDN documentation for CreateFile(). The Win32 API
uses file handles, which are more randomish integers, not small
integers like file descriptors.
Because file descriptors are specific to the C library on Windows,
the file descriptor returned by this function makes sense only to
functions in the same C library. Thus if the GLib-using code uses a
different C library than GLib does, the file descriptor returned by
this function cannot be passed to C library functions like write()
or read().
See your C library manual for more details about open().
a pathname in the GLib file name encoding (UTF-8 on Windows)
as in open()
as in open()
a new file descriptor, or -1 if an error occurred. The
return value can be used exactly like the return value from open().
Since: 2.6
Unlinks a #GNode from a tree, resulting in two separate trees.
the #GNode to unlink, which becomes the root of a new tree
Determines whether a character is a mark (non-spacing mark,
combining mark, or enclosing mark in Unicode speak).
Given some UTF-8 text, obtain a character value
with g_utf8_get_char().
Note: in most cases where isalpha characters are allowed,
ismark characters should be allowed to as they are essential
for writing most European languages as well as many non-Latin
scripts.
a Unicode character
%TRUE if @c is a mark character
Since: 2.14
Checks whether the allocator used by g_malloc() is the system's
malloc implementation. If it returns %TRUE memory allocated with
malloc() can be used interchangeable with memory allocated using g_malloc().
This function is useful for avoiding an extra copy of allocated memory returned
by a non-GLib-based API.
A different allocator can be set using g_mem_set_vtable().
if %TRUE, malloc() and g_malloc() can be mixed.
Formats a string according to @format and
prefix it to an existing error message. If
@err is %NULL (ie: no error variable) then do
nothing.
If *@err is %NULL (ie: an error variable is
present but there is no error condition) then
also do nothing. Whether or not it makes
sense to take advantage of this feature is up
to you.
Since: 2.16
a return location for a #GError, or %NULL
printf()-style format string
arguments to @format
Gets the registration informations of @app_name for the bookmark for
@uri. See g_bookmark_file_set_app_info() for more informations about
the returned data.
The string returned in @app_exec must be freed.
In the event the URI cannot be found, %FALSE is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the
event that no application with name @app_name has registered a bookmark
for @uri, %FALSE is returned and error is set to
#G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. In the event that unquoting
the command line fails, an error of the #G_SHELL_ERROR domain is
set and %FALSE is returned.
a #GBookmarkFile
a valid URI
an application's name
location for the command line of the application, or %NULL
return location for the registration count, or %NULL
return location for the last registration time, or %NULL
return location for a #GError, or %NULL
%TRUE on success.
Since: 2.12
Gets the position of the first child of a #GNode
which contains the given data.
a #GNode
the data to find
the index of the child of @node which contains
@data, or -1 if the data is not found
Looks whether the string @str begins with @prefix.
a nul-terminated string.
the nul-terminated prefix to look for.
%TRUE if @str begins with @prefix, %FALSE otherwise.
Since: 2.2
Retrieves the position of the @match_num<!-- -->'th capturing
parentheses. 0 is the full text of the match, 1 is the first
paren set, 2 the second, and so on.
If @match_num is a valid sub pattern but it didn't match anything
(e.g. sub pattern 1, matching "b" against "(a)?b") then @start_pos
and @end_pos are set to -1 and %TRUE is returned.
If the match was obtained using the DFA algorithm, that is using
g_regex_match_all() or g_regex_match_all_full(), the retrieved
position is not that of a set of parentheses but that of a matched
substring. Substrings are matched in reverse order of length, so
0 is the longest match.
#GMatchInfo structure
number of the sub expression
pointer to location where to store the start position
pointer to location where to store the end position
%TRUE if the position was fetched, %FALSE otherwise. If
the position cannot be fetched, @start_pos and @end_pos are left
unchanged
Since: 2.14
Parses a string containing debugging options
into a %guint containing bit flags. This is used
within GDK and GTK+ to parse the debug options passed on the
command line or through environment variables.
If @string is equal to "all", all flags are set. If @string
is equal to "help", all the available keys in @keys are printed
out to standard error.
a list of debug options separated by colons, spaces, or
commas, or %NULL.
pointer to an array of #GDebugKey which associate
strings with bit flags.
the number of #GDebugKey<!-- -->s in the array.
the combined set of bit flags.
Determines whether a character is punctuation or a symbol.
Given some UTF-8 text, obtain a character value with
g_utf8_get_char().
a Unicode character
%TRUE if @c is a punctuation or symbol character
Removes an environment variable from the environment.
Note that on some systems, when variables are overwritten, the memory
used for the previous variables and its value isn't reclaimed.
Furthermore, this function can't be guaranteed to operate in a
threadsafe way.
Since: 2.4
the environment variable to remove, must not contain '='.
Removes the first element of the queue.
a #GQueue.
the #GList element at the head of the queue, or %NULL if the queue
is empty.
Creates a new instance of a #GObject subtype and sets its properties.
Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY)
which are not explicitly specified are set to their default values.
the type id of the #GObject subtype to instantiate
the name of the first property
the value of the first property, followed optionally by more
name/value pairs, followed by %NULL
a new instance of @object_type
Removes all list nodes with data equal to @data.
Returns: new head of @list
a #GList
data to remove
new head of @list
Adds a new element on to the end of the list.
<note><para>
The return value is the new start of the list, which may
have changed, so make sure you store the new value.
</para></note>
<note><para>
Note that g_slist_append() has to traverse the entire list
to find the end, which is inefficient when adding multiple
elements. A common idiom to avoid the inefficiency is to prepend
the elements and reverse the list when all elements have been added.
</para></note>
|[
/* Notice that these are initialized to the empty list. */
GSList *list = NULL, *number_list = NULL;
/* This is a list of strings. */
list = g_slist_append (list, "first");
list = g_slist_append (list, "second");
/* This is a list of integers. */
number_list = g_slist_append (number_list, GINT_TO_POINTER (27));
number_list = g_slist_append (number_list, GINT_TO_POINTER (14));
]|
a #GSList
the data for the new element
the new start of the #GSList
Clears the current value in @value and "unsets" the type,
this releases all resources associated with this GValue.
An unset value is the same as an uninitialized (zero-filled)
#GValue structure.
An initialized #GValue structure.
Checks whether @value contains the default value as specified in @pspec.
a valid #GParamSpec
a #GValue of correct type for @pspec
whether @value contains the canonical default for this @pspec
Determines whether a character is a lowercase letter.
Given some UTF-8 text, obtain a character value with
g_utf8_get_char().
a Unicode character
%TRUE if @c is a lowercase letter
An implementation of the standard vprintf() function which supports
positional parameters, as specified in the Single Unix Specification.
a standard printf() format string, but notice
<link linkend="string-precision">string precision pitfalls</link>.
the list of arguments to insert in the output.
the number of bytes printed.
Since: 2.2
Sets the meta marshaller of @closure. A meta marshaller wraps
@closure->marshal and modifies the way it is called in some
fashion. The most common use of this facility is for C callbacks.
The same marshallers (generated by <link
linkend="glib-genmarshal">glib-genmarshal</link>) are used
everywhere, but the way that we get the callback function
differs. In most cases we want to use @closure->callback, but in
other cases we want to use some different technique to retrieve the
callback function.
For example, class closures for signals (see
g_signal_type_cclosure_new()) retrieve the callback function from a
fixed offset in the class structure. The meta marshaller retrieves
the right callback and passes it to the marshaller as the
@marshal_data argument.
a #GClosure
context-dependent data to pass to @meta_marshal
a #GClosureMarshal function
Get the contents of a %G_TYPE_BOXED derived #GValue. Upon getting,
the boxed value is duplicated and needs to be later freed with
g_boxed_free(), e.g. like: g_boxed_free (G_VALUE_TYPE (@value),
return_value);
a valid #GValue of %G_TYPE_BOXED derived type
boxed contents of @value
Sets the icon for the bookmark for @uri. If @href is %NULL, unsets
the currently set icon. @href can either be a full URL for the icon
file or the icon name following the Icon Naming specification.
If no bookmark for @uri is found one is created.
Since: 2.12
a #GBookmarkFile
a valid URI
the URI of the icon for the bookmark, or %NULL
the MIME type of the icon for the bookmark
Checks whether @group appears in the list of groups to which
the bookmark for @uri belongs to.
In the event the URI cannot be found, %FALSE is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
a #GBookmarkFile
a valid URI
the group name to be searched
return location for a #GError, or %NULL
%TRUE if @group was found.
Since: 2.12
A marshaller for a #GCClosure with a callback of type
<literal>gchar* (*callback) (gpointer instance, GObject *arg1, gpointer arg2, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
a #GValue, which can store the returned string
3
a #GValue array holding instance, arg1 and arg2
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
This is an internal function introduced mainly for C marshallers.
Deprecated: 2.4: Use g_value_take_param() instead.
a valid #GValue of type %G_TYPE_PARAM
the #GParamSpec to be set
Inserts a new key and value into a #GHashTable.
If the key already exists in the #GHashTable its current value is replaced
with the new value. If you supplied a @value_destroy_func when creating the
#GHashTable, the old value is freed using that function. If you supplied
a @key_destroy_func when creating the #GHashTable, the passed key is freed
using that function.
a #GHashTable.
a key to insert.
the value to associate with the key.
Creates a new random number generator initialized with a seed taken
either from <filename>/dev/urandom</filename> (if existing) or from
the current time (as a fallback).
the new #GRand.
Removes the key/value pair currently pointed to by the iterator
from its associated #GHashTable. Can only be called after
g_hash_table_iter_next() returned %TRUE, and cannot be called more
than once for the same key/value pair.
If the #GHashTable was created using g_hash_table_new_full(), the
key and value are freed using the supplied destroy functions, otherwise
you have to make sure that any dynamically allocated values are freed
yourself.
Since: 2.16
an initialized #GHashTableIter.
A variant of g_type_class_unref() for use in #GTypeClassCacheFunc
implementations. It unreferences a class without consulting the chain
of #GTypeClassCacheFunc<!-- -->s, avoiding the recursion which would occur
otherwise.
The #GTypeClass structure to unreference.
Calls the given function for key/value pairs in the #GHashTable until
@predicate returns %TRUE. The function is passed the key and value of
each pair, and the given @user_data parameter. The hash table may not
be modified while iterating over it (you can't add/remove items).
Note, that hash tables are really only optimized for forward lookups,
i.e. g_hash_table_lookup().
So code that frequently issues g_hash_table_find() or
g_hash_table_foreach() (e.g. in the order of once per every entry in a
hash table) should probably be reworked to use additional or different
data structures for reverse lookups (keep in mind that an O(n) find/foreach
operation issued for all n values in a hash table ends up needing O(n*n)
operations).
a #GHashTable.
function to test the key/value pairs for a certain property.
user data to pass to the function.
The value of the first key/value pair is returned, for which
func evaluates to %TRUE. If no pair with the requested property is found,
%NULL is returned.
Since: 2.4
Creates a new #GParamSpecPool.
If @type_prefixing is %TRUE, lookups in the newly created pool will
allow to specify the owner as a colon-separated prefix of the
property name, like "GtkContainer:border-width". This feature is
deprecated, so you should always set @type_prefixing to %FALSE.
Whether the pool will support type-prefixed property names.
a newly allocated #GParamSpecPool.
Creates a new instance of a #GObject subtype and sets its properties.
Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY)
which are not explicitly specified are set to their default values.
the type id of the #GObject subtype to instantiate
the name of the first property
the value of the first property, followed optionally by more
name/value pairs, followed by %NULL
a new instance of @object_type
Return value: the data that @iter points to
a #GSequenceIter
the data that @iter points to
Since: 2.14
Adds a pair of notifiers which get invoked before and after the
closure callback, respectively. This is typically used to protect
the extra arguments for the duration of the callback. See
g_object_watch_closure() for an example of marshal guards.
a #GClosure
data to pass to @pre_marshal_notify
a function to call before the closure callback
data to pass to @post_marshal_notify
a function to call after the closure callback
Inserts @data into @sequence using @func to determine the new position.
The sequence must already be sorted according to @cmp_func; otherwise the
new position of @data is undefined.
a #GSequence
the data to insert
the #GCompareDataFunc used to compare items in the sequence. It
is called with two items of the @seq and @user_data. It should
return 0 if the items are equal, a negative value if the first
item comes before the second, and a positive value if the second
item comes before the first.
user data passed to @cmp_func.
a #GSequenceIter pointing to the new item.
Since: 2.14
Get the contents of a %G_TYPE_UINT #GValue.
a valid #GValue of type %G_TYPE_UINT
unsigned integer contents of @value
Traverses a tree starting at the given root #GNode.
It calls the given function for each node visited.
The traversal can be halted at any point by returning %TRUE from @func.
the root #GNode of the tree to traverse
the order in which nodes are visited - %G_IN_ORDER,
%G_PRE_ORDER, %G_POST_ORDER, or %G_LEVEL_ORDER.
which types of children are to be visited, one of
%G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
the maximum depth of the traversal. Nodes below this
depth will not be visited. If max_depth is -1 all nodes in
the tree are visited. If depth is 1, only the root is visited.
If depth is 2, the root and its children are visited. And so on.
the function to call for each visited #GNode
user data to pass to the function
Sets a flag on the closure to indicate that it's calling
environment has become invalid, and thus causes any future
invocations of g_closure_invoke() on this @closure to be
ignored. Also, invalidation notifiers installed on the closure will
be called at this point. Note that unless you are holding a
reference to the closure yourself, the invalidation notifiers may
unref the closure and cause it to be destroyed, so if you need to
access the closure after calling g_closure_invalidate(), make sure
that you've previously called g_closure_ref().
Note that g_closure_invalidate() will also be called when the
reference count of a closure drops to zero (unless it has already
been invalidated before).
GClosure to invalidate
Return value: a string owned by GLib that must not be modified
a string owned by GLib that must not be modified
or freed.
Since: 2.6
Retrieves the current line number and the number of the character on
that line. Intended for use in error messages; there are no strict
semantics for what constitutes the "current" line number other than
"the best number we could come up with for error messages."
a #GMarkupParseContext
return location for a line number, or %NULL
return location for a char-on-line number, or %NULL
Return value: a #GSequenceIter pointing to the next position after @iter.
a #GSequenceIter
a #GSequenceIter pointing to the next position after @iter.
Since: 2.14
Get a reproducible random integer number out of a specified range,
see g_test_rand_int() for details on test case random numbers.
the minimum value returned by this function
the smallest value not to be returned by this function
a number with @begin <= number < @end.
Since: 2.16
This function will set the maximum @interval that a thread waiting
in the pool for new tasks can be idle for before being
stopped. This function is similar to calling
g_thread_pool_stop_unused_threads() on a regular timeout, except,
this is done on a per thread basis.
By setting @interval to 0, idle threads will not be stopped.
This function makes use of g_async_queue_timed_pop () using
@interval.
Since: 2.10
the maximum @interval (1/1000ths of a second) a thread
can be idle.
Converts a pointer to a #gint to a hash value.
It can be passed to g_hash_table_new() as the @hash_func parameter,
when using pointers to integers values as keys in a #GHashTable.
a pointer to a #gint key
a hash value corresponding to the key.
Associates a new value with @key under @group_name.
If @key cannot be found then it is created.
If @group_name cannot be found then it is created.
Since: 2.6
a #GKeyFile
a group name
a key
a string
Creates a new #GMainLoop structure.
a #GMainContext (if %NULL, the default context will be used).
set to %TRUE to indicate that the loop is running. This
is not very important since calling g_main_loop_run() will set this to
%TRUE anyway.
a new #GMainLoop.
Checks whether a source is allowed to be called recursively.
see g_source_set_can_recurse().
a #GSource
whether recursion is allowed.
Return value: whether @iter is the begin iterator
a #GSequenceIter
whether @iter is the begin iterator
Since: 2.14
Writes a formatted string into a #GString.
This is similar to the standard sprintf() function,
except that the #GString buffer automatically expands
to contain the results. The previous contents of the
#GString are destroyed.
a #GString
the string format. See the printf() documentation
the parameters to insert into the format string
Finds the leftmost occurrence of the given Unicode character
in a UTF-8 encoded string, while limiting the search to @len bytes.
If @len is -1, allow unbounded search.
a nul-terminated UTF-8 encoded string
the maximum length of @p
a Unicode character
%NULL if the string does not contain the character,
otherwise, a pointer to the start of the leftmost occurrence of
the character in the string.
This function is deprecated. Use
g_win32_get_package_installation_directory_of_module() and
g_build_filename() instead.
Returns: a string containing the complete path to @subdir inside
You should pass %NULL for this.
The name of a DLL that a package provides, in UTF-8, or %NULL.
A subdirectory of the package installation directory, also in UTF-8
a string containing the complete path to @subdir inside
the installation directory of @package. The returned string is in
the GLib file name encoding, i.e. UTF-8. The return value should be
freed with g_free() when no longer needed. If something goes wrong,
%NULL is returned.
@Deprecated:2.18: Pass the HMODULE of a DLL or EXE to
g_win32_get_package_installation_directory_of_module() instead, and
then construct a subdirectory pathname with g_build_filename().
Return value: an #GSequenceIter pointing to the position where @data
a #GSequence
data for the new item
the #GCompareDataFunc used to compare items in the sequence. It
is called with two items of the @seq and @user_data. It should
return 0 if the items are equal, a negative value if the first
item comes before the second, and a positive value if the second
item comes before the first.
user data passed to @cmp_func.
an #GSequenceIter pointing to the position where @data
would have been inserted according to @cmp_func and @cmp_data.
Since: 2.14
Stops a signal's current emission.
This will prevent the default method from running, if the signal was
%G_SIGNAL_RUN_LAST and you connected normally (i.e. without the "after"
flag).
Prints a warning if used on a signal which isn't being emitted.
the object whose signal handlers you wish to stop.
the signal identifier, as returned by g_signal_lookup().
the detail which the signal was emitted with.
Return value: a %NULL-terminated string array or %NULL if the specified
a #GKeyFile
a group name
a key
return location for the number of returned strings, or %NULL
return location for a #GError, or %NULL
a %NULL-terminated string array or %NULL if the specified
key cannot be found. The array should be freed with g_strfreev().
Since: 2.6
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, guint arg1, gpointer arg2, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
3
a #GValue array holding instance, arg1 and arg2
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Adds @prerequisite_type to the list of prerequisites of @interface_type.
This means that any type implementing @interface_type must also implement
@prerequisite_type. Prerequisites can be thought of as an alternative to
interface derivation (which GType doesn't support). An interface can have
at most one instantiatable prerequisite type.
#GType value of an interface type.
#GType value of an interface or instantiatable type.
Decrements the reference count of the class structure being passed in.
Once the last reference count of a class has been released, classes
may be finalized by the type system, so further dereferencing of a
class pointer after g_type_class_unref() are invalid.
The #GTypeClass structure to unreference.
Set the contents of a %G_TYPE_INT #GValue to @v_int.
a valid #GValue of type %G_TYPE_INT
integer value to be set
Returns: The GTypeInterface structure of iface_type if implemented
A #GTypeClass structure.
An interface ID which this class conforms to.
The GTypeInterface structure of iface_type if implemented
by @instance_class, %NULL otherwise
Decreases reference count of @regex by 1. When reference count drops
to zero, it frees all the memory associated with the regex structure.
Since: 2.14
a #GRegex
Get a copy the contents of a %G_TYPE_STRING #GValue.
a valid #GValue of type %G_TYPE_STRING
a newly allocated copy of the string content of @value
Increases the reference count of the asynchronous @queue by 1. You
do not need to hold the lock to call this function.
a #GAsyncQueue.
the @queue that was passed in (since 2.6)
Parses a command line into an argument vector, in much the same way
the shell would, but without many of the expansions the shell would
perform (variable expansion, globs, operators, filename expansion,
etc. are not supported). The results are defined to be the same as
those you would get from a UNIX98 /bin/sh, as long as the input
contains none of the unsupported shell expansions. If the input
does contain such expansions, they are passed through
literally. Possible errors are those from the #G_SHELL_ERROR
domain. Free the returned vector with g_strfreev().
command line to parse
return location for number of args
return location for array of args
return location for error
%TRUE on success, %FALSE if error set
Inserts a new element into the list before the given position.
a pointer to a #GList
the list element before which the new element
is inserted or %NULL to insert at the end of the list
the data for the new element
the new start of the #GList
Gets the user name of the current user. The encoding of the returned
string is system-defined. On UNIX, it might be the preferred file name
encoding, or something else, and there is no guarantee that it is even
consistent on a machine. On Windows, it is always UTF-8.
the user name of the current user.
Usually if the string passed to g_regex_match*() matches as far as
it goes, but is too short to match the entire pattern, %FALSE is
returned. There are circumstances where it might be helpful to
distinguish this case from other cases in which there is no match.
Consider, for example, an application where a human is required to
type in data for a field with specific formatting requirements. An
example might be a date in the form ddmmmyy, defined by the pattern
"^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$".
If the application sees the user’s keystrokes one by one, and can
check that what has been typed so far is potentially valid, it is
able to raise an error as soon as a mistake is made.
GRegex supports the concept of partial matching by means of the
#G_REGEX_MATCH_PARTIAL flag. When this is set the return code for
g_regex_match() or g_regex_match_full() is, as usual, %TRUE
for a complete match, %FALSE otherwise. But, when these functions
return %FALSE, you can check if the match was partial calling
g_match_info_is_partial_match().
When using partial matching you cannot use g_match_info_fetch*().
Because of the way certain internal optimizations are implemented
the partial matching algorithm cannot be used with all patterns.
So repeated single characters such as "a{2,4}" and repeated single
meta-sequences such as "\d+" are not permitted if the maximum number
of occurrences is greater than one. Optional items such as "\d?"
(where the maximum is one) are permitted. Quantifiers with any values
are permitted after parentheses, so the invalid examples above can be
coded thus "(a){2,4}" and "(\d)+". If #G_REGEX_MATCH_PARTIAL is set
for a pattern that does not conform to the restrictions, matching
functions return an error.
a #GMatchInfo structure
%TRUE if the match was partial, %FALSE otherwise
Since: 2.14
Calls the @use_plugin function from the #GTypePluginClass of
@plugin. There should be no need to use this function outside of
the GObject type system itself.
a #GTypePlugin
Stops a #GMainLoop from running. Any calls to g_main_loop_run()
for the loop will return.
Note that sources that have already been dispatched when
g_main_loop_quit() is called will still be executed.
a #GMainLoop
Associates a list of integer values with @key under @group_name.
If @key cannot be found then it is created.
Since: 2.6
a #GKeyFile
a group name
a key
an array of integer values
number of integer values in @list
Return value: The link at the @n'th position, or %NULL if @n is off the
a #GQueue
the position of the link
The link at the @n'th position, or %NULL if @n is off the
end of the list
Since: 2.4
Converts a single character to UTF-8.
a Unicode character code
output buffer, must have at least 6 bytes of space.
If %NULL, the length will be computed and returned
and nothing will be written to @outbuf.
number of bytes written
Bundles up pointers to each of the matching substrings from a match
and stores them in an array of gchar pointers. The first element in
the returned array is the match number 0, i.e. the entire matched
text.
If a sub pattern didn't match anything (e.g. sub pattern 1, matching
"b" against "(a)?b") then an empty string is inserted.
If the last match was obtained using the DFA algorithm, that is using
g_regex_match_all() or g_regex_match_all_full(), the retrieved
strings are not that matched by sets of parentheses but that of the
matched substring. Substrings are matched in reverse order of length,
so the first one is the longest match.
The strings are fetched from the string passed to the match function,
so you cannot call this function after freeing the string.
a #GMatchInfo structure
a %NULL-terminated array of gchar * pointers. It must be
freed using g_strfreev(). If the previous match failed %NULL is
returned
Since: 2.14
Returns: the invocation hint of the innermost signal emission.
the instance to query
the invocation hint of the innermost signal emission.
Atomically increments the reference count of @hash_table by one.
This function is MT-safe and may be called from any thread.
a valid #GHashTable.
the passed in #GHashTable.
Since: 2.10
Increases the reference count of the asynchronous @queue by 1.
@Deprecated: Since 2.8, reference counting is done atomically
so g_async_queue_ref() can be used regardless of the @queue's
lock.
a #GAsyncQueue.
Internal function to parse a signal name into its @signal_id
and @detail quark.
a string of the form "signal-name::detail".
The interface/instance type that introduced "signal-name".
Location to store the signal id.
Location to store the detail quark.
%TRUE forces creation of a #GQuark for the detail.
Whether the signal name could successfully be parsed and @signal_id_p and @detail_p contain valid return values.
Return value: a newly allocated string containing
an absolute pathname in the GLib file name encoding
a newly allocated string containing
a rendition of the basename of the filename in valid UTF-8
Since: 2.6
Return a newly allocated and 0-terminated array of type IDs, listing the
child types of @type. The return value has to be g_free()ed after use.
The parent type.
Optional #guint pointer to contain the number of child types.
Newly allocated and 0-terminated array of child types.
Returns: %TRUE if g_value_copy() is possible with @src_type and @dest_type.
source type to be copied.
destination type for copying.
%TRUE if g_value_copy() is possible with @src_type and @dest_type.
Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
If @p does not point to a valid UTF-8 encoded character, results are
undefined. If you are not sure that the bytes are complete
valid Unicode characters, you should use g_utf8_get_char_validated()
instead.
a pointer to Unicode character encoded as UTF-8
the resulting character
Creates a new #GParamSpecInt instance specifying a %G_TYPE_INT property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Invokes the closure, i.e. executes the callback represented by the @closure.
a #GClosure
a #GValue to store the return value. May be %NULL if the
callback of @closure doesn't return a value.
the length of the @param_values array
an array of #GValue<!-- -->s holding the arguments on
which to invoke the callback of @closure
a context-dependent invocation hint
Determines whether a character is printable and not a space
(returns %FALSE for control characters, format characters, and
spaces). g_unichar_isprint() is similar, but returns %TRUE for
spaces. Given some UTF-8 text, obtain a character value with
g_utf8_get_char().
a Unicode character
%TRUE if @c is printable unless it's a space
Like g_list_sort(), but the comparison function accepts
a user data argument.
a #GList
comparison function
user data to pass to comparison function
the new head of @list
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gulong arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gulong parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Return value: the default main context.
the default main context.
Frees all memory allocated by the #GStringChunk.
After calling g_string_chunk_free() it is not safe to
access any of the strings which were contained within it.
a #GStringChunk
Convert a character to ASCII upper case.
Unlike the standard C library toupper() function, this only
recognizes standard ASCII letters and ignores the locale, returning
all non-ASCII characters unchanged, even if they are upper case
letters in a particular character set. Also unlike the standard
library function, this takes and returns a char, not an int, so
don't call it on %EOF but no need to worry about casting to #guchar
before passing a possibly non-ASCII character in.
any character.
the result of converting @c to upper case.
If @c is not an ASCII lower case letter,
@c is returned unchanged.
Recursively copies a #GNode (but does not deep-copy the data inside the
nodes, see g_node_copy_deep() if you need that).
a #GNode
a new #GNode containing the same data pointers
A wrapper for the POSIX chdir() function. The function changes the
current directory of the process to @path.
See your C library manual for more details about chdir().
a pathname in the GLib file name encoding (UTF-8 on Windows)
0 on success, -1 if an error occurred.
Since: 2.8
Gets the current directory.
The returned string should be freed when no longer needed. The encoding
of the returned string is system defined. On Windows, it is always UTF-8.
the current directory.
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gint parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
This function gets back user data pointers stored via
g_object_set_qdata() and removes the @data from object
without invoking it's destroy() function (if any was
set).
Usually, calling this function is only required to update
user data pointers with a destroy notifier, for example:
|[
void
object_add_to_user_list (GObject *object,
const gchar *new_string)
{
// the quark, naming the object data
GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
// retrive the old string list
GList *list = g_object_steal_qdata (object, quark_string_list);
// prepend new string
list = g_list_prepend (list, g_strdup (new_string));
// this changed 'list', so we need to set it again
g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
}
static void
free_string_list (gpointer data)
{
GList *node, *list = data;
for (node = list; node; node = node->next)
g_free (node->data);
g_list_free (list);
}
]|
Using g_object_get_qdata() in the above example, instead of
g_object_steal_qdata() would have left the destroy function set,
and thus the partial string list would have been freed upon
g_object_set_qdata_full().
The GObject to get a stored user data pointer from
A #GQuark, naming the user data pointer
The user data pointer set, or %NULL
Check whether g_value_transform() is able to transform values
of type @src_type into values of type @dest_type.
Source type.
Target type.
%TRUE if the transformation is possible, %FALSE otherwise.
Removes a source from the default main loop context given the
source functions and user data. If multiple sources exist with the
same source functions and user data, only one will be destroyed.
The @source_funcs passed to g_source_new()
the user data for the callback
%TRUE if a source was found and removed.
A convenience function to connect multiple signals at once.
The signal specs expected by this function have the form
"modifier::signal_name", where modifier can be one of the following:
<variablelist>
<varlistentry>
<term>signal</term>
<listitem><para>
equivalent to <literal>g_signal_connect_data (..., NULL, 0)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>object_signal</term>
<term>object-signal</term>
<listitem><para>
equivalent to <literal>g_signal_connect_object (..., 0)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>swapped_signal</term>
<term>swapped-signal</term>
<listitem><para>
equivalent to <literal>g_signal_connect_data (..., NULL, G_CONNECT_SWAPPED)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>swapped_object_signal</term>
<term>swapped-object-signal</term>
<listitem><para>
equivalent to <literal>g_signal_connect_object (..., G_CONNECT_SWAPPED)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>signal_after</term>
<term>signal-after</term>
<listitem><para>
equivalent to <literal>g_signal_connect_data (..., NULL, G_CONNECT_AFTER)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>object_signal_after</term>
<term>object-signal-after</term>
<listitem><para>
equivalent to <literal>g_signal_connect_object (..., G_CONNECT_AFTER)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>swapped_signal_after</term>
<term>swapped-signal-after</term>
<listitem><para>
equivalent to <literal>g_signal_connect_data (..., NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>swapped_object_signal_after</term>
<term>swapped-object-signal-after</term>
<listitem><para>
equivalent to <literal>g_signal_connect_object (..., G_CONNECT_SWAPPED | G_CONNECT_AFTER)</literal>
</para></listitem>
</varlistentry>
</variablelist>
|[
menu->toplevel = g_object_connect (g_object_new (GTK_TYPE_WINDOW,
"type", GTK_WINDOW_POPUP,
"child", menu,
NULL),
"signal::event", gtk_menu_window_event, menu,
"signal::size_request", gtk_menu_window_size_request, menu,
"signal::destroy", gtk_widget_destroyed, &menu->toplevel,
NULL);
]|
a #GObject
the spec for the first signal
#GCallback for the first signal, followed by data for the
first signal, followed optionally by more signal
spec/callback/data triples, followed by %NULL
@object
Sets the length of a #GString. If the length is less than
the current length, the string will be truncated. If the
length is greater than the current length, the contents
of the newly added area are undefined. (However, as
always, string->str[string->len] will be a nul byte.)
a #GString
the new length
@string
Removes @group from the list of groups to which the bookmark
for @uri belongs to.
In the event the URI cannot be found, %FALSE is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
In the event no group was defined, %FALSE is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
a #GBookmarkFile
a valid URI
the group name to be removed
return location for a #GError, or %NULL
%TRUE if @group was successfully removed.
Since: 2.12
Converts a string which is in the encoding used for strings by
the C runtime (usually the same as that used by the operating
system) in the <link linkend="setlocale">current locale</link> into a
UTF-8 string.
a string in the encoding of the current locale. On Windows
this means the system codepage.
the length of the string, or -1 if the string is
nul-terminated<footnoteref linkend="nul-unsafe"/>.
location to store the number of bytes in the
input string that were successfully converted, or %NULL.
Even if the conversion was successful, this may be
less than @len if there were partial characters
at the end of the input. If the error
#G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value
stored will the byte offset after the last valid
input sequence.
the number of bytes stored in the output buffer (not
including the terminating nul).
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError may occur.
The converted string, or %NULL on an error.
Sets the meta-data of application @name inside the list of
applications that have registered a bookmark for @uri inside
@bookmark.
You should rarely use this function; use g_bookmark_file_add_application()
and g_bookmark_file_remove_application() instead.
@name can be any UTF-8 encoded string used to identify an
application.
@exec can have one of these two modifiers: "%f", which will
be expanded as the local file name retrieved from the bookmark's
URI; "%u", which will be expanded as the bookmark's URI.
The expansion is done automatically when retrieving the stored
command line using the g_bookmark_file_get_app_info() function.
@count is the number of times the application has registered the
bookmark; if is < 0, the current registration count will be increased
by one, if is 0, the application with @name will be removed from
the list of registered applications.
@stamp is the Unix time of the last registration; if it is -1, the
current time will be used.
If you try to remove an application by setting its registration count to
zero, and no bookmark for @uri is found, %FALSE is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND; similarly,
in the event that no application @name has registered a bookmark
for @uri, %FALSE is returned and error is set to
#G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. Otherwise, if no bookmark
for @uri is found, one is created.
a #GBookmarkFile
a valid URI
an application's name
an application's command line
the number of registrations done for this application
the time of the last registration for this application
return location for a #GError or %NULL
%TRUE if the application's meta-data was successfully
changed.
Since: 2.12
Disconnects all handlers on an instance that match a certain
selection criteria. The criteria mask is passed as an OR-ed
combination of #GSignalMatchType flags, and the criteria values are
passed as arguments. Passing at least one of the
%G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC or
%G_SIGNAL_MATCH_DATA match flags is required for successful
matches. If no handlers were found, 0 is returned, the number of
disconnected handlers otherwise.
The instance to remove handlers from.
Mask indicating which of @signal_id, @detail, @closure, @func
and/or @data the handlers have to match.
Signal the handlers have to be connected to.
Signal detail the handlers have to be connected to.
The closure the handlers will invoke.
The C closure callback of the handlers (useless for non-C closures).
The closure data of the handlers' closures.
The number of handlers that matched.
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, glong arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #glong parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Splits @string into a number of tokens not containing any of the characters
in @delimiter. A token is the (possibly empty) longest string that does not
contain any of the characters in @delimiters. If @max_tokens is reached, the
remainder is appended to the last token.
For example the result of g_strsplit_set ("abc:def/ghi", ":/", -1) is a
%NULL-terminated vector containing the three strings "abc", "def",
and "ghi".
The result if g_strsplit_set (":def/ghi:", ":/", -1) is a %NULL-terminated
vector containing the four strings "", "def", "ghi", and "".
As a special case, the result of splitting the empty string "" is an empty
vector, not a vector containing a single string. The reason for this
special case is that being able to represent a empty vector is typically
more useful than consistent handling of empty elements. If you do need
to represent empty elements, you'll need to check for the empty string
before calling g_strsplit_set().
Note that this function works on bytes not characters, so it can't be used
to delimit UTF-8 strings for anything but ASCII characters.
The string to be tokenized
A nul-terminated string containing bytes that are used
to split the string.
The maximum number of tokens to split @string into.
If this is less than 1, the string is split completely
a newly-allocated %NULL-terminated array of strings. Use
g_strfreev() to free it.
Since: 2.4
Finds a #GSource given a pair of context and ID.
a #GMainContext (if %NULL, the default context will be used)
the source ID, as returned by g_source_get_id().
the #GSource if found, otherwise, %NULL
This function outputs @key_file as a string.
Note that this function never reports an error,
so it is safe to pass %NULL as @error.
a #GKeyFile
return location for the length of the
returned string, or %NULL
return location for a #GError, or %NULL
a newly allocated string holding
the contents of the #GKeyFile
Since: 2.6
Returns: %TRUE if the previous match operation succeeded,
a #GMatchInfo structure
%TRUE if the previous match operation succeeded,
%FALSE otherwise
Since: 2.14
Prepares to poll sources within a main loop. The resulting information
for polling is determined by calling g_main_context_query ().
a #GMainContext
location to store priority of highest priority
source already ready.
%TRUE if some source is ready to be dispatched
prior to polling.
Creates a new closure which invokes @callback_func with @user_data as
the first parameter.
the function to invoke
user data to pass to @callback_func
destroy notify to be called when @user_data is no longer used
a new #GCClosure
Get the contents of a %G_TYPE_LONG #GValue.
a valid #GValue of type %G_TYPE_LONG
long integer contents of @value
This function looks for a key file named @file in the paths
specified in @search_dirs, loads the file into @key_file and
Return value: %TRUE if a key file could be loaded, %FALSE otherwise
an empty #GKeyFile struct
a relative path to a filename to open and parse
%NULL-terminated array of directories to search
return location for a string containing the full path
of the file, or %NULL
flags from #GKeyFileFlags
return location for a #GError, or %NULL
%TRUE if a key file could be loaded, %FALSE otherwise
Since: 2.14
Inserts a #GNode as the first child of the given parent.
the #GNode to place the new #GNode under
the #GNode to insert
the inserted #GNode
Adds a #GTypeClassCacheFunc to be called before the reference count of a
class goes from one to zero. This can be used to prevent premature class
destruction. All installed #GTypeClassCacheFunc functions will be chained
until one of them returns %TRUE. The functions have to check the class id
passed in to figure whether they actually want to cache the class of this
type, since all classes are routed through the same #GTypeClassCacheFunc
chain.
data to be passed to @cache_func
a #GTypeClassCacheFunc
Gets the last child of a #GNode.
a #GNode (must not be %NULL)
the last child of @node, or %NULL if @node has no children
Retrieves every value inside @hash_table. The returned data is
valid until @hash_table is modified.
a #GHashTable
a #GList containing all the values inside the hash
table. The content of the list is owned by the hash table and
should not be modified or freed. Use g_list_free() when done
using the list.
Since: 2.14
Find the #GParamSpec with the given name for an
interface. Generally, the interface vtable passed in as @g_iface
will be the default vtable from g_type_default_interface_ref(), or,
if you know the interface has already been loaded,
g_type_default_interface_peek().
Since: 2.4
any interface vtable for the interface, or the default
vtable for the interface
name of a property to lookup.
the #GParamSpec for the property of the interface with the
name @property_name, or %NULL if no such property exists.
Removes an interface check function added with
g_type_add_interface_check().
Since: 2.4
callback data passed to g_type_add_interface_check()
callback function passed to g_type_add_interface_check()
Sets the function which is used to translate user-visible
strings, for <option>--help</option> output. Different
groups can use different #GTranslateFunc<!-- -->s. If @func
is %NULL, strings are not translated.
If you are using gettext(), you only need to set the translation
domain, see g_option_group_set_translation_domain().
Since: 2.6
a #GOptionGroup
the #GTranslateFunc, or %NULL
user data to pass to @func, or %NULL
a function which gets called to free @data, or %NULL
Pops data from the @queue. If no data is received before @end_time,
%NULL is returned. This function must be called while holding the
@queue's lock.
To easily calculate @end_time a combination of g_get_current_time()
and g_time_val_add() can be used.
a #GAsyncQueue.
a #GTimeVal, determining the final time.
data from the queue or %NULL, when no data is
received before @end_time.
Creates a new #GNode containing the given data.
Used to create the first node in a tree.
the data of the new node
a new #GNode
Associates a new integer value with @key under @group_name.
If @key cannot be found then it is created.
Since: 2.6
a #GKeyFile
a group name
a key
an integer value
Converts a string which is in the encoding used by GLib for
filenames into a UTF-8 string. Note that on Windows GLib uses UTF-8
for filenames; on other platforms, this function indirectly depends on
the <link linkend="setlocale">current locale</link>.
a string in the encoding for filenames
the length of the string, or -1 if the string is
nul-terminated<footnoteref linkend="nul-unsafe"/>.
location to store the number of bytes in the
input string that were successfully converted, or %NULL.
Even if the conversion was successful, this may be
less than @len if there were partial characters
at the end of the input. If the error
#G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value
stored will the byte offset after the last valid
input sequence.
the number of bytes stored in the output buffer (not
including the terminating nul).
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError may occur.
The converted string, or %NULL on an error.
Get the codeset for the current locale.
a newly allocated string containing the name
of the codeset. This string must be freed with g_free().
Inserts a new element into the list, using the given
comparison function to determine its position.
a #GSList
the data for the new element
the function to compare elements in the list.
It should return a number > 0 if the first parameter
comes after the second parameter in the sort order.
the new start of the #GSList
An implementation of the GNU vasprintf() function which supports
positional parameters, as specified in the Single Unix Specification.
This function is similar to g_vsprintf(), except that it allocates a
string to hold the output, instead of putting the output in a buffer
you allocate in advance.
the return location for the newly-allocated string.
a standard printf() format string, but notice
<link linkend="string-precision">string precision pitfalls</link>.
the list of arguments to insert in the output.
the number of bytes printed.
Since: 2.4
Computes a list of applicable locale names, which can be used to
e.g. construct locale-dependent filenames or search paths. The returned
list is sorted from most desirable to least desirable and always contains
the default locale "C".
For example, if LANGUAGE=de:en_US, then the returned list is
"de", "en_US", "en", "C".
This function consults the environment variables <envar>LANGUAGE</envar>,
<envar>LC_ALL</envar>, <envar>LC_MESSAGES</envar> and <envar>LANG</envar>
to find the list of locales specified by the user.
a %NULL-terminated array of strings owned by GLib
that must not be modified or freed.
Since: 2.6
Calls the given function for each key/value pair in the #GHashTable.
If the function returns %TRUE, then the key/value pair is removed from the
#GHashTable, but no key or value destroy functions are called.
See #GHashTableIter for an alternative way to loop over the
key/value pairs in the hash table.
a #GHashTable.
the function to call for each key/value pair.
user data to pass to the function.
the number of key/value pairs removed.
Retrieves a comment above @key from @group_name.
If @key is %NULL then @comment will be read from above
@group_name. If both @key and @group_name are %NULL, then
@comment will be read from above the first group in the file.
a #GKeyFile
a group name, or %NULL
a key
return location for a #GError
a comment that should be freed with g_free()
Since: 2.6
Sets the function used to sort the list of tasks. This allows the
tasks to be processed by a priority determined by @func, and not
just in the order in which they were added to the pool.
Note, if the maximum number of threads is more than 1, the order
that threads are executed can not be guranteed 100%. Threads are
scheduled by the operating system and are executed at random. It
cannot be assumed that threads are executed in the order they are
created.
Since: 2.10
a #GThreadPool
the #GCompareDataFunc used to sort the list of tasks.
This function is passed two tasks. It should return
0 if the order in which they are handled does not matter,
a negative value if the first task should be processed before
the second or a positive value if the second task should be
processed first.
user data passed to @func.
A wrapper for the POSIX creat() function. The creat() function is
used to convert a pathname into a file descriptor, creating a file
if necessary.
On POSIX systems file descriptors are implemented by the operating
system. On Windows, it's the C library that implements creat() and
file descriptors. The actual Windows API for opening files is
different, see MSDN documentation for CreateFile(). The Win32 API
uses file handles, which are more randomish integers, not small
integers like file descriptors.
Because file descriptors are specific to the C library on Windows,
the file descriptor returned by this function makes sense only to
functions in the same C library. Thus if the GLib-using code uses a
different C library than GLib does, the file descriptor returned by
this function cannot be passed to C library functions like write()
or read().
See your C library manual for more details about creat().
a pathname in the GLib file name encoding (UTF-8 on Windows)
as in creat()
a new file descriptor, or -1 if an error occurred. The
return value can be used exactly like the return value from creat().
Since: 2.8
Translate a Win32 error code (as returned by GetLastError()) into
the corresponding message. The message is either language neutral,
or in the thread's language, or the user's language, the system's
language, or US English (see docs for FormatMessage()). The
returned string is in UTF-8. It should be deallocated with
g_free().
error code.
newly-allocated error message
Convert a string from UTF-16 to UCS-4. The result will be
nul-terminated.
a UTF-16 encoded string
the maximum length (number of <type>gunichar2</type>) of @str to use.
If @len < 0, then the string is nul-terminated.
location to store number of words read, or %NULL.
If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
returned in case @str contains a trailing partial
character. If an error occurs then the index of the
invalid input is stored here.
location to store number of characters written, or %NULL.
The value stored here does not include the trailing
0 character.
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError other than
%G_CONVERT_ERROR_NO_CONVERSION may occur.
a pointer to a newly allocated UCS-4 string.
This value must be freed with g_free(). If an
error occurs, %NULL will be returned and
@error set.
Creates a new #GParamSpecLong instance specifying a %G_TYPE_LONG property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Removes the key/value pair currently pointed to by the iterator
from its associated #GHashTable, without calling the key and value
destroy functions. Can only be called after
g_hash_table_iter_next() returned %TRUE, and cannot be called more
than once for the same key/value pair.
Since: 2.16
an initialized #GHashTableIter.
Check the result of the last g_test_trap_fork() call.
%TRUE if the last forked child terminated successfully.
Since: 2.16
Convert a sequence of bytes encoded as UTF-8 to a Unicode character.
This function checks for incomplete characters, for invalid characters
such as characters that are out of the range of Unicode, and for
overlong encodings of valid characters.
a pointer to Unicode character encoded as UTF-8
the maximum number of bytes to read, or -1, for no maximum or
if @p is nul-terminated
the resulting character. If @p points to a partial
sequence at the end of a string that could begin a valid
character (or if @max_len is zero), returns (gunichar)-2;
otherwise, if @p does not point to a valid UTF-8 encoded
Unicode character, returns (gunichar)-1.
Resets the state of the @checksum back to it's initial state.
Since: 2.18
the #GChecksum to reset
Flush the status from a sequence of calls to g_base64_encode_step().
whether to break long lines
pointer to destination buffer
Saved state from g_base64_encode_step()
Saved state from g_base64_encode_step()
The number of bytes of output that was written
Since: 2.12
Releases the queue's lock.
a #GAsyncQueue.
Adds a file descriptor to the set of file descriptors polled for
this source. This is usually combined with g_source_new() to add an
event source. The event source's check function will typically test
the @revents field in the #GPollFD struct and return %TRUE if events need
to be processed.
a #GSource
a #GPollFD structure holding information about a file
descriptor to watch.
Get the contents of a %G_TYPE_OBJECT derived #GValue.
a valid #GValue of %G_TYPE_OBJECT derived type
object contents of @value
Allocates a struct of the given size and initializes the initial
part as a #GClosure. This function is mainly useful when
implementing new types of closures.
|[
typedef struct _MyClosure MyClosure;
struct _MyClosure
{
GClosure closure;
// extra data goes here
};
static void
my_closure_finalize (gpointer notify_data,
GClosure *closure)
{
MyClosure *my_closure = (MyClosure *)closure;
// free extra data here
}
MyClosure *my_closure_new (gpointer data)
{
GClosure *closure;
MyClosure *my_closure;
closure = g_closure_new_simple (sizeof (MyClosure), data);
my_closure = (MyClosure *) closure;
// initialize extra data here
g_closure_add_finalize_notifier (closure, notify_data,
my_closure_finalize);
return my_closure;
}
]|
the size of the structure to allocate, must be at least
<literal>sizeof (GClosure)</literal>
data to store in the @data field of the newly allocated #GClosure
a newly allocated #GClosure
Creates a new random number generator initialized with @seed.
a value to initialize the random number generator.
the new #GRand.
Return value: Whether @iter is the end iterator.
a #GSequenceIter
Whether @iter is the end iterator.
Since: 2.14
Removes the last element of the queue.
a #GQueue.
the #GList element at the tail of the queue, or %NULL if the queue
is empty.
Reverses a #GList.
It simply switches the next and prev pointers of each element.
a #GList
the start of the reversed #GList
Inserts @data into @queue using @func to determine the new
position.
This function requires that the @queue is sorted before pushing on
new elements.
This function will lock @queue before it sorts the queue and unlock
it when it is finished.
For an example of @func see g_async_queue_sort().
Since: 2.10
a #GAsyncQueue
the @data to push into the @queue
the #GCompareDataFunc is used to sort @queue. This function
is passed two elements of the @queue. The function should return
0 if they are equal, a negative value if the first element
should be higher in the @queue or a positive value if the first
element should be lower in the @queue than the second element.
user data passed to @func.
Unescapes a whole escaped string.
If any of the characters in @illegal_characters or the character zero appears
as an escaped character in @escaped_string then that is an error and %NULL
will be returned. This is useful it you want to avoid for instance having a
slash being expanded in an escaped path element, which might confuse pathname
handling.
an escaped string to be unescaped.
an optional string of illegal characters not to be allowed.
an unescaped version of @escaped_string. The returned string
should be freed when no longer needed.
Since: 2.16
Appends a formatted string onto the end of a #GString.
This function is similar to g_string_append_printf()
except that the arguments to the format string are passed
as a va_list.
Since: 2.14
a #GString
the string format. See the printf() documentation
the list of arguments to insert in the output
Returns: The version information.
The version information.
Since: 2.6
Adds @nestedsuite to @suite.
Since: 2.16
a #GTestSuite
another #GTestSuite
Gets the directory components of a file name. If the file name has no
directory components "." is returned. The returned string should be
freed when no longer needed.
the name of the file.
the directory components of the file.
Get the contents of a %G_TYPE_DOUBLE #GValue.
a valid #GValue of type %G_TYPE_DOUBLE
double contents of @value
Another name for g_cclosure_marshal_BOOLEAN__FLAGS().
Converts an escaped ASCII-encoded URI to a local filename in the
encoding used for filenames.
a uri describing a filename (escaped, encoded in ASCII).
Location to store hostname for the URI, or %NULL.
If there is no hostname in the URI, %NULL will be
stored in this location.
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError may occur.
a newly-allocated string holding the resulting
filename, or %NULL on an error.
Pops data from the @queue. If no data is received before @end_time,
%NULL is returned.
To easily calculate @end_time a combination of g_get_current_time()
and g_time_val_add() can be used.
a #GAsyncQueue.
a #GTimeVal, determining the final time.
data from the queue or %NULL, when no data is
received before @end_time.
Adds a string to be displayed in <option>--help</option> output
after the list of options. This text often includes a bug reporting
address.
Note that the summary is translated (see
g_option_context_set_translate_func()).
Since: 2.12
a #GOptionContext
a string to be shown in <option>--help</option> output
after the list of options, or %NULL
This function works like g_object_set_qdata(), but in addition,
a void (*destroy) (gpointer) function may be specified which is
called with @data as argument when the @object is finalized, or
the data is being overwritten by a call to g_object_set_qdata()
with the same @quark.
The GObject to set store a user data pointer
A #GQuark, naming the user data pointer
An opaque user data pointer
Function to invoke with @data as argument, when @data
needs to be freed
Sets the name of the program. This name should <emphasis>not</emphasis>
be localized, contrast with g_set_application_name(). Note that for
thread-safety reasons this function can only be called once.
the name of the program.
Lookup the type ID from a given type name, returning 0 if no type
has been registered under this name (this is the preferred method
to find out by name whether a specific type has been registered
yet).
Type name to lookup.
Corresponding type ID or 0.
Gets the #GMainContext with which the source is associated.
Calling this function on a destroyed source is an error.
a #GSource
the #GMainContext with which the source is associated,
or %NULL if the context has not yet been added
to a source.
Converts a character to lower case.
a Unicode character.
the result of converting @c to lower case.
If @c is not an upperlower or titlecase character,
or has no lowercase equivalent @c is returned unchanged.
Creates a new instance of a #GObject subtype and sets its properties.
Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY)
which are not explicitly specified are set to their default values.
the type id of the #GObject subtype to instantiate
the length of the @parameters array
an array of #GParameter
a new instance of @object_type
Returns: the #GTypePlugin for the dynamic interface @interface_type
the #GType value of an instantiatable type.
the #GType value of an interface type.
the #GTypePlugin for the dynamic interface @interface_type
of @instance_type.
Executes a child program asynchronously (your program will not
block waiting for the child to exit). The child program is
specified by the only argument that must be provided, @argv. @argv
should be a %NULL-terminated array of strings, to be passed as the
argument vector for the child. The first string in @argv is of
course the name of the program to execute. By default, the name of
the program must be a full path; the <envar>PATH</envar> shell variable
will only be searched if you pass the %G_SPAWN_SEARCH_PATH flag.
On Windows, note that all the string or string vector arguments to
this function and the other g_spawn*() functions are in UTF-8, the
GLib file name encoding. Unicode characters that are not part of
the system codepage passed in these arguments will be correctly
available in the spawned program only if it uses wide character API
to retrieve its command line. For C programs built with Microsoft's
tools it is enough to make the program have a wmain() instead of
main(). wmain() has a wide character argument vector as parameter.
At least currently, mingw doesn't support wmain(), so if you use
mingw to develop the spawned program, it will have to call the
undocumented function __wgetmainargs() to get the wide character
argument vector and environment. See gspawn-win32-helper.c in the
GLib sources or init.c in the mingw runtime sources for a prototype
for that function. Alternatively, you can retrieve the Win32 system
level wide character command line passed to the spawned program
using the GetCommandLineW() function.
On Windows the low-level child process creation API
<function>CreateProcess()</function> doesn't use argument vectors,
but a command line. The C runtime library's
<function>spawn*()</function> family of functions (which
g_spawn_async_with_pipes() eventually calls) paste the argument
vector elements together into a command line, and the C runtime startup code
does a corresponding reconstruction of an argument vector from the
command line, to be passed to main(). Complications arise when you have
argument vector elements that contain spaces of double quotes. The
<function>spawn*()</function> functions don't do any quoting or
escaping, but on the other hand the startup code does do unquoting
and unescaping in order to enable receiving arguments with embedded
spaces or double quotes. To work around this asymmetry,
g_spawn_async_with_pipes() will do quoting and escaping on argument
vector elements that need it before calling the C runtime
spawn() function.
The returned @child_pid on Windows is a handle to the child
process, not its identifier. Process handles and process
identifiers are different concepts on Windows.
@envp is a %NULL-terminated array of strings, where each string
has the form <literal>KEY=VALUE</literal>. This will become
the child's environment. If @envp is %NULL, the child inherits its
parent's environment.
@flags should be the bitwise OR of any flags you want to affect the
function's behaviour. The %G_SPAWN_DO_NOT_REAP_CHILD means that
the child will not automatically be reaped; you must use a
#GChildWatch source to be notified about the death of the child
process. Eventually you must call g_spawn_close_pid() on the
@child_pid, in order to free resources which may be associated
with the child process. (On Unix, using a #GChildWatch source is
equivalent to calling waitpid() or handling the %SIGCHLD signal
manually. On Windows, calling g_spawn_close_pid() is equivalent
to calling CloseHandle() on the process handle returned in
@child_pid).
%G_SPAWN_LEAVE_DESCRIPTORS_OPEN means that the parent's open file
descriptors will be inherited by the child; otherwise all
descriptors except stdin/stdout/stderr will be closed before
calling exec() in the child. %G_SPAWN_SEARCH_PATH
means that <literal>argv[0]</literal> need not be an absolute path, it
will be looked for in the user's <envar>PATH</envar>.
%G_SPAWN_STDOUT_TO_DEV_NULL means that the child's standard output will
be discarded, instead of going to the same location as the parent's
standard output. If you use this flag, @standard_output must be %NULL.
%G_SPAWN_STDERR_TO_DEV_NULL means that the child's standard error
will be discarded, instead of going to the same location as the parent's
standard error. If you use this flag, @standard_error must be %NULL.
%G_SPAWN_CHILD_INHERITS_STDIN means that the child will inherit the parent's
standard input (by default, the child's standard input is attached to
/dev/null). If you use this flag, @standard_input must be %NULL.
%G_SPAWN_FILE_AND_ARGV_ZERO means that the first element of @argv is
the file to execute, while the remaining elements are the
actual argument vector to pass to the file. Normally
g_spawn_async_with_pipes() uses @argv[0] as the file to execute, and
passes all of @argv to the child.
@child_setup and @user_data are a function and user data. On POSIX
platforms, the function is called in the child after GLib has
performed all the setup it plans to perform (including creating
pipes, closing file descriptors, etc.) but before calling
exec(). That is, @child_setup is called just
before calling exec() in the child. Obviously
actions taken in this function will only affect the child, not the
parent.
On Windows, there is no separate fork() and exec()
functionality. Child processes are created and run with a single
API call, CreateProcess(). There is no sensible thing @child_setup
could be used for on Windows so it is ignored and not called.
If non-%NULL, @child_pid will on Unix be filled with the child's
process ID. You can use the process ID to send signals to the
child, or to use g_child_watch_add() (or waitpid()) if you specified the
%G_SPAWN_DO_NOT_REAP_CHILD flag. On Windows, @child_pid will be
filled with a handle to the child process only if you specified the
%G_SPAWN_DO_NOT_REAP_CHILD flag. You can then access the child
process using the Win32 API, for example wait for its termination
with the <function>WaitFor*()</function> functions, or examine its
exit code with GetExitCodeProcess(). You should close the handle
with CloseHandle() or g_spawn_close_pid() when you no longer need it.
If non-%NULL, the @standard_input, @standard_output, @standard_error
locations will be filled with file descriptors for writing to the child's
standard input or reading from its standard output or standard error.
The caller of g_spawn_async_with_pipes() must close these file descriptors
when they are no longer in use. If these parameters are %NULL, the corresponding
pipe won't be created.
If @standard_input is NULL, the child's standard input is attached to
/dev/null unless %G_SPAWN_CHILD_INHERITS_STDIN is set.
If @standard_error is NULL, the child's standard error goes to the same
location as the parent's standard error unless %G_SPAWN_STDERR_TO_DEV_NULL
is set.
If @standard_output is NULL, the child's standard output goes to the same
location as the parent's standard output unless %G_SPAWN_STDOUT_TO_DEV_NULL
is set.
@error can be %NULL to ignore errors, or non-%NULL to report errors.
If an error is set, the function returns %FALSE. Errors
are reported even if they occur in the child (for example if the
executable in <literal>argv[0]</literal> is not found). Typically
the <literal>message</literal> field of returned errors should be displayed
to users. Possible errors are those from the #G_SPAWN_ERROR domain.
If an error occurs, @child_pid, @standard_input, @standard_output,
and @standard_error will not be filled with valid values.
If @child_pid is not %NULL and an error does not occur then the returned
process reference must be closed using g_spawn_close_pid().
<note><para>
If you are writing a GTK+ application, and the program you
are spawning is a graphical application, too, then you may
want to use gdk_spawn_on_screen_with_pipes() instead to ensure that
the spawned program opens its windows on the right screen.
</para></note>
child's current working directory, or %NULL to inherit parent's, in the GLib file name encoding
child's argument vector, in the GLib file name encoding
child's environment, or %NULL to inherit parent's, in the GLib file name encoding
flags from #GSpawnFlags
function to run in the child just before exec()
user data for @child_setup
return location for child process ID, or %NULL
return location for file descriptor to write to child's stdin, or %NULL
return location for file descriptor to read child's stdout, or %NULL
return location for file descriptor to read child's stderr, or %NULL
return location for error
%TRUE on success, %FALSE if an error was set
Return value: The #GSequenceIter at position @pos
a #GSequence
a position in @seq, or -1 for the end.
The #GSequenceIter at position @pos
Since: 2.14
Converts from a pointer to position within a string to a integer
character offset.
Since 2.10, this function allows @pos to be before @str, and returns
a negative offset in this case.
a UTF-8 encoded string
a pointer to a position within @str
the resulting character offset
Sets the time the bookmark for @uri was last visited.
If no bookmark for @uri is found then it is created.
The "visited" time should only be set if the bookmark was launched,
either using the command line retrieved by g_bookmark_file_get_app_info()
or by the default application for the bookmark's MIME type, retrieved
using g_bookmark_file_get_mime_type(). Changing the "visited" time
does not affect the "modified" time.
Since: 2.12
a #GBookmarkFile
a valid URI
a timestamp or -1 to use the current time
Copies a #GRand into a new one with the same exact state as before.
This way you can take a snapshot of the random number generator for
replaying later.
a #GRand.
the new #GRand.
Since: 2.4
Executes a child synchronously (waits for the child to exit before returning).
All output from the child is stored in @standard_output and @standard_error,
if those parameters are non-%NULL. Note that you must set the
%G_SPAWN_STDOUT_TO_DEV_NULL and %G_SPAWN_STDERR_TO_DEV_NULL flags when
passing %NULL for @standard_output and @standard_error.
If @exit_status is non-%NULL, the exit status of the child is stored
there as it would be returned by waitpid(); standard UNIX macros such
as WIFEXITED() and WEXITSTATUS() must be used to evaluate the exit status.
Note that this function call waitpid() even if @exit_status is %NULL, and
does not accept the %G_SPAWN_DO_NOT_REAP_CHILD flag.
If an error occurs, no data is returned in @standard_output,
@standard_error, or @exit_status.
This function calls g_spawn_async_with_pipes() internally; see that
function for full details on the other parameters and details on
how these functions work on Windows.
child's current working directory, or %NULL to inherit parent's
child's argument vector
child's environment, or %NULL to inherit parent's
flags from #GSpawnFlags
function to run in the child just before exec()
user data for @child_setup
return location for child output, or %NULL
return location for child error messages, or %NULL
return location for child exit status, as returned by waitpid(), or %NULL
return location for error, or %NULL
%TRUE on success, %FALSE if an error was set.
Return value: The position of the first element in @queue which contains @data, or -1 if no element in @queue contains @data.
a #GQueue
the data to find.
The position of the first element in @queue which contains @data, or -1 if no element in @queue contains @data.
Since: 2.4
This sets an opaque, named pointer on an object.
The name is specified through a #GQuark (retrived e.g. via
g_quark_from_static_string()), and the pointer
can be gotten back from the @object with g_object_get_qdata()
until the @object is finalized.
Setting a previously set user data pointer, overrides (frees)
the old pointer set, using #NULL as pointer essentially
removes the data stored.
The GObject to set store a user data pointer
A #GQuark, naming the user data pointer
An opaque user data pointer
Adds a function to be called after an interface vtable is
initialized for any class (i.e. after the @interface_init member of
#GInterfaceInfo has been called).
This function is useful when you want to check an invariant that
depends on the interfaces of a class. For instance, the
implementation of #GObject uses this facility to check that an
object implements all of the properties that are defined on its
interfaces.
Since: 2.4
data to pass to @check_func
function to be called after each interface
is initialized.
Sets the value of a date to the date corresponding to a time
specified as a time_t. The time to date conversion is done using
the user's current timezone.
To set the value of a date to the current day, you could write:
|[
g_date_set_time_t (date, time (NULL));
]|
Since: 2.10
a #GDate
<type>time_t</type> value to set
Add a message to the test report.
Since: 2.16
the format string
printf-like arguments to @format
Construct an exact copy of a #GValueArray by duplicating all its
contents.
#GValueArray to copy
Newly allocated copy of #GValueArray
Convert a string from UTF-16 to UTF-8. The result will be
terminated with a 0 byte.
Note that the input is expected to be already in native endianness,
an initial byte-order-mark character is not handled specially.
g_convert() can be used to convert a byte buffer of UTF-16 data of
ambiguous endianess.
a UTF-16 encoded string
the maximum length (number of <type>gunichar2</type>) of @str to use.
If @len < 0, then the string is nul-terminated.
location to store number of words read, or %NULL.
If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
returned in case @str contains a trailing partial
character. If an error occurs then the index of the
invalid input is stored here.
location to store number of bytes written, or %NULL.
The value stored here does not include the trailing
0 byte.
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError other than
%G_CONVERT_ERROR_NO_CONVERSION may occur.
a pointer to a newly allocated UTF-8 string.
This value must be freed with g_free(). If an
error occurs, %NULL will be returned and
@error set.
Sets whether to ignore unknown options or not. If an argument is
ignored, it is left in the @argv array after parsing. By default,
g_option_context_parse() treats unknown options as error.
This setting does not affect non-option arguments (i.e. arguments
which don't start with a dash). But note that GOption cannot reliably
determine whether a non-option belongs to a preceding unknown option.
Since: 2.6
a #GOptionContext
%TRUE to ignore unknown options, %FALSE to produce
an error when unknown options are met
If @err is %NULL, does nothing. If @err is non-%NULL,
calls g_error_free() on *@err and sets *@err to %NULL.
a #GError return location
Registers a value transformation function for use in g_value_transform().
A previously registered transformation function for @src_type and @dest_type
will be replaced.
Source type.
Target type.
a function which transforms values of type @src_type
into value of type @dest_type
Increases the reference count of @object.
a #GObject
the same @object
Copies a #GChecksum. If @checksum has been closed, by calling
g_checksum_get_string() or g_checksum_get_digest(), the copied
checksum will be closed as well.
the #GChecksum to copy
the copy of the passed #GChecksum. Use g_checksum_free()
when finished using it.
Since: 2.16
Registers @type_id as the predefined identifier and @type_name as the
name of a fundamental type. The type system uses the information
contained in the #GTypeInfo structure pointed to by @info and the
#GTypeFundamentalInfo structure pointed to by @finfo to manage the
type and its instances. The value of @flags determines additional
characteristics of the fundamental type.
A predefined type identifier.
0-terminated string used as the name of the new type.
The #GTypeInfo structure for this type.
The #GTypeFundamentalInfo structure for this type.
Bitwise combination of #GTypeFlags values.
The predefined type identifier.
Return value: the end iterator for @seq
a #GSequence
the end iterator for @seq
Since: 2.14
Appends @unescaped to @string, escaped any characters that
are reserved in URIs using URI-style escape sequences.
a #GString
a string
a string of reserved characters allowed to be used
set %TRUE if the escaped string may include UTF8 characters
@string
Since: 2.16
Convert a character to ASCII lower case.
Unlike the standard C library tolower() function, this only
recognizes standard ASCII letters and ignores the locale, returning
all non-ASCII characters unchanged, even if they are lower case
letters in a particular character set. Also unlike the standard
library function, this takes and returns a char, not an int, so
don't call it on %EOF but no need to worry about casting to #guchar
before passing a possibly non-ASCII character in.
any character.
the result of converting @c to lower case.
If @c is not an ASCII upper case letter,
@c is returned unchanged.
Collects the attributes of the element from the
data passed to the #GMarkupParser start_element
function, dealing with common error conditions
and supporting boolean values.
This utility function is not required to write
a parser but can save a lot of typing.
The @element_name, @attribute_names,
@attribute_values and @error parameters passed
to the start_element callback should be passed
unmodified to this function.
Following these arguments is a list of
"supported" attributes to collect. It is an
error to specify multiple attributes with the
same name. If any attribute not in the list
appears in the @attribute_names array then an
unknown attribute error will result.
The #GMarkupCollectType field allows specifying
the type of collection to perform and if a
given attribute must appear or is optional.
The attribute name is simply the name of the
attribute to collect.
The pointer should be of the appropriate type
(see the descriptions under
#GMarkupCollectType) and may be %NULL in case a
particular attribute is to be allowed but
ignored.
This function deals with issuing errors for missing attributes
(of type %G_MARKUP_ERROR_MISSING_ATTRIBUTE), unknown attributes
(of type %G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE) and duplicate
attributes (of type %G_MARKUP_ERROR_INVALID_CONTENT) as well
as parse errors for boolean-valued attributes (again of type
%G_MARKUP_ERROR_INVALID_CONTENT). In all of these cases %FALSE
will be returned and @error will be set as appropriate.
the current tag name
the attribute names
the attribute values
a pointer to a #GError or %NULL
the #GMarkupCollectType of the
first attribute
the name of the first attribute
a pointer to the storage location of the
first attribute (or %NULL), followed by
more types names and pointers, ending
with %G_MARKUP_COLLECT_INVALID.
%TRUE if successful
Since: 2.16
Return value: The number of items in @queue.
a #GQueue
The number of items in @queue.
Since: 2.4
Looks up a #GParamSpec in the pool.
a #GParamSpecPool
the name to look for
the owner to look for
If %TRUE, also try to find a #GParamSpec with @param_name
owned by an ancestor of @owner_type.
The found #GParamSpec, or %NULL if no matching #GParamSpec was found.
This returns the string that #GIOChannel uses to determine
where in the file a line break occurs. A value of %NULL
indicates autodetection.
a #GIOChannel
a location to return the length of the line terminator
The line termination string. This value
is owned by GLib and must not be freed.
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gboolean arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gboolean parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Lists the properties of an interface.Generally, the interface
vtable passed in as @g_iface will be the default vtable from
g_type_default_interface_ref(), or, if you know the interface has
already been loaded, g_type_default_interface_peek().
Since: 2.4
any interface vtable for the interface, or the default
vtable for the interface
location to store number of properties returned.
a pointer to an array of pointers to #GParamSpec
structures. The paramspecs are owned by GLib, but the
array should be freed with g_free() when you are done with
it.
Reverses a UTF-8 string. @str must be valid UTF-8 encoded text.
(Use g_utf8_validate() on all text before trying to use UTF-8
utility functions with it.)
This function is intended for programmatic uses of reversed strings.
It pays no attention to decomposed characters, combining marks, byte
order marks, directional indicators (LRM, LRO, etc) and similar
characters which might need special handling when reversing a string
for display purposes.
Note that unlike g_strreverse(), this function returns
newly-allocated memory, which should be freed with g_free() when
no longer needed.
a UTF-8 encoded string
the maximum length of @str to use, in bytes. If @len < 0,
then the string is nul-terminated.
a newly-allocated string which is the reverse of @str.
Since: 2.2
Return value: A random number.
lower closed bound of the interval.
upper open bound of the interval.
A random number.
Gets flags values packed in together with the datalist.
See g_datalist_set_flags().
pointer to the location that holds a list
the flags of the datalist
Since: 2.8
Removes the idle function with the given data.
the data for the idle source's callback.
%TRUE if an idle source was found and removed.
Creates a new #GQueue.
a new #GQueue.
Sort @value_array using @compare_func to compare the elements accoring to
the semantics of #GCompareFunc.
The current implementation uses Quick-Sort as sorting algorithm.
#GValueArray to sort
function to compare elements
the #GValueArray passed in as @value_array
Gets the name of the file without any leading directory components.
It returns a pointer into the given file name string.
the name of the file.
the name of the file without any leading directory components.
Deprecated:2.2: Use g_path_get_basename() instead, but notice that
g_path_get_basename() allocates new memory for the returned string, unlike
this function which returns a pointer into the argument.
A wrapper for the POSIX unlink() function. The unlink() function
deletes a name from the filesystem. If this was the last link to the
file and no processes have it opened, the diskspace occupied by the
file is freed.
See your C library manual for more details about unlink(). Note
that on Windows, it is in general not possible to delete files that
are open to some process, or mapped into memory.
a pathname in the GLib file name encoding (UTF-8 on Windows)
0 if the name was successfully deleted, -1 if an error
occurred
Since: 2.6
Set the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed.
The boxed value is assumed to be static, and is thus not duplicated
when setting the #GValue.
a valid #GValue of %G_TYPE_BOXED derived type
static boxed value to be set
Return Value: %TRUE if the @channel is buffered.
a #GIOChannel
%TRUE if the @channel is buffered.
Converts a string from UTF-8 to the encoding used for strings by
the C runtime (usually the same as that used by the operating
system) in the <link linkend="setlocale">current locale</link>. On
Windows this means the system codepage.
a UTF-8 encoded string
the length of the string, or -1 if the string is
nul-terminated<footnoteref linkend="nul-unsafe"/>.
location to store the number of bytes in the
input string that were successfully converted, or %NULL.
Even if the conversion was successful, this may be
less than @len if there were partial characters
at the end of the input. If the error
#G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value
stored will the byte offset after the last valid
input sequence.
the number of bytes stored in the output buffer (not
including the terminating nul).
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError may occur.
The converted string, or %NULL on an error.
Decreases the reference count of @object. When its reference count
drops to 0, the object is finalized (i.e. its memory is freed).
a #GObject
Removes the item pointed to by @iter. It is an error to pass the
end iterator to this function.
If the sequnce has a data destroy function associated with it, this
function is called on the data for the removed item.
Since: 2.14
a #GSequenceIter
Get the nickname of a #GParamSpec.
a valid #GParamSpec
the nickname of @pspec.
Tries to pop data from the @queue. If no data is available, %NULL is
returned. This function must be called while holding the @queue's
lock.
a #GAsyncQueue.
data from the queue or %NULL, when no data is
available immediately.
Gets the first element in a #GList.
a #GList
the first element in the #GList,
or %NULL if the #GList has no elements
Sets the contents of a %G_TYPE_OBJECT derived #GValue to @v_object
and takes over the ownership of the callers reference to @v_object;
the caller doesn't have to unref it any more (i.e. the reference
count of the object is not increased).
If you want the #GValue to hold its own reference to @v_object, use
g_value_set_object() instead.
Since: 2.4
a valid #GValue of %G_TYPE_OBJECT derived type
object value to be set
Return value: The main loop recursion level in the current thread
The main loop recursion level in the current thread
Inserts a new element into the list, using the given comparison
function to determine its position.
a pointer to a #GList
the data for the new element
the function to compare elements in the list.
It should return a number > 0 if the first parameter
comes after the second parameter in the sort order.
user data to pass to comparison function.
the new start of the #GList
Since: 2.10
A predefined #GSignalAccumulator for signals that return a
boolean values. The behavior that this accumulator gives is
that a return of %TRUE stops the signal emission: no further
callbacks will be invoked, while a return of %FALSE allows
the emission to coninue. The idea here is that a %TRUE return
indicates that the callback <emphasis>handled</emphasis> the signal,
and no further handling is needed.
Since: 2.4
standard #GSignalAccumulator parameter
standard #GSignalAccumulator parameter
standard #GSignalAccumulator parameter
standard #GSignalAccumulator parameter
standard #GSignalAccumulator result
Removes all keys and their associated values from a #GHashTable.
If the #GHashTable was created using g_hash_table_new_full(), the keys
and values are freed using the supplied destroy functions, otherwise you
have to make sure that any dynamically allocated values are freed
yourself.
Since: 2.12
a #GHashTable
Sets the character which is used to separate
values in lists. Typically ';' or ',' are used
as separators. The default list separator is ';'.
Since: 2.6
a #GKeyFile
the separator
Return value: A random number.
a #GRand.
lower closed bound of the interval.
upper open bound of the interval.
A random number.
Removes a key and its associated value from a #GHashTable.
If the #GHashTable was created using g_hash_table_new_full(), the
key and value are freed using the supplied destroy functions, otherwise
you have to make sure that any dynamically allocated values are freed
yourself.
a #GHashTable.
the key to remove.
%TRUE if the key was found and removed from the #GHashTable.
This function is intended for #GObject implementations to re-enforce a
<link linkend="floating-ref">floating</link> object reference.
Doing this is seldomly required, all
#GInitiallyUnowned<!-- -->s are created with a floating reference which
usually just needs to be sunken by calling g_object_ref_sink().
Since: 2.10
a #GObject
Converts a #GString to uppercase.
a #GString
@string
Deprecated:2.2: This function uses the locale-specific
toupper() function, which is almost never the right thing.
Use g_string_ascii_up() or g_utf8_strup() instead.
Return value: whether @error has @domain and @code
a #GError
an error domain
an error code
whether @error has @domain and @code
Creates a new #GString, with enough space for @dfl_size
bytes. This is useful if you are going to add a lot of
text to the string and don't want it to be reallocated
too often.
the default size of the space allocated to
hold the string
the new #GString
Return the path to the share\locale or lib\locale subfolder of the
GLib installation folder. The path is in the system codepage. We
have to use system codepage as bindtextdomain() doesn't have a
UTF-8 interface.
Converts a filename into a valid UTF-8 string. The conversion is
not necessarily reversible, so you should keep the original around
and use the return value of this function only for display purposes.
Unlike g_filename_to_utf8(), the result is guaranteed to be non-%NULL
even if the filename actually isn't in the GLib file name encoding.
If GLib can not make sense of the encoding of @filename, as a last resort it
replaces unknown characters with U+FFFD, the Unicode replacement character.
You can search the result for the UTF-8 encoding of this character (which is
"\357\277\275" in octal notation) to find out if @filename was in an invalid
encoding.
If you know the whole pathname of the file you should use
g_filename_display_basename(), since that allows location-based
translation of filenames.
a pathname hopefully in the GLib file name encoding
a newly allocated string containing
a rendition of the filename in valid UTF-8
Since: 2.6
Calls a function for each element of a #GSList.
a #GSList
the function to call with each element's data
user data to pass to the function
Reverses the order of the children of a #GNode.
(It doesn't change the order of the grandchildren.)
a #GNode.
A convenience function which creates a main group if it doesn't
exist, adds the @entries to it and sets the translation domain.
Since: 2.6
a #GOptionContext
a %NULL-terminated array of #GOptionEntry<!-- -->s
a translation domain to use for translating
the <option>--help</option> output for the options in @entries
with gettext(), or %NULL
Opens a directory for reading. The names of the files in the
directory can then be retrieved using g_dir_read_name().
the path to the directory you are interested in. On Unix
in the on-disk encoding. On Windows in UTF-8
Currently must be set to 0. Reserved for future use.
return location for a #GError, or %NULL.
If non-%NULL, an error will be set if and only if
g_dir_open() fails.
a newly allocated #GDir on success, %NULL on failure.
If non-%NULL, you must free the result with g_dir_close()
when you are finished with it.
Polls @fds, as with the poll() system call, but portably. (On
systems that don't have poll(), it is emulated using select().)
This is used internally by #GMainContext, but it can be called
directly if you need to block until a file descriptor is ready, but
don't want to run the full main loop.
Each element of @fds is a #GPollFD describing a single file
descriptor to poll. The %fd field indicates the file descriptor,
and the %events field indicates the events to poll for. On return,
the %revents fields will be filled with the events that actually
occurred.
On POSIX systems, the file descriptors in @fds can be any sort of
file descriptor, but the situation is much more complicated on
Windows. If you need to use g_poll() in code that has to run on
Windows, the easiest solution is to construct all of your
#GPollFD<!-- -->s with g_io_channel_win32_make_pollfd().
file descriptors to poll
the number of file descriptors in @fds
amount of time to wait, in milliseconds, or -1 to wait forever
the number of entries in @fds whose %revents fields
were filled in, or 0 if the operation timed out, or -1 on error or
if the call was interrupted.
Since: 2.20
Creates a new #GParamSpecULong instance specifying a %G_TYPE_ULONG
property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Overrides the class closure (i.e. the default handler) for the
given signal for emissions on instances of @instance_type with
callabck @class_handler. @instance_type must be derived from the
type to which the signal belongs.
See g_signal_chain_from_overridden() and
g_signal_chain_from_overridden_handler() for how to chain up to the
parent class closure from inside the overridden one.
Since: 2.18
the name for the signal
the instance type on which to override the class handler
for the signal.
the handler.
Gets the position of the element containing
the given data (starting from 0).
a #GList
the data to find
the index of the element containing the data,
or -1 if the data is not found
Remove a specified datum from the object's data associations,
without invoking the association's destroy handler.
#GObject containing the associations
name of the key
the data if found, or %NULL if no such data exists.
A #GParamSpecPool maintains a collection of #GParamSpec<!-- -->s which can be
quickly accessed by owner and name. The implementation of the #GObject property
system uses such a pool to store the #GParamSpecs of the properties all object
types.
Inserts @data into the list of tasks to be executed by @pool. When
the number of currently running threads is lower than the maximal
allowed number of threads, a new thread is started (or reused) with
the properties given to g_thread_pool_new (). Otherwise @data stays
in the queue until a thread in this pool finishes its previous task
and processes @data.
@error can be %NULL to ignore errors, or non-%NULL to report
errors. An error can only occur when a new thread couldn't be
created. In that case @data is simply appended to the queue of work
to do.
a #GThreadPool
a new task for @pool
return location for error
Increases reference count of @regex by 1.
a #GRegex
@regex
Since: 2.14
Reads a line, including the terminating character(s),
from a #GIOChannel into a newly-allocated string.
@str_return will contain allocated memory if the return
is %G_IO_STATUS_NORMAL.
a #GIOChannel
The line read from the #GIOChannel, including the
line terminator. This data should be freed with g_free()
when no longer needed. This is a nul-terminated string.
If a @length of zero is returned, this will be %NULL instead.
location to store length of the read data, or %NULL
location to store position of line terminator, or %NULL
A location to return an error of type #GConvertError
or #GIOChannelError
the status of the operation.
Increase the reference count of @object, and possibly remove the
<link linkend="floating-ref">floating</link> reference, if @object
has a floating reference.
In other words, if the object is floating, then this call "assumes
ownership" of the floating reference, converting it to a normal
reference by clearing the floating flag while leaving the reference
count unchanged. If the object is not floating, then this call
adds a new normal reference increasing the reference count by one.
Since: 2.10
a #GObject
@object
Moves the data pointed to a new position as indicated by @cmp_func. This
function should be called for items in a sequence already sorted according
to @cmp_func whenever some aspect of an item changes so that @cmp_func
may return different values for that item.
Since: 2.14
A #GSequenceIter
the #GCompareDataFunc used to compare items in the sequence. It
is called with two items of the @seq and @user_data. It should
return 0 if the items are equal, a negative value if the first
item comes before the second, and a positive value if the second
item comes before the first.
user data passed to @cmp_func.
An auxiliary function for gettext() support (see Q_()).
a string
another string
@msgval, unless @msgval is identical to @msgid and contains
a '|' character, in which case a pointer to the substring of msgid after
the first '|' character is returned.
Since: 2.4
Determines information necessary to poll this main loop.
a #GMainContext
maximum priority source to check
location to store timeout to be used in polling
location to store #GPollFD records that need to be polled.
length of @fds.
the number of records actually stored in @fds,
or, if more than @n_fds records need to be stored, the number
of records that need to be stored.
Gets the current user's home directory as defined in the
password database.
Note that in contrast to traditional UNIX tools, this function
prefers <filename>passwd</filename> entries over the <envar>HOME</envar>
environment variable.
One of the reasons for this decision is that applications in many
cases need special handling to deal with the case where
<envar>HOME</envar> is
<simplelist>
<member>Not owned by the user</member>
<member>Not writeable</member>
<member>Not even readable</member>
</simplelist>
Since applications are in general <emphasis>not</emphasis> written
to deal with these situations it was considered better to make
g_get_home_dir() not pay attention to <envar>HOME</envar> and to
return the real home directory for the user. If applications
want to pay attention to <envar>HOME</envar>, they can do:
|[
const char *homedir = g_getenv ("HOME");
if (!homedir)
homedir = g_get_home_dir (<!-- -->);
]|
the current user's home directory
Adds a new element on to the start of the list.
<note><para>
The return value is the new start of the list, which
may have changed, so make sure you store the new value.
</para></note>
|[
/* Notice that it is initialized to the empty list. */
GList *list = NULL;
list = g_list_prepend (list, "last");
list = g_list_prepend (list, "first");
]|
a pointer to a #GList
the data for the new element
the new start of the #GList
A statically-allocated #GQueue must be initialized with this function
before it can be used. Alternatively you can initialize it with
#G_QUEUE_INIT. It is not necessary to initialize queues created with
g_queue_new().
Since: 2.14
an uninitialized #GQueue
Returns: the expanded string, or %NULL if an error occurred
a #GMatchInfo or %NULL
the string to expand
location to store the error occuring, or %NULL to ignore errors
the expanded string, or %NULL if an error occurred
Since: 2.14
Loads a key file from memory into an empty #GKeyFile structure.
If the object cannot be created then %error is set to a #GKeyFileError.
an empty #GKeyFile struct
key file loaded in memory
the length of @data in bytes
flags from #GKeyFileFlags
return location for a #GError, or %NULL
%TRUE if a key file could be loaded, %FALSE otherwise
Since: 2.6
Creates a new #GParamSpecChar instance specifying a %G_TYPE_CHAR property.
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Converts all lower case ASCII letters to upper case ASCII letters.
a GString
passed-in @string pointer, with all the lower case
characters converted to upper case in place, with
semantics that exactly match g_ascii_toupper().
Compare two strings, ignoring the case of ASCII characters.
Unlike the BSD strcasecmp() function, this only recognizes standard
ASCII letters and ignores the locale, treating all non-ASCII
bytes as if they are not letters.
This function should be used only on strings that are known to be
in encodings where the bytes corresponding to ASCII letters always
represent themselves. This includes UTF-8 and the ISO-8859-*
charsets, but not for instance double-byte encodings like the
Windows Codepage 932, where the trailing bytes of double-byte
characters include all ASCII letters. If you compare two CP932
strings using this function, you will get false matches.
string to compare with @s2.
string to compare with @s1.
0 if the strings match, a negative value if @s1 < @s2,
or a positive value if @s1 > @s2.
Gets the last element in a #GSList.
<note><para>
This function iterates over the whole list.
</para></note>
a #GSList
the last element in the #GSList,
or %NULL if the #GSList has no elements
Creates a new asynchronous queue with an initial reference count of 1 and
sets up a destroy notify function that is used to free any remaining
queue items when the queue is destroyed after the final unref.
function to free queue elements
the new #GAsyncQueue.
Since: 2.16
Return value: the maximal number of threads
a #GThreadPool
the maximal number of threads
Determines the preferred character sets used for filenames.
The first character set from the @charsets is the filename encoding, the
subsequent character sets are used when trying to generate a displayable
representation of a filename, see g_filename_display_name().
On Unix, the character sets are determined by consulting the
environment variables <envar>G_FILENAME_ENCODING</envar> and
<envar>G_BROKEN_FILENAMES</envar>. On Windows, the character set
used in the GLib API is always UTF-8 and said environment variables
have no effect.
<envar>G_FILENAME_ENCODING</envar> may be set to a comma-separated list
of character set names. The special token "@locale" is taken to
mean the character set for the <link linkend="setlocale">current
locale</link>. If <envar>G_FILENAME_ENCODING</envar> is not set, but
<envar>G_BROKEN_FILENAMES</envar> is, the character set of the current
locale is taken as the filename encoding. If neither environment variable
is set, UTF-8 is taken as the filename encoding, but the character
set of the current locale is also put in the list of encodings.
The returned @charsets belong to GLib and must not be freed.
Note that on Unix, regardless of the locale character set or
<envar>G_FILENAME_ENCODING</envar> value, the actual file names present
on a system might be in any random encoding or just gibberish.
return location for the %NULL-terminated list of encoding names
%TRUE if the filename encoding is UTF-8.
Since: 2.6
Clears the current value in @value and resets it to the default value
(as if the value had just been initialized).
An initialized #GValue structure.
the #GValue structure that has been passed in
Free the boxed structure @boxed which is of type @boxed_type.
The type of @boxed.
The boxed structure to be freed.
Determines the numeric value of a character as a decimal
digit. Differs from g_unichar_digit_value() because it takes
a char, so there's no worry about sign extension if characters
are signed.
an ASCII character.
If @c is a decimal digit (according to
g_ascii_isdigit()), its numeric value. Otherwise, -1.
Adds the #GIOChannel into the default main loop context
with the given priority.
This internally creates a main loop source using g_io_create_watch()
and attaches it to the main loop context with g_source_attach().
You can do these steps manuallt if you need greater control.
a #GIOChannel
the priority of the #GIOChannel source
the condition to watch for
the function to call when the condition is satisfied
user data to pass to @func
the function to call when the source is removed
the event source id
Compiles the regular expression to an internal form, and does
the initial setup of the #GRegex structure.
the regular expression
compile options for the regular expression, or 0
match options for the regular expression, or 0
return location for a #GError
a #GRegex structure. Call g_regex_unref() when you
are done with it
Since: 2.14
Check the result of the last g_test_trap_fork() call.
%TRUE if the last forked child got killed due to a fork timeout.
Since: 2.16
Removes the last element of the queue.
a #GQueue.
the data of the last element in the queue, or %NULL if the queue
is empty.
Transforms @src_value into @dest_value if possible, and then
validates @dest_value, in order for it to conform to @pspec. If
@strict_validation is %TRUE this function will only succeed if the
transformed @dest_value complied to @pspec without modifications.
See also g_value_type_transformable(), g_value_transform() and
g_param_value_validate().
a valid #GParamSpec
souce #GValue
destination #GValue of correct type for @pspec
%TRUE requires @dest_value to conform to @pspec
without modifications
%TRUE if transformation and validation were successful,
%FALSE otherwise and @dest_value is left untouched.
Gets the element at the given position in a #GList.
a #GList
the position of the element, counting from 0
the element, or %NULL if the position is off
the end of the #GList
Inserts a new element into the list, using the given comparison
function to determine its position.
a pointer to a #GList
the data for the new element
the function to compare elements in the list. It should
return a number > 0 if the first parameter comes after the
second parameter in the sort order.
the new start of the #GList
This is similar to g_signal_connect_data(), but uses a closure which
ensures that the @gobject stays alive during the call to @c_handler
by temporarily adding a reference count to @gobject.
Note that there is a bug in GObject that makes this function
much less useful than it might seem otherwise. Once @gobject is
disposed, the callback will no longer be called, but, the signal
handler is <emphasis>not</emphasis> currently disconnected. If the
@instance is itself being freed at the same time than this doesn't
matter, since the signal will automatically be removed, but
if @instance persists, then the signal handler will leak. You
should not remove the signal yourself because in a future versions of
GObject, the handler <emphasis>will</emphasis> automatically
be disconnected.
It's possible to work around this problem in a way that will
continue to work with future versions of GObject by checking
that the signal handler is still connected before disconnected it:
<informalexample><programlisting>
if (g_signal_handler_is_connected (instance, id))
g_signal_handler_disconnect (instance, id);
</programlisting></informalexample>
the instance to connect to.
a string of the form "signal-name::detail".
the #GCallback to connect.
the object to pass as data to @c_handler.
a combination of #GConnnectFlags.
the handler id.
Sets a function to be called at regular intervals, with the given
priority. The function is called repeatedly until it returns
%FALSE, at which point the timeout is automatically destroyed and
the function will not be called again. The @notify function is
called when the timeout is destroyed. The first call to the
function will be at the end of the first @interval.
Note that timeout functions may be delayed, due to the processing of other
event sources. Thus they should not be relied on for precise timing.
After each call to the timeout function, the time of the next
timeout is recalculated based on the current time and the given interval
(it does not try to 'catch up' time lost in delays).
This internally creates a main loop source using g_timeout_source_new()
and attaches it to the main loop context using g_source_attach(). You can
do these steps manually if you need greater control.
the priority of the timeout source. Typically this will be in
the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
the time between calls to the function, in milliseconds
(1/1000ths of a second)
function to call
data to pass to @function
function to call when the timeout is removed, or %NULL
the ID (greater than 0) of the event source.
Return value: %TRUE if the source has been destroyed
a #GSource
%TRUE if the source has been destroyed
Since: 2.12
Sets the value of a date from a #GTimeVal value. Note that the
@tv_usec member is ignored, because #GDate can't make use of the
additional precision.
Since: 2.10
a #GDate
#GTimeVal value to set
Set the contents of a %G_TYPE_FLAGS #GValue to @v_flags.
a valid #GValue whose type is derived from %G_TYPE_FLAGS
flags value to be set
Looks up a key in the #GTree, returning the original key and the
associated value and a #gboolean which is %TRUE if the key was found. This
is useful if you need to free the memory allocated for the original key,
for example before calling g_tree_remove().
a #GTree.
the key to look up.
returns the original key.
returns the value associated with the key.
%TRUE if the key was found in the #GTree.
Determines if a given character typically takes zero width when rendered.
The return value is %TRUE for all non-spacing and enclosing marks
(e.g., combining accents), format characters, zero-width
space, but not U+00AD SOFT HYPHEN.
A typical use of this function is with one of g_unichar_iswide() or
g_unichar_iswide_cjk() to determine the number of cells a string occupies
when displayed on a grid display (terminals). However, note that not all
terminals support zero-width rendering of zero-width marks.
a Unicode character
%TRUE if the character has zero width
Since: 2.14
Like the standard C strncpy() function, but
copies a given number of characters instead of a given number of
bytes. The @src string must be valid UTF-8 encoded text.
(Use g_utf8_validate() on all text before trying to use UTF-8
utility functions with it.)
buffer to fill with characters from @src
UTF-8 encoded string
character count
@dest
Checks whether @replacement is a valid replacement string
(see g_regex_replace()), i.e. that all escape sequences in
it are valid.
If @has_references is not %NULL then @replacement is checked
for pattern references. For instance, replacement text 'foo\n'
does not contain references and may be evaluated without information
about actual match, but '\0\1' (whole match followed by first
subpattern) requires valid #GMatchInfo object.
the replacement string
location to store information about
references in @replacement or %NULL
location to store error
whether @replacement is a valid replacement string
Since: 2.14
Decode a sequence of Base-64 encoded text into binary data
zero-terminated string with base64 text to decode
The length of the decoded data is written here
a newly allocated buffer containing the binary data
that @text represents. The returned buffer must
be freed with g_free().
Since: 2.12
Return value: whether a test was %TRUE
a filename to test in the GLib file name encoding
bitfield of #GFileTest flags
whether a test was %TRUE
Return value: the length of the @queue.
a #GAsyncQueue.
the length of the @queue.
Sets @title as the title of the bookmark for @uri inside the
bookmark file @bookmark.
If @uri is %NULL, the title of @bookmark is set.
If a bookmark for @uri cannot be found then it is created.
Since: 2.12
a #GBookmarkFile
a valid URI or %NULL
a UTF-8 encoded string
Deletes an emission hook.
the id of the signal
the id of the emission hook, as returned by
g_signal_add_emission_hook()
Sets the maximal allowed number of threads for @pool. A value of -1
means, that the maximal number of threads is unlimited.
Setting @max_threads to 0 means stopping all work for @pool. It is
effectively frozen until @max_threads is set to a non-zero value
again.
A thread is never terminated while calling @func, as supplied by
g_thread_pool_new (). Instead the maximal number of threads only
has effect for the allocation of new threads in g_thread_pool_push().
A new thread is allocated, whenever the number of currently
running threads in @pool is smaller than the maximal number.
@error can be %NULL to ignore errors, or non-%NULL to report
errors. An error can only occur when a new thread couldn't be
created.
a #GThreadPool
a new maximal number of threads for @pool
return location for error
Finds the start of the next UTF-8 character in the string after @p.
@p does not have to be at the beginning of a UTF-8 character. No check
is made to see if the character found is actually valid other than
it starts with an appropriate byte.
a pointer to a position within a UTF-8 encoded string
a pointer to the byte following the end of the string,
or %NULL to indicate that the string is nul-terminated.
a pointer to the found character or %NULL
Determines whether a character is a space, tab, or line separator
(newline, carriage return, etc.). Given some UTF-8 text, obtain a
character value with g_utf8_get_char().
(Note: don't use this to do word breaking; you have to use
Pango or equivalent to get word breaking right, the algorithm
is fairly complex.)
a Unicode character
%TRUE if @c is a space character
Convert a string from UTF-8 to a 32-bit fixed width
representation as UCS-4. A trailing 0 will be added to the
string after the converted text.
a UTF-8 encoded string
the maximum length of @str to use, in bytes. If @len < 0,
then the string is nul-terminated.
location to store number of bytes read, or %NULL.
If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
returned in case @str contains a trailing partial
character. If an error occurs then the index of the
invalid input is stored here.
location to store number of characters written or %NULL.
The value here stored does not include the trailing 0
character.
location to store the error occuring, or %NULL to ignore
errors. Any of the errors in #GConvertError other than
%G_CONVERT_ERROR_NO_CONVERSION may occur.
a pointer to a newly allocated UCS-4 string.
This value must be freed with g_free(). If an
error occurs, %NULL will be returned and
@error set.
If @dest is %NULL, free @src; otherwise,
moves @src into *@dest. *@dest must be %NULL.
After the move, add a prefix as with
g_prefix_error().
Since: 2.16
error return location
error to move into the return location
printf()-style format string
arguments to @format
Gets the first sibling of a #GNode.
This could possibly be the node itself.
a #GNode
the first sibling of @node
Looks up or registers a type that is implemented with a particular
type plugin. If a type with name @type_name was previously registered,
the #GType identifier for the type is returned, otherwise the type
is newly registered, and the resulting #GType identifier returned.
When reregistering a type (typically because a module is unloaded
then reloaded, and reinitialized), @module and @parent_type must
be the same as they were previously.
As long as any instances of the type exist, the type plugin will
not be unloaded.
a #GTypeModule
the type for the parent class
name for the type
type information structure
flags field providing details about the type
the new or existing type ID
Makes a copy of @error.
a #GError
a new #GError
Returns: The nextmost fundamental type ID to be registered,
The nextmost fundamental type ID to be registered,
or 0 if the type system ran out of fundamental type IDs.
Insert a copy of @value as last element of @value_array.
#GValueArray to add an element to
#GValue to copy into #GValueArray
the #GValueArray passed in as @value_array
Gets the name of the program. This name should <emphasis>not</emphasis>
be localized, contrast with g_get_application_name().
(If you are using GDK or GTK+ the program name is set in gdk_init(),
which is called by gtk_init(). The program name is found by taking
the last component of <literal>argv[0]</literal>.)
the name of the program. The returned string belongs
to GLib and must not be modified or freed.
Inserts @len bytes of @val into @string at @pos.
Because @len is provided, @val may contain embedded
nuls and need not be nul-terminated. If @pos is -1,
bytes are inserted at the end of the string.
Since this function does not stop at nul bytes, it is
the caller's responsibility to ensure that @val has at
least @len addressable bytes.
a #GString
position in @string where insertion should
happen, or -1 for at the end
bytes to insert
number of bytes of @val to insert
@string
Inserts a new key and value into a #GTree similar to g_tree_insert().
The difference is that if the key already exists in the #GTree, it gets
replaced by the new key. If you supplied a @value_destroy_func when
creating the #GTree, the old value is freed using that function. If you
supplied a @key_destroy_func when creating the #GTree, the old key is
freed using that function.
The tree is automatically 'balanced' as new key/value pairs are added,
so that the distance from the root to every leaf is as small as possible.
a #GTree.
the key to insert.
the value corresponding to the key.
This function creates a new thread pool.
Whenever you call g_thread_pool_push(), either a new thread is
created or an unused one is reused. At most @max_threads threads
are running concurrently for this thread pool. @max_threads = -1
allows unlimited threads to be created for this thread pool. The
newly created or reused thread now executes the function @func with
the two arguments. The first one is the parameter to
g_thread_pool_push() and the second one is @user_data.
The parameter @exclusive determines, whether the thread pool owns
all threads exclusive or whether the threads are shared
globally. If @exclusive is %TRUE, @max_threads threads are started
immediately and they will run exclusively for this thread pool until
it is destroyed by g_thread_pool_free(). If @exclusive is %FALSE,
threads are created, when needed and shared between all
non-exclusive thread pools. This implies that @max_threads may not
be -1 for exclusive thread pools.
@error can be %NULL to ignore errors, or non-%NULL to report
errors. An error can only occur when @exclusive is set to %TRUE and
not all @max_threads threads could be created.
a function to execute in the threads of the new thread pool
user data that is handed over to @func every time it
is called
the maximal number of threads to execute concurrently in
the new thread pool, -1 means no limit
should this thread pool be exclusive?
return location for error
the new #GThreadPool
Finds the first child of a #GNode with the given data.
a #GNode
which types of children are to be searched, one of
%G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
the data to find
the found child #GNode, or %NULL if the data is not found
Adds a #GSource to a @context so that it will be executed within
that context. Remove it by calling g_source_destroy().
a #GSource
a #GMainContext (if %NULL, the default context will be used)
the ID (greater than 0) for the source within the
#GMainContext.
Removes an invalidation notifier.
Notice that notifiers are automatically removed after they are run.
a #GClosure
data which was passed to g_closure_add_invalidate_notifier()
when registering @notify_func
the callback function to remove
An implementation of the standard fprintf() function which supports
positional parameters, as specified in the Single Unix Specification.
the stream to write to.
a standard printf() format string, but notice
<link linkend="string-precision">string precision pitfalls</link>.
the list of arguments to insert in the output.
the number of bytes printed.
Since: 2.2
Finds the element in a #GSList which
contains the given data.
a #GSList
the element data to find
the found #GSList element,
or %NULL if it is not found
Associates a list of string values for @key and @locale under
@group_name. If the translation for @key cannot be found then
it is created.
Since: 2.6
a #GKeyFile
a group name
a key
a locale identifier
a %NULL-terminated array of locale string values
the length of @list
Creates a new #GError with the given @domain and @code,
and a message formatted with @format.
error domain
error code
printf()-style format for error message
parameters for message format
a new #GError
Removes a key/value pair from a #GTree.
If the #GTree was created using g_tree_new_full(), the key and value
are freed using the supplied destroy functions, otherwise you have to
make sure that any dynamically allocated values are freed yourself.
If the key does not exist in the #GTree, the function does nothing.
a #GTree.
the key to remove.
%TRUE if the key was found (prior to 2.8, this function returned
nothing)
This is an internal function introduced mainly for C marshallers.
Deprecated: 2.4: Use g_value_take_string() instead.
a valid #GValue of type %G_TYPE_STRING
duplicated unowned string to be set
Get the contents of a pointer #GValue.
a valid #GValue of %G_TYPE_POINTER
pointer contents of @value
Get a reproducible random floating point number,
see g_test_rand_int() for details on test case random numbers.
a random number from the seeded random number generator.
Since: 2.16
A wrapper for the POSIX rmdir() function. The rmdir() function
deletes a directory from the filesystem.
See your C library manual for more details about how rmdir() works
on your system.
a pathname in the GLib file name encoding (UTF-8 on Windows)
0 if the directory was successfully removed, -1 if an error
occurred
Since: 2.6
Creates a new asynchronous queue with the initial reference count of 1.
the new #GAsyncQueue.
Specifies a function to be called at normal program termination.
Since GLib 2.8.2, on Windows g_atexit() actually is a preprocessor
macro that maps to a call to the atexit() function in the C
library. This means that in case the code that calls g_atexit(),
i.e. atexit(), is in a DLL, the function will be called when the
DLL is detached from the program. This typically makes more sense
than that the function is called when the GLib DLL is detached,
which happened earlier when g_atexit() was a function in the GLib
DLL.
The behaviour of atexit() in the context of dynamically loaded
modules is not formally specified and varies wildly.
On POSIX systems, calling g_atexit() (or atexit()) in a dynamically
loaded module which is unloaded before the program terminates might
well cause a crash at program exit.
Some POSIX systems implement atexit() like Windows, and have each
dynamically loaded module maintain an own atexit chain that is
called when the module is unloaded.
On other POSIX systems, before a dynamically loaded module is
unloaded, the registered atexit functions (if any) residing in that
module are called, regardless where the code that registered them
resided. This is presumably the most robust approach.
As can be seen from the above, for portability it's best to avoid
calling g_atexit() (or atexit()) except in the main executable of a
program.
the function to call on normal program termination.
Compares two strings for ordering using the linguistically
correct rules for the <link linkend="setlocale">current locale</link>.
When sorting a large number of strings, it will be significantly
faster to obtain collation keys with g_utf8_collate_key() and
compare the keys with strcmp() when sorting instead of sorting
the original strings.
a UTF-8 encoded string
a UTF-8 encoded string
< 0 if @str1 compares before @str2,
0 if they compare equal, > 0 if @str1 compares after @str2.
A wrapper for the POSIX lstat() function. The lstat() function is
like stat() except that in the case of symbolic links, it returns
information about the symbolic link itself and not the file that it
refers to. If the system does not support symbolic links g_lstat()
is identical to g_stat().
See your C library manual for more details about lstat().
a pathname in the GLib file name encoding (UTF-8 on Windows)
a pointer to a <structname>stat</structname> struct, which
will be filled with the file information
0 if the information was successfully retrieved, -1 if an error
occurred
Since: 2.6
Overrides the class closure (i.e. the default handler) for the given signal
for emissions on instances of @instance_type. @instance_type must be derived
from the type to which the signal belongs.
See g_signal_chain_from_overridden() and
g_signal_chain_from_overridden_handler() for how to chain up to the
parent class closure from inside the overridden one.
the signal id
the instance type on which to override the class closure
for the signal.
the closure.
Appends a formatted string onto the end of a #GString.
This function is similar to g_string_sprintf() except that
the text is appended to the #GString.
Deprecated: This function has been renamed to g_string_append_printf()
a #GString
the string format. See the sprintf() documentation
the parameters to insert into the format string
This is an internal function introduced mainly for C marshallers.
Deprecated: 2.4: Use g_value_take_boxed() instead.
a valid #GValue of %G_TYPE_BOXED derived type
duplicated unowned boxed value to be set
Converts a string to a #guint64 value.
This function behaves like the standard strtoull() function
does in the C locale. It does this without actually
changing the current locale, since that would not be
thread-safe.
This function is typically used when reading configuration
files or other non-user input that should be locale independent.
To handle input from the user you should normally use the
locale-sensitive system strtoull() function.
If the correct value would cause overflow, %G_MAXUINT64
is returned, and %ERANGE is stored in %errno. If the base is
outside the valid range, zero is returned, and %EINVAL is stored
in %errno. If the string conversion fails, zero is returned, and
@endptr returns @nptr (if @endptr is non-%NULL).
the string to convert to a numeric value.
if non-%NULL, it returns the character after
the last character used in the conversion.
to be used for the conversion, 2..36 or 0
the #guint64 value or zero on error.
Since: 2.2
Sets the contents of a %G_TYPE_PARAM #GValue to @param and takes
over the ownership of the callers reference to @param; the caller
doesn't have to unref it any more.
Since: 2.4
a valid #GValue of type %G_TYPE_PARAM
the #GParamSpec to be set
Removes a source from the default main loop context given the user
data for the callback. If multiple sources exist with the same user
data, only one will be destroyed.
the user_data for the callback.
%TRUE if a source was found and removed.
Removes a key and its associated value from a #GTree without calling
the key and value destroy functions.
If the key does not exist in the #GTree, the function does nothing.
a #GTree.
the key to remove.
%TRUE if the key was found (prior to 2.8, this function returned
nothing)
Calls the given function for each of the key/value pairs in the #GTree.
The function is passed the key and value of each pair, and the given
@data parameter. The tree is traversed in sorted order.
The tree may not be modified while iterating over it (you can't
add/remove items). To remove all items matching a predicate, you need
to add each item to a list in your #GTraverseFunc as you walk over
the tree, then walk the list and remove each item.
a #GTree.
the function to call for each node visited. If this function
returns %TRUE, the traversal is stopped.
user data to pass to the function.
Finds an element in a #GList, using a supplied function to
find the desired element. It iterates over the list, calling
the given function which should return 0 when the desired
element is found. The function takes two #gconstpointer arguments,
the #GList element's data as the first argument and the
given user data.
a #GList
user data passed to the function
the function to call for each element.
It should return 0 when the desired element is found
the found #GList element, or %NULL if it is not found
Checks if any sources have pending events for the given context.
a #GMainContext (if %NULL, the default context will be used)
%TRUE if events are pending.
Creates a new timeout source.
The source will not initially be associated with any #GMainContext
and must be added to one with g_source_attach() before it will be
executed.
the timeout interval in milliseconds.
the newly-created timeout source
Creates a new #GTree like g_tree_new() and allows to specify functions
to free the memory allocated for the key and value that get called when
removing the entry from the #GTree.
qsort()-style comparison function.
data to pass to comparison function.
a function to free the memory allocated for the key
used when removing the entry from the #GTree or %NULL if you don't
want to supply such a function.
a function to free the memory allocated for the
value used when removing the entry from the #GTree or %NULL if you
don't want to supply such a function.
a new #GTree.
On some platforms, notably Windows, the #GPid type represents a resource
which must be closed to prevent resource leaking. g_spawn_close_pid()
is provided for this purpose. It should be used on all platforms, even
though it doesn't do anything under UNIX.
The process reference to close
Adds a copy of @string to the #GStringChunk, unless the same
string has already been added to the #GStringChunk with
g_string_chunk_insert_const().
This function is useful if you need to copy a large number
of strings but do not want to waste space storing duplicates.
But you must remember that there may be several pointers to
the same string, and so any changes made to the strings
should be done very carefully.
Note that g_string_chunk_insert_const() will not return a
pointer to a string added with g_string_chunk_insert(), even
if they do match.
a #GStringChunk
the string to add
a pointer to the new or existing copy of @string
within the #GStringChunk
Frees the memory allocated for the #GString.
If @free_segment is %TRUE it also frees the character data.
a #GString
if %TRUE the actual character data is freed as well
the character data of @string
(i.e. %NULL if @free_segment is %TRUE)
Converts a character to uppercase.
a Unicode character
the result of converting @c to uppercase.
If @c is not an lowercase or titlecase character,
or has no upper case equivalent @c is returned unchanged.
Gets the data of the element at the given position.
a #GList
the position of the element
the element's data, or %NULL if the position
is off the end of the #GList
Increments the reference count on a closure to force it staying
alive while the caller holds a pointer to it.
#GClosure to increment the reference count on
The @closure passed in, for convenience
Installs a new property. This is usually done in the class initializer.
Note that it is possible to redefine a property in a derived class,
by installing a property with the same name. This can be useful at times,
e.g. to change the range of allowed values or the default value.
a #GObjectClass
the id for the new property
the #GParamSpec for the new property
Removes all items in the (@begin, @end) range.
If the sequence has a data destroy function associated with it, this
function is called on the data for the removed items.
Since: 2.14
a #GSequenceIter
a #GSequenceIter
Creates a new #GParamSpec instance.
A property name consists of segments consisting of ASCII letters and
digits, separated by either the '-' or '_' character. The first
character of a property name must be a letter. Names which violate these
rules lead to undefined behaviour.
When creating and looking up a #GParamSpec, either separator can be
used, but they cannot be mixed. Using '-' is considerably more
efficient and in fact required when using property names as detail
strings for signals.
Beyond the name, #GParamSpec<!-- -->s have two more descriptive
strings associated with them, the @nick, which should be suitable
for use as a label for the property in a property editor, and the
@blurb, which should be a somewhat longer description, suitable for
e.g. a tooltip. The @nick and @blurb should ideally be localized.
the #GType for the property; must be derived from #G_TYPE_PARAM
the canonical name of the property
the nickname of the property
a short description of the property
a combination of #GParamFlags
a newly allocated #GParamSpec instance
This sets the string that #GIOChannel uses to determine
where in the file a line break occurs.
a #GIOChannel
The line termination string. Use %NULL for autodetect.
Autodetection breaks on "\n", "\r\n", "\r", "\0", and
the Unicode paragraph separator. Autodetection should
not be used for anything other than file-based channels.
The length of the termination string. If -1 is passed, the
string is assumed to be nul-terminated. This option allows
termination strings with embedded nuls.
Registers an invalidation notifier which will be called when the
@closure is invalidated with g_closure_invalidate(). Invalidation
notifiers are invoked before finalization notifiers, in an
unspecified order.
a #GClosure
data to pass to @notify_func
the callback function to register
Frees all of the memory used by a #GSList.
The freed elements are returned to the slice allocator.
a #GSList
Looks up or registers an enumeration that is implemented with a particular
type plugin. If a type with name @type_name was previously registered,
the #GType identifier for the type is returned, otherwise the type
is newly registered, and the resulting #GType identifier returned.
As long as any instances of the type exist, the type plugin will
not be unloaded.
Since: 2.6
a #GTypeModule
name for the type
an array of #GEnumValue structs for the
possible enumeration values. The array is
terminated by a struct with all members being
0.
the new or existing type ID
If the paramspec redirects operations to another paramspec,
Returns: paramspec to which requests on this paramspec should
a #GParamSpec
paramspec to which requests on this paramspec should
be redirected, or %NULL if none.
Adds the dynamic @interface_type to @instantiable_type. The information
contained in the #GTypePlugin structure pointed to by @plugin
is used to manage the relationship.
the #GType value of an instantiable type.
the #GType value of an interface type.
the #GTypePlugin structure to retrieve the #GInterfaceInfo from.
Adds a copy of @string to the #GStringChunk.
It returns a pointer to the new copy of the string
in the #GStringChunk. The characters in the string
can be changed, if necessary, though you should not
change anything after the end of the string.
Unlike g_string_chunk_insert_const(), this function
does not check for duplicates. Also strings added
with g_string_chunk_insert() will not be searched
by g_string_chunk_insert_const() when looking for
duplicates.
a #GStringChunk
the string to add
a pointer to the copy of @string within
the #GStringChunk
Completes the process of a temporary sub-parser redirection.
This function exists to collect the user_data allocated by a
matching call to g_markup_parse_context_push(). It must be called
in the end_element handler corresponding to the start_element
handler during which g_markup_parse_context_push() was called. You
must not call this function from the error callback -- the
@user_data is provided directly to the callback in that case.
This function is not intended to be directly called by users
interested in invoking subparsers. Instead, it is intended to be
used by the subparsers themselves to implement a higher-level
interface.
a #GMarkupParseContext
the user_data passed to g_markup_parse_context_push().
Since: 2.18
Report the result of a performance or measurement test.
The test should generally strive to maximize the reported
quantities (larger values are better than smaller ones),
this and @maximized_quantity can determine sorting
order for test result reports.
Since: 2.16
the reported value
the format string of the report message
arguments to pass to the printf() function
Computes the canonical decomposition of a Unicode character.
a Unicode character.
location to store the length of the return value.
a newly allocated string of Unicode characters.
@result_len is set to the resulting length of the string.
Return value: the begin iterator for @seq.
a #GSequence
the begin iterator for @seq.
Since: 2.14
Registers @type_name as the name of a new dynamic type derived from
@parent_type. The type system uses the information contained in the
#GTypePlugin structure pointed to by @plugin to manage the type and its
instances (if not abstract). The value of @flags determines the nature
(e.g. abstract or not) of the type.
Type from which this type will be derived.
0-terminated string used as the name of the new type.
The #GTypePlugin structure to retrieve the #GTypeInfo from.
Bitwise combination of #GTypeFlags values.
The new type identifier or #G_TYPE_INVALID if registration failed.
Gets the element @n places before @list.
a #GList
the position of the element, counting from 0
the element, or %NULL if the position is
off the end of the #GList
Creates a new child_watch source.
The source will not initially be associated with any #GMainContext
and must be added to one with g_source_attach() before it will be
executed.
Note that child watch sources can only be used in conjunction with
<literal>g_spawn...</literal> when the %G_SPAWN_DO_NOT_REAP_CHILD
flag is used.
Note that on platforms where #GPid must be explicitly closed
(see g_spawn_close_pid()) @pid must not be closed while the
source is still active. Typically, you will want to call
g_spawn_close_pid() in the callback function for the source.
Note further that using g_child_watch_source_new() is not
compatible with calling <literal>waitpid(-1)</literal> in
the application. Calling waitpid() for individual pids will
still work fine.
process to watch. On POSIX the pid of a child process. On
Windows a handle for a process (which doesn't have to be a child).
the newly-created child watch source
Since: 2.4
Gets the root of a tree.
a #GNode
the root of the tree
Removes the specified group, @group_name,
from the key file.
a #GKeyFile
a group name
return location for a #GError or %NULL
%TRUE if the group was removed, %FALSE otherwise
Since: 2.6
Return value: A random number.
a #GRand.
A random number.
Specify the base URI for bug reports.
The base URI is used to construct bug report messages for
g_test_message() when g_test_bug() is called.
Calling this function outside of a test case sets the
default base URI for all test cases. Calling it from within
a test case changes the base URI for the scope of the test
case only.
Bug URIs are constructed by appending a bug specific URI
portion to @uri_pattern, or by replacing the special string
'%s' within @uri_pattern if that is present.
Since: 2.16
the base pattern for bug URIs
Copies the value of @src_value into @dest_value.
An initialized #GValue structure.
An initialized #GValue structure of the same type as @src_value.
Determines if a character is typically rendered in a double-width
cell under legacy East Asian locales. If a character is wide according to
g_unichar_iswide(), then it is also reported wide with this function, but
the converse is not necessarily true. See the
<ulink url="http://www.unicode.org/reports/tr11/">Unicode Standard
Annex #11</ulink> for details.
a Unicode character
%TRUE if the character is wide in legacy East Asian locales
Since: 2.12
Sets the function which is used to translate the contexts
user-visible strings, for <option>--help</option> output.
If @func is %NULL, strings are not translated.
Note that option groups have their own translation functions,
this function only affects the @parameter_string (see g_option_context_new()),
the summary (see g_option_context_set_summary()) and the description
(see g_option_context_set_description()).
If you are using gettext(), you only need to set the translation
domain, see g_context_group_set_translation_domain().
Since: 2.12
a #GOptionContext
the #GTranslateFunc, or %NULL
user data to pass to @func, or %NULL
a function which gets called to free @data, or %NULL
This function returns a #GIOCondition depending on whether there
is data to be read/space to write data in the internal buffers in
the #GIOChannel. Only the flags %G_IO_IN and %G_IO_OUT may be set.
A #GIOChannel
A #GIOCondition
Calls the given function for each of the key/value pairs in the
#GHashTable. The function is passed the key and value of each
pair, and the given @user_data parameter. The hash table may not
be modified while iterating over it (you can't add/remove
items). To remove all items matching a predicate, use
g_hash_table_foreach_remove().
See g_hash_table_find() for performance caveats for linear
order searches in contrast to g_hash_table_lookup().
a #GHashTable.
the function to call for each key/value pair.
user data to pass to the function.
Gets the data of the element at the given position.
a #GSList
the position of the element
the element's data, or %NULL if the position
is off the end of the #GSList
Create a new test suite with the name @suite_name.
a name for the suite
A newly allocated #GTestSuite instance.
Since: 2.16
Return value: a newly allocated %NULL-terminated string array
a #GKeyFile
a group name
a key
a locale identifier or %NULL
return location for the number of returned strings or %NULL
return location for a #GError or %NULL
a newly allocated %NULL-terminated string array
or %NULL if the key isn't found. The string array should be freed
with g_strfreev().
Since: 2.6
A variant of g_cclosure_new() which uses @object as @user_data and
calls g_object_watch_closure() on @object and the created
closure. This function is useful when you have a callback closely
associated with a #GObject, and want the callback to no longer run
after the object is is freed.
the function to invoke
a #GObject pointer to pass to @callback_func
a new #GCClosure
Adds a new item to the end of @seq.
a #GSequencePointer
the data for the new item
an iterator pointing to the new item
Since: 2.14
Sorts @queue using @func.
This function is called while holding the @queue's lock.
Since: 2.10
a #GAsyncQueue
the #GCompareDataFunc is used to sort @queue. This
function is passed two elements of the @queue. The function
should return 0 if they are equal, a negative value if the
first element should be higher in the @queue or a positive
value if the first element should be lower in the @queue than
the second element.
user data passed to @func
Adds a byte onto the start of a #GString,
expanding it if necessary.
a #GString
the byte to prepend on the start of the #GString
@string
Return value: a #GSequenceIter which is @delta positions away from @iter.
a #GSequenceIter
A positive or negative number indicating how many positions away
from @iter the returned #GSequenceIter will be.
a #GSequenceIter which is @delta positions away from @iter.
Since: 2.14
Initialize the GLib testing framework, e.g. by seeding the
test random number generator, the name for g_get_prgname()
and parsing test related command line args.
So far, the following arguments are understood:
<variablelist>
<varlistentry>
<term><option>-l</option></term>
<listitem><para>
list test cases available in a test executable.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--seed=<replaceable>RANDOMSEED</replaceable></option></term>
<listitem><para>
provide a random seed to reproduce test runs using random numbers.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--verbose</option></term>
<listitem><para>run tests verbosely.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-q</option>, <option>--quiet</option></term>
<listitem><para>run tests quietly.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-p <replaceable>TESTPATH</replaceable></option></term>
<listitem><para>
execute all tests matching <replaceable>TESTPATH</replaceable>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-m {perf|slow|thorough|quick}</option></term>
<listitem><para>
execute tests according to these test modes:
<variablelist>
<varlistentry>
<term>perf</term>
<listitem><para>
performance tests, may take long and report results.
</para></listitem>
</varlistentry>
<varlistentry>
<term>slow, thorough</term>
<listitem><para>
slow and thorough tests, may take quite long and
maximize coverage.
</para></listitem>
</varlistentry>
<varlistentry>
<term>quick</term>
<listitem><para>
quick tests, should run really quickly and give good coverage.
</para></listitem>
</varlistentry>
</variablelist>
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--debug-log</option></term>
<listitem><para>debug test logging output.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-k</option>, <option>--keep-going</option></term>
<listitem><para>gtester-specific argument.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--GTestLogFD <replaceable>N</replaceable></option></term>
<listitem><para>gtester-specific argument.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--GTestSkipCount <replaceable>N</replaceable></option></term>
<listitem><para>gtester-specific argument.</para></listitem>
</varlistentry>
</variablelist>
Since: 2.16
Address of the @argc parameter of the main() function.
Changed if any arguments were handled.
Address of the @argv parameter of main().
Any parameters understood by g_test_init() stripped before return.
Reserved for future extension. Currently, you must pass %NULL.
Associates a string value for @key and @locale under @group_name.
If the translation for @key cannot be found then it is created.
Since: 2.6
a #GKeyFile
a group name
a key
a locale identifier
a string
Converts a Unicode character into UTF-8, and insert it
into the string at the given position.
a #GString
the position at which to insert character, or -1 to
append at the end of the string
a Unicode character
@string
Frees a #GBookmarkFile.
Since: 2.12
a #GBookmarkFile
Scans for a match in string for the pattern in @regex.
The @match_options are combined with the match options specified
when the @regex structure was created, letting you have more
flexibility in reusing #GRegex structures.
Setting @start_position differs from just passing over a shortened
string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
that begins with any kind of lookbehind assertion, such as "\b".
A #GMatchInfo structure, used to get information on the match, is
stored in @match_info if not %NULL. Note that if @match_info is
not %NULL then it is created even if the function returns %FALSE,
i.e. you must free it regardless if regular expression actually
matched.
@string is not copied and is used in #GMatchInfo internally. If
you use any #GMatchInfo method (except g_match_info_free()) after
freeing or modifying @string then the behaviour is undefined.
To retrieve all the non-overlapping matches of the pattern in
string you can use g_match_info_next().
|[
static void
print_uppercase_words (const gchar *string)
{
/* Print all uppercase-only words. */
GRegex *regex;
GMatchInfo *match_info;
GError *error = NULL;
regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
g_regex_match_full (regex, string, -1, 0, 0, &match_info, &error);
while (g_match_info_matches (match_info))
{
gchar *word = g_match_info_fetch (match_info, 0);
g_print ("Found: %s\n", word);
g_free (word);
g_match_info_next (match_info, &error);
}
g_match_info_free (match_info);
g_regex_unref (regex);
if (error != NULL)
{
g_printerr ("Error while matching: %s\n", error->message);
g_error_free (error);
}
}
]|
a #GRegex structure from g_regex_new()
the string to scan for matches
the length of @string, or -1 if @string is nul-terminated
starting index of the string to match
match options
pointer to location where to store the #GMatchInfo,
or %NULL if you do not need it
location to store the error occuring, or %NULL to ignore errors
%TRUE is the string matched, %FALSE otherwise
Since: 2.14
Obtains the character set for the <link linkend="setlocale">current
locale</link>; you might use this character set as an argument to
g_convert(), to convert from the current locale's encoding to some
other encoding. (Frequently g_locale_to_utf8() and g_locale_from_utf8()
are nice shortcuts, though.)
On Windows the character set returned by this function is the
so-called system default ANSI code-page. That is the character set
used by the "narrow" versions of C library and Win32 functions that
handle file names. It might be different from the character set
used by the C library's current locale.
The return value is %TRUE if the locale's encoding is UTF-8, in that
case you can perhaps avoid calling g_convert().
The string returned in @charset is not allocated, and should not be
freed.
return location for character set name
%TRUE if the returned charset is UTF-8
Associates a list of string values for @key under @group_name.
If @key cannot be found then it is created.
If @group_name cannot be found then it is created.
Since: 2.6
a #GKeyFile
a group name
a key
an array of string values
number of string values in @list
Escapes text so that the markup parser will parse it verbatim.
Less than, greater than, ampersand, etc. are replaced with the
corresponding entities. This function would typically be used
when writing out a file to be parsed with the markup parser.
Note that this function doesn't protect whitespace and line endings
from being processed according to the XML rules for normalization
of line endings and attribute values.
Note also that if given a string containing them, this function
will produce character references in the range of &#x1; ..
&#x1f; for all control sequences except for tabstop, newline
and carriage return. The character references in this range are
not valid XML 1.0, but they are valid XML 1.1 and will be accepted
by the GMarkup parser.
some valid UTF-8 text
length of @text in bytes, or -1 if the text is nul-terminated
a newly allocated string with the escaped text
Removes a reference added with g_object_add_toggle_ref(). The
reference count of the object is decreased by one.
Since: 2.8
a #GObject
a function to call when this reference is the
last reference to the object, or is no longer
the last reference.
data to pass to @notify
Creates a new property of type #GParamSpecOverride. This is used
to direct operations to another paramspec, and will not be directly
useful unless you are implementing a new base type similar to GObject.
Since: 2.4
the name of the property.
The property that is being overridden
the newly created #GParamSpec
Returns: Location of the #GTypeValueTable associated with @type or
A #GType value.
Location of the #GTypeValueTable associated with @type or
%NULL if there is no #GTypeValueTable associated with @type.
Parses the command line arguments, recognizing options
which have been added to @context. A side-effect of
calling this function is that g_set_prgname() will be
called.
If the parsing is successful, any parsed arguments are
removed from the array and @argc and @argv are updated
accordingly. A '--' option is stripped from @argv
unless there are unparsed options before and after it,
or some of the options after it start with '-'. In case
of an error, @argc and @argv are left unmodified.
If automatic <option>--help</option> support is enabled
(see g_option_context_set_help_enabled()), and the
@argv array contains one of the recognized help options,
this function will produce help output to stdout and
call <literal>exit (0)</literal>.
Note that function depends on the
<link linkend="setlocale">current locale</link> for
automatic character set conversion of string and filename
arguments.
a #GOptionContext
a pointer to the number of command line arguments
a pointer to the array of command line arguments
a return location for errors
%TRUE if the parsing was successful,
%FALSE if an error occurred
Since: 2.6
Return a newly allocated string, which describes the contents of a
#GValue. The main purpose of this function is to describe #GValue
contents for debugging output, the way in which the contents are
described may change between different GLib versions.
#GValue which contents are to be described.
Newly allocated string.
Creates a new #GParamSpecUInt instance specifying a %G_TYPE_UINT property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Stops a signal's current emission.
This is just like g_signal_stop_emission() except it will look up the
signal id for you.
the object whose signal handlers you wish to stop.
a string of the form "signal-name::detail".
Decrements the reference count of a closure after it was previously
incremented by the same caller. If no other callers are using the
closure, then the closure will be destroyed and freed.
#GClosure to decrement the reference count on
Splits a string into a maximum of @max_tokens pieces, using the given
@delimiter. If @max_tokens is reached, the remainder of @string is appended
to the last token.
As a special case, the result of splitting the empty string "" is an empty
vector, not a vector containing a single string. The reason for this
special case is that being able to represent a empty vector is typically
more useful than consistent handling of empty elements. If you do need
to represent empty elements, you'll need to check for the empty string
before calling g_strsplit().
a string to split.
a string which specifies the places at which to split the string.
The delimiter is not included in any of the resulting strings, unless
@max_tokens is reached.
the maximum number of pieces to split @string into. If this is
less than 1, the string is split completely.
a newly-allocated %NULL-terminated array of strings. Use
g_strfreev() to free it.
Returns: %TRUE if the queue is empty.
a #GQueue.
%TRUE if the queue is empty.
Sets @mime_type as the MIME type of the bookmark for @uri.
If a bookmark for @uri cannot be found then it is created.
Since: 2.12
a #GBookmarkFile
a valid URI
a MIME type
Frees a #GError and associated resources.
a #GError
This function enqueus a callback @destroy_func() to be executed
during the next test case teardown phase. This is most useful
to auto destruct allocted test resources at the end of a test run.
Resources are released in reverse queue order, that means enqueueing
callback A before callback B will cause B() to be called before
A() during teardown.
Since: 2.16
Destroy callback for teardown phase.
Destroy callback data.
Registers a private structure for an instantiatable type;
when an object is allocated, the private structures for
the type and all of its parent types are allocated
sequentially in the same memory block as the public
structures. This function should be called in the
type's class_init() function. The private structure can
be retrieved using the G_TYPE_INSTANCE_GET_PRIVATE() macro.
The following example shows attaching a private structure
<structname>MyObjectPrivate</structname> to an object
<structname>MyObject</structname> defined in the standard GObject
fashion.
|[
typedef struct _MyObjectPrivate MyObjectPrivate;
struct _MyObjectPrivate {
int some_field;
};
#define MY_OBJECT_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), MY_TYPE_OBJECT, MyObjectPrivate))
static void
my_object_class_init (MyObjectClass *klass)
{
g_type_class_add_private (klass, sizeof (MyObjectPrivate));
}
static int
my_object_get_some_field (MyObject *my_object)
{
MyObjectPrivate *priv = MY_OBJECT_GET_PRIVATE (my_object);
return priv->some_field;
}
]|
Since: 2.4
class structure for an instantiatable type
size of private structure.
Lists the signals by id that a certain instance or interface type
created. Further information about the signals can be acquired through
g_signal_query().
Instance or interface type.
Location to store the number of signal ids for @itype.
Newly allocated array of signal IDs.
Creates a new signal. (This is usually done in the class initializer.)
A signal name consists of segments consisting of ASCII letters and
digits, separated by either the '-' or '_' character. The first
character of a signal name must be a letter. Names which violate these
rules lead to undefined behaviour of the GSignal system.
When registering a signal and looking up a signal, either separator can
be used, but they cannot be mixed.
the name for the signal
the type this signal pertains to. It will also pertain to
types which are derived from this type.
a combination of #GSignalFlags specifying detail of when
the default handler is to be invoked. You should at least specify
%G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
The offset of the function pointer in the class structure
for this type. Used to invoke a class method generically. Pass 0 to
not associate a class method with this signal.
the accumulator for this signal; may be %NULL.
user data for the @accumulator.
the function to translate arrays of parameter values to
signal emissions into C language callback invocations.
the type of return value, or #G_TYPE_NONE for a signal
without a return value.
the number of parameter types to follow.
a list of types, one for each parameter.
the signal id
A wrapper for the POSIX remove() function. The remove() function
deletes a name from the filesystem.
See your C library manual for more details about how remove() works
on your system. On Unix, remove() removes also directories, as it
calls unlink() for files and rmdir() for directories. On Windows,
although remove() in the C library only works for files, this
function tries first remove() and then if that fails rmdir(), and
thus works for both files and directories. Note however, that on
Windows, it is in general not possible to remove a file that is
open to some process, or mapped into memory.
If this function fails on Windows you can't infer too much from the
errno value. rmdir() is tried regardless of what caused remove() to
fail. Any errno value set by remove() will be overwritten by that
set by rmdir().
a pathname in the GLib file name encoding (UTF-8 on Windows)
0 if the file was successfully removed, -1 if an error
occurred
Since: 2.6
Retrieves the number of the subexpression named @name.
#GRegex structure
name of the subexpression
The number of the subexpression or -1 if @name
does not exists
Since: 2.14
Passes the results of polling back to the main loop.
a #GMainContext
the maximum numerical priority of sources to check
array of #GPollFD's that was passed to the last call to
g_main_context_query()
return value of g_main_context_query()
%TRUE if some sources are ready to be dispatched.
A simple version of g_spawn_sync() with little-used parameters
removed, taking a command line instead of an argument vector. See
g_spawn_sync() for full details. @command_line will be parsed by
g_shell_parse_argv(). Unlike g_spawn_sync(), the %G_SPAWN_SEARCH_PATH flag
is enabled. Note that %G_SPAWN_SEARCH_PATH can have security
implications, so consider using g_spawn_sync() directly if
appropriate. Possible errors are those from g_spawn_sync() and those
from g_shell_parse_argv().
If @exit_status is non-%NULL, the exit status of the child is stored there as
it would be returned by waitpid(); standard UNIX macros such as WIFEXITED()
and WEXITSTATUS() must be used to evaluate the exit status.
On Windows, please note the implications of g_shell_parse_argv()
parsing @command_line. Parsing is done according to Unix shell rules, not
Windows command interpreter rules.
Space is a separator, and backslashes are
special. Thus you cannot simply pass a @command_line containing
canonical Windows paths, like "c:\\program files\\app\\app.exe", as
the backslashes will be eaten, and the space will act as a
separator. You need to enclose such paths with single quotes, like
"'c:\\program files\\app\\app.exe' 'e:\\folder\\argument.txt'".
a command line
return location for child output
return location for child errors
return location for child exit status, as returned by waitpid()
return location for errors
%TRUE on success, %FALSE if an error was set
Compares @str1 and @str2 like strcmp(). Handles %NULL strings gracefully.
a C string or %NULL
another C string or %NULL
-1, 0 or 1, if @str1 is <, == or > than @str2.
Since: 2.16
Sorts @seq using @cmp_func.
Since: 2.14
a #GSequence
the #GCompareDataFunc used to sort @seq. This function is
passed two items of @seq and should return 0 if they are equal,
a negative value fi the first comes before the second, and a
positive value if the second comes before the first.
user data passed to @cmp_func
Adds a string to be displayed in <option>--help</option> output
before the list of options. This is typically a summary of the
program functionality.
Note that the summary is translated (see
g_option_context_set_translate_func(), g_option_context_set_translation_domain()).
Since: 2.12
a #GOptionContext
a string to be shown in <option>--help</option> output
before the list of options, or %NULL
Behaves exactly like g_build_filename(), but takes the path elements
as a string array, instead of varargs. This function is mainly
meant for language bindings.
%NULL-terminated array of strings containing the path elements.
a newly-allocated string that must be freed with g_free().
Since: 2.8
Set the contents of a %G_TYPE_STRING #GValue to @v_string.
a valid #GValue of type %G_TYPE_STRING
caller-owned string to be duplicated for the #GValue
Replacement for g_io_channel_write() with the new API.
On seekable channels with encodings other than %NULL or UTF-8, generic
mixing of reading and writing is not allowed. A call to g_io_channel_write_chars ()
may only be made on a channel from which data has been read in the
cases described in the documentation for g_io_channel_set_encoding ().
a #GIOChannel
a buffer to write data from
the size of the buffer. If -1, the buffer
is taken to be a nul-terminated string.
The number of bytes written. This can be nonzero
even if the return value is not %G_IO_STATUS_NORMAL.
If the return value is %G_IO_STATUS_NORMAL and the
channel is blocking, this will always be equal
to @count if @count >= 0.
a location to return an error of type #GConvertError
or #GIOChannelError
the status of the operation.
Emits a "notify" signal for the property @property_name on @object.
a #GObject
the name of a property installed on the class of @object.
Gets the current flags for a #GIOChannel, including read-only
flags such as %G_IO_FLAG_IS_READABLE.
The values of the flags %G_IO_FLAG_IS_READABLE and %G_IO_FLAG_IS_WRITEABLE
are cached for internal use by the channel when it is created.
If they should change at some later point (e.g. partial shutdown
of a socket with the UNIX shutdown() function), the user
should immediately call g_io_channel_get_flags() to update
the internal values of these flags.
a #GIOChannel
the flags which are set on the channel
Creates a new #GParamSpecDouble instance specifying a %G_TYPE_DOUBLE
property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Reads all the remaining data from the file.
a #GIOChannel
Location to store a pointer to a string holding
the remaining data in the #GIOChannel. This data should
be freed with g_free() when no longer needed. This
data is terminated by an extra nul character, but there
may be other nuls in the intervening data.
location to store length of the data
location to return an error of type #GConvertError
or #GIOChannelError
%G_IO_STATUS_NORMAL on success.
This function never returns %G_IO_STATUS_EOF.
Blocks all handlers on an instance that match a certain selection criteria.
The criteria mask is passed as an OR-ed combination of #GSignalMatchType
flags, and the criteria values are passed as arguments.
Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
If no handlers were found, 0 is returned, the number of blocked handlers
otherwise.
The instance to block handlers from.
Mask indicating which of @signal_id, @detail, @closure, @func
and/or @data the handlers have to match.
Signal the handlers have to be connected to.
Signal detail the handlers have to be connected to.
The closure the handlers will invoke.
The C closure callback of the handlers (useless for non-C closures).
The closure data of the handlers' closures.
The number of handlers that matched.
Return value: A random number.
A random number.
Gets a property of an object.
In general, a copy is made of the property contents and the caller is
responsible for freeing the memory by calling g_value_unset().
Note that g_object_get_property() is really intended for language
bindings, g_object_get() is much more convenient for C programming.
a #GObject
the name of the property to get
return location for the property value
Writes a formatted string into a #GString.
This is similar to the standard sprintf() function,
except that the #GString buffer automatically expands
to contain the results. The previous contents of the
#GString are destroyed.
Deprecated: This function has been renamed to g_string_printf().
a #GString
the string format. See the sprintf() documentation
the parameters to insert into the format string
Set the contents of a %G_TYPE_UINT64 #GValue to @v_uint64.
a valid #GValue of type %G_TYPE_UINT64
unsigned 64bit integer value to be set
Registers a finalization notifier which will be called when the
reference count of @closure goes down to 0. Multiple finalization
notifiers on a single closure are invoked in unspecified order. If
a single call to g_closure_unref() results in the closure being
both invalidated and finalized, then the invalidate notifiers will
be run before the finalize notifiers.
a #GClosure
data to pass to @notify_func
the callback function to register
Creates a new #GTree.
the function used to order the nodes in the #GTree.
It should return values similar to the standard strcmp() function -
0 if the two arguments are equal, a negative value if the first argument
comes before the second, or a positive value if the first argument comes
after the second.
a new #GTree.
Creates a new #GParamSpecBoxed instance specifying a %G_TYPE_OBJECT
derived property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
%G_TYPE_OBJECT derived type of this property
flags for the property specified
a newly created parameter specification
Removes a finalization notifier.
Notice that notifiers are automatically removed after they are run.
a #GClosure
data which was passed to g_closure_add_finalize_notifier()
when registering @notify_func
the callback function to remove
Sets a function to be called at regular intervals, with the default
priority, #G_PRIORITY_DEFAULT. The function is called repeatedly
until it returns %FALSE, at which point the timeout is automatically
destroyed and the function will not be called again. The first call
to the function will be at the end of the first @interval.
Note that timeout functions may be delayed, due to the processing of other
event sources. Thus they should not be relied on for precise timing.
After each call to the timeout function, the time of the next
timeout is recalculated based on the current time and the given interval
(it does not try to 'catch up' time lost in delays).
If you want to have a timer in the "seconds" range and do not care
about the exact time of the first call of the timer, use the
g_timeout_add_seconds() function; this function allows for more
optimizations and more efficient system power usage.
This internally creates a main loop source using g_timeout_source_new()
and attaches it to the main loop context using g_source_attach(). You can
do these steps manually if you need greater control.
the time between calls to the function, in milliseconds
(1/1000ths of a second)
function to call
data to pass to @function
the ID (greater than 0) of the event source.
Creates a new #GParamSpecParam instance specifying a %G_TYPE_PARAM
property.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
a #GType derived from %G_TYPE_PARAM
flags for the property specified
a newly created parameter specification
Returns: the length of the contents of @file.
a #GMappedFile
the length of the contents of @file.
Since: 2.8
Computes the checksum for a binary @data of @length. This is a
convenience wrapper for g_checksum_new(), g_checksum_get_string()
and g_checksum_free().
a #GChecksumType
binary blob to compute the digest of
length of @data
the digest of the binary data as a string in hexadecimal.
The returned string should be freed with g_free() when done using it.
Since: 2.16
Loads a key file into an empty #GKeyFile structure.
If the file could not be loaded then %error is set to
either a #GFileError or #GKeyFileError.
an empty #GKeyFile struct
the path of a filename to load, in the GLib filename encoding
flags from #GKeyFileFlags
return location for a #GError, or %NULL
%TRUE if a key file could be loaded, %FALSE otherwise
Since: 2.6
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter denotes a flags type.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the flags parameter
the invocation hint given as the last argument
to g_closure_invoke()
additional data specified when registering the marshaller
Frees the memory allocated for the #GQueue. Only call this function if
@queue was created with g_queue_new(). If queue elements contain
dynamically-allocated memory, they should be freed first.
a #GQueue.
Frees one #GList element.
It is usually used after g_list_remove_link().
a #GList element
Reverses the order of the items in @queue.
Since: 2.4
a #GQueue
Creates a new #GParamSpecString instance.
See g_param_spec_internal() for details on property names.
canonical name of the property specified
nick name for the property specified
description of the property specified
default value for the property specified
flags for the property specified
a newly created parameter specification
Return value: the length of the @queue.
a #GAsyncQueue.
the length of the @queue.
Gets the last element in a #GList.
a #GList
the last element in the #GList,
or %NULL if the #GList has no elements
Converts a string to a #gint64 value.
This function behaves like the standard strtoll() function
does in the C locale. It does this without actually
changing the current locale, since that would not be
thread-safe.
This function is typically used when reading configuration
files or other non-user input that should be locale independent.
To handle input from the user you should normally use the
locale-sensitive system strtoll() function.
If the correct value would cause overflow, %G_MAXINT64 or %G_MININT64
is returned, and %ERANGE is stored in %errno. If the base is
outside the valid range, zero is returned, and %EINVAL is stored
in %errno. If the string conversion fails, zero is returned, and
@endptr returns @nptr (if @endptr is non-%NULL).
the string to convert to a numeric value.
if non-%NULL, it returns the character after
the last character used in the conversion.
to be used for the conversion, 2..36 or 0
the #gint64 value or zero on error.
Since: 2.12
Escapes the special characters used for regular expressions
in @string, for instance "a.b*c" becomes "a\.b\*c". This
function is useful to dynamically generate regular expressions.
@string can contain nul characters that are replaced with "\0",
in this case remember to specify the correct length of @string
in @length.
the string to escape
the length of @string, or -1 if @string is nul-terminated
a newly-allocated escaped string
Since: 2.14
Get the contents of a %G_TYPE_FLAGS #GValue.
a valid #GValue whose type is derived from %G_TYPE_FLAGS
flags contents of @value
Get a reproducible random floating pointer number out of a specified range,
see g_test_rand_int() for details on test case random numbers.
the minimum value returned by this function
the minimum value not returned by this function
a number with @range_start <= number < @range_end.
Since: 2.16
Reads a Unicode character from @channel.
This function cannot be called on a channel with %NULL encoding.
a #GIOChannel
a location to return a character
a location to return an error of type #GConvertError
or #GIOChannelError
a #GIOStatus
Given a @leaf_type and a @root_type which is contained in its
anchestry, return the type that @root_type is the immediate parent
of. In other words, this function determines the type that is
derived directly from @root_type which is also a base class of
@leaf_type. Given a root type and a leaf type, this function can
be used to determine the types and order in which the leaf type is
descended from the root type.
Descendant of @root_type and the type to be returned.
Immediate parent of the returned type.
Immediate child of @root_type and anchestor of @leaf_type.
A wrapper for the POSIX mkdir() function. The mkdir() function
attempts to create a directory with the given name and permissions.
The mode argument is ignored on Windows.
See your C library manual for more details about mkdir().
a pathname in the GLib file name encoding (UTF-8 on Windows)
permissions to use for the newly created directory
0 if the directory was successfully created, -1 if an error
occurred
Since: 2.6
Returns: the summary
a #GOptionContext
the summary
Since: 2.12
Sets the marshaller of @closure. The <literal>marshal_data</literal>
of @marshal provides a way for a meta marshaller to provide additional
information to the marshaller. (See g_closure_set_meta_marshal().) For
GObject's C predefined marshallers (the g_cclosure_marshal_*()
functions), what it provides is a callback function to use instead of
@closure->callback.
a #GClosure
a #GClosureMarshal function
Converts @time_ into an ISO 8601 encoded string, relative to the
Coordinated Universal Time (UTC).
a #GTimeVal
a newly allocated string containing an ISO 8601 date
Since: 2.12
Return value: the path to the specified special directory, or %NULL
the logical id of special directory
the path to the specified special directory, or %NULL
if the logical id was not found. The returned string is owned by
GLib and should not be modified or freed.
Since: 2.14
Return a newly allocated and 0-terminated array of type IDs, listing the
interface types that @type conforms to. The return value has to be
g_free()ed after use.
The type to list interface types for.
Optional #guint pointer to contain the number of
interface types.
Newly allocated and 0-terminated array of interface types.
Sets the source functions (can be used to override
default implementations) of an unattached source.
Since: 2.12
a #GSource
the new #GSourceFuncs
Using the standard algorithm for regular expression matching only
the longest match in the string is retrieved. This function uses
a different algorithm so it can retrieve all the possible matches.
For more documentation see g_regex_match_all_full().
A #GMatchInfo structure, used to get information on the match, is
stored in @match_info if not %NULL. Note that if @match_info is
not %NULL then it is created even if the function returns %FALSE,
i.e. you must free it regardless if regular expression actually
matched.
a #GRegex structure from g_regex_new()
the string to scan for matches
match options
pointer to location where to store the #GMatchInfo,
or %NULL if you do not need it
%TRUE is the string matched, %FALSE otherwise
Since: 2.14
Converts a gpointer to a hash value.
It can be passed to g_hash_table_new() as the @hash_func parameter,
when using pointers as keys in a #GHashTable.
a #gpointer key
a hash value corresponding to the key.
Registers @property_id as referring to a property with the
name @name in a parent class or in an interface implemented
by @oclass. This allows this class to <firstterm>override</firstterm>
a property implementation in a parent class or to provide
the implementation of a property from an interface.
<note>
Internally, overriding is implemented by creating a property of type
#GParamSpecOverride; generally operations that query the properties of
the object class, such as g_object_class_find_property() or
g_object_class_list_properties() will return the overridden
property. However, in one case, the @construct_properties argument of
the @constructor virtual function, the #GParamSpecOverride is passed
instead, so that the @param_id field of the #GParamSpec will be
correct. For virtually all uses, this makes no difference. If you
need to get the overridden property, you can call
g_param_spec_get_redirect_target().
</note>
Since: 2.4
a #GObjectClass
the new property ID
the name of a property registered in a parent class or
in an interface of this class.
Determines whether a character is alphabetic (i.e. a letter).
Given some UTF-8 text, obtain a character value with
g_utf8_get_char().
a Unicode character
%TRUE if @c is an alphabetic character
Unlinks @link_ so that it will no longer be part of @queue. The link is
not freed.
@link_ must be part of @queue,
Since: 2.4
a #GQueue
a #GList link that <emphasis>must</emphasis> be part of @queue
Gets the time the bookmark for @uri was last visited.
In the event the URI cannot be found, -1 is returned and
@error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
a #GBookmarkFile
a valid URI
return location for a #GError, or %NULL
a timestamp.
Since: 2.12
Enqueue a pointer to be released with g_free() during the next
teardown phase. This is equivalent to calling g_test_queue_destroy()
with a destroy callback of g_free().
Since: 2.16
the pointer to be stored.
Creates a new empty #GKeyFile object. Use
g_key_file_load_from_file(), g_key_file_load_from_data(),
g_key_file_load_from_dirs() or g_key_file_load_from_data_dirs() to
read an existing key file.
an empty #GKeyFile.
Since: 2.6