Index: docs/reference/glib/glib-sections.txt
===================================================================
RCS file: /cvs/gnome/glib/docs/reference/glib/glib-sections.txt,v
retrieving revision 1.144
diff -u -p -r1.144 glib-sections.txt
--- docs/reference/glib/glib-sections.txt	19 Apr 2006 02:59:37 -0000	1.144
+++ docs/reference/glib/glib-sections.txt	21 Apr 2006 17:30:49 -0000
@@ -1445,6 +1445,33 @@ GKeyFile
 G_KEY_FILE_ERROR
 GKeyFileError
 GKeyFileFlags
+
+<SUBSECTION>
+G_KEY_FILE_DESKTOP_GROUP
+GKeyFileDesktopType
+G_KEY_FILE_DESKTOP_KEY_TYPE
+G_KEY_FILE_DESKTOP_KEY_VERSION
+G_KEY_FILE_DESKTOP_KEY_ENCODING
+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_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_ACTIONS
+G_KEY_FILE_DESKTOP_KEY_MIME_TYPE
+G_KEY_FILE_DESKTOP_KEY_URL
+G_KEY_FILE_DESKTOP_KEY_CATEGORIES
+G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN
+G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN
+G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY
+G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS
+
+<SUBSECTION>
 g_key_file_new
 g_key_file_free
 g_key_file_set_list_separator
@@ -1470,6 +1497,7 @@ g_key_file_get_locale_string_list
 g_key_file_get_boolean_list
 g_key_file_get_integer_list
 g_key_file_get_double_list
+g_key_file_desktop_get_entry_type
 g_key_file_get_comment
 
 <SUBSECTION>
@@ -1484,6 +1512,7 @@ g_key_file_set_locale_string_list
 g_key_file_set_boolean_list
 g_key_file_set_integer_list
 g_key_file_set_double_list
+g_key_file_desktop_set_entry_type
 g_key_file_set_comment
 g_key_file_remove_group
 g_key_file_remove_key
