| GnomeVFS - Filesystem Abstraction library | ||||
|---|---|---|---|---|
MIME DatabaseMIME Database — functions for getting information about applications and components associated with MIME types. |
GnomeVFSMimeApplication;
GnomeVFSMimeApplication* gnome_vfs_mime_get_default_application
(const char *mime_type);
GnomeVFSMimeApplication* gnome_vfs_mime_get_default_application_for_uri
(const char *uri,
const char *mime_type);
GList * gnome_vfs_mime_get_all_applications
(const char *mime_type);
GList * gnome_vfs_mime_get_all_applications_for_uri
(const char *uri,
const char *mime_type);
GList * gnome_vfs_mime_get_all_desktop_entries
(const char *mime_type);
gchar * gnome_vfs_mime_get_default_desktop_entry
(const char *mime_type);
Bonobo_ServerInfo * gnome_vfs_mime_get_default_component
(const char *mime_type);
GList * gnome_vfs_mime_get_all_components
(const char *mime_type);
const char * gnome_vfs_mime_get_icon (const char *mime_type);
const char * gnome_vfs_mime_get_description (const char *mime_type);
gboolean gnome_vfs_mime_can_be_executable
(const char *mime_type);
GnomeVFSMimeApplication* gnome_vfs_mime_application_new_from_desktop_id
(const char *id);
GnomeVFSResult gnome_vfs_mime_application_launch
(GnomeVFSMimeApplication *app,
GList *uris);
GnomeVFSResult gnome_vfs_mime_application_launch_with_env
(GnomeVFSMimeApplication *app,
GList *uris,
char **envp);
const char * gnome_vfs_mime_application_get_desktop_id
(GnomeVFSMimeApplication *app);
const char * gnome_vfs_mime_application_get_desktop_file_path
(GnomeVFSMimeApplication *app);
const char * gnome_vfs_mime_application_get_name
(GnomeVFSMimeApplication *app);
const char * gnome_vfs_mime_application_get_generic_name
(GnomeVFSMimeApplication *app);
const char * gnome_vfs_mime_application_get_icon
(GnomeVFSMimeApplication *app);
const char * gnome_vfs_mime_application_get_exec
(GnomeVFSMimeApplication *app);
const char * gnome_vfs_mime_application_get_binary_name
(GnomeVFSMimeApplication *app);
gboolean gnome_vfs_mime_application_requires_terminal
(GnomeVFSMimeApplication *app);
gboolean gnome_vfs_mime_application_supports_uris
(GnomeVFSMimeApplication *app);
gboolean gnome_vfs_mime_application_supports_startup_notification
(GnomeVFSMimeApplication *app);
const char * gnome_vfs_mime_application_get_startup_wm_class
(GnomeVFSMimeApplication *app);
gboolean gnome_vfs_mime_application_equal
(GnomeVFSMimeApplication *app_a,
GnomeVFSMimeApplication *app_b);
GnomeVFSMimeApplication* gnome_vfs_mime_application_copy
(GnomeVFSMimeApplication *application);
void gnome_vfs_mime_application_free (GnomeVFSMimeApplication *application);
void gnome_vfs_mime_application_list_free
(GList *list);
void gnome_vfs_mime_component_list_free
(GList *list);
This API can be used to query the applications and components associated with particular MIME types, and to collect extra information about them, and also provides a convenience function for launching them. Applications can register themselves for particular MIME types by adhering to the Freedesktop.Org Desktop Entry Specification.
typedef struct {
char *id;
char *name;
} GnomeVFSMimeApplication;
A struct encapsulating information about an application known to the MIME database.
Only very few fields of this information are actually
public, most of them must be queried using the
gnome_vfs_mime_application_*()
API.
id; |
The desktop ID of the application. |
name; |
The user-visible name of the application. |
GnomeVFSMimeApplication* gnome_vfs_mime_get_default_application (constchar *mime_type);
Query the MIME database for the application to be executed on files of MIME type
mime_type by default.
If you know the actual uri of the file you should use gnome_vfs_mime_get_default_application_for_uri instead, as it will then be able to pick a better app. For instance it won't pick an app that claims to only handle local files for a remote uri.
mime_type : |
a const char * containing a mime type, e.g. "image/png". |
| Returns : | a GnomeVFSMimeApplication representing the default handler of mime_type.
|
GnomeVFSMimeApplication* gnome_vfs_mime_get_default_application_for_uri (constchar *uri, constchar *mime_type);
uri : |
|
mime_type : |
|
| Returns : |
GList * gnome_vfs_mime_get_all_applications (constchar *mime_type);
Return an alphabetically sorted list of GnomeVFSMimeApplication
data structures representing all applications in the MIME database registered
to handle files of MIME type mime_type (and supertypes).
mime_type : |
a const char * containing a mime type, e.g. "image/png". |
| Returns : | a mime_type.
|
GList * gnome_vfs_mime_get_all_applications_for_uri (constchar *uri, constchar *mime_type);
Return an alphabetically sorted list of GnomeVFSMimeApplication
data structures representing all applications in the MIME database able
to handle the file identified by uri of mime_type (and supertypes).
uri : |
a stringified uri. |
mime_type : |
a const char * containing a mime type, e.g. "application/x-php". |
| Returns : | a |
Since 2.10
GList * gnome_vfs_mime_get_all_desktop_entries (constchar *mime_type);
gnome_vfs_mime_get_all_desktop_entries is deprecated and should not be used in newly-written code.
Returns all the desktop filenames for mime_type. The desktop files
are listed in an order so that default applications are listed before
non-default ones, and handlers for inherited mimetypes are listed
after the base ones.
mime_type : |
a mime type. |
| Returns : | a mime_type.
|
gchar * gnome_vfs_mime_get_default_desktop_entry (constchar *mime_type);
gnome_vfs_mime_get_default_desktop_entry is deprecated and should not be used in newly-written code.
Returns the default desktop filename for mime_type.
mime_type : |
a mime type. |
| Returns : | the default desktop filename for mime_type.
|
Bonobo_ServerInfo * gnome_vfs_mime_get_default_component (constchar *mime_type);
gnome_vfs_mime_get_default_component is deprecated and should not be used in newly-written code.
mime_type : |
|
| Returns : |
GList * gnome_vfs_mime_get_all_components (constchar *mime_type);
gnome_vfs_mime_get_all_components is deprecated and should not be used in newly-written code.
mime_type : |
|
| Returns : |
constchar * gnome_vfs_mime_get_icon (constchar *mime_type);
gnome_vfs_mime_get_icon is deprecated and should not be used in newly-written code. Use gnome_icon_lookup()
Query the MIME database for an icon representing the mime_type.
It usually returns a filename without path information, e.g. "i-chardev.png", and sometimes does not have an extension, e.g. "i-regular" if the icon is supposed to be image type agnostic between icon themes. Icons are generic and not theme specific. These will not necessarily match with the icons a user sees in Nautilus, you have been warned.
mime_type : |
a const char * containing a MIME type. |
| Returns : | The filename of the icon as listed in the MIME database. |
constchar * gnome_vfs_mime_get_description (constchar *mime_type);
Query the MIME database for a description of the mime_type.
mime_type : |
the mime type. |
| Returns : | description of MIME type mime_type.
|
gboolean gnome_vfs_mime_can_be_executable (constchar *mime_type);
Check whether files of mime_type might conceivably be executable.
Default for known types if FALSETRUE
mime_type : |
a const char * containing a mime type. |
| Returns : | TRUEmime_type
can be executable, FALSE |
GnomeVFSMimeApplication* gnome_vfs_mime_application_new_from_desktop_id (constchar *id);
Returns a new GnomeVFSMimeApplication for the id.
id : |
the identifier of a desktop entry. |
| Returns : | a GnomeVFSMimeApplication. |
Since 2.10
GnomeVFSResult gnome_vfs_mime_application_launch (GnomeVFSMimeApplication *app,GList *uris);
Launches the given mime application with the given parameters. Command line parameters will be expanded as required by the application. The application will also be launched in a terminal if that is required. If the application only supports one argument per instance then multiple instances of the application will be launched.
app : |
the GnomeVFSMimeApplication to launch. |
uris : |
parameters for the GnomeVFSMimeApplication. |
| Returns : |
GNOME_VFS_OK if the application was launched.
GNOME_VFS_ERROR_NOT_SUPPORTED if the uri protocol is not
supported by the application.
GNOME_VFS_ERROR_PARSE if the application command can not
be parsed.
GNOME_VFS_ERROR_LAUNCH if the application command can not
be launched.
GNOME_VFS_ERROR_INTERNAL for other internal and GConf errors.
|
Since 2.4
GnomeVFSResult gnome_vfs_mime_application_launch_with_env (GnomeVFSMimeApplication *app,GList *uris,char **envp);
Same as gnome_vfs_mime_application_launch() except that
the application will be launched with the given environment.
app : |
the GnomeVFSMimeApplication to launch. |
uris : |
parameters for the GnomeVFSMimeApplication. |
envp : |
the environment to use for the application. |
| Returns : | same as gnome_vfs_mime_application_launch().
|
Since 2.4
constchar * gnome_vfs_mime_application_get_desktop_id (GnomeVFSMimeApplication *app);
Returns the identifier of the desktop entry.
app : |
a GnomeVFSMimeApplication. |
| Returns : | the identifier of the desktop entry. |
Since 2.10
constchar * gnome_vfs_mime_application_get_desktop_file_path (GnomeVFSMimeApplication *app);
Returns the path of the desktop entry, a configuration file describing the properties of a particular program like it's name, how it is to be launched, how it appears in menus.
app : |
a GnomeVFSMimeApplication. |
| Returns : | the path of the .desktop file. |
Since 2.10
constchar * gnome_vfs_mime_application_get_name (GnomeVFSMimeApplication *app);
Returns the name of the application app
app : |
a GnomeVFSMimeApplication. |
| Returns : | the name of the application. |
Since 2.10
constchar * gnome_vfs_mime_application_get_generic_name (GnomeVFSMimeApplication *app);
Returns the generic name of the application.
app : |
a GnomeVFSMimeApplication. |
| Returns : | the generic name of the application. |
Since 2.10
constchar * gnome_vfs_mime_application_get_icon (GnomeVFSMimeApplication *app);
Returns an icon representing the specified application.
app : |
a GnomeVFSMimeApplication. |
| Returns : | the filename of the icon usually without path information, e.g. "gedit-icon.png", and sometimes does not have an extension, e.g. "gnome-pdf" if the icon is supposed to be image type agnostic between icon themes. Icons are generic, and not theme specific. |
Since 2.10
constchar * gnome_vfs_mime_application_get_exec (GnomeVFSMimeApplication *app);
Returns the program to execute, possibly with arguments and parameter variables, as specified by the Desktop Entry Specification.
app : |
a GnomeVFSMimeApplication. |
| Returns : | the command line to execute. |
Since 2.10
constchar * gnome_vfs_mime_application_get_binary_name (GnomeVFSMimeApplication *app);
Returns the binary name of the specified application.
Useful to implement startup notification.
Note that this only provides partial information about
application execution, it misses arguments and macros.
DO NOT USE it to launch the application.
Use gnome_vfs_mime_application_launch or
gnome_vfs_mime_application_get_exec() if you really
need to write a custom launcher.
app : |
a GnomeVFSMimeApplication. |
| Returns : | the application's binary name. |
Since 2.10
gboolean gnome_vfs_mime_application_requires_terminal (GnomeVFSMimeApplication *app);
Returns whether the application runs in a terminal window.
app : |
a GnomeVFSMimeApplication. |
| Returns : | TRUE |
Since 2.10
gboolean gnome_vfs_mime_application_supports_uris (GnomeVFSMimeApplication *app);
Returns whether the application accept uris as command lines arguments.
app : |
a GnomeVFSMimeApplication. |
| Returns : | TRUE |
Since 2.10
gboolean gnome_vfs_mime_application_supports_startup_notification (GnomeVFSMimeApplication *app);
Returns whether the application supports startup notification. If true, it is KNOWN that the application will send a "remove" message when started with the DESKTOP_LAUNCH_ID environment variable set.
app : |
a GnomeVFSMimeApplication. |
| Returns : | TRUE |
Since 2.10
constchar * gnome_vfs_mime_application_get_startup_wm_class (GnomeVFSMimeApplication *app);
Returns the WM class of the main window of the application.
app : |
a GnomeVFSMimeApplication |
| Returns : | The WM class of the application's window |
Since 2.10
gboolean gnome_vfs_mime_application_equal (GnomeVFSMimeApplication *app_a, GnomeVFSMimeApplication *app_b);
Compare app_a and app_b.
app_a : |
a GnomeVFSMimeApplication. |
app_b : |
a GnomeVFSMimeApplication. |
| Returns : | TRUEapp_a and app_b are equal, FALSE |
Since 2.10
GnomeVFSMimeApplication* gnome_vfs_mime_application_copy (GnomeVFSMimeApplication *application);
Creates a newly referenced copy of a GnomeVFSMimeApplication object.
application : |
a GnomeVFSMimeApplication to be duplicated. |
| Returns : | a copy of application.
|
void gnome_vfs_mime_application_free (GnomeVFSMimeApplication *application);
Frees a GnomeVFSMimeApplication *.
application : |
a GnomeVFSMimeApplication to be freed. |
void gnome_vfs_mime_application_list_free (GList *list);
Frees lists of gnome_vfs_get_all_applications()
list : |
a |