CafeDesktopItem

CafeDesktopItem

Functions

CafeDesktopItem * cafe_desktop_item_new ()
CafeDesktopItem * cafe_desktop_item_new_from_file ()
CafeDesktopItem * cafe_desktop_item_new_from_uri ()
CafeDesktopItem * cafe_desktop_item_new_from_string ()
CafeDesktopItem * cafe_desktop_item_new_from_basename ()
CafeDesktopItem * cafe_desktop_item_copy ()
gboolean cafe_desktop_item_save ()
CafeDesktopItem * cafe_desktop_item_ref ()
void cafe_desktop_item_unref ()
int cafe_desktop_item_launch ()
int cafe_desktop_item_launch_with_env ()
int cafe_desktop_item_launch_on_screen ()
int cafe_desktop_item_drop_uri_list ()
int cafe_desktop_item_drop_uri_list_with_env ()
gboolean cafe_desktop_item_exists ()
CafeDesktopItemType cafe_desktop_item_get_entry_type ()
void cafe_desktop_item_set_entry_type ()
const char * cafe_desktop_item_get_location ()
void cafe_desktop_item_set_location ()
void cafe_desktop_item_set_location_file ()
CafeDesktopItemStatus cafe_desktop_item_get_file_status ()
char * cafe_desktop_item_get_icon ()
char * cafe_desktop_item_find_icon ()
gboolean cafe_desktop_item_attr_exists ()
const char * cafe_desktop_item_get_string ()
void cafe_desktop_item_set_string ()
const char * cafe_desktop_item_get_attr_locale ()
const char * cafe_desktop_item_get_localestring ()
const char * cafe_desktop_item_get_localestring_lang ()
GList * cafe_desktop_item_get_languages ()
void cafe_desktop_item_set_localestring ()
void cafe_desktop_item_set_localestring_lang ()
void cafe_desktop_item_clear_localestring ()
char ** cafe_desktop_item_get_strings ()
void cafe_desktop_item_set_strings ()
gboolean cafe_desktop_item_get_boolean ()
void cafe_desktop_item_set_boolean ()
void cafe_desktop_item_set_launch_time ()
#define cafe_desktop_item_clear_attr()
void cafe_desktop_item_clear_section ()

Types and Values

Object Hierarchy

    GBoxed
    ╰── CafeDesktopItem

Includes

#include <cafe-desktop-item.h>

Description

Functions

cafe_desktop_item_new ()

CafeDesktopItem *
cafe_desktop_item_new (void);

Creates a CafeDesktopItem object. The reference count on the returned value is set to '1'.

Returns

The new CafeDesktopItem


cafe_desktop_item_new_from_file ()

CafeDesktopItem *
cafe_desktop_item_new_from_file (const char *file,
                                 CafeDesktopItemLoadFlags flags,
                                 GError **error);

This function loads 'file' and turns it into a CafeDesktopItem.

Parameters

file

The filename or directory path to load the CafeDesktopItem from

 

flags

Flags to influence the loading process

 

Returns

The newly loaded item.


cafe_desktop_item_new_from_uri ()

CafeDesktopItem *
cafe_desktop_item_new_from_uri (const char *uri,
                                CafeDesktopItemLoadFlags flags,
                                GError **error);

This function loads 'uri' and turns it into a CafeDesktopItem.

Parameters

uri

URI to load the CafeDesktopItem from

 

flags

Flags to influence the loading process

 

Returns

The newly loaded item.


cafe_desktop_item_new_from_string ()

CafeDesktopItem *
cafe_desktop_item_new_from_string (const char *uri,
                                   const char *string,
                                   gssize length,
                                   CafeDesktopItemLoadFlags flags,
                                   GError **error);

This function turns the contents of the string into a CafeDesktopItem.

Parameters

string

string to load the CafeDesktopItem from

 

length

length of string, or -1 to use strlen

 

flags

Flags to influence the loading process

 

error

place to put errors

 

Returns

The newly loaded item.


cafe_desktop_item_new_from_basename ()

CafeDesktopItem *
cafe_desktop_item_new_from_basename (const char *basename,
                                     CafeDesktopItemLoadFlags flags,
                                     GError **error);

This function loads 'basename' from a system data directory and returns its CafeDesktopItem.

Parameters

basename

The basename of the CafeDesktopItem to load.

 

flags

Flags to influence the loading process

 

Returns

The newly loaded item.


cafe_desktop_item_copy ()

CafeDesktopItem *
cafe_desktop_item_copy (const CafeDesktopItem *item);

Creates a copy of a CafeDesktopItem. The new copy has a refcount of 1. Note: Section stack is NOT copied.

