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 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. 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 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 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 If @dest is %NULL, free @src; otherwise, moves @src into *@dest. *@dest 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 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 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 Associates a list of double 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.12 a #GKeyFile a group name a key an array of double values number of double values in @list 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. 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: 1. The channel was just created, and has not been written to or read from yet. 2. The channel is write-only. 3. 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.) 4. The current encoding is %NULL or UTF-8. 5. 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). 6. 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. 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. Frees a #GMarkupParseContext. Can't be called from inside one of the #GMarkupParser functions. 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. 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. For example, g_utf8_collate() normalizes with %G_NORMALIZE_ALL as its first step. %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. 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 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 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 characters 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 characters 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) 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. localized name of the application Tries to become the owner of the specified context. If some other context 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. 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 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. 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. 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 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. 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 Return value: A random number. a #GRand. A random number. 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 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 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. 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 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. 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 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 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 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. 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. 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 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.) 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 A wrapper for the POSIX freopen() function. The freopen() function opens a file and associates it with an existing stream. See the 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 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 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. 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 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 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 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) 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 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 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 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 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. Determines if a character is typically rendered in a double-width cell. a Unicode character %TRUE if the character is wide 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 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 @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 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 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? 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 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. 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 characters printed. Since: 2.2 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. 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. 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 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. 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. Return value: A random number. lower closed bound of the interval. upper open bound of the interval. A random number. 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. If @group_name is %NULL, the start group is used. Since: 2.12 a #GKeyFile a group name a key an double 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. Since: 2.12 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 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 (see g_option_context_set_translate_func()). 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 This function cannot be called on a channel with %NULL encoding. a #GIOChannel a character A location to return an error of type #GConvertError or #GIOChannelError a #GIOStatus 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. process id of a child process to watch function to call data to pass to @function the ID (greater than 0) of the event source. Since: 2.4 Return value: the length of the @queue. a #GAsyncQueue. the length of the @queue. 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 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 Frees a #GError and associated resources. a #GError 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 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 Return value: A random number. A random number. 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. <informalexample><programlisting> 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); </programlisting></informalexample> 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 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. 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 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 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. See g_timeout_add_seconds_full() for the differences between g_timeout_add() and g_timeout_add_seconds(). 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 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 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. 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. @Deprecated:2.10: Use g_date_set_time_t() instead. a #GDate. #GTime value to set. 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 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 underlying access() function in the C library only checks the READONLY attribute, and does not look at the ACL at all. Software that needs to handle file permissions on Windows more exactly should use the Win32 API. See the 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 Frees all the memory associated with the #GMatchInfo structure. Since: 2.14 a #GMatchInfo 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 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 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. 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 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 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 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. a Unicode character the #GUnicodeScript for the character. Since: 2.14 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() 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 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 strcuture 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 characters 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 characters which would be produced if the buffer was large enough. Converts a string containing an ISO 8601 encoded date and time to a #GTimeVal and puts it into @time_. a ISO 8601 encoded date string a #GTimeVal %TRUE if the conversion was successful. Since: 2.12 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.) 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. 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 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 Expires as many unused cache buckets as it needs to in order to get the total number of buckets < ICONV_CACHE_SIZE. Converts a Unicode character into UTF-8, and appends it to the string. a #GString a Unicode character @string Returns: %TRUE if unknown options are ignored. a #GOptionContext %TRUE if unknown options are ignored. Since: 2.6 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 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. Return value: a newly allocated string or %NULL if the specified a #GKeyFile a group name a key a locale 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 A wrapper for the POSIX chmod() function. The chmod() function is used to set the permissions of a file system object. Note that 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 READONLY attribute. It does not touch any ACL. Software that needs to manage file permissions on Windows exactly should use the Win32 API. See the 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 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 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 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. 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 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 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. 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. 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. the priority of the idle source. Typically this will be in the range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE. process id of a child process to watch 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 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 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. 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 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 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 Creates a new cache bucket, inserts it into the cache and increments the cache size. This assumes ownership of @key. cache key iconv descriptor a pointer to the newly allocated cache bucket. 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. 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. Sets the buffer size. a #GIOChannel the size of the buffer. 0 == pick a good size 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 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. 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 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 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 characters 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. 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 Appends a formatted string onto the end of a #GString. This function is 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 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 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 id of a child process to watch. On Windows, a HANDLE for the process to watch (which actually doesn't have to be a child). the newly-created child watch source Since: 2.4 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 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 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. 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. 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 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 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 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 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, or 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: <informalexample><programlisting> gint32 id1; gint32 id2; id1 = GPOINTER_TO_INT (element1); id2 = GPOINTER_TO_INT (element2); return (id1 > id2 ? +1 : id1 == id2 ? 0 : -1); </programlisting></informalexample> 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. 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 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. 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 Try to determine the installation directory for a software package. @package should be a short identifier for the package. Typically it is 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. Parallel installations of different versions of some GLib-using library, or GLib itself, might well be desirable for various reasons. For the same reason it is recommeded to always pass %NULL as @package to this function, to avoid the temptation to use the Registry. 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. An identifier for a software package, or %NULL, in UTF-8 The name of a DLL that a package provides, or %NULL, in UTF-8 a string containing the installation directory for @package. The string is in the GLib file name encoding, i.e. UTF-8 on Windows. The return value should be freed with g_free() when not needed any longer. 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(). 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. Since: 2.6 a #GKeyFile a group name a key name to remove return location for a #GError or %NULL Gets the priority of a source. a #GSource the priority of the source 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 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 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. Pops data from the @queue. This function blocks until data become available. a #GAsyncQueue. data from the queue. 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. Returns: the description a #GOptionContext the description Since: 2.12 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 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 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. 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 terminated with a 0 character. 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. Return value: the number of unprocessed tasks a #GThreadPool the number of unprocessed tasks 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 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 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. 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. 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. 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(). 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(). 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. 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. 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 Return value: length of @str_array. a %NULL-terminated array of strings. length of @str_array. Since: 2.6 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 On some platforms, notably WIN32, 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 identifier to close 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. Frees the memory allocated for the #GRand. a #GRand. Adds the options specified in @entries to @group. Since: 2.6 a #GOptionGroup a %NULL-terminated array of #GOptionEntry<!-- -->s 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. 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 Increases the reference count on a source by one. a #GSource @source 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. 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 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. Sets the value of a date from a <type>time_t</type> value. To set the value of a date to the current day, you could write: <informalexample><programlisting> g_date_set_time_t (date, time (NULL)); </programlisting></informalexample> Since: 2.10 a #GDate <type>time_t</type> value to set Places a comment above @key from @group_name. @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. Since: 2.6 a #GKeyFile a group name, or %NULL a key a comment return location for a #GError The quark used as %G_IO_CHANNEL_ERROR 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 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. 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 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 match options %TRUE is the string matched, %FALSE otherwise Since: 2.14 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. 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. 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 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 Set the pointer at the specified location to %NULL. the memory address of the pointer. 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 Returns: a pointer into @file_name after the root component. a file name. a pointer into @file_name after the root component. 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 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. Remove all elemeents in @queue which contains @data. Since: 2.4 a #GQueue data to remove 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 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 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. 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 Return value: A random number. a #GRand. lower closed bound of the interval. upper open bound of the interval. A random number. 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 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. Returns: the number of the highest back reference a #GRegex the number of the highest back reference Since: 2.14 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(). 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. 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 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. 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 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 match options a %NULL-terminated gchar ** array. Free it using g_strfreev() Since: 2.14 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 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. 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 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. 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. 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 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. 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. Since: 2.2 a #GMarkupParseContext the name of the currently open element, or %NULL 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. Note in particular that on Win9x it is not possible to rename a file if a file with the new name already exists. Also it is not possible in general on Windows to rename an open file. 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 buffer size. a #GIOChannel the size of the buffer. 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 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 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 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 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 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 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 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 POSIX fopen() function. The fopen() function opens a file and associates a new stream with it. See the 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 Makes a copy of @error. a #GError a new #GError 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 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 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 wether 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. 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 terminated with a 0 character. 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. 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 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. 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 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. 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. 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 characters printed. Since: 2.2 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 Removes all the elements in @queue. If queue elements contain dynamically-allocated memory, they should be freed first. Since: 2.14 a #GQueue 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(). a #GHashTable. the key to look up. returns the original key. returns the value associated with the key. %TRUE if the key was found in the #GHashTable. 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 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. 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 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 a 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. 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 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. 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(). Releases ownership of a context previously acquired by this thread with g_main_context_acquire(). If the context was acquired multiple times, the only release ownership when g_main_context_release() is called as many times as it was acquired. a #GMainContext 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 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 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 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(). <informalexample><programlisting> 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); } </programlisting></informalexample> 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. Removes a comment above @key from @group_name. @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. Since: 2.6 a #GKeyFile a group name, or %NULL a key return location for a #GError 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 Increases the reference count on a #GMainLoop object by one. a #GMainLoop @loop Return value: a newly-allocated %NULL-terminated array of 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 A wrapper for the POSIX open() function. The open() function is used to convert a pathname into a file descriptor. Note that 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 Windows API for opening files is something different. See the 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 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. 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 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. a list of debug options separated by colons, spaces, or commas; or the string "all" to set all flags. 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. 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 terminated with a 0 character. 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. 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 characters printed. Since: 2.2 Sets the icon for the bookmark for @uri. If @href is %NULL, unsets the currently set icon. If no bookmark for @uri is found it 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 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. 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 Return value: the data that @iter points to a #GSequenceIter the data that @iter points to Since: 2.14 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 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 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. 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. 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. Returns: a string containing the complete path to @subdir inside An identifier for a software package, in UTF-8, or %NULL 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 on Windows. The return value should be freed with g_free() when no longer needed. 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 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 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 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. 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 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 Stops a #GMainLoop from running. Any calls to g_main_loop_run() for the loop will return. a #GMainLoop 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. 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. 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 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 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. 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. 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. 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 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 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. 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 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. 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. 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 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 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. 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. 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 othewise 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 othewise Since: 2.14 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 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 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 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 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(). 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 characters 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. 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. @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 necessar. Note that 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 something different. See the 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 terminated with a 0 character. a UTF-16 encoded string the maximum length (number of <type>gunichar2</type>) of @str to use. If @len < 0, then the string is terminated with a 0 character. 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. 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. 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. 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 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. 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. 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. Appends a formatted string onto the end of a #GString. This function is 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 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. Classifies a Unicode character by type. a Unicode character the type of the character. 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. Returns: %TRUE if automatic help generation is turned on. a #GOptionContext %TRUE if automatic help generation is turned on. Since: 2.6 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 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. 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. 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 argument vectors 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. @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(). @child_setup is called in the parent process just before creating the child process. You should carefully consider what you do in @child_setup if you intend your software to be portable to Windows. 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 pid 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 no 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. 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. 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 return location for child error messages return location for child exit status, as returned by waitpid() return location for error %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 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. 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 Return value: the end iterator for @seq a #GSequence the end iterator for @seq Since: 2.14 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. Return value: The number of items in @queue. a #GQueue The number of items in @queue. Since: 2.4 This returns the string that #GIOChannel uses to determine where in the file a line break occurs. A value of %NULL indicates auto detection. 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. 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.) 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. 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. 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 Return Value: %TRUE if the @channel is buffered. a #GIOChannel. %TRUE if the @channel is buffered. 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 A location to return an error of type #GConvertError or #GIOChannelError %G_IO_STATUS_NORMAL on success. This function never returns %G_IO_STATUS_EOF. 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 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 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. Returns the depth of the stack of calls to the depth of the stack of calls to g_main_context_dispatch() on any #GMainContext in the current thread. That is, when called from the toplevel, it gives 0. When called from within a callback from g_main_context_iteration() (or g_main_loop_run(), etc.) it returns 1. When called from within a callback to a recursive call to g_main_context_iterate(), it returns 2. And so forth. This function is useful in a situation like the following: Imagine an extremely simple "garbage collected" system. <example> static GList *free_list; gpointer allocate_memory (gsize size) { gpointer result = g_malloc (size); free_list = g_list_prepend (free_list, result); return result; } void free_allocated_memory (void) { GList *l; for (l = free_list; l; l = l->next); g_free (l->data); g_list_free (free_list); free_list = NULL; } [...] while (TRUE); { g_main_context_iteration (NULL, TRUE); free_allocated_memory(); } </example> This works from an application, however, if you want to do the same thing from a library, it gets more difficult, since you no longer control the main loop. You might think you can simply use an idle function to make the call to free_allocated_memory(), but that doesn't work, since the idle function could be called from a recursive callback. This can be fixed by using g_main_depth() <example> gpointer allocate_memory (gsize size) { FreeListBlock *block = g_new (FreeListBlock, 1);\ block->mem = g_malloc (size); block->depth = g_main_depth (); free_list = g_list_prepend (free_list, block); return block->mem; } void free_allocated_memory (void) { GList *l; int depth = g_main_depth (); for (l = free_list; l; ); { GList *next = l->next; FreeListBlock *block = l->data; if (block->depth > depth) { g_free (block->mem); g_free (block); free_list = g_list_delete_link (free_list, l); } l = next; } } </example> There is a temptation to use g_main_depth() to solve problems with reentrancy. For instance, while waiting for data to be received from the network in response to a menu item, the menu item might be selected again. It might seem that one could make the menu item's callback return immediately and do nothing if g_main_depth() returns a value greater than 1. However, this should be avoided since the user then sees selecting the menu item do nothing. Furthermore, you'll find yourself adding these checks all over your code, since there are doubtless many, many things that the user could do. Instead, you can use the following techniques: <orderedlist> <listitem> <para> Use gtk_widget_set_sensitive() or modal dialogs to prevent the user from interacting with elements while the main loop is recursing. </para> </listitem> <listitem> <para> Avoid main loop recursion in situations where you can't handle arbitrary callbacks. Instead, structure your code so that you simply return to the main loop and then get called again when there is more work to do. </para> </listitem> </orderedlist> 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 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. 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 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 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. 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 the 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 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 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 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_homedir() 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: <informalexample><programlisting> const char *homedir = g_getenv ("HOME"); if (!homedir) homedir = g_get_homedir (<!-- -->); </programlisting></informalexample> the current user's home directory 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. 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. 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 othewise Since: 2.6 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(). 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 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 Return value: the maximal number of threads a #GThreadPool the maximal number of threads 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. 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 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 match options for the regular expression return location for a #GError a #GRegex structure. Call g_regex_unref() when you are done with it Since: 2.14 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. 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). 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 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 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 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. the string to search for. a pointer to the found occurrence, or %NULL if not found. 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 @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 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 end of the string, or %NULL to indicate that the string is nul-terminated, in which case the returned value will be 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. 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. 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. 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 Adds a #GSource to a @context so that it will be executed within that context. a #GSource a #GMainContext (if %NULL, the default context will be used) the ID (greater than 0) for the source within the #GMainContext. 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 characters printed. Since: 2.2 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 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) 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. See g_spawn_async_with_pipes() for a full description; this function simply calls the g_spawn_async_with_pipes() without any pipes. <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> 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 ID, or %NULL return location for error %TRUE on success, %FALSE if error is set 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. 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 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. 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. 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. Gets the poll function set by g_main_context_set_poll_func(). a #GMainContext the poll function 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. 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 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 auto detect. Auto detection breaks on "\n", "\r\n", "\r", "\0", and the Unicode paragraph separator. Auto detection 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 embeded nuls. 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 characters printed. Since: 2.2 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. 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 Expires a single cache bucket @bucket. This should only ever be called on a bucket that currently has no used iconv descriptors open. @node is not a required argument. If @node is not supplied, we search for it ourselves. cache bucket's node cache bucket 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. Removes the specified group, @group_name, from the key file. Since: 2.6 a #GKeyFile a group name return location for a #GError or %NULL Return value: A random number. a #GRand. A random number. 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. Return value: a newly allocated %NULL-terminated string array a #GKeyFile a group name a key a locale 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 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 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. 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 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 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(). <informalexample><programlisting> 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); } } </programlisting></informalexample> 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.) 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 locale string values number of locale 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. 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 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 Returns: a canonical representation for the string a static string a canonical representation for the string Since: 2.10 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. 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. 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 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 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. 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 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>. 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. 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 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. 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. 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. Returns: the length of the contents of @file. a #GMappedFile the length of the contents of @file. Since: 2.8 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 file name encoding flags from #GKeyFileFlags return location for a #GError, or %NULL %TRUE if a key file could be loaded, %FALSE othewise Since: 2.6 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 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 Reverses the order of the items in @queue. Since: 2.4 a #GQueue Return value: the length of the @queue. a #GAsyncQueue. the length of the @queue. 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 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 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 the 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 Converts @time_ into a ISO 8601 encoded string, relative to the Coordinated Universal Time (UTC). a #GTimeVal a newly allocated string containing a 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 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. 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 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 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