add defines for desktop file handling. #339225, original patch from

* glib/gkeyfile.h: add defines for desktop file handling. #339225,
	original patch from Vincent Untz.

svn path=/trunk/; revision=5521
This commit is contained in:
Dan Winship 2007-05-30 14:25:34 +00:00
parent 92ebd4eac0
commit 90320fba4f
5 changed files with 346 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2007-05-30 Dan Winship <danw@novell.com>
* glib/gkeyfile.h: add defines for desktop file handling. #339225,
original patch from Vincent Untz.
2007-05-29 Cody Russell <bratsche@gnome.org>
* configure.in: Fix a sed script that doesn't correctly detect

View File

@ -1,3 +1,8 @@
2007-05-30 Dan Winship <danw@novell.com>
* glib/glib-sections.txt:
* glib/tmpl/keyfile.sgml: add G_KEY_FILE_DESKTOP_* macros
2007-05-2626 Matthias Clasen <mclasen@redhat.com>
* gobject/tmpl/objects.sgml: Fix a typo

View File

@ -1501,6 +1501,8 @@ GKeyFile
G_KEY_FILE_ERROR
GKeyFileError
GKeyFileFlags
<SUBSECTION>
g_key_file_new
g_key_file_free
g_key_file_set_list_separator
@ -1545,6 +1547,31 @@ g_key_file_remove_group
g_key_file_remove_key
g_key_file_remove_comment
<SUBSECTION>
G_KEY_FILE_DESKTOP_GROUP
G_KEY_FILE_DESKTOP_KEY_TYPE
G_KEY_FILE_DESKTOP_KEY_VERSION
G_KEY_FILE_DESKTOP_KEY_NAME
G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME
G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY
G_KEY_FILE_DESKTOP_KEY_COMMENT
G_KEY_FILE_DESKTOP_KEY_ICON
G_KEY_FILE_DESKTOP_KEY_HIDDEN
G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN
G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN
G_KEY_FILE_DESKTOP_KEY_TRY_EXEC
G_KEY_FILE_DESKTOP_KEY_EXEC
G_KEY_FILE_DESKTOP_KEY_PATH
G_KEY_FILE_DESKTOP_KEY_TERMINAL
G_KEY_FILE_DESKTOP_KEY_MIME_TYPE
G_KEY_FILE_DESKTOP_KEY_CATEGORIES
G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY
G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS
G_KEY_FILE_DESKTOP_KEY_URL
G_KEY_FILE_DESKTOP_TYPE_APPLICATION
G_KEY_FILE_DESKTOP_TYPE_LINK
G_KEY_FILE_DESKTOP_TYPE_DIRECTORY
<SUBSECTION Private>
g_key_file_error_quark
</SECTION>

View File