Parameters

item

The item to be copied

 

Returns

The new copy


cafe_desktop_item_save ()

gboolean
cafe_desktop_item_save (CafeDesktopItem *item,
                        const char *under,
                        gboolean force,
                        GError **error);

Writes the specified item to disk. If the 'under' is NULL, the original location is used. It sets the location of this entry to point to the new location.

Parameters

item

A desktop item

 

under

A new uri (location) for this CafeDesktopItem

 

force

Save even if it wasn't modified

 

error

GError return

 

Returns

boolean. TRUE if the file was saved, FALSE otherwise


cafe_desktop_item_ref ()

CafeDesktopItem *
cafe_desktop_item_ref (CafeDesktopItem *item);

Increases the reference count of the specified item.

Parameters

item

A desktop item

 

Returns

the newly referenced item


cafe_desktop_item_unref ()

void
cafe_desktop_item_unref (CafeDesktopItem *item);

Decreases the reference count of the specified item, and destroys the item if there are no more references left.

Parameters

item

A desktop item

 

cafe_desktop_item_launch ()

int
cafe_desktop_item_launch (const CafeDesktopItem *item,
                          GList *file_list,
                          CafeDesktopItemLaunchFlags flags,
                          GError **error);

This function runs the program listed in the specified 'item', optionally appending additional arguments to its command line. It uses g_shell_parse_argv to parse the the exec string into a vector which is then passed to g_spawn_async for execution. This can return all the errors from CafeURL, g_shell_parse_argv and g_spawn_async, in addition to it's own. The files are only added if the entry defines one of the standard % strings in it's Exec field.

Parameters

item

A desktop item

 

file_list

Files/URIs to launch this item with, can be NULL

 

flags

FIXME

 

error

FIXME

 

Returns

The the pid of the process spawned. If more then one process was spawned the last pid is returned. On error -1 is returned and error is set.


cafe_desktop_item_launch_with_env ()

int
cafe_desktop_item_launch_with_env (const CafeDesktopItem *item,
                                   GList *file_list,
                                   CafeDesktopItemLaunchFlags flags,
                                   char **envp,
                                   GError **error);

See cafe_desktop_item_launch for a full description. This function additionally passes an environment vector for the child process which is to be launched.

Parameters

item

A desktop item

 

file_list

Files/URIs to launch this item with, can be NULL

 

flags

FIXME

 

envp

child's environment, or NULL to inherit parent's

 

error

FIXME

 

Returns

The the pid of the process spawned. If more then one process was spawned the last pid is returned. On error -1 is returned and error is set.


cafe_desktop_item_launch_on_screen ()

int
cafe_desktop_item_launch_on_screen (const CafeDesktopItem *item,
                                    GList *file_list,
                                    CafeDesktopItemLaunchFlags flags,
                                    CdkScreen *screen,
                                    int workspace,
                                    GError **error);

See cafe_desktop_item_launch for a full description. This function additionally attempts to launch the application on a given screen and workspace.

Parameters

item

A desktop item

 

file_list

Files/URIs to launch this item with, can be NULL

 

flags

FIXME

 

screen

the CdkScreen on which the application should be launched

 

workspace

the workspace on which the app should be launched (-1 for current)

 

error

FIXME

 

Returns

The the pid of the process spawned. If more then one process was spawned the last pid is returned. On error -1 is returned and error is set.


cafe_desktop_item_drop_uri_list ()

int
cafe_desktop_item_drop_uri_list (const CafeDesktopItem *item,
                                 const char *uri_list,
                                 CafeDesktopItemLaunchFlags flags,
                                 GError **error);

A list of files or urls dropped onto an icon, the proper (Url or File) exec is run you can pass directly string that you got as the text/uri-list. This just parses the list and calls

Parameters

item

A desktop item

 

uri_list

text as gotten from a text/uri-list

 

flags

FIXME

 

error

FIXME

 

Returns

The value returned by cafe_execute_async() upon execution of the specified item or -1 on error. If multiple instances are run, the return of the last one is returned.


cafe_desktop_item_drop_uri_list_with_env ()

int
cafe_desktop_item_drop_uri_list_with_env
                               (const CafeDesktopItem *item,
                                const char *uri_list,
                                CafeDesktopItemLaunchFlags flags,
                                char **envp,
                                GError **error);

See cafe_desktop_item_drop_uri_list for a full description. This function additionally passes an environment vector for the child process which is to be launched.

Parameters

item

A desktop item

 

uri_list

text as gotten from a text/uri-list

 

flags

FIXME

 

envp

child's environment

 

error

