1<!-- ##### SECTION ./tmpl/desktop_entry.sgml:Long_Description ##### --> 2<para> 3The "GDesktopEntry" parser is intended to parse files written to 4the <ulink 5url="http://www.freedesktop.org/Standards/desktop-entry-spec">Desktop 6Entry Specification</ulink>. It supports deserialization of 7desktop entries from files and in-memory data. Desktop entries 8are used for a variety of things including menus, application 9MIME type registration, and launchers. 10</para> 11 12<para> 13To load an existing desktop entry from a data directory (as 14returned by g_get_user_data_dir() and g_get_system_data_dirs()) 15use g_desktop_entry_new_from_data_dirs(). To load an existing 16desktop entry from an arbitrary location on the file system use 17g_desktop_entry_new_from_file(). If the desktop entry is already 18in memory use g_desktop_entry_new_from_data(). Once the desktop 19entry is loaded its keys can be queried using the g_desktop_entry_get 20family of functions. 21</para> 22 23<para> 24To create a new desktop entry first call g_desktop_entry_new(). 25Then, call the g_desktop_entry_set family of functions. Next, 26call g_desktop_entry_to_data() to output the desktop entry to 27a byte array, which can be written to disk or sent over a 28network. Finally, call g_desktop_entry_free() to deallocate the 29#GDesktopEntry object returned by g_desktop_entry_new(). 30</para> 31 32 33<!-- ##### SECTION ./tmpl/desktop_entry.sgml:See_Also ##### --> 34<para> 35 36</para> 37 38 39<!-- ##### SECTION ./tmpl/desktop_entry.sgml:Short_Description ##### --> 40serializes and deserializes a desktop entry. 41 42 43<!-- ##### SECTION ./tmpl/desktop_entry.sgml:Title ##### --> 44Desktop Entry Parser 45 46 47<!-- ##### SECTION ./tmpl/glib-unused.sgml:Stability_Level ##### --> 48 49 50 51<!-- ##### SECTION ./tmpl/testutils.sgml:Long_Description ##### --> 52<para> 53 54</para> 55 56 57<!-- ##### SECTION ./tmpl/testutils.sgml:See_Also ##### --> 58<para> 59 60</para> 61 62 63<!-- ##### SECTION ./tmpl/testutils.sgml:Short_Description ##### --> 64 65 66 67<!-- ##### SECTION ./tmpl/testutils.sgml:Stability_Level ##### --> 68 69 70 71<!-- ##### SECTION ./tmpl/testutils.sgml:Title ##### --> 72Testing 73 74 75<!-- ##### ENUM GChannelError ##### --> 76<para> 77 78</para> 79 80@G_CHANNEL_ERROR_ACCES: 81@G_CHANNEL_ERROR_BADF: 82@G_CHANNEL_ERROR_DEADLK: 83@G_CHANNEL_ERROR_FAULT: 84@G_CHANNEL_ERROR_INVAL: 85@G_CHANNEL_ERROR_IO: 86@G_CHANNEL_ERROR_ISDIR: 87@G_CHANNEL_ERROR_MFILE: 88@G_CHANNEL_ERROR_NOLCK: 89@G_CHANNEL_ERROR_NOSPC: 90@G_CHANNEL_ERROR_PERM: 91@G_CHANNEL_ERROR_PIPE: 92@G_CHANNEL_ERROR_SPIPE: 93@G_CHANNEL_ERROR_ENCODE_RW: 94@G_CHANNEL_ERROR_FAILED: 95 96<!-- ##### ENUM GChannelStatus ##### --> 97<para> 98 99</para> 100 101@G_CHANNEL_STATUS_NORMAL: 102@G_CHANNEL_STATUS_EOF: 103@G_CHANNEL_STATUS_PARTIAL_CHARS: 104@G_CHANNEL_STATUS_AGAIN: 105@G_CHANNEL_STATUS_INTR: 106@G_CHANNEL_STATUS_ERROR: 107@G_CHANNEL_STATUS_BAD_INPUT: 108 109<!-- ##### USER_FUNCTION GCompareFuncData ##### --> 110<para> 111 112</para> 113 114@a: 115@b: 116@user_data: 117@Returns: 118 119<!-- ##### USER_FUNCTION GCompletionStrcmpFunc ##### --> 120<para> 121 122</para> 123 124@s1: 125@s2: 126@Returns: 127 128<!-- ##### STRUCT GDesktopEntry ##### --> 129<para> 130 131</para> 132 133 134<!-- ##### ENUM GDesktopEntryError ##### --> 135<para> 136Error codes returned by desktop entry parsing. 137</para> 138 139@G_DESKTOP_ENTRY_ERROR_UNKNOWN_ENCODING: text being parsed is not UTF-8 and 140cannot be guessed. 141@G_DESKTOP_ENTRY_ERROR_BAD_START_GROUP: desktop entry does not start with a 142legal start group. 143@G_DESKTOP_ENTRY_ERROR_PARSE: desktop entry is empty or contains invalid 144data. 145@G_DESKTOP_ENTRY_ERROR_NOT_FOUND: valid desktop entry could not be found. 146@G_DESKTOP_ENTRY_ERROR_KEY_NOT_FOUND: desktop entry does not have requested 147key. 148@G_DESKTOP_ENTRY_ERROR_GROUP_NOT_FOUND: desktop entry does not have requested 149group 150@G_DESKTOP_ENTRY_ERROR_INVALID_VALUE: desktop entry contains key which has 151value that cannot be validated. 152 153<!-- ##### ENUM GDesktopEntryFlags ##### --> 154<para> 155#GDesktopEntry supports a few flags for tweaking performance during 156deserialization. #G_DESKTOP_ENTRY_DISCARD_COMMENTS and 157#G_DESKTOP_ENTRY_DISCARD_TRANSLATIONS will reduce memory footprint, 158and #G_DESKTOP_ENTRY_GENERATE_LOOKUP_MAP will increase key lookup speed. 159</para> 160 161@G_DESKTOP_ENTRY_NONE: use parser defaults 162@G_DESKTOP_ENTRY_DISCARD_COMMENTS: Discard all lines that are blank 163or start with "#". 164@G_DESKTOP_ENTRY_DISCARD_TRANSLATIONS: Only retain translations that 165are returned by g_get_language_names(). 166@G_DESKTOP_ENTRY_GENERATE_LOOKUP_MAP: Generate a lookup map for key names to make lookups constant time at the cost of more memory. 167 168<!-- ##### USER_FUNCTION GErrorFunc ##### --> 169<para> 170Specifies the type of function passed to g_set_error_handler(). 171</para> 172 173@str: the error message. 174 175<!-- ##### USER_FUNCTION GHookFreeFunc ##### --> 176<para> 177 178</para> 179 180@hook_list: 181@hook: 182 183<!-- ##### ENUM GIOFileMode ##### --> 184<para> 185 186</para> 187 188@G_IO_FILE_MODE_READ: 189@G_IO_FILE_MODE_WRITE: 190@G_IO_FILE_MODE_APPEND: 191@G_IO_FILE_MODE_READ_WRITE: 192@G_IO_FILE_MODE_READ_WRITE_TRUNCATE: 193@G_IO_FILE_MODE_READ_WRITE_APPEND: 194 195<!-- ##### ENUM GMatchType ##### --> 196<para> 197Enumeration representing different kinds of patterns. This is only used 198internally for optimizing the match algorithm. 199</para> 200 201@G_MATCH_ALL: a general pattern. 202@G_MATCH_ALL_TAIL: a general pattern which contains a fixed part matching 203the end of the string. 204@G_MATCH_HEAD: a pattern matching every string with a certain prefix. 205@G_MATCH_TAIL: a pattern matching every string with a certain suffix. 206@G_MATCH_EXACT: a pattern matching exactly one string. 207@G_MATCH_LAST: 208 209<!-- ##### USER_FUNCTION GWarningFunc ##### --> 210<para> 211Specifies the type of function passed to g_set_warning_handler(). 212</para> 213 214@str: the warning message. 215 216<!-- ##### MACRO G_CHANNEL_ERROR ##### --> 217<para> 218 219</para> 220 221 222<!-- ##### MACRO G_DESKTOP_ENTRY_ERROR ##### --> 223<para> 224Error domain for desktop entry parsing. Errors in this domain will 225be from the #GDesktopEntryError enumeration. See #GError for information on 226error domains. 227</para> 228 229 230<!-- ##### MACRO G_HOOK_DEFERRED_DESTROY ##### --> 231<para> 232 233</para> 234 235 236<!-- ##### MACRO G_IO_CHANNEL_DEFAULT_LINE_TERM ##### --> 237<para> 238One of %G_IO_CHANNEL_UNIX_LINE_TERM, %G_IO_CHANNEL_DOS_LINE_TERM, 239or %G_IO_CHANNEL_MACINTOSH_LINE_TERM (unimplemented) 240depending on the system type. 241</para> 242 243 244<!-- ##### MACRO G_IO_CHANNEL_DOS_LINE_TERM ##### --> 245<para> 246 247</para> 248 249 250<!-- ##### MACRO G_IO_CHANNEL_ENCODE_RAW ##### --> 251<para> 252Encoding for nonbuffered IO. With this encoding, data must be 253read using g_io_channel_read_chars(); the other functions will 254not work. 255</para> 256 257 258<!-- ##### MACRO G_IO_CHANNEL_MACINTOSH_LINE_TERM ##### --> 259<para> 260 261</para> 262 263 264<!-- ##### MACRO G_IO_CHANNEL_UNIX_LINE_TERM ##### --> 265<para> 266 267</para> 268 269 270<!-- ##### MACRO NAME_MAX ##### --> 271<para> 272Provided for UNIX emulation on Windows; equivalent to UNIX macro 273%NAME_MAX, which is the maximum length of a single path component. 274i.e. just the <filename>foo</filename> in <filename>/usr/bin/foo</filename>. 275</para> 276 277 278<!-- ##### MACRO _ ##### --> 279<para> 280Marks a string for translation, gets replaced with the translated string 281at runtime. 282</para> 283 284@String: the string to be translated 285@Since: 2.4 286 287<!-- ##### MACRO access ##### --> 288<para> 289 290</para> 291 292 293<!-- ##### MACRO close ##### --> 294<para> 295 296</para> 297 298 299<!-- ##### FUNCTION closedir ##### --> 300<para> 301Provided for UNIX emulation on Windows; see documentation for <function>closedir()</function> 302in any UNIX manual. 303</para> 304 305@Param1: 306@Returns: 307 308<!-- ##### MACRO fdopen ##### --> 309<para> 310 311</para> 312 313 314<!-- ##### MACRO ftruncate ##### --> 315<para> 316Provided for UNIX emulation on Windows; see documentation for ftruncate() 317in any UNIX manual. 318</para> 319 320@fd: 321@size: 322 323<!-- ##### FUNCTION g_channel_error_from_errno ##### --> 324<para> 325 326</para> 327 328@en: 329@Returns: 330 331<!-- ##### FUNCTION g_channel_error_quark ##### --> 332<para> 333 334</para> 335 336@Returns: 337 338<!-- ##### FUNCTION g_convert_error_quark ##### --> 339<para> 340 341</para> 342 343@Returns: 344 345<!-- ##### FUNCTION g_desktop_entry_escape_strings ##### --> 346<para> 347 348</para> 349 350@entry: 351@should_escape: 352 353<!-- ##### FUNCTION g_desktop_entry_free ##### --> 354<para> 355 356</para> 357 358@entry: 359 360<!-- ##### FUNCTION g_desktop_entry_get_boolean ##### --> 361<para> 362 363</para> 364 365@entry: 366@group_name: 367@key: 368@error: 369@Returns: 370 371<!-- ##### FUNCTION g_desktop_entry_get_boolean_list ##### --> 372<para> 373 374</para> 375 376@entry: 377@group_name: 378@key: 379@length: 380@error: 381@Returns: 382 383<!-- ##### FUNCTION g_desktop_entry_get_groups ##### --> 384<para> 385 386</para> 387 388@entry: 389@length: 390@Returns: 391 392<!-- ##### FUNCTION g_desktop_entry_get_integer ##### --> 393<para> 394 395</para> 396 397@entry: 398@group_name: 399@key: 400@error: 401@Returns: 402 403<!-- ##### FUNCTION g_desktop_entry_get_integer_list ##### --> 404<para> 405 406</para> 407 408@entry: 409@group_name: 410@key: 411@length: 412@error: 413@Returns: 414 415<!-- ##### FUNCTION g_desktop_entry_get_keys ##### --> 416<para> 417 418</para> 419 420@entry: 421@group_name: 422@length: 423@error: 424@Returns: 425 426<!-- ##### FUNCTION g_desktop_entry_get_locale_string ##### --> 427<para> 428 429</para> 430 431@entry: 432@group_name: 433@key: 434@locale: 435@error: 436@Returns: 437 438<!-- ##### FUNCTION g_desktop_entry_get_locale_string_list ##### --> 439<para> 440 441</para> 442 443@entry: 444@group_name: 445@key: 446@locale: 447@length: 448@error: 449@Returns: 450 451<!-- ##### FUNCTION g_desktop_entry_get_start_group ##### --> 452<para> 453 454</para> 455 456@entry: 457@Returns: 458 459<!-- ##### FUNCTION g_desktop_entry_get_string ##### --> 460<para> 461 462</para> 463 464@entry: 465@group_name: 466@key: 467@error: 468@Returns: 469 470<!-- ##### FUNCTION g_desktop_entry_get_string_list ##### --> 471<para> 472 473</para> 474 475@entry: 476@group_name: 477@key: 478@length: 479@error: 480@Returns: 481 482<!-- ##### FUNCTION g_desktop_entry_has_group ##### --> 483<para> 484 485</para> 486 487@entry: 488@group_name: 489@Returns: 490 491<!-- ##### FUNCTION g_desktop_entry_has_key ##### --> 492<para> 493 494</para> 495 496@entry: 497@group_name: 498@key: 499@error: 500@Returns: 501 502<!-- ##### FUNCTION g_desktop_entry_new ##### --> 503<para> 504 505</para> 506 507@flags: 508@error: 509@Returns: 510 511<!-- ##### FUNCTION g_desktop_entry_new_from_data ##### --> 512<para> 513 514</para> 515 516@data: 517@length: 518@legal_start_groups: 519@flags: 520@error: 521@Returns: 522 523<!-- ##### FUNCTION g_desktop_entry_new_from_data_dirs ##### --> 524<para> 525 526</para> 527 528@file: 529@full_path: 530@legal_start_groups: 531@flags: 532@error: 533@Returns: 534 535<!-- ##### FUNCTION g_desktop_entry_new_from_file ##### --> 536<para> 537 538</para> 539 540@file: 541@legal_start_groups: 542@flags: 543@error: 544@Returns: 545 546<!-- ##### FUNCTION g_desktop_entry_remove_group ##### --> 547<para> 548 549</para> 550 551@entry: 552@group_name: 553@error: 554 555<!-- ##### FUNCTION g_desktop_entry_remove_key ##### --> 556<para> 557 558</para> 559 560@entry: 561@group_name: 562@key: 563@error: 564 565<!-- ##### FUNCTION g_desktop_entry_set_boolean ##### --> 566<para> 567 568</para> 569 570@entry: 571@group_name: 572@key: 573@boolean: 574@error: 575 576<!-- ##### FUNCTION g_desktop_entry_set_boolean_list ##### --> 577<para> 578 579</para> 580 581@entry: 582@group_name: 583@key: 584@list: 585@length: 586@error: 587 588<!-- ##### FUNCTION g_desktop_entry_set_integer ##### --> 589<para> 590 591</para> 592 593@entry: 594@group_name: 595@key: 596@integer: 597@error: 598 599<!-- ##### FUNCTION g_desktop_entry_set_integer_list ##### --> 600<para> 601 602</para> 603 604@entry: 605@group_name: 606@key: 607@list: 608@length: 609@error: 610 611<!-- ##### FUNCTION g_desktop_entry_set_locale_string ##### --> 612<para> 613 614</para> 615 616@entry: 617@group_name: 618@key: 619@locale: 620@string: 621@error: 622 623<!-- ##### FUNCTION g_desktop_entry_set_locale_string_list ##### --> 624<para> 625 626</para> 627 628@entry: 629@group_name: 630@key: 631@locale: 632@list: 633@length: 634@error: 635 636<!-- ##### FUNCTION g_desktop_entry_set_string ##### --> 637<para> 638 639</para> 640 641@entry: 642@group_name: 643@key: 644@string: 645@error: 646 647<!-- ##### FUNCTION g_desktop_entry_set_string_list ##### --> 648<para> 649 650</para> 651 652@entry: 653@group_name: 654@key: 655@list: 656@length: 657@error: 658 659<!-- ##### FUNCTION g_desktop_entry_to_data ##### --> 660<para> 661 662</para> 663 664@entry: 665@length: 666@error: 667@Returns: 668 669<!-- ##### FUNCTION g_file_replace ##### --> 670<para> 671 672</para> 673 674@filename: 675@contents: 676@length: 677@error: 678@Returns: 679 680<!-- ##### FUNCTION g_format_file_size_for_display ##### --> 681<para> 682 683</para> 684 685@size: 686@Returns: 687 688<!-- ##### FUNCTION g_io_channel_error_quark ##### --> 689<para> 690 691</para> 692 693@Returns: 694 695<!-- ##### VARIABLE g_log_domain_glib ##### --> 696<para> 697The log domain used for messages logged by GLib itself. 698</para> 699 700 701<!-- ##### FUNCTION g_main_add_poll ##### --> 702<para> 703Adds a file descriptor to be polled. 704This is usually combined with g_source_add() to add an event source. 705The event source's check function will typically test the revents 706field in the #GPollFD struct and return TRUE if events need to be processed. 707</para> 708 709@fd: a #GPollFD, which is a file descriptor together with a bitwise 710combination of #GIOCondition flags determining which events to poll for. 711@priority: the priority of the poll, which should be the same as the priority 712used for g_source_add() to ensure that the file descriptor is polled whenever 713the results may be needed. 714See #G_PRIORITY_DEFAULT, #G_PRIORITY_DEFAULT_IDLE, #G_PRIORITY_HIGH, 715#G_PRIORITY_HIGH_IDLE, and #G_PRIORITY_LOW. 716 717<!-- ##### FUNCTION g_main_context_get ##### --> 718<para> 719 720</para> 721 722@thread: 723@Returns: 724 725<!-- ##### FUNCTION g_main_loop_destroy ##### --> 726<para> 727 728</para> 729 730@loop: 731 732<!-- ##### FUNCTION g_main_remove_poll ##### --> 733<para> 734Removes a file descriptor from the list being polled. 735</para> 736 737@fd: the #GPollFD to remove. 738 739<!-- ##### FUNCTION g_main_win32_get_poll_func ##### --> 740<para> 741 742</para> 743 744@Returns: 745 746<!-- ##### FUNCTION g_mem_check ##### --> 747<para> 748Checks if the given memory has already been freed. If it has it outputs 749a warning message. 750To use this function you must configure glib with the flag 751'--enable-mem-check=yes' before compiling. 752</para> 753 754@mem: the memory to check. 755 756<!-- ##### FUNCTION g_regex_error_quark ##### --> 757<para> 758 759</para> 760 761@Returns: 762 763<!-- ##### FUNCTION g_regex_free ##### --> 764<para> 765 766</para> 767 768@regex: 769 770<!-- ##### FUNCTION g_scanner_stat_mode ##### --> 771<para> 772Gets the file attributes. 773This is the <structfield>st_mode</structfield> field from the 774<structname>stat</structname> structure. See the <function>stat()</function> 775documentation. 776</para> 777 778@filename: the file name. 779@Returns: the file attributes. 780 781<!-- ##### FUNCTION g_set_error_handler ##### --> 782<para> 783Sets the function to be called to handle error messages. 784This function is deprecated in favour of the new logging facilities. 785</para> 786 787@func: the function to be called to handle error messages. 788@Returns: the old error handler. 789 790<!-- ##### FUNCTION g_set_message_handler ##### --> 791<para> 792Sets the function to be called to handle messages. 793This function is deprecated in favour of the new logging facilities. 794</para> 795 796@func: the function to be called to handle normal messages. 797@Returns: the old message handler. 798 799<!-- ##### FUNCTION g_set_warning_handler ##### --> 800<para> 801Sets the function to be called to handle warning messages. 802This function is deprecated in favour of the new logging facilities. 803</para> 804 805@func: the function to be called to handle warning messages. 806@Returns: the old warning handler. 807 808<!-- ##### FUNCTION g_source_add ##### --> 809<para> 810</para> 811 812@priority: 813@can_recurse: 814@funcs: 815@source_data: 816@user_data: 817@notify: 818@Returns: 819@source: 820@context: 821 822<!-- ##### FUNCTION g_source_connect ##### --> 823<para> 824 825</para> 826 827@source: 828@func: 829@data: 830@notify: 831 832<!-- ##### FUNCTION g_source_connect_indirect ##### --> 833<para> 834 835</para> 836 837@source: 838@callback_data: 839@callback_funcs: 840 841<!-- ##### FUNCTION g_source_remove_by_source_data ##### --> 842<para> 843Removes the first event source found with the given source data. 844</para> 845<para> 846Event sources are sorted with the highest priority first. Sources with equal 847priority are stored in the order in which they were added. 848</para> 849 850@source_data: the source data, which contains information specific to the 851type of source. 852@Returns: TRUE if an event source was found and removed. 853 854<!-- ##### FUNCTION g_static_private_get_for_thread ##### --> 855<para> 856 857</para> 858 859@private_key: 860@thread: 861@Returns: 862 863<!-- ##### FUNCTION g_static_private_set_for_thread ##### --> 864<para> 865 866</para> 867 868@private_key: 869@thread: 870@data: 871@notify: 872 873<!-- ##### MACRO g_string ##### --> 874<para> 875Turns the argument into a string literal by using the '#' stringizing operator. 876</para> 877 878@x: text to convert to a literal string. 879 880<!-- ##### FUNCTION g_warn_message ##### --> 881<para> 882 883</para> 884 885@domain: 886@file: 887@line: 888@func: 889@warnexpr: 890 891<!-- ##### MACRO getcwd ##### --> 892<para> 893 894</para> 895 896 897<!-- ##### MACRO getpid ##### --> 898<para> 899 900</para> 901 902 903<!-- ##### MACRO lseek ##### --> 904<para> 905 906</para> 907 908 909<!-- ##### MACRO open ##### --> 910<para> 911 912</para> 913 914 915<!-- ##### FUNCTION opendir ##### --> 916<para> 917Provided for UNIX emulation on Windows; see documentation for <function>opendir()</function> 918in any UNIX manual. 919</para> 920 921@Param1: 922@Returns: 923 924<!-- ##### MACRO pclose ##### --> 925<para> 926 927</para> 928 929 930<!-- ##### MACRO pipe ##### --> 931<para> 932Provided for UNIX emulation on Windows; see documentation for pipe() 933in any UNIX manual. 934</para> 935 936@phandles: file descriptors, the first one for reading, the second one for writing. 937 938<!-- ##### MACRO popen ##### --> 939<para> 940 941</para> 942 943 944<!-- ##### MACRO read ##### --> 945<para> 946 947</para> 948 949 950<!-- ##### MACRO readdir ##### --> 951<para> 952Provided for UNIX emulation on Windows; see documentation for <function>readdir()</function> 953in any UNIX manual. 954</para> 955 956 957<!-- ##### FUNCTION rewinddir ##### --> 958<para> 959Provided for UNIX emulation on Windows; see documentation for <function>rewinddir()</function> 960in any UNIX manual. 961</para> 962 963@Param1: 964 965<!-- ##### MACRO write ##### --> 966<para> 967 968</para> 969 970 971