blob: 139c5004a03a6a5fc6e48823021f468abfa84750 [file] [log] [blame]
<!-- ##### SECTION ./tmpl/desktop_entry.sgml:Long_Description ##### -->
<para>
The "GDesktopEntry" parser is intended to parse files written to
the <ulink
url="http://www.freedesktop.org/Standards/desktop-entry-spec">Desktop
Entry Specification</ulink>. It supports deserialization of
desktop entries from files and in-memory data. Desktop entries
are used for a variety of things including menus, application
MIME type registration, and launchers.
</para>
<para>
To load an existing desktop entry from a data directory (as
returned by g_get_user_data_dir() and g_get_system_data_dirs())
use g_desktop_entry_new_from_data_dirs(). To load an existing
desktop entry from an arbitrary location on the file system use
g_desktop_entry_new_from_file(). If the desktop entry is already
in memory use g_desktop_entry_new_from_data(). Once the desktop
entry is loaded its keys can be queried using the g_desktop_entry_get
family of functions.
</para>
<para>
To create a new desktop entry first call g_desktop_entry_new().
Then, call the g_desktop_entry_set family of functions. Next,
call g_desktop_entry_to_data() to output the desktop entry to
a byte array, which can be written to disk or sent over a
network. Finally, call g_desktop_entry_free() to deallocate the
#GDesktopEntry object returned by g_desktop_entry_new().
</para>
<!-- ##### SECTION ./tmpl/desktop_entry.sgml:See_Also ##### -->
<para>
</para>
<!-- ##### SECTION ./tmpl/desktop_entry.sgml:Short_Description ##### -->
serializes and deserializes a desktop entry.
<!-- ##### SECTION ./tmpl/desktop_entry.sgml:Title ##### -->
Desktop Entry Parser
<!-- ##### SECTION ./tmpl/glib-unused.sgml:Stability_Level ##### -->
<!-- ##### SECTION ./tmpl/testutils.sgml:Long_Description ##### -->
<para>
</para>
<!-- ##### SECTION ./tmpl/testutils.sgml:See_Also ##### -->
<para>
</para>
<!-- ##### SECTION ./tmpl/testutils.sgml:Short_Description ##### -->
<!-- ##### SECTION ./tmpl/testutils.sgml:Stability_Level ##### -->
<!-- ##### SECTION ./tmpl/testutils.sgml:Title ##### -->
Testing
<!-- ##### ENUM GChannelError ##### -->
<para>
</para>
@G_CHANNEL_ERROR_ACCES:
@G_CHANNEL_ERROR_BADF:
@G_CHANNEL_ERROR_DEADLK:
@G_CHANNEL_ERROR_FAULT:
@G_CHANNEL_ERROR_INVAL:
@G_CHANNEL_ERROR_IO:
@G_CHANNEL_ERROR_ISDIR:
@G_CHANNEL_ERROR_MFILE:
@G_CHANNEL_ERROR_NOLCK:
@G_CHANNEL_ERROR_NOSPC:
@G_CHANNEL_ERROR_PERM:
@G_CHANNEL_ERROR_PIPE:
@G_CHANNEL_ERROR_SPIPE:
@G_CHANNEL_ERROR_ENCODE_RW:
@G_CHANNEL_ERROR_FAILED:
<!-- ##### ENUM GChannelStatus ##### -->
<para>
</para>
@G_CHANNEL_STATUS_NORMAL:
@G_CHANNEL_STATUS_EOF:
@G_CHANNEL_STATUS_PARTIAL_CHARS:
@G_CHANNEL_STATUS_AGAIN:
@G_CHANNEL_STATUS_INTR:
@G_CHANNEL_STATUS_ERROR:
@G_CHANNEL_STATUS_BAD_INPUT:
<!-- ##### USER_FUNCTION GCompareFuncData ##### -->
<para>
</para>
@a:
@b:
@user_data:
@Returns:
<!-- ##### USER_FUNCTION GCompletionStrcmpFunc ##### -->
<para>
</para>
@s1:
@s2:
@Returns:
<!-- ##### STRUCT GDesktopEntry ##### -->
<para>
</para>
<!-- ##### ENUM GDesktopEntryError ##### -->
<para>
Error codes returned by desktop entry parsing.
</para>
@G_DESKTOP_ENTRY_ERROR_UNKNOWN_ENCODING: text being parsed is not UTF-8 and
cannot be guessed.
@G_DESKTOP_ENTRY_ERROR_BAD_START_GROUP: desktop entry does not start with a
legal start group.
@G_DESKTOP_ENTRY_ERROR_PARSE: desktop entry is empty or contains invalid
data.
@G_DESKTOP_ENTRY_ERROR_NOT_FOUND: valid desktop entry could not be found.
@G_DESKTOP_ENTRY_ERROR_KEY_NOT_FOUND: desktop entry does not have requested
key.
@G_DESKTOP_ENTRY_ERROR_GROUP_NOT_FOUND: desktop entry does not have requested
group
@G_DESKTOP_ENTRY_ERROR_INVALID_VALUE: desktop entry contains key which has
value that cannot be validated.
<!-- ##### ENUM GDesktopEntryFlags ##### -->
<para>
#GDesktopEntry supports a few flags for tweaking performance during
deserialization. #G_DESKTOP_ENTRY_DISCARD_COMMENTS and
#G_DESKTOP_ENTRY_DISCARD_TRANSLATIONS will reduce memory footprint,
and #G_DESKTOP_ENTRY_GENERATE_LOOKUP_MAP will increase key lookup speed.
</para>
@G_DESKTOP_ENTRY_NONE: use parser defaults
@G_DESKTOP_ENTRY_DISCARD_COMMENTS: Discard all lines that are blank
or start with "#".
@G_DESKTOP_ENTRY_DISCARD_TRANSLATIONS: Only retain translations that
are returned by g_get_language_names().
@G_DESKTOP_ENTRY_GENERATE_LOOKUP_MAP: Generate a lookup map for key names to make lookups constant time at the cost of more memory.
<!-- ##### USER_FUNCTION GErrorFunc ##### -->
<para>
Specifies the type of function passed to g_set_error_handler().
</para>
@str: the error message.
<!-- ##### USER_FUNCTION GHookFreeFunc ##### -->
<para>
</para>
@hook_list:
@hook:
<!-- ##### ENUM GIOFileMode ##### -->
<para>
</para>
@G_IO_FILE_MODE_READ:
@G_IO_FILE_MODE_WRITE:
@G_IO_FILE_MODE_APPEND:
@G_IO_FILE_MODE_READ_WRITE:
@G_IO_FILE_MODE_READ_WRITE_TRUNCATE:
@G_IO_FILE_MODE_READ_WRITE_APPEND:
<!-- ##### ENUM GMatchType ##### -->
<para>
Enumeration representing different kinds of patterns. This is only used
internally for optimizing the match algorithm.
</para>
@G_MATCH_ALL: a general pattern.
@G_MATCH_ALL_TAIL: a general pattern which contains a fixed part matching
the end of the string.
@G_MATCH_HEAD: a pattern matching every string with a certain prefix.
@G_MATCH_TAIL: a pattern matching every string with a certain suffix.
@G_MATCH_EXACT: a pattern matching exactly one string.
@G_MATCH_LAST:
<!-- ##### USER_FUNCTION GWarningFunc ##### -->
<para>
Specifies the type of function passed to g_set_warning_handler().
</para>
@str: the warning message.
<!-- ##### MACRO G_CHANNEL_ERROR ##### -->
<para>
</para>
<!-- ##### MACRO G_DESKTOP_ENTRY_ERROR ##### -->
<para>
Error domain for desktop entry parsing. Errors in this domain will
be from the #GDesktopEntryError enumeration. See #GError for information on
error domains.
</para>
<!-- ##### MACRO G_HOOK_DEFERRED_DESTROY ##### -->
<para>
</para>
<!-- ##### MACRO G_IO_CHANNEL_DEFAULT_LINE_TERM ##### -->
<para>
One of %G_IO_CHANNEL_UNIX_LINE_TERM, %G_IO_CHANNEL_DOS_LINE_TERM,
or %G_IO_CHANNEL_MACINTOSH_LINE_TERM (unimplemented)
depending on the system type.
</para>
<!-- ##### MACRO G_IO_CHANNEL_DOS_LINE_TERM ##### -->
<para>
</para>
<!-- ##### MACRO G_IO_CHANNEL_ENCODE_RAW ##### -->
<para>
Encoding for nonbuffered IO. With this encoding, data must be
read using g_io_channel_read_chars(); the other functions will
not work.
</para>
<!-- ##### MACRO G_IO_CHANNEL_MACINTOSH_LINE_TERM ##### -->
<para>
</para>
<!-- ##### MACRO G_IO_CHANNEL_UNIX_LINE_TERM ##### -->
<para>
</para>
<!-- ##### MACRO NAME_MAX ##### -->
<para>
Provided for UNIX emulation on Windows; equivalent to UNIX macro
%NAME_MAX, which is the maximum length of a single path component.
i.e. just the <filename>foo</filename> in <filename>/usr/bin/foo</filename>.
</para>
<!-- ##### MACRO _ ##### -->
<para>
Marks a string for translation, gets replaced with the translated string
at runtime.
</para>
@String: the string to be translated
@Since: 2.4
<!-- ##### MACRO access ##### -->
<para>
</para>
<!-- ##### MACRO close ##### -->
<para>
</para>
<!-- ##### FUNCTION closedir ##### -->
<para>
Provided for UNIX emulation on Windows; see documentation for <function>closedir()</function>
in any UNIX manual.
</para>
@Param1:
@Returns:
<!-- ##### MACRO fdopen ##### -->
<para>
</para>
<!-- ##### MACRO ftruncate ##### -->
<para>
Provided for UNIX emulation on Windows; see documentation for ftruncate()
in any UNIX manual.
</para>
@fd:
@size:
<!-- ##### FUNCTION g_channel_error_from_errno ##### -->
<para>
</para>
@en:
@Returns:
<!-- ##### FUNCTION g_channel_error_quark ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION g_convert_error_quark ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION g_desktop_entry_escape_strings ##### -->
<para>
</para>
@entry:
@should_escape:
<!-- ##### FUNCTION g_desktop_entry_free ##### -->
<para>
</para>
@entry:
<!-- ##### FUNCTION g_desktop_entry_get_boolean ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_get_boolean_list ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@length:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_get_groups ##### -->
<para>
</para>
@entry:
@length:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_get_integer ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_get_integer_list ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@length:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_get_keys ##### -->
<para>
</para>
@entry:
@group_name:
@length:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_get_locale_string ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@locale:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_get_locale_string_list ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@locale:
@length:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_get_start_group ##### -->
<para>
</para>
@entry:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_get_string ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_get_string_list ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@length:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_has_group ##### -->
<para>
</para>
@entry:
@group_name:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_has_key ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_new ##### -->
<para>
</para>
@flags:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_new_from_data ##### -->
<para>
</para>
@data:
@length:
@legal_start_groups:
@flags:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_new_from_data_dirs ##### -->
<para>
</para>
@file:
@full_path:
@legal_start_groups:
@flags:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_new_from_file ##### -->
<para>
</para>
@file:
@legal_start_groups:
@flags:
@error:
@Returns:
<!-- ##### FUNCTION g_desktop_entry_remove_group ##### -->
<para>
</para>
@entry:
@group_name:
@error:
<!-- ##### FUNCTION g_desktop_entry_remove_key ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@error:
<!-- ##### FUNCTION g_desktop_entry_set_boolean ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@boolean:
@error:
<!-- ##### FUNCTION g_desktop_entry_set_boolean_list ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@list:
@length:
@error:
<!-- ##### FUNCTION g_desktop_entry_set_integer ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@integer:
@error:
<!-- ##### FUNCTION g_desktop_entry_set_integer_list ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@list:
@length:
@error:
<!-- ##### FUNCTION g_desktop_entry_set_locale_string ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@locale:
@string:
@error:
<!-- ##### FUNCTION g_desktop_entry_set_locale_string_list ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@locale:
@list:
@length:
@error:
<!-- ##### FUNCTION g_desktop_entry_set_string ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@string:
@error:
<!-- ##### FUNCTION g_desktop_entry_set_string_list ##### -->
<para>
</para>
@entry:
@group_name:
@key:
@list:
@length:
@error:
<!-- ##### FUNCTION g_desktop_entry_to_data ##### -->
<para>
</para>
@entry:
@length:
@error:
@Returns:
<!-- ##### FUNCTION g_file_replace ##### -->
<para>
</para>
@filename:
@contents:
@length:
@error:
@Returns:
<!-- ##### FUNCTION g_format_file_size_for_display ##### -->
<para>
</para>
@size:
@Returns:
<!-- ##### FUNCTION g_io_channel_error_quark ##### -->
<para>
</para>
@Returns:
<!-- ##### VARIABLE g_log_domain_glib ##### -->
<para>
The log domain used for messages logged by GLib itself.
</para>
<!-- ##### FUNCTION g_main_add_poll ##### -->
<para>
Adds a file descriptor to be polled.
This is usually combined with g_source_add() 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.
</para>
@fd: a #GPollFD, which is a file descriptor together with a bitwise
combination of #GIOCondition flags determining which events to poll for.
@priority: the priority of the poll, which should be the same as the priority
used for g_source_add() to ensure that the file descriptor is polled whenever
the results may be needed.
See #G_PRIORITY_DEFAULT, #G_PRIORITY_DEFAULT_IDLE, #G_PRIORITY_HIGH,
#G_PRIORITY_HIGH_IDLE, and #G_PRIORITY_LOW.
<!-- ##### FUNCTION g_main_context_get ##### -->
<para>
</para>
@thread:
@Returns:
<!-- ##### FUNCTION g_main_loop_destroy ##### -->
<para>
</para>
@loop:
<!-- ##### FUNCTION g_main_remove_poll ##### -->
<para>
Removes a file descriptor from the list being polled.
</para>
@fd: the #GPollFD to remove.
<!-- ##### FUNCTION g_main_win32_get_poll_func ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION g_mem_check ##### -->
<para>
Checks if the given memory has already been freed. If it has it outputs
a warning message.
To use this function you must configure glib with the flag
'--enable-mem-check=yes' before compiling.
</para>
@mem: the memory to check.
<!-- ##### FUNCTION g_regex_error_quark ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION g_regex_free ##### -->
<para>
</para>
@regex:
<!-- ##### FUNCTION g_scanner_stat_mode ##### -->
<para>
Gets the file attributes.
This is the <structfield>st_mode</structfield> field from the
<structname>stat</structname> structure. See the <function>stat()</function>
documentation.
</para>
@filename: the file name.
@Returns: the file attributes.
<!-- ##### FUNCTION g_set_error_handler ##### -->
<para>
Sets the function to be called to handle error messages.
This function is deprecated in favour of the new logging facilities.
</para>
@func: the function to be called to handle error messages.
@Returns: the old error handler.
<!-- ##### FUNCTION g_set_message_handler ##### -->
<para>
Sets the function to be called to handle messages.
This function is deprecated in favour of the new logging facilities.
</para>
@func: the function to be called to handle normal messages.
@Returns: the old message handler.
<!-- ##### FUNCTION g_set_warning_handler ##### -->
<para>
Sets the function to be called to handle warning messages.
This function is deprecated in favour of the new logging facilities.
</para>
@func: the function to be called to handle warning messages.
@Returns: the old warning handler.
<!-- ##### FUNCTION g_source_add ##### -->
<para>
</para>
@priority:
@can_recurse:
@funcs:
@source_data:
@user_data:
@notify:
@Returns:
@source:
@context:
<!-- ##### FUNCTION g_source_connect ##### -->
<para>
</para>
@source:
@func:
@data:
@notify:
<!-- ##### FUNCTION g_source_connect_indirect ##### -->
<para>
</para>
@source:
@callback_data:
@callback_funcs:
<!-- ##### FUNCTION g_source_remove_by_source_data ##### -->
<para>
Removes the first event source found with the given source data.
</para>
<para>
Event sources are sorted with the highest priority first. Sources with equal
priority are stored in the order in which they were added.
</para>
@source_data: the source data, which contains information specific to the
type of source.
@Returns: TRUE if an event source was found and removed.
<!-- ##### FUNCTION g_static_private_get_for_thread ##### -->
<para>
</para>
@private_key:
@thread:
@Returns:
<!-- ##### FUNCTION g_static_private_set_for_thread ##### -->
<para>
</para>
@private_key:
@thread:
@data:
@notify:
<!-- ##### MACRO g_string ##### -->
<para>
Turns the argument into a string literal by using the '#' stringizing operator.
</para>
@x: text to convert to a literal string.
<!-- ##### FUNCTION g_warn_message ##### -->
<para>
</para>
@domain:
@file:
@line:
@func:
@warnexpr:
<!-- ##### MACRO getcwd ##### -->
<para>
</para>
<!-- ##### MACRO getpid ##### -->
<para>
</para>
<!-- ##### VARIABLE glib_binary_age ##### -->
<para>
This is the binary age passed to <application>libtool</application>. If
<application>libtool</application> means nothing to you, don't worry
about it. ;-)
</para>
<!-- ##### FUNCTION glib_check_version ##### -->
<para>
</para>
@required_major:
@required_minor:
@required_micro:
@Returns:
<!-- ##### VARIABLE glib_interface_age ##### -->
<para>
This is the interface age passed to <application>libtool</application>. If
<application>libtool</application> means nothing to you, don't worry
about it. ;-)
</para>
<!-- ##### VARIABLE glib_major_version ##### -->
<para>
The major version number of the GLib library.
(e.g. in GLib version 1.2.5 this is 1.)
</para>
<para>
This variable is in the library, so represents the
GLib library you have linked against. Contrast with the
#GLIB_MAJOR_VERSION macro, which represents the major version of the
GLib headers you have included.
</para>
<!-- ##### VARIABLE glib_micro_version ##### -->
<para>
The micro version number of the GLib library.
(e.g. in GLib version 1.2.5 this is 5.)
</para>
<para>
This variable is in the library, so represents the GLib library you
have linked against. Contrast with the #GLIB_MICRO_VERSION macro, which
represents the micro version of the GLib headers you have included.
</para>
<!-- ##### VARIABLE glib_minor_version ##### -->
<para>
The minor version number of the GLib library.
(e.g. in GLib version 1.2.5 this is 2.)
</para>
<para>
This variable is in the library, so represents the
GLib library you have linked against. Contrast with the
#GLIB_MINOR_VERSION macro, which represents the minor version of the
GLib headers you have included.
</para>
<!-- ##### MACRO lseek ##### -->
<para>
</para>
<!-- ##### MACRO open ##### -->
<para>
</para>
<!-- ##### FUNCTION opendir ##### -->
<para>
Provided for UNIX emulation on Windows; see documentation for <function>opendir()</function>
in any UNIX manual.
</para>
@Param1:
@Returns:
<!-- ##### MACRO pclose ##### -->
<para>
</para>
<!-- ##### MACRO pipe ##### -->
<para>
Provided for UNIX emulation on Windows; see documentation for pipe()
in any UNIX manual.
</para>
@phandles: file descriptors, the first one for reading, the second one for writing.
<!-- ##### MACRO popen ##### -->
<para>
</para>
<!-- ##### MACRO read ##### -->
<para>
</para>
<!-- ##### MACRO readdir ##### -->
<para>
Provided for UNIX emulation on Windows; see documentation for <function>readdir()</function>
in any UNIX manual.
</para>
<!-- ##### FUNCTION rewinddir ##### -->
<para>
Provided for UNIX emulation on Windows; see documentation for <function>rewinddir()</function>
in any UNIX manual.
</para>
@Param1:
<!-- ##### MACRO write ##### -->
<para>
</para>