a selection of portable utility functions.
These are portable utility functions.
mchars
)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 withg-get-prgname
, which gets a non-localized name. Ifg-set-application-name
has not been called, returns the result ofg-get-prgname
(which may be ‘#f
’ ifg-set-prgname
has also not been called).
- ret
- human-readable application name. may return ‘
#f
’Since 2.2
mchars
)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 bygtk-init
, butg-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.
- application-name
- localized name of the application
mchars
)Gets the name of the program. This name should not be localized, contrast with
g-get-application-name
. (If you are using GDK or GTK+ the program name is set ingdk-init
, which is called bygtk-init
. The program name is found by taking the last component of ‘argv[0]’.)
- ret
- the name of the program. The returned string belongs to GLib and must not be modified or freed.
mchars
)Sets the name of the program. This name should not be localized, contrast with
g-set-application-name
. Note that for thread-safety reasons this function can only be called once.
- prgname
- the name of the program.
mchars
)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.
- ret
- the user name of the current user.
mchars
)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.
- ret
- the user's real name.
mchars
)Returns a base directory in which to store non-essential, cached data specific to particular user.
On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification
- ret
- a string owned by GLib that must not be modified or freed.
Since 2.6
mchars
)Returns a base directory in which to access application data such as icons that is customized for a particular user.
On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification
- ret
- a string owned by GLib that must not be modified or freed.
Since 2.6
mchars
)Returns a base directory in which to store user-specific application configuration information such as user preferences and settings.
On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification
- ret
- a string owned by GLib that must not be modified or freed.
Since 2.6
mchars
)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.
- ret
- the host name of the machine.
Since 2.8
mchars
)Gets the current user's home directory.
Note that in contrast to traditional UNIX tools, this function prefers passwd entries over the HOME environment variable.
- ret
- the current user's home directory.
mchars
)Gets the directory to use for temporary files. This is found from inspecting the environment variables TMPDIR, TMP, and TEMP 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 ‘
#f
’.
- ret
- the directory to use for temporary files.