![]() |
![]() |
![]() |
libxfce4util Reference Manual | ![]() |
---|---|---|---|---|
#include <libxfce4util/libxfce4util.h> XfceDesktopEntry; XfceDesktopEntry* xfce_desktop_entry_new (const gchar *file, const gchar **categories, gint num_categories); XfceDesktopEntry* xfce_desktop_entry_new_from_data (const gchar *data, const gchar **categories, gint num_categories); const gchar* xfce_desktop_entry_get_file (XfceDesktopEntry *desktop_entry); gboolean xfce_desktop_entry_get_string (XfceDesktopEntry *desktop_entry, const gchar *key, gboolean translated, gchar **value_return); gboolean xfce_desktop_entry_get_int (XfceDesktopEntry *desktop_entry, const gchar *key, gint *value_return); gboolean xfce_desktop_entry_has_translated_entry (XfceDesktopEntry *desktop_entry, const gchar *key);
XfceDesktopEntry is a wrapper for a so-called desktop entry file. The desktop entry format is defined on Freedesktop.org.
typedef struct _XfceDesktopEntry XfceDesktopEntry;
All the fields in the XfceDesktopEntry structure are private to the XfceDesktopEntry implementation and should never be accessed directly. Instead, you should use the functions listed below.
XfceDesktopEntry* xfce_desktop_entry_new (const gchar *file, const gchar **categories, gint num_categories);
Create a new XfceDesktopEntry object from a desktop entry stored in a file on disk.
The caller is responsible to free the returned object (if any) using
g_object_unref()
when no longer needed.
|
full path to the desktop entry file to use. |
|
array of categories, not necessarily NULL terminated. |
|
number of items in categories .
|
Returns : |
newly created XfceDesktopEntry or NULL if something goes wrong. |
Since 4.2
XfceDesktopEntry* xfce_desktop_entry_new_from_data (const gchar *data, const gchar **categories, gint num_categories);
Create a new XfceDesktopEntry object from a desktop entry stored in memory.
The caller is responsible to free the returned object (if any) using
g_object_unref()
when no longer needed.
|
pointer to the desktop entry inline data. |
|
array of categories, not necessarily NULL terminated. |
|
number of items in categories .
|
Returns : |
newly created XfceDesktopEntry or NULL if something goes wrong. |
Since 4.2
const gchar* xfce_desktop_entry_get_file (XfceDesktopEntry *desktop_entry);
Obtain the path to the desktop entry file associated with the XfceDesktopEntry.
|
an XfceDesktopEntry. |
Returns : |
path of the desktop entry file used to create desktop_entry . The
return value should be considered read-only and must not be freed
by the caller.
|
Since 4.2
gboolean xfce_desktop_entry_get_string (XfceDesktopEntry *desktop_entry, const gchar *key, gboolean translated, gchar **value_return);
Finds the value for key
. When translated
is TRUE the function will use
the translated value (using the current locale settings) if available or
the untranslated value if no translation can be found.
|
an XfceDesktopEntry |
|
category to find value for. |
|
set to TRUE if the translated value is preferred. |
|
location for the value, which will be newly allocated. |
Returns : |
TRUE on success, FALSE on failure. value_return must be freed.
|
Since 4.2
gboolean xfce_desktop_entry_get_int (XfceDesktopEntry *desktop_entry, const gchar *key, gint *value_return);
Gets a value from desktop_entry
as integer. Therefore finds the value for
key
and returns its integer representation.
|
an XfceDesktopEntry. |
|
category to find value for. |
|
location for the value. |
Returns : |
TRUE on success, FALSE on failure. |
Since 4.2
gboolean xfce_desktop_entry_has_translated_entry (XfceDesktopEntry *desktop_entry, const gchar *key);
Checks to see if desktop_entry
has a value for key
translated into
the current locale.
|
an XfceDesktopEntry. |
|
the key to check. |
Returns : |
TRUE if there is a translated key, FALSE otherwise.
|
Since 4.3