Returns the value of an environment variable.
Return a name for the machine.
Tests if
hostname
contains segments with an ASCII-compatible
encoding of an Internationalized Domain Name. If this returns
true
, you should decode the hostname with
hostname_to_unicode()
before displaying it to the user.
Tests if hostname
is the string form of an IPv4 or IPv6 address.
(Eg, “192.168.0.1”.)
Tests if
hostname
contains Unicode characters. If this returns
true
, you need to encode the hostname with
hostname_to_ascii()
before using it in non-IDN-aware contexts.
Converts hostname
to its canonical ASCII form; an ASCII-only
string containing no uppercase letters and not ending with a
trailing dot.
Converts hostname
to its canonical presentation form; a UTF-8
string in Unicode normalization form C, containing no uppercase
letters, no forbidden characters, and no ASCII-encoded segments,
and not ending with a trailing dot.
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”.
Computes a list of applicable locale names with a locale category name,
which can be used to construct the fallback locale-dependent filenames
or search paths. The returned list is sorted from most desirable to
least desirable and always contains the default locale “C”.
Gets the names of all variables set in the environment.
Returns a list of derived variants of
locale
, 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.
This function handles territory, charset and extra locale modifiers. See
setlocale(3)
for information about locales and their format.
Returns the currently firing source for this thread.
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.
Create a directory if it doesn’t already exist. Create intermediate
parent directories as needed, too.
Queries the system monotonic time.
Determine the approximate number of threads that the system will
schedule simultaneously for this process. This is intended to be
used as a parameter to [ThreadPool::new()
][crate::ThreadPool::new()] for CPU bound tasks and
similar cases.
Prompts the user with
[E]xit, [H]alt, show [S]tack trace or [P]roceed
.
This function is intended to be used for debugging use only.
The following example shows how it can be used together with
the g_log()
functions.
Invokes gdb, which attaches to the current process and shows a
stack trace. Called by
on_error_query()
when the “[S]tack trace”
option is selected. You can get the current process’s program name
with
g_get_prgname()
, assuming that you have called
gtk_init()
or
gdk_init()
.
Get information about the operating system.
Returns a random gdouble
equally distributed over the range [0..1).
Returns a random gdouble
equally distributed over the range
[begin
..end
).
Return a random guint32
equally distributed over the range
[0..2^32-1].
Returns a random gint32
equally distributed over the range
[begin
..end
-1].
Sets the seed for the global random number generator, which is used
by the g_random_* functions, to seed
.
Gets the real name of the user. This usually comes from the user’s
entry in the passwd
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.
Queries the system wall-clock time.
Resets the cache used for
user_special_dir()
, so
that the latest on-disk version is used. Call this only
if you just changed the data on disk yourself.
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
set_application_name()
will not.
Sets an environment variable. On UNIX, both the variable’s name and
value can be arbitrary byte strings, except that the variable’s name
cannot contain ‘=’. On Windows, they should be in UTF-8.
Returns an ordered list of base directories in which to access
system-wide configuration information.
Returns an ordered list of base directories in which to access
system-wide application data.
Gets the directory to use for temporary files.
Returns a base directory in which to store non-essential, cached
data specific to particular user.
Returns a base directory in which to store user-specific application
configuration information such as user preferences and settings.
Returns a base directory in which to access application data such
as icons that is customized for a particular user.
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.
Returns a directory that is unique to the current user on the local
system.
Returns the full path of a special directory using its logical id.
Returns a base directory in which to store state files specific to
particular user.