FIXME

 

Returns

The value returned by cafe_execute_async() upon execution of the specified item or -1 on error. If multiple instances are run, the return of the last one is returned.


cafe_desktop_item_exists ()

gboolean
cafe_desktop_item_exists (const CafeDesktopItem *item);

Attempt to figure out if the program that can be executed by this item actually exists. First it tries the TryExec attribute to see if that contains a program that is in the path. Then if there is no such attribute, it tries the first word of the Exec attribute.

Parameters

item

A desktop item

 

Returns

A boolean, TRUE if it exists, FALSE otherwise.


cafe_desktop_item_get_entry_type ()

CafeDesktopItemType
cafe_desktop_item_get_entry_type (const CafeDesktopItem *item);

Gets the type attribute (the 'Type' field) of the item. This should usually be 'Application' for an application, but it can be 'Directory' for a directory description. There are other types available as well. The type usually indicates how the desktop item should be handeled and how the 'Exec' field should be handeled.

Parameters

item

A desktop item

 

Returns

The type of the specified 'item'. The returned memory remains owned by the CafeDesktopItem and should not be freed.


cafe_desktop_item_set_entry_type ()

void
cafe_desktop_item_set_entry_type (CafeDesktopItem *item,
                                  CafeDesktopItemType type);

cafe_desktop_item_get_location ()

const char *
cafe_desktop_item_get_location (const CafeDesktopItem *item);

Parameters

item

A desktop item

 

Returns

The file location associated with 'item'.


cafe_desktop_item_set_location ()

void
cafe_desktop_item_set_location (CafeDesktopItem *item,
                                const char *location);

Set's the 'location' uri of this item.

Parameters

item

A desktop item

 

location

A uri string specifying the file location of this particular item.

 

cafe_desktop_item_set_location_file ()

void
cafe_desktop_item_set_location_file (CafeDesktopItem *item,
                                     const char *file);

Set's the 'location' uri of this item to the given file .

Parameters

item

A desktop item

 

file

A local filename specifying the file location of this particular item.

 

cafe_desktop_item_get_file_status ()

CafeDesktopItemStatus
cafe_desktop_item_get_file_status (const CafeDesktopItem *item);

This function checks the modification time of the on-disk file to see if it is more recent than the in-memory data.

Parameters

item

A desktop item

 

Returns

An enum value that specifies whether the item has changed since being loaded.


cafe_desktop_item_get_icon ()

char *
cafe_desktop_item_get_icon (const CafeDesktopItem *item,
                            CtkIconTheme *icon_theme);

This function goes and looks for the icon file. If the icon is not set as an absolute filename, this will look for it in the standard places. If it can't find the icon, it will return NULL

Parameters

icon_theme

a CtkIconTheme

 

item

A desktop item

 

Returns

A newly allocated string


cafe_desktop_item_find_icon ()

char *
cafe_desktop_item_find_icon (CtkIconTheme *icon_theme,
                             const char *icon,
                             int desired_size,
                             int flags);

This function goes and looks for the icon file. If the icon is not an absolute filename, this will look for it in the standard places. If it can't find the icon, it will return NULL

Parameters

icon_theme

a CtkIconTheme

 

icon

icon name, something you'd get out of the Icon key

 

desired_size

FIXME

 

flags

FIXME

 

Returns

A newly allocated string


cafe_desktop_item_attr_exists ()

gboolean
cafe_desktop_item_attr_exists (const CafeDesktopItem *item,
                               const char *attr);

cafe_desktop_item_get_string ()

const char *
cafe_desktop_item_get_string (const CafeDesktopItem *item,
                              const char *attr);

cafe_desktop_item_set_string ()

void
cafe_desktop_item_set_string (CafeDesktopItem *item,
                              const char *attr,
                              const char *value);

cafe_desktop_item_get_attr_locale ()

const char *
cafe_desktop_item_get_attr_locale (const CafeDesktopItem *item,
                                   const char *attr);

cafe_desktop_item_get_localestring ()

const char *
cafe_desktop_item_get_localestring (const CafeDesktopItem *item,
                                    const char *attr);

cafe_desktop_item_get_localestring_lang ()

const char *
cafe_desktop_item_get_localestring_lang
                               (const CafeDesktopItem *item,
                                const char *attr,
                                const char *language);

cafe_desktop_item_get_languages ()

GList *
cafe_desktop_item_get_languages (const CafeDesktopItem *item,
                                 const char *attr);

cafe_desktop_item_set_localestring ()

void
cafe_desktop_item_set_localestring (CafeDesktopItem *item,
                                    const char *attr,
                                    const char *value);

