## PkDesktop PkDesktop — Find desktop metadata about a package |

## Synopsis

    #define             PK_DESKTOP_DEFAULT_DATABASE
    #define             PK_DESKTOP_DEFAULT_APPLICATION_DIR
                        PkDesktopPrivate;
                        PkDesktop;
                        PkDesktopClass;
    PkDesktop *         pk_desktop_new                      (void);
    void                pk_desktop_test                     (gpointer user_data);
    gboolean            pk_desktop_open_database            (PkDesktop *desktop,
                                                             GError **error);
    GPtrArray *         pk_desktop_get_files_for_package    (PkDesktop *desktop,
                                                             const gchar *package,
                                                             GError **error);
    GPtrArray *         pk_desktop_get_shown_for_package    (PkDesktop *desktop,
                                                             const gchar *package,
                                                             GError **error);
    gchar *             pk_desktop_get_package_for_file     (PkDesktop *desktop,
                                                             const gchar *filename,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----PkDesktop

## Description

Desktop metadata such as icon name and localised summary may be stored in a local sqlite cache, and this module allows applications to query this.

## Details

### PK_DESKTOP_DEFAULT_DATABASE

    #define PK_DESKTOP_DEFAULT_DATABASE		LOCALSTATEDIR "/lib/PackageKit/desktop-files.db"

The default location for the database

### PK_DESKTOP_DEFAULT_APPLICATION_DIR

    #define             PK_DESKTOP_DEFAULT_APPLICATION_DIR

The default location for the desktop files

### PkDesktopPrivate

    typedef struct _PkDesktopPrivate PkDesktopPrivate;

Private PkDesktop data

### PkDesktop

    typedef struct _PkDesktop PkDesktop;

### PkDesktopClass

    typedef struct {
    	GObjectClass parent_class;
    } PkDesktopClass;

### pk_desktop_new ()

    PkDesktop *         pk_desktop_new                      (void);

Returns : |

Since 0.5.3

### pk_desktop_test ()

    void                pk_desktop_test                     (gpointer user_data);

`user_data` : |

### pk_desktop_open_database ()

    gboolean            pk_desktop_open_database            (PkDesktop *desktop,
                                                             GError **error);

`desktop` : | a valid PkDesktop instance
`error` : |
Returns : | `TRUE` if opened correctly

Since 0.5.3

### pk_desktop_get_files_for_package ()

    GPtrArray *         pk_desktop_get_files_for_package    (PkDesktop *desktop,
                                                             const gchar *package,
                                                             GError **error);

Return all desktop files owned by a package, regardless if they are shown in the main menu or not.

`desktop` : | a valid PkDesktop instance
`package` : | the package name, e.g. "gnome-power-manager"
`error` : | a `GError` to put the error code and message in, or `NULL`
Returns : | string array of results, free with `g_ptr_array_unref()`. [transfer full]

Since 0.5.3

### pk_desktop_get_shown_for_package ()

    GPtrArray *         pk_desktop_get_shown_for_package    (PkDesktop *desktop,
                                                             const gchar *package,
                                                             GError **error);

Return all desktop files owned by a package that would be shown in a menu, i.e are an application

`desktop` : | a valid PkDesktop instance
`package` : | the package name, e.g. "gnome-power-manager"
`error` : | a `GError` to put the error code and message in, or `NULL`
Returns : | string array of results, free with `g_ptr_array_unref()`. [transfer full]

Since 0.5.3

### pk_desktop_get_package_for_file ()

    gchar *             pk_desktop_get_package_for_file     (PkDesktop *desktop,
                                                             const gchar *filename,
                                                             GError **error);

Returns the package name that owns the desktop file. Fast.

`desktop` : | a valid PkDesktop instance
`filename` : | a fully qualified filename
`error` : | a `GError` to put the error code and message in, or `NULL`
Returns : | package name, or `NULL`

Since 0.5.3