Index: docs/reference/glib/tmpl/keyfile.sgml
===================================================================
RCS file: /cvs/gnome/glib/docs/reference/glib/tmpl/keyfile.sgml,v
retrieving revision 1.5
diff -u -p -r1.5 keyfile.sgml
--- docs/reference/glib/tmpl/keyfile.sgml	5 May 2005 14:57:27 -0000	1.5
+++ docs/reference/glib/tmpl/keyfile.sgml	21 Apr 2006 17:30:49 -0000
@@ -141,6 +141,199 @@ Flags which influence the parsing.
   contents of the key file back to a file; otherwise only the translations for the current
   language will be written back.
 
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_GROUP ##### -->
+<para>
+Main group of a desktop entry file, as defined in the
+<ulink url="http://freedesktop.org/Standards/desktop-entry-spec">Desktop
+Entry Specification</ulink>.
+</para>
+
+
+
+<!-- ##### ENUM GKeyFileDesktopType ##### -->
+<para>
+Types of a desktop entry.
+</para>
+
+@G_KEY_FILE_DESKTOP_TYPE_NULL: there is no defined type in the desktop entry
+@G_KEY_FILE_DESKTOP_TYPE_OTHER: the desktop entry type is not one of the following type
+@G_KEY_FILE_DESKTOP_TYPE_APPLICATION: the desktop entry is for an Application
+@G_KEY_FILE_DESKTOP_TYPE_LINK: the desktop entry is for a Link
+@G_KEY_FILE_DESKTOP_TYPE_DIRECTORY: the desktop entry is for a Directory (this is used for menus)
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_TYPE ##### -->
+<para>
+Key defining the type of a desktop entry file. The value is a string.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_VERSION ##### -->
+<para>
+Key defining the version of the
+<ulink url="http://freedesktop.org/Standards/desktop-entry-spec">Desktop
+Entry Specification</ulink> used for the desktop entry file. The value is
+is a numerical value.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_ENCODING ##### -->
+<para>
+Key defining the encoding of the whole desktop entry file. The value is a
+string. #GKeyFile only supports UTF-8-encoded files, so if it is not 'UTF-8',
+the file should be parsed with another tool.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_NAME ##### -->
+<para>
+Key defining the specific name of the desktop entry. The value is a localized
+string.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME ##### -->
+<para>
+Key defining the generic name of the desktop entry. The value is a localized
+string.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY ##### -->
+<para>
+Key defining whether the desktop entry should be shown in menus. The value is a
+boolean.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_COMMENT ##### -->
+<para>
+Key defining the tooltip for the desktop entry. The value is a localized
+string.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_ICON ##### -->
+<para>
+Key defining the icon to be displayed for the desktop entry. The value is
+a localized string.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_HIDDEN ##### -->
+<para>
+Key defining whether the desktop entry has been by the user deleted. The value
+is a boolean.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_TRY_EXEC ##### -->
+<para>
+Key defining a 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
+Application type. The value is a string.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_EXEC ##### -->
+<para>
+Key defining the program to execute. It is only valid for desktop entries with
+the Application type. The value is a string.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_PATH ##### -->
+<para>
+Key defining the working directory to run the program in. It is only valid for
+desktop entries with the Application type. The value is a string.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_TERMINAL ##### -->
+<para>
+Key defining whether the program should be runned in a terminal window. It is
+only valid for desktop entries with the Application type. The value is a
+boolean.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_ACTIONS ##### -->
+<para>
+Key defining the list of possible additional actions. The value is a list of
+strings.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_MIME_TYPE ##### -->
+<para>
+Key defining the list of MIME type(s) supported by this desktop entry. The
+value is a list of strings.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_URL ##### -->
+<para>
+Key defining the URL to access. It is only valid for desktop entries with the
+Link type. The value is a string.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_CATEGORIES ##### -->
+<para>
+Key defining the categories in which the desktop entry should be shown in a
+menu. The value is a list of strings.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN ##### -->
+<para>
+Key identifying the environments that should display the desktop entry. The
+value is a list of strings.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN ##### -->
+<para>
+Key identifying the environments that should not display the desktop entry. The
+value is a list of strings.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY ##### -->
+<para>
+Key defining whether the application supports the
+<ulink url="http://www.freedesktop.org/Standards/startup-notification-spec">Startup
+Notification Protocol Specification</ulink>. The value is a boolean.
+</para>
+
+
+
+<!-- ##### MACRO G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS ##### -->
+<para>
+Key defining a WM class or a WM name hint that will be mapped to at least one
+window of the application. The value is a string.
+</para>
+
+
+
 <!-- ##### FUNCTION g_key_file_new ##### -->
 <para>
 
@@ -329,6 +522,18 @@ Flags which influence the parsing.
 @Returns: 
 
 
+<!-- ##### FUNCTION g_key_file_get_double ##### -->
+<para>
+
+</para>
+
+@key_file: 
+@group_name: 
+@key: 
+@error: 
+@Returns: 
+
+
 <!-- ##### FUNCTION g_key_file_get_string_list ##### -->
 <para>
 
@@ -382,6 +587,29 @@ Flags which influence the parsing.
 @Returns: 
 
 
+<!-- ##### FUNCTION g_key_file_get_double_list ##### -->
+<para>
+
+</para>
+
+@key_file: 
+@group_name: 
+@key: 
+@length: 
+@error: 
+@Returns: 
+
+
+<!-- ##### FUNCTION g_key_file_desktop_get_entry_type ##### -->
+<para>
+
+</para>
+
+@key_file: 
+@error: 
+@Returns: 
+
+
 <!-- ##### FUNCTION g_key_file_get_comment ##### -->
 <para>
 
@@ -437,8 +665,6 @@ Flags which influence the parsing.
 @group_name: 
 @key: 
 @value: 
-<!-- # Unused Parameters # -->
-@boolean: 
 
 
 <!-- ##### FUNCTION g_key_file_set_integer ##### -->