@ -601,3 +601,285 @@ Flags which influence the parsing.
@error:
<!-- ##### MACRO G_KEY_FILE_DESKTOP_GROUP ##### -->
<para>
The name of the main group of a desktop entry file, as defined in the
<ulink url="http://freedesktop.org/Standards/desktop-entry-spec">Desktop
Entry Specification</ulink>. Consult the specification for more
details about the meanings of the keys below.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_TYPE ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a string giving the type of the desktop entry. Usually
<link linkend="G-KEY-FILE-DESKTOP-TYPE-APPLICATION:CAPS"><literal>G_KEY_FILE_DESKTOP_TYPE_APPLICATION</literal></link>,
<link linkend="G-KEY-FILE-DESKTOP-TYPE-LINK:CAPS"><literal>G_KEY_FILE_DESKTOP_TYPE_LINK</literal></link>, or
<link linkend="G-KEY-FILE-DESKTOP-TYPE-DIRECTORY:CAPS"><literal>G_KEY_FILE_DESKTOP_TYPE_DIRECTORY</literal></link>.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_VERSION ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a string giving the version of the Desktop
Entry Specification used for the desktop entry file.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_NAME ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a localized string giving the specific name of the
desktop entry.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a localized string giving the generic name of the
desktop entry.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a boolean stating whether the desktop entry should be
shown in menus.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_COMMENT ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a localized string giving the tooltip for the desktop
entry.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_ICON ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a localized string giving the name of the icon to be
displayed for the desktop entry.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_HIDDEN ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a boolean stating whether the desktop entry has been
deleted by the user.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a list of strings identifying the environments that
should display the desktop entry.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a list of strings identifying the environments that
should not display the desktop entry.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_TRY_EXEC ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a string giving the file name of a binary on disk
used to determine if the program is actually installed. It is only
valid for desktop entries with the <literal>Application</literal>
type.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_EXEC ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a string giving the command line to execute. It is only
valid for desktop entries with the <literal>Application</literal>
type.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_PATH ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a string containing the working directory to run the
program in. It is only valid for desktop entries with the
<literal>Application</literal> type.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_TERMINAL ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a boolean stating whether the program should be
run in a terminal window. It is only valid for desktop entries with
the <literal>Application</literal> type.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_MIME_TYPE ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a list of strings giving the MIME types supported
by this desktop entry.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_CATEGORIES ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a list of strings giving the categories in which the
desktop entry should be shown in a menu.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a boolean stating whether the application supports
the <ulink
url="http://www.freedesktop.org/Standards/startup-notification-spec">Startup
Notification Protocol Specification</ulink>.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is string identifying the WM class or name hint of a
window that the application will create, which can be used to emulate
Startup Notification with older applications.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_URL ##### -->
<para>
A key under <link
linkend="G-KEY-FILE-DESKTOP-GROUP:CAPS"><literal>G_KEY_FILE_DESKTOP_GROUP</literal></link>
whose value is a string giving the URL to access. It is only valid
for desktop entries with the <literal>Link</literal> type.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_TYPE_APPLICATION ##### -->
<para>
The value of the <link
linkend="G-KEY-FILE-DESKTOP-KEY-TYPE:CAPS"><literal>G_KEY_FILE_DESKTOP_KEY_TYPE</literal></link>
key for desktop entries representing applications.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_TYPE_LINK ##### -->
<para>
The value of the <link
linkend="G-KEY-FILE-DESKTOP-KEY-TYPE:CAPS"><literal>G_KEY_FILE_DESKTOP_KEY_TYPE</literal></link>
key for desktop entries representing links to documents.
</para>
@Since: 2.14
<!-- ##### MACRO G_KEY_FILE_DESKTOP_TYPE_DIRECTORY ##### -->
<para>
The value of the <link
linkend="G-KEY-FILE-DESKTOP-KEY-TYPE:CAPS"><literal>G_KEY_FILE_DESKTOP_KEY_TYPE</literal></link>
key for desktop entries representing directories.
</para>
@Since: 2.14

View File

@ -214,6 +214,33 @@ void g_key_file_remove_group (GKeyFile *key_file,
const gchar *group_name,
GError **error);
/* Defines for handling freedesktop.org Desktop files */
#define G_KEY_FILE_DESKTOP_GROUP "Desktop Entry"
#define G_KEY_FILE_DESKTOP_KEY_TYPE "Type"
#define G_KEY_FILE_DESKTOP_KEY_VERSION "Version"
#define G_KEY_FILE_DESKTOP_KEY_NAME "Name"
#define G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME "GenericName"
#define G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY "NoDisplay"
#define G_KEY_FILE_DESKTOP_KEY_COMMENT "Comment"
#define G_KEY_FILE_DESKTOP_KEY_ICON "Icon"
#define G_KEY_FILE_DESKTOP_KEY_HIDDEN "Hidden"
#define G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN "OnlyShowIn"
#define G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN "NotShowIn"
#define G_KEY_FILE_DESKTOP_KEY_TRY_EXEC "TryExec"
#define G_KEY_FILE_DESKTOP_KEY_EXEC "Exec"
#define G_KEY_FILE_DESKTOP_KEY_PATH "Path"
#define G_KEY_FILE_DESKTOP_KEY_TERMINAL "Terminal"
#define G_KEY_FILE_DESKTOP_KEY_MIME_TYPE "MimeType"
#define G_KEY_FILE_DESKTOP_KEY_CATEGORIES "Categories"
#define G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY "StartupNotify"
#define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass"
#define G_KEY_FILE_DESKTOP_KEY_URL "URL"
#define G_KEY_FILE_DESKTOP_TYPE_APPLICATION "Application"
#define G_KEY_FILE_DESKTOP_TYPE_LINK "Link"
#define G_KEY_FILE_DESKTOP_TYPE_DIRECTORY "Directory"
G_END_DECLS
#endif /* __G_KEY_FILE_H__ */