libxfce4util Reference Manual |
---|
XfceDesktopEntry — A GObject that wraps a .desktop file.
#include <libxfce4util/libxfce4util.h> struct XfceDesktopEntry; XfceDesktopEntry* xfce_desktop_entry_new (const char *file, const char **categories, int num_categories); gboolean xfce_desktop_entry_parse (XfceDesktopEntry *desktop_entry); char* xfce_desktop_entry_get_file (XfceDesktopEntry *desktop_entry); gboolean xfce_desktop_entry_get_string (XfceDesktopEntry *desktop_entry, const char *key, gboolean translated, char **value); gboolean xfce_desktop_entry_get_int (XfceDesktopEntry *desktop_entry, const char *key, int *value);
XfceDesktopEntry is a wrapper for a so-called desktop entry file. The desktop entry format is defined on Freedesktop.org.
struct 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 char *file, const char **categories, int num_categories);
Create a new XfceDesktopEntry object.
file : | full path to the desktop entry file to use. |
categories : | array of categories, not necessarily NULL terminated. |
num_categories : | number of items in categories. |
Returns : | newly created XfceDesktopEntry or NULL if something goes wrong. |
gboolean xfce_desktop_entry_parse (XfceDesktopEntry *desktop_entry);
Parses the desktop entry file and fills in the values for all categories.
desktop_entry : | an XfceDesktopEntry. |
Returns : | TRUE on success, FALSE on failure. |
char* xfce_desktop_entry_get_file (XfceDesktopEntry *desktop_entry);
Obtain the path to the desktop entry file associated with the XfceDesktopEntry.
desktop_entry : | 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. |
gboolean xfce_desktop_entry_get_string (XfceDesktopEntry *desktop_entry, const char *key, gboolean translated, char **value);
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.
desktop_entry : | an XfceDesktopEntry |
key : | category to find value for. |
translated : | set to TRUE if the translated value is preferred. |
value : | location for the value, which will be newly allocated. |
Returns : | TRUE on success, FALSE on failure. value must be freed. |
gboolean xfce_desktop_entry_get_int (XfceDesktopEntry *desktop_entry, const char *key, int *value);
Gets a value from desktop_entry as integer. Therefore finds the value for key and returns its integer representation.
desktop_entry : | an XfceDesktopEntry. |
key : | category to find value for. |
value : | location for the value. |
Returns : | TRUE on success, FALSE on failure. |
<< XDG Base Directory support |