@@ -450,8 +676,17 @@ Flags which influence the parsing.
 @group_name: 
 @key: 
 @value: 
-<!-- # Unused Parameters # -->
-@integer: 
+
+
+<!-- ##### FUNCTION g_key_file_set_double ##### -->
+<para>
+
+</para>
+
+@key_file: 
+@group_name: 
+@key: 
+@value: 
 
 
 <!-- ##### FUNCTION g_key_file_set_string_list ##### -->
@@ -501,6 +736,27 @@ Flags which influence the parsing.
 @key: 
 @list: 
 @length: 
+
+
+<!-- ##### FUNCTION g_key_file_set_double_list ##### -->
+<para>
+
+</para>
+
+@key_file: 
+@group_name: 
+@key: 
+@list: 
+@length: 
+
+
+<!-- ##### FUNCTION g_key_file_desktop_set_entry_type ##### -->
+<para>
+
+</para>
+
+@key_file: 
+@type: 
 
 
 <!-- ##### FUNCTION g_key_file_set_comment ##### -->
Index: glib/gkeyfile.c
===================================================================
RCS file: /cvs/gnome/glib/glib/gkeyfile.c,v
retrieving revision 1.39
diff -u -p -r1.39 gkeyfile.c
--- glib/gkeyfile.c	19 Apr 2006 02:59:36 -0000	1.39
+++ glib/gkeyfile.c	21 Apr 2006 17:30:50 -0000
@@ -2336,7 +2336,7 @@ g_key_file_get_double_list  (GKeyFile   
  * @group_name.  If @key cannot be found then it is created.
  * If @group_name is %NULL the start group is used.
  *
- * Since: 2.21
+ * Since: 2.12
  **/
 void
 g_key_file_set_double_list (GKeyFile     *key_file,
@@ -2366,6 +2366,103 @@ g_key_file_set_double_list (GKeyFile    
 
   g_key_file_set_value (key_file, group_name, key, values->str);
   g_string_free (values, TRUE);
+}
+
+/**
+ * g_key_file_desktop_get_entry_type:
+ * @key_file: a #GKeyFile
+ * @error: return location for a #GError or %NULL
+ *
+ * Returns the type of a desktop entry, as defined in the Desktop
+ * Entry Specificaiton.
+ *
+ * If the type cannot be found then the return value is
+ * #G_KEY_FILE_DESKTOP_TYPE_NULL.
+ *
+ * Return value: the type of the desktop entry, as a #GKeyFileDesktopType
+ *
+ * Since: 2.12
+ **/
+GKeyFileDesktopType
+g_key_file_desktop_get_entry_type (GKeyFile  *key_file,
+                                   GError   **error)
+{
+  GError *key_file_error = NULL;
+  GKeyFileDesktopType retval;
+  char *type;
+
+  g_return_val_if_fail (key_file != NULL, G_KEY_FILE_DESKTOP_TYPE_NULL);
+
+  type = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
+                                G_KEY_FILE_DESKTOP_KEY_TYPE, &key_file_error);
+
+  if (key_file_error)
+    g_propagate_error (error, key_file_error);
+
+  if (!type)
+    return G_KEY_FILE_DESKTOP_TYPE_NULL;
+
+  retval = G_KEY_FILE_DESKTOP_TYPE_OTHER;
+
+  switch (type [0])
+    {
+      case 'A':
+        if (!strcmp (type, "Application"))
+          retval = G_KEY_FILE_DESKTOP_TYPE_APPLICATION;
+        break;
+      case 'D':
+        if (!strcmp (type, "Directory"))
+          retval = G_KEY_FILE_DESKTOP_TYPE_DIRECTORY;
+        break;
+      case 'L':
+        if (!strcmp (type, "Link"))
+          retval = G_KEY_FILE_DESKTOP_TYPE_LINK;
+        break;
+      default:
+        break;
+    }
+
+  g_free (type);
+
+  return retval;
+}
+
+/**
+ * g_key_file_desktop_set_entry_type:
+ * @key_file: a #GKeyFile
+ * @type: a #GKeyFileDesktopType
+ *
+ * Associates a type for the desktop entry. @type must be
+ * #G_KEY_FILE_DESKTOP_TYPE_APPLICATION, #G_KEY_FILE_DESKTOP_TYPE_LINK
+ * or #G_KEY_FILE_DESKTOP_TYPE_DIRECTORY. If the key type of the
+ * desktop entry cannot be found then it is created.
+ *
+ * Since: 2.12
+ **/
+void
+g_key_file_desktop_set_entry_type (GKeyFile            *key_file,
+                                   GKeyFileDesktopType  type)
+{
+  const char *type_str;
+
+  switch (type)
+  {
+    case G_KEY_FILE_DESKTOP_TYPE_APPLICATION:
+      type_str = "Application";
+      break;
+    case G_KEY_FILE_DESKTOP_TYPE_LINK:
+      type_str = "Link";
+      break;
+    case G_KEY_FILE_DESKTOP_TYPE_DIRECTORY:
+      type_str = "Directory";
+      break;
+    default:
+      return;
+      break;
+  }
+
+  g_key_file_set_value (key_file, G_KEY_FILE_DESKTOP_GROUP,
+                        G_KEY_FILE_DESKTOP_KEY_TYPE, type_str);
 }
 
 static void
Index: glib/gkeyfile.h
===================================================================
RCS file: /cvs/gnome/glib/glib/gkeyfile.h,v
retrieving revision 1.5
diff -u -p -r1.5 gkeyfile.h
--- glib/gkeyfile.h	19 Apr 2006 02:59:36 -0000	1.5
+++ glib/gkeyfile.h	21 Apr 2006 17:30:50 -0000
@@ -50,6 +50,39 @@ typedef enum
   G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1
 } GKeyFileFlags;
 