cafe_desktop_item_set_localestring_lang ()

void
cafe_desktop_item_set_localestring_lang
                               (CafeDesktopItem *item,
                                const char *attr,
                                const char *language,
                                const char *value);

cafe_desktop_item_clear_localestring ()

void
cafe_desktop_item_clear_localestring (CafeDesktopItem *item,
                                      const char *attr);

cafe_desktop_item_get_strings ()

char **
cafe_desktop_item_get_strings (const CafeDesktopItem *item,
                               const char *attr);

cafe_desktop_item_set_strings ()

void
cafe_desktop_item_set_strings (CafeDesktopItem *item,
                               const char *attr,
                               char **strings);

cafe_desktop_item_get_boolean ()

gboolean
cafe_desktop_item_get_boolean (const CafeDesktopItem *item,
                               const char *attr);

cafe_desktop_item_set_boolean ()

void
cafe_desktop_item_set_boolean (CafeDesktopItem *item,
                               const char *attr,
                               gboolean value);

cafe_desktop_item_set_launch_time ()

void
cafe_desktop_item_set_launch_time (CafeDesktopItem *item,
                                   guint32 timestamp);

cafe_desktop_item_clear_attr()

#define             cafe_desktop_item_clear_attr(item,attr)

cafe_desktop_item_clear_section ()

void
cafe_desktop_item_clear_section (CafeDesktopItem *item,
                                 const char *section);

Types and Values

enum CafeDesktopItemType

Members

CAFE_DESKTOP_ITEM_TYPE_NULL

   

CAFE_DESKTOP_ITEM_TYPE_OTHER

   

CAFE_DESKTOP_ITEM_TYPE_APPLICATION

   

CAFE_DESKTOP_ITEM_TYPE_LINK

   

CAFE_DESKTOP_ITEM_TYPE_FSDEVICE

   

CAFE_DESKTOP_ITEM_TYPE_MIME_TYPE

   

CAFE_DESKTOP_ITEM_TYPE_DIRECTORY

   

CAFE_DESKTOP_ITEM_TYPE_SERVICE

   

CAFE_DESKTOP_ITEM_TYPE_SERVICE_TYPE

   

enum CafeDesktopItemStatus

Members

CAFE_DESKTOP_ITEM_UNCHANGED

   

CAFE_DESKTOP_ITEM_CHANGED

   

CAFE_DESKTOP_ITEM_DISAPPEARED

   

CafeDesktopItem

typedef struct _CafeDesktopItem CafeDesktopItem;

CAFE_DESKTOP_ITEM_ENCODING

#define CAFE_DESKTOP_ITEM_ENCODING "Encoding" /* string */

CAFE_DESKTOP_ITEM_VERSION

#define CAFE_DESKTOP_ITEM_VERSION "Version"  /* numeric */

CAFE_DESKTOP_ITEM_NAME

#define CAFE_DESKTOP_ITEM_NAME		"Name" /* localestring */

CAFE_DESKTOP_ITEM_GENERIC_NAME

#define CAFE_DESKTOP_ITEM_GENERIC_NAME "GenericName" /* localestring */

CAFE_DESKTOP_ITEM_TYPE

#define CAFE_DESKTOP_ITEM_TYPE		"Type" /* string */

CAFE_DESKTOP_ITEM_FILE_PATTERN

#define CAFE_DESKTOP_ITEM_FILE_PATTERN "FilePattern" /* regexp(s) */

CAFE_DESKTOP_ITEM_TRY_EXEC

#define CAFE_DESKTOP_ITEM_TRY_EXEC "TryExec" /* string */

CAFE_DESKTOP_ITEM_NO_DISPLAY

#define CAFE_DESKTOP_ITEM_NO_DISPLAY "NoDisplay" /* boolean */

CAFE_DESKTOP_ITEM_COMMENT

#define CAFE_DESKTOP_ITEM_COMMENT "Comment" /* localestring */

CAFE_DESKTOP_ITEM_EXEC

#define CAFE_DESKTOP_ITEM_EXEC		"Exec" /* string */

CAFE_DESKTOP_ITEM_ACTIONS

#define CAFE_DESKTOP_ITEM_ACTIONS "Actions" /* strings */

CAFE_DESKTOP_ITEM_ICON

#define CAFE_DESKTOP_ITEM_ICON		"Icon" /* string */

CAFE_DESKTOP_ITEM_MINI_ICON

#define CAFE_DESKTOP_ITEM_MINI_ICON "MiniIcon" /* string */

CAFE_DESKTOP_ITEM_HIDDEN

#define CAFE_DESKTOP_ITEM_HIDDEN "Hidden" /* boolean */

