1 <!-- ##### SECTION ./tmpl/desktop_entry.sgml:Long_Description ##### -->
3 The "GDesktopEntry" parser is intended to parse files written to
5 url="http://www.freedesktop.org/Standards/desktop-entry-spec">Desktop
6 Entry Specification</ulink>. It supports deserialization of
7 desktop entries from files and in-memory data. Desktop entries
8 are used for a variety of things including menus, application
9 MIME type registration, and launchers.
13 To load an existing desktop entry from a data directory (as
14 returned by g_get_user_data_dir() and g_get_system_data_dirs())
15 use g_desktop_entry_new_from_data_dirs(). To load an existing
16 desktop entry from an arbitrary location on the file system use
17 g_desktop_entry_new_from_file(). If the desktop entry is already
18 in memory use g_desktop_entry_new_from_data(). Once the desktop
19 entry is loaded its keys can be queried using the g_desktop_entry_get
24 To create a new desktop entry first call g_desktop_entry_new().
25 Then, call the g_desktop_entry_set family of functions. Next,
26 call g_desktop_entry_to_data() to output the desktop entry to
27 a byte array, which can be written to disk or sent over a
28 network. Finally, call g_desktop_entry_free() to deallocate the
29 #GDesktopEntry object returned by g_desktop_entry_new().
33 <!-- ##### SECTION ./tmpl/desktop_entry.sgml:See_Also ##### -->
39 <!-- ##### SECTION ./tmpl/desktop_entry.sgml:Short_Description ##### -->
40 serializes and deserializes a desktop entry.
43 <!-- ##### SECTION ./tmpl/desktop_entry.sgml:Title ##### -->
47 <!-- ##### ENUM GChannelError ##### -->
52 @G_CHANNEL_ERROR_ACCES:
53 @G_CHANNEL_ERROR_BADF:
54 @G_CHANNEL_ERROR_DEADLK:
55 @G_CHANNEL_ERROR_FAULT:
56 @G_CHANNEL_ERROR_INVAL:
58 @G_CHANNEL_ERROR_ISDIR:
59 @G_CHANNEL_ERROR_MFILE:
60 @G_CHANNEL_ERROR_NOLCK:
61 @G_CHANNEL_ERROR_NOSPC:
62 @G_CHANNEL_ERROR_PERM:
63 @G_CHANNEL_ERROR_PIPE:
64 @G_CHANNEL_ERROR_SPIPE:
65 @G_CHANNEL_ERROR_ENCODE_RW:
66 @G_CHANNEL_ERROR_FAILED:
68 <!-- ##### ENUM GChannelStatus ##### -->
73 @G_CHANNEL_STATUS_NORMAL:
74 @G_CHANNEL_STATUS_EOF:
75 @G_CHANNEL_STATUS_PARTIAL_CHARS:
76 @G_CHANNEL_STATUS_AGAIN:
77 @G_CHANNEL_STATUS_INTR:
78 @G_CHANNEL_STATUS_ERROR:
79 @G_CHANNEL_STATUS_BAD_INPUT:
81 <!-- ##### USER_FUNCTION GCompareFuncData ##### -->
91 <!-- ##### USER_FUNCTION GCompletionStrcmpFunc ##### -->
100 <!-- ##### STRUCT GDesktopEntry ##### -->
106 <!-- ##### ENUM GDesktopEntryError ##### -->
108 Error codes returned by desktop entry parsing.
111 @G_DESKTOP_ENTRY_ERROR_UNKNOWN_ENCODING: text being parsed is not UTF-8 and
113 @G_DESKTOP_ENTRY_ERROR_BAD_START_GROUP: desktop entry does not start with a
115 @G_DESKTOP_ENTRY_ERROR_PARSE: desktop entry is empty or contains invalid
117 @G_DESKTOP_ENTRY_ERROR_NOT_FOUND: valid desktop entry could not be found.
118 @G_DESKTOP_ENTRY_ERROR_KEY_NOT_FOUND: desktop entry does not have requested
120 @G_DESKTOP_ENTRY_ERROR_GROUP_NOT_FOUND: desktop entry does not have requested
122 @G_DESKTOP_ENTRY_ERROR_INVALID_VALUE: desktop entry contains key which has
123 value that cannot be validated.
125 <!-- ##### ENUM GDesktopEntryFlags ##### -->
127 #GDesktopEntry supports a few flags for tweaking performance during
128 deserialization. #G_DESKTOP_ENTRY_DISCARD_COMMENTS and
129 #G_DESKTOP_ENTRY_DISCARD_TRANSLATIONS will reduce memory footprint,
130 and #G_DESKTOP_ENTRY_GENERATE_LOOKUP_MAP will increase key lookup speed.
133 @G_DESKTOP_ENTRY_NONE: use parser defaults
134 @G_DESKTOP_ENTRY_DISCARD_COMMENTS: Discard all lines that are blank
136 @G_DESKTOP_ENTRY_DISCARD_TRANSLATIONS: Only retain translations that
137 are returned by g_get_language_names().
138 @G_DESKTOP_ENTRY_GENERATE_LOOKUP_MAP: Generate a lookup map for key names to make lookups constant time at the cost of more memory.
140 <!-- ##### USER_FUNCTION GErrorFunc ##### -->
142 Specifies the type of function passed to g_set_error_handler().
145 @str: the error message.
147 <!-- ##### USER_FUNCTION GHookFreeFunc ##### -->
155 <!-- ##### ENUM GIOFileMode ##### -->
160 @G_IO_FILE_MODE_READ:
161 @G_IO_FILE_MODE_WRITE:
162 @G_IO_FILE_MODE_APPEND:
163 @G_IO_FILE_MODE_READ_WRITE:
164 @G_IO_FILE_MODE_READ_WRITE_TRUNCATE:
165 @G_IO_FILE_MODE_READ_WRITE_APPEND:
167 <!-- ##### ENUM GMatchType ##### -->
169 Enumeration representing different kinds of patterns. This is only used
170 internally for optimizing the match algorithm.
173 @G_MATCH_ALL: a general pattern.
174 @G_MATCH_ALL_TAIL: a general pattern which contains a fixed part matching
175 the end of the string.
176 @G_MATCH_HEAD: a pattern matching every string with a certain prefix.
177 @G_MATCH_TAIL: a pattern matching every string with a certain suffix.
178 @G_MATCH_EXACT: a pattern matching exactly one string.
181 <!-- ##### USER_FUNCTION GWarningFunc ##### -->
183 Specifies the type of function passed to g_set_warning_handler().
186 @str: the warning message.
188 <!-- ##### MACRO G_CHANNEL_ERROR ##### -->
194 <!-- ##### MACRO G_DESKTOP_ENTRY_ERROR ##### -->
196 Error domain for desktop entry parsing. Errors in this domain will
197 be from the #GDesktopEntryError enumeration. See #GError for information on
202 <!-- ##### MACRO G_HOOK_DEFERRED_DESTROY ##### -->
208 <!-- ##### MACRO G_IO_CHANNEL_DEFAULT_LINE_TERM ##### -->
210 One of %G_IO_CHANNEL_UNIX_LINE_TERM, %G_IO_CHANNEL_DOS_LINE_TERM,
211 or %G_IO_CHANNEL_MACINTOSH_LINE_TERM (unimplemented)
212 depending on the system type.
216 <!-- ##### MACRO G_IO_CHANNEL_DOS_LINE_TERM ##### -->
222 <!-- ##### MACRO G_IO_CHANNEL_ENCODE_RAW ##### -->
224 Encoding for nonbuffered IO. With this encoding, data must be
225 read using g_io_channel_read_chars(); the other functions will
230 <!-- ##### MACRO G_IO_CHANNEL_MACINTOSH_LINE_TERM ##### -->
236 <!-- ##### MACRO G_IO_CHANNEL_UNIX_LINE_TERM ##### -->
242 <!-- ##### MACRO NAME_MAX ##### -->
244 Provided for UNIX emulation on Windows; equivalent to UNIX macro
245 %NAME_MAX, which is the maximum length of a single path component.
246 i.e. just the <filename>foo</filename> in <filename>/usr/bin/foo</filename>.
250 <!-- ##### MACRO access ##### -->
256 <!-- ##### MACRO close ##### -->
262 <!-- ##### FUNCTION closedir ##### -->
264 Provided for UNIX emulation on Windows; see documentation for <function>closedir()</function>
271 <!-- ##### MACRO fdopen ##### -->
277 <!-- ##### MACRO ftruncate ##### -->
279 Provided for UNIX emulation on Windows; see documentation for <function>ftruncate()</function>
286 <!-- ##### FUNCTION g_channel_error_from_errno ##### -->
294 <!-- ##### FUNCTION g_channel_error_quark ##### -->
301 <!-- ##### FUNCTION g_convert_error_quark ##### -->
308 <!-- ##### FUNCTION g_desktop_entry_escape_strings ##### -->
316 <!-- ##### FUNCTION g_desktop_entry_free ##### -->
323 <!-- ##### FUNCTION g_desktop_entry_get_boolean ##### -->
334 <!-- ##### FUNCTION g_desktop_entry_get_boolean_list ##### -->
346 <!-- ##### FUNCTION g_desktop_entry_get_groups ##### -->
355 <!-- ##### FUNCTION g_desktop_entry_get_integer ##### -->
366 <!-- ##### FUNCTION g_desktop_entry_get_integer_list ##### -->
378 <!-- ##### FUNCTION g_desktop_entry_get_keys ##### -->
389 <!-- ##### FUNCTION g_desktop_entry_get_locale_string ##### -->
401 <!-- ##### FUNCTION g_desktop_entry_get_locale_string_list ##### -->
414 <!-- ##### FUNCTION g_desktop_entry_get_start_group ##### -->
422 <!-- ##### FUNCTION g_desktop_entry_get_string ##### -->
433 <!-- ##### FUNCTION g_desktop_entry_get_string_list ##### -->
445 <!-- ##### FUNCTION g_desktop_entry_has_group ##### -->
454 <!-- ##### FUNCTION g_desktop_entry_has_key ##### -->
465 <!-- ##### FUNCTION g_desktop_entry_new ##### -->
474 <!-- ##### FUNCTION g_desktop_entry_new_from_data ##### -->
486 <!-- ##### FUNCTION g_desktop_entry_new_from_data_dirs ##### -->
498 <!-- ##### FUNCTION g_desktop_entry_new_from_file ##### -->
509 <!-- ##### FUNCTION g_desktop_entry_remove_group ##### -->
518 <!-- ##### FUNCTION g_desktop_entry_remove_key ##### -->
528 <!-- ##### FUNCTION g_desktop_entry_set_boolean ##### -->
539 <!-- ##### FUNCTION g_desktop_entry_set_boolean_list ##### -->
551 <!-- ##### FUNCTION g_desktop_entry_set_integer ##### -->
562 <!-- ##### FUNCTION g_desktop_entry_set_integer_list ##### -->
574 <!-- ##### FUNCTION g_desktop_entry_set_locale_string ##### -->
586 <!-- ##### FUNCTION g_desktop_entry_set_locale_string_list ##### -->
599 <!-- ##### FUNCTION g_desktop_entry_set_string ##### -->
610 <!-- ##### FUNCTION g_desktop_entry_set_string_list ##### -->
622 <!-- ##### FUNCTION g_desktop_entry_to_data ##### -->
632 <!-- ##### FUNCTION g_io_channel_error_quark ##### -->
639 <!-- ##### VARIABLE g_log_domain_glib ##### -->
641 The log domain used for messages logged by GLib itself.
645 <!-- ##### FUNCTION g_main_add_poll ##### -->
647 Adds a file descriptor to be polled.
648 This is usually combined with g_source_add() to add an event source.
649 The event source's check function will typically test the revents
650 field in the #GPollFD struct and return TRUE if events need to be processed.
653 @fd: a #GPollFD, which is a file descriptor together with a bitwise
654 combination of #GIOCondition flags determining which events to poll for.
655 @priority: the priority of the poll, which should be the same as the priority
656 used for g_source_add() to ensure that the file descriptor is polled whenever
657 the results may be needed.
658 See #G_PRIORITY_DEFAULT, #G_PRIORITY_DEFAULT_IDLE, #G_PRIORITY_HIGH,
659 #G_PRIORITY_HIGH_IDLE, and #G_PRIORITY_LOW.
661 <!-- ##### FUNCTION g_main_context_get ##### -->
669 <!-- ##### FUNCTION g_main_loop_destroy ##### -->
676 <!-- ##### FUNCTION g_main_remove_poll ##### -->
678 Removes a file descriptor from the list being polled.
681 @fd: the #GPollFD to remove.
683 <!-- ##### FUNCTION g_main_win32_get_poll_func ##### -->
690 <!-- ##### FUNCTION g_mem_check ##### -->
692 Checks if the given memory has already been freed. If it has it outputs
694 To use this function you must configure glib with the flag
695 '--enable-mem-check=yes' before compiling.
698 @mem: the memory to check.
700 <!-- ##### FUNCTION g_scanner_stat_mode ##### -->
702 Gets the file attributes.
703 This is the <structfield>st_mode</structfield> field from the
704 <structname>stat</structname> structure. See the <function>stat()</function>
708 @filename: the file name.
709 @Returns: the file attributes.
711 <!-- ##### FUNCTION g_set_error_handler ##### -->
713 Sets the function to be called to handle error messages.
714 This function is deprecated in favour of the new logging facilities.
717 @func: the function to be called to handle error messages.
718 @Returns: the old error handler.
720 <!-- ##### FUNCTION g_set_message_handler ##### -->
722 Sets the function to be called to handle messages.
723 This function is deprecated in favour of the new logging facilities.
726 @func: the function to be called to handle normal messages.
727 @Returns: the old message handler.
729 <!-- ##### FUNCTION g_set_warning_handler ##### -->
731 Sets the function to be called to handle warning messages.
732 This function is deprecated in favour of the new logging facilities.
735 @func: the function to be called to handle warning messages.
736 @Returns: the old warning handler.
738 <!-- ##### FUNCTION g_source_add ##### -->
752 <!-- ##### FUNCTION g_source_connect ##### -->
762 <!-- ##### FUNCTION g_source_connect_indirect ##### -->
771 <!-- ##### FUNCTION g_source_remove_by_source_data ##### -->
773 Removes the first event source found with the given source data.
776 Event sources are sorted with the highest priority first. Sources with equal
777 priority are stored in the order in which they were added.
780 @source_data: the source data, which contains information specific to the
782 @Returns: TRUE if an event source was found and removed.
784 <!-- ##### FUNCTION g_static_private_get_for_thread ##### -->
793 <!-- ##### FUNCTION g_static_private_set_for_thread ##### -->
803 <!-- ##### MACRO g_string ##### -->
805 Turns the argument into a string literal by using the '#' stringizing operator.
808 @x: text to convert to a literal string.
810 <!-- ##### MACRO getcwd ##### -->
816 <!-- ##### MACRO getpid ##### -->
822 <!-- ##### MACRO lseek ##### -->
828 <!-- ##### MACRO open ##### -->
834 <!-- ##### FUNCTION opendir ##### -->
836 Provided for UNIX emulation on Windows; see documentation for <function>opendir()</function>
843 <!-- ##### MACRO pclose ##### -->
849 <!-- ##### MACRO popen ##### -->
855 <!-- ##### MACRO read ##### -->
861 <!-- ##### MACRO readdir ##### -->
863 Provided for UNIX emulation on Windows; see documentation for <function>readdir()</function>
868 <!-- ##### FUNCTION rewinddir ##### -->
870 Provided for UNIX emulation on Windows; see documentation for <function>rewinddir()</function>
876 <!-- ##### MACRO write ##### -->