+#define G_KEY_FILE_DESKTOP_GROUP "Desktop Entry"
+
+typedef enum
+{
+  G_KEY_FILE_DESKTOP_TYPE_NULL = 0,
+  G_KEY_FILE_DESKTOP_TYPE_OTHER,
+  G_KEY_FILE_DESKTOP_TYPE_APPLICATION,
+  G_KEY_FILE_DESKTOP_TYPE_LINK,
+  G_KEY_FILE_DESKTOP_TYPE_DIRECTORY
+} GKeyFileDesktopType;
+
+#define G_KEY_FILE_DESKTOP_KEY_TYPE             "Type"
+#define G_KEY_FILE_DESKTOP_KEY_VERSION          "Version"
+#define G_KEY_FILE_DESKTOP_KEY_ENCODING         "Encoding"
+#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_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_ACTIONS          "Actions"
+#define G_KEY_FILE_DESKTOP_KEY_MIME_TYPE        "MimeType"
+#define G_KEY_FILE_DESKTOP_KEY_URL              "URL"
+#define G_KEY_FILE_DESKTOP_KEY_CATEGORIES       "Categories"
+#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_STARTUP_NOTIFY   "StartupNotify"
+#define G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS "StartupWMClass"
+
 GKeyFile *g_key_file_new                    (void);
 void      g_key_file_free                   (GKeyFile             *key_file);
 void      g_key_file_set_list_separator     (GKeyFile             *key_file,
@@ -195,6 +228,11 @@ gchar    *g_key_file_get_comment        
                                              const gchar          *group_name,
                                              const gchar          *key,
                                              GError              **error) G_GNUC_MALLOC;
+
+GKeyFileDesktopType g_key_file_desktop_get_entry_type (GKeyFile  *key_file,
+                                                       GError   **error);
+void g_key_file_desktop_set_entry_type     (GKeyFile            *key_file,
+                                            GKeyFileDesktopType  type);
 
 void      g_key_file_remove_comment         (GKeyFile             *key_file,
                                              const gchar          *group_name,
