GNOME Desktop Library Reference Manual | ||||
---|---|---|---|---|
Top | Description |
Synopsis
#include <libgnome/gnome-desktop-item.h> enum GnomeDesktopItemType; enum GnomeDesktopItemStatus; GnomeDesktopItem; #define GNOME_DESKTOP_ITEM_ENCODING #define GNOME_DESKTOP_ITEM_VERSION #define GNOME_DESKTOP_ITEM_NAME #define GNOME_DESKTOP_ITEM_GENERIC_NAME #define GNOME_DESKTOP_ITEM_TYPE #define GNOME_DESKTOP_ITEM_FILE_PATTERN #define GNOME_DESKTOP_ITEM_TRY_EXEC #define GNOME_DESKTOP_ITEM_NO_DISPLAY #define GNOME_DESKTOP_ITEM_COMMENT #define GNOME_DESKTOP_ITEM_EXEC #define GNOME_DESKTOP_ITEM_ACTIONS #define GNOME_DESKTOP_ITEM_ICON #define GNOME_DESKTOP_ITEM_MINI_ICON #define GNOME_DESKTOP_ITEM_HIDDEN #define GNOME_DESKTOP_ITEM_PATH #define GNOME_DESKTOP_ITEM_TERMINAL #define GNOME_DESKTOP_ITEM_TERMINAL_OPTIONS #define GNOME_DESKTOP_ITEM_SWALLOW_TITLE #define GNOME_DESKTOP_ITEM_SWALLOW_EXEC #define GNOME_DESKTOP_ITEM_MIME_TYPE #define GNOME_DESKTOP_ITEM_PATTERNS #define GNOME_DESKTOP_ITEM_DEFAULT_APP #define GNOME_DESKTOP_ITEM_DEV #define GNOME_DESKTOP_ITEM_FS_TYPE #define GNOME_DESKTOP_ITEM_MOUNT_POINT #define GNOME_DESKTOP_ITEM_READ_ONLY #define GNOME_DESKTOP_ITEM_UNMOUNT_ICON #define GNOME_DESKTOP_ITEM_SORT_ORDER #define GNOME_DESKTOP_ITEM_URL #define GNOME_DESKTOP_ITEM_DOC_PATH #define GNOME_DESKTOP_ITEM_CATEGORIES #define GNOME_DESKTOP_ITEM_ONLY_SHOW_IN enum GnomeDesktopItemLoadFlags; enum GnomeDesktopItemLaunchFlags; enum GnomeDesktopItemIconFlags; enum GnomeDesktopItemError; #define GNOME_DESKTOP_ITEM_ERROR GnomeDesktopItem * gnome_desktop_item_new (void
); GnomeDesktopItem * gnome_desktop_item_new_from_file (const char *file
,GnomeDesktopItemLoadFlags flags
,GError **error
); GnomeDesktopItem * gnome_desktop_item_new_from_uri (const char *uri
,GnomeDesktopItemLoadFlags flags
,GError **error
); GnomeDesktopItem * gnome_desktop_item_new_from_string (const char *uri
,const char *string
,gssize length
,GnomeDesktopItemLoadFlags flags
,GError **error
); GnomeDesktopItem * gnome_desktop_item_new_from_basename (const char *basename
,GnomeDesktopItemLoadFlags flags
,GError **error
); GnomeDesktopItem * gnome_desktop_item_copy (const GnomeDesktopItem *item
); gboolean gnome_desktop_item_save (GnomeDesktopItem *item
,const char *under
,gboolean force
,GError **error
); GnomeDesktopItem * gnome_desktop_item_ref (GnomeDesktopItem *item
); void gnome_desktop_item_unref (GnomeDesktopItem *item
); int gnome_desktop_item_launch (const GnomeDesktopItem *item
,GList *file_list
,GnomeDesktopItemLaunchFlags flags
,GError **error
); int gnome_desktop_item_launch_with_env (const GnomeDesktopItem *item
,GList *file_list
,GnomeDesktopItemLaunchFlags flags
,char **envp
,GError **error
); int gnome_desktop_item_launch_on_screen (const GnomeDesktopItem *item
,GList *file_list
,GnomeDesktopItemLaunchFlags flags
,GdkScreen *screen
,int workspace
,GError **error
); int gnome_desktop_item_drop_uri_list (const GnomeDesktopItem *item
,const char *uri_list
,GnomeDesktopItemLaunchFlags flags
,GError **error
); int gnome_desktop_item_drop_uri_list_with_env (const GnomeDesktopItem *item
,const char *uri_list
,GnomeDesktopItemLaunchFlags flags
,char **envp
,GError **error
); gboolean gnome_desktop_item_exists (const GnomeDesktopItem *item
); GnomeDesktopItemType gnome_desktop_item_get_entry_type (const GnomeDesktopItem *item
); void gnome_desktop_item_set_entry_type (GnomeDesktopItem *item
,GnomeDesktopItemType type
); const char * gnome_desktop_item_get_location (const GnomeDesktopItem *item
); void gnome_desktop_item_set_location (GnomeDesktopItem *item
,const char *location
); void gnome_desktop_item_set_location_file (GnomeDesktopItem *item
,const char *file
); GnomeDesktopItemStatus gnome_desktop_item_get_file_status (const GnomeDesktopItem *item
); char * gnome_desktop_item_get_icon (const GnomeDesktopItem *item
,GtkIconTheme *icon_theme
); char * gnome_desktop_item_find_icon (GtkIconTheme *icon_theme
,const char *icon
,int desired_size
,int flags
); gboolean gnome_desktop_item_attr_exists (const GnomeDesktopItem *item
,const char *attr
); const char * gnome_desktop_item_get_string (const GnomeDesktopItem *item
,const char *attr
); void gnome_desktop_item_set_string (GnomeDesktopItem *item
,const char *attr
,const char *value
); const char * gnome_desktop_item_get_attr_locale (const GnomeDesktopItem *item
,const char *attr
); const char * gnome_desktop_item_get_localestring (const GnomeDesktopItem *item
,const char *attr
); const char * gnome_desktop_item_get_localestring_lang (const GnomeDesktopItem *item
,const char *attr
,const char *language
); GList * gnome_desktop_item_get_languages (const GnomeDesktopItem *item
,const char *attr
); void gnome_desktop_item_set_localestring (GnomeDesktopItem *item
,const char *attr
,const char *value
); void gnome_desktop_item_set_localestring_lang (GnomeDesktopItem *item
,const char *attr
,const char *language
,const char *value
); void gnome_desktop_item_clear_localestring (GnomeDesktopItem *item
,const char *attr
); char ** gnome_desktop_item_get_strings (const GnomeDesktopItem *item
,const char *attr
); void gnome_desktop_item_set_strings (GnomeDesktopItem *item
,const char *attr
,char **strings
); gboolean gnome_desktop_item_get_boolean (const GnomeDesktopItem *item
,const char *attr
); void gnome_desktop_item_set_boolean (GnomeDesktopItem *item
,const char *attr
,gboolean value
); void gnome_desktop_item_set_launch_time (GnomeDesktopItem *item
,guint32 timestamp
); #define gnome_desktop_item_clear_attr (item, attr) void gnome_desktop_item_clear_section (GnomeDesktopItem *item
,const char *section
);
Details
enum GnomeDesktopItemType
typedef enum { GNOME_DESKTOP_ITEM_TYPE_NULL = 0 /* This means its NULL, that is, not * set */, GNOME_DESKTOP_ITEM_TYPE_OTHER /* This means it's not one of the below strings types, and you must get the Type attribute. */, /* These are the standard compliant types: */ GNOME_DESKTOP_ITEM_TYPE_APPLICATION, GNOME_DESKTOP_ITEM_TYPE_LINK, GNOME_DESKTOP_ITEM_TYPE_FSDEVICE, GNOME_DESKTOP_ITEM_TYPE_MIME_TYPE, GNOME_DESKTOP_ITEM_TYPE_DIRECTORY, GNOME_DESKTOP_ITEM_TYPE_SERVICE, GNOME_DESKTOP_ITEM_TYPE_SERVICE_TYPE } GnomeDesktopItemType;
enum GnomeDesktopItemStatus
typedef enum { GNOME_DESKTOP_ITEM_UNCHANGED = 0, GNOME_DESKTOP_ITEM_CHANGED = 1, GNOME_DESKTOP_ITEM_DISAPPEARED = 2 } GnomeDesktopItemStatus;
GNOME_DESKTOP_ITEM_GENERIC_NAME
#define GNOME_DESKTOP_ITEM_GENERIC_NAME "GenericName" /* localestring */
GNOME_DESKTOP_ITEM_FILE_PATTERN
#define GNOME_DESKTOP_ITEM_FILE_PATTERN "FilePattern" /* regexp(s) */
GNOME_DESKTOP_ITEM_TERMINAL_OPTIONS
#define GNOME_DESKTOP_ITEM_TERMINAL_OPTIONS "TerminalOptions" /* string */
GNOME_DESKTOP_ITEM_SWALLOW_TITLE
#define GNOME_DESKTOP_ITEM_SWALLOW_TITLE "SwallowTitle" /* string */
enum GnomeDesktopItemLoadFlags
typedef enum { /* Use the TryExec field to determine if this should be loaded */ GNOME_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS = 1<<0, GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS = 1<<1 } GnomeDesktopItemLoadFlags;
enum GnomeDesktopItemLaunchFlags
typedef enum { /* Never launch more instances even if the app can only * handle one file and we have passed many */ GNOME_DESKTOP_ITEM_LAUNCH_ONLY_ONE = 1<<0, /* Use current directory instead of home directory */ GNOME_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR = 1<<1, /* Append the list of URIs to the command if no Exec * parameter is specified, instead of launching the * app without parameters. */ GNOME_DESKTOP_ITEM_LAUNCH_APPEND_URIS = 1<<2, /* Same as above but instead append local paths */ GNOME_DESKTOP_ITEM_LAUNCH_APPEND_PATHS = 1<<3, /* Don't automatically reap child process. */ GNOME_DESKTOP_ITEM_LAUNCH_DO_NOT_REAP_CHILD = 1<<4 } GnomeDesktopItemLaunchFlags;
enum GnomeDesktopItemIconFlags
typedef enum { /* Don't check the kde directories */ GNOME_DESKTOP_ITEM_ICON_NO_KDE = 1<<0 } GnomeDesktopItemIconFlags;
enum GnomeDesktopItemError
typedef enum { GNOME_DESKTOP_ITEM_ERROR_NO_FILENAME /* No filename set or given on save */, GNOME_DESKTOP_ITEM_ERROR_UNKNOWN_ENCODING /* Unknown encoding of the file */, GNOME_DESKTOP_ITEM_ERROR_CANNOT_OPEN /* Cannot open file */, GNOME_DESKTOP_ITEM_ERROR_NO_EXEC_STRING /* Cannot launch due to no execute string */, GNOME_DESKTOP_ITEM_ERROR_BAD_EXEC_STRING /* Cannot launch due to bad execute string */, GNOME_DESKTOP_ITEM_ERROR_NO_URL /* No URL on a url entry*/, GNOME_DESKTOP_ITEM_ERROR_NOT_LAUNCHABLE /* Not a launchable type of item */, GNOME_DESKTOP_ITEM_ERROR_INVALID_TYPE /* Not of type application/x-gnome-app-info */ } GnomeDesktopItemError;
gnome_desktop_item_new ()
GnomeDesktopItem * gnome_desktop_item_new (void
);
Creates a GnomeDesktopItem object. The reference count on the returned value is set to '1'.
Returns : |
The new GnomeDesktopItem |
gnome_desktop_item_new_from_file ()
GnomeDesktopItem * gnome_desktop_item_new_from_file (const char *file
,GnomeDesktopItemLoadFlags flags
,GError **error
);
This function loads 'file' and turns it into a GnomeDesktopItem.
|
The filename or directory path to load the GnomeDesktopItem from |
|
Flags to influence the loading process |
Returns : |
The newly loaded item. |
gnome_desktop_item_new_from_uri ()
GnomeDesktopItem * gnome_desktop_item_new_from_uri (const char *uri
,GnomeDesktopItemLoadFlags flags
,GError **error
);
This function loads 'uri' and turns it into a GnomeDesktopItem.
|
URI to load the GnomeDesktopItem from |
|
Flags to influence the loading process |
Returns : |
The newly loaded item. |
gnome_desktop_item_new_from_string ()
GnomeDesktopItem * gnome_desktop_item_new_from_string (const char *uri
,const char *string
,gssize length
,GnomeDesktopItemLoadFlags flags
,GError **error
);
This function turns the contents of the string into a GnomeDesktopItem.
|
string to load the GnomeDesktopItem from |
|
length of string, or -1 to use strlen |
|
Flags to influence the loading process |
|
place to put errors |
Returns : |
The newly loaded item. |
gnome_desktop_item_new_from_basename ()
GnomeDesktopItem * gnome_desktop_item_new_from_basename (const char *basename
,GnomeDesktopItemLoadFlags flags
,GError **error
);
This function loads 'basename' from a system data directory and returns its GnomeDesktopItem.
|
The basename of the GnomeDesktopItem to load. |
|
Flags to influence the loading process |
Returns : |
The newly loaded item. |
gnome_desktop_item_copy ()
GnomeDesktopItem * gnome_desktop_item_copy (const GnomeDesktopItem *item
);
Creates a copy of a GnomeDesktopItem. The new copy has a refcount of 1. Note: Section stack is NOT copied.
|
The item to be copied |
Returns : |
The new copy |
gnome_desktop_item_save ()
gboolean gnome_desktop_item_save (GnomeDesktopItem *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.
|
A desktop item |
|
A new uri (location) for this GnomeDesktopItem |
|
Save even if it wasn't modified |
|
GError return |
Returns : |
boolean. TRUE if the file was saved, FALSE otherwise |
gnome_desktop_item_ref ()
GnomeDesktopItem * gnome_desktop_item_ref (GnomeDesktopItem *item
);
Increases the reference count of the specified item.
|
A desktop item |
Returns : |
the newly referenced item
|
gnome_desktop_item_unref ()
void gnome_desktop_item_unref (GnomeDesktopItem *item
);
Decreases the reference count of the specified item, and destroys the item if there are no more references left.
|
A desktop item |
gnome_desktop_item_launch ()
int gnome_desktop_item_launch (const GnomeDesktopItem *item
,GList *file_list
,GnomeDesktopItemLaunchFlags 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 GnomeURL, 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.
|
A desktop item |
|
Files/URIs to launch this item with, can be NULL
|
|
FIXME |
|
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. |
gnome_desktop_item_launch_with_env ()
int gnome_desktop_item_launch_with_env (const GnomeDesktopItem *item
,GList *file_list
,GnomeDesktopItemLaunchFlags flags
,char **envp
,GError **error
);
See gnome_desktop_item_launch for a full description. This function additionally passes an environment vector for the child process which is to be launched.
|
A desktop item |
|
Files/URIs to launch this item with, can be NULL
|
|
FIXME |
|
child's environment, or NULL to inherit parent's |
|
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. |
gnome_desktop_item_launch_on_screen ()
int gnome_desktop_item_launch_on_screen (const GnomeDesktopItem *item
,GList *file_list
,GnomeDesktopItemLaunchFlags flags
,GdkScreen *screen
,int workspace
,GError **error
);
See gnome_desktop_item_launch for a full description. This function additionally attempts to launch the application on a given screen and workspace.
|
A desktop item |
|
Files/URIs to launch this item with, can be NULL
|
|
FIXME |
|
the GdkScreen on which the application should be launched |
|
the workspace on which the app should be launched (-1 for current) |
|
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. |
gnome_desktop_item_drop_uri_list ()
int gnome_desktop_item_drop_uri_list (const GnomeDesktopItem *item
,const char *uri_list
,GnomeDesktopItemLaunchFlags 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
|
A desktop item |
|
text as gotten from a text/uri-list |
|
FIXME |
|
FIXME |
Returns : |
The value returned by #gnome_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. |
gnome_desktop_item_drop_uri_list_with_env ()
int gnome_desktop_item_drop_uri_list_with_env (const GnomeDesktopItem *item
,const char *uri_list
,GnomeDesktopItemLaunchFlags flags
,char **envp
,GError **error
);
See gnome_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.
|
A desktop item |
|
text as gotten from a text/uri-list |
|
FIXME |
|
child's environment |
|
FIXME |
Returns : |
The value returned by #gnome_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. |
gnome_desktop_item_exists ()
gboolean gnome_desktop_item_exists (const GnomeDesktopItem *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.
|
A desktop item |
Returns : |
A boolean, TRUE if it exists, FALSE otherwise. |
gnome_desktop_item_get_entry_type ()
GnomeDesktopItemType gnome_desktop_item_get_entry_type (const GnomeDesktopItem *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.
|
A desktop item |
Returns : |
The type of the specified 'item'. The returned memory remains owned by the GnomeDesktopItem and should not be freed. |
gnome_desktop_item_set_entry_type ()
void gnome_desktop_item_set_entry_type (GnomeDesktopItem *item
,GnomeDesktopItemType type
);
gnome_desktop_item_get_location ()
const char * gnome_desktop_item_get_location
(const GnomeDesktopItem *item
);
|
A desktop item |
Returns : |
The file location associated with 'item'. |
gnome_desktop_item_set_location ()
void gnome_desktop_item_set_location (GnomeDesktopItem *item
,const char *location
);
Set's the 'location' uri of this item.
|
A desktop item |
|
A uri string specifying the file location of this particular item. |
gnome_desktop_item_set_location_file ()
void gnome_desktop_item_set_location_file (GnomeDesktopItem *item
,const char *file
);
Set's the 'location' uri of this item to the given file
.
|
A desktop item |
|
A local filename specifying the file location of this particular item. |
gnome_desktop_item_get_file_status ()
GnomeDesktopItemStatus gnome_desktop_item_get_file_status
(const GnomeDesktopItem *item
);
This function checks the modification time of the on-disk file to see if it is more recent than the in-memory data.
|
A desktop item |
Returns : |
An enum value that specifies whether the item has changed since being loaded. |
gnome_desktop_item_get_icon ()
char * gnome_desktop_item_get_icon (const GnomeDesktopItem *item
,GtkIconTheme *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
|
A desktop item |
|
a GtkIconTheme |
Returns : |
A newly allocated string |
gnome_desktop_item_find_icon ()
char * gnome_desktop_item_find_icon (GtkIconTheme *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
|
a GtkIconTheme |
|
icon name, something you'd get out of the Icon key |
|
FIXME |
|
FIXME |
Returns : |
A newly allocated string |
gnome_desktop_item_attr_exists ()
gboolean gnome_desktop_item_attr_exists (const GnomeDesktopItem *item
,const char *attr
);
gnome_desktop_item_get_string ()
const char * gnome_desktop_item_get_string (const GnomeDesktopItem *item
,const char *attr
);
gnome_desktop_item_set_string ()
void gnome_desktop_item_set_string (GnomeDesktopItem *item
,const char *attr
,const char *value
);
gnome_desktop_item_get_attr_locale ()
const char * gnome_desktop_item_get_attr_locale (const GnomeDesktopItem *item
,const char *attr
);
gnome_desktop_item_get_localestring ()
const char * gnome_desktop_item_get_localestring (const GnomeDesktopItem *item
,const char *attr
);
gnome_desktop_item_get_localestring_lang ()
const char * gnome_desktop_item_get_localestring_lang (const GnomeDesktopItem *item
,const char *attr
,const char *language
);
gnome_desktop_item_get_languages ()
GList * gnome_desktop_item_get_languages (const GnomeDesktopItem *item
,const char *attr
);
gnome_desktop_item_set_localestring ()
void gnome_desktop_item_set_localestring (GnomeDesktopItem *item
,const char *attr
,const char *value
);
gnome_desktop_item_set_localestring_lang ()
void gnome_desktop_item_set_localestring_lang (GnomeDesktopItem *item
,const char *attr
,const char *language
,const char *value
);
gnome_desktop_item_clear_localestring ()
void gnome_desktop_item_clear_localestring (GnomeDesktopItem *item
,const char *attr
);
gnome_desktop_item_get_strings ()
char ** gnome_desktop_item_get_strings (const GnomeDesktopItem *item
,const char *attr
);
gnome_desktop_item_set_strings ()
void gnome_desktop_item_set_strings (GnomeDesktopItem *item
,const char *attr
,char **strings
);
gnome_desktop_item_get_boolean ()
gboolean gnome_desktop_item_get_boolean (const GnomeDesktopItem *item
,const char *attr
);
gnome_desktop_item_set_boolean ()
void gnome_desktop_item_set_boolean (GnomeDesktopItem *item
,const char *attr
,gboolean value
);
gnome_desktop_item_set_launch_time ()
void gnome_desktop_item_set_launch_time (GnomeDesktopItem *item
,guint32 timestamp
);
gnome_desktop_item_clear_section ()
void gnome_desktop_item_clear_section (GnomeDesktopItem *item
,const char *section
);