CAFE_DESKTOP_ITEM_PATH

#define CAFE_DESKTOP_ITEM_PATH		"Path" /* string */

CAFE_DESKTOP_ITEM_TERMINAL

#define CAFE_DESKTOP_ITEM_TERMINAL "Terminal" /* boolean */

CAFE_DESKTOP_ITEM_TERMINAL_OPTIONS

#define CAFE_DESKTOP_ITEM_TERMINAL_OPTIONS "TerminalOptions" /* string */

CAFE_DESKTOP_ITEM_SWALLOW_TITLE

#define CAFE_DESKTOP_ITEM_SWALLOW_TITLE "SwallowTitle" /* string */

CAFE_DESKTOP_ITEM_SWALLOW_EXEC

#define CAFE_DESKTOP_ITEM_SWALLOW_EXEC "SwallowExec" /* string */

CAFE_DESKTOP_ITEM_MIME_TYPE

#define CAFE_DESKTOP_ITEM_MIME_TYPE "MimeType" /* regexp(s) */

CAFE_DESKTOP_ITEM_PATTERNS

#define CAFE_DESKTOP_ITEM_PATTERNS "Patterns" /* regexp(s) */

CAFE_DESKTOP_ITEM_DEFAULT_APP

#define CAFE_DESKTOP_ITEM_DEFAULT_APP "DefaultApp" /* string */

CAFE_DESKTOP_ITEM_DEV

#define CAFE_DESKTOP_ITEM_DEV		"Dev" /* string */

CAFE_DESKTOP_ITEM_FS_TYPE

#define CAFE_DESKTOP_ITEM_FS_TYPE "FSType" /* string */

CAFE_DESKTOP_ITEM_MOUNT_POINT

#define CAFE_DESKTOP_ITEM_MOUNT_POINT "MountPoint" /* string */

CAFE_DESKTOP_ITEM_READ_ONLY

#define CAFE_DESKTOP_ITEM_READ_ONLY "ReadOnly" /* boolean */

CAFE_DESKTOP_ITEM_UNMOUNT_ICON

#define CAFE_DESKTOP_ITEM_UNMOUNT_ICON "UnmountIcon" /* string */

CAFE_DESKTOP_ITEM_SORT_ORDER

#define CAFE_DESKTOP_ITEM_SORT_ORDER "SortOrder" /* strings */

CAFE_DESKTOP_ITEM_URL

#define CAFE_DESKTOP_ITEM_URL		"URL" /* string */

CAFE_DESKTOP_ITEM_DOC_PATH

#define CAFE_DESKTOP_ITEM_DOC_PATH "X-CAFE-DocPath" /* string */

CAFE_DESKTOP_ITEM_CATEGORIES

#define CAFE_DESKTOP_ITEM_CATEGORIES "Categories" /* string */

CAFE_DESKTOP_ITEM_ONLY_SHOW_IN

#define CAFE_DESKTOP_ITEM_ONLY_SHOW_IN "OnlyShowIn" /* string */

enum CafeDesktopItemLoadFlags

Members

CAFE_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS

   

CAFE_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS

   

enum CafeDesktopItemLaunchFlags

Members

CAFE_DESKTOP_ITEM_LAUNCH_ONLY_ONE

   

CAFE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR

   

CAFE_DESKTOP_ITEM_LAUNCH_APPEND_URIS

   

CAFE_DESKTOP_ITEM_LAUNCH_APPEND_PATHS

   

CAFE_DESKTOP_ITEM_LAUNCH_DO_NOT_REAP_CHILD

   

enum CafeDesktopItemIconFlags

Members

CAFE_DESKTOP_ITEM_ICON_NO_KDE

   

enum CafeDesktopItemError

Members

CAFE_DESKTOP_ITEM_ERROR_NO_FILENAME

   

CAFE_DESKTOP_ITEM_ERROR_UNKNOWN_ENCODING

   

CAFE_DESKTOP_ITEM_ERROR_CANNOT_OPEN

   

CAFE_DESKTOP_ITEM_ERROR_NO_EXEC_STRING

   

CAFE_DESKTOP_ITEM_ERROR_BAD_EXEC_STRING

   

CAFE_DESKTOP_ITEM_ERROR_NO_URL

   

CAFE_DESKTOP_ITEM_ERROR_NOT_LAUNCHABLE

   

CAFE_DESKTOP_ITEM_ERROR_INVALID_TYPE

   

CAFE_DESKTOP_ITEM_ERROR

#define CAFE_DESKTOP_ITEM_ERROR cafe_desktop_item_error_quark ()