Top |
MIME DatabaseMIME Database — functions for getting information about applications and components associated with MIME types. |
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.
GnomeVFSMimeApplication *
gnome_vfs_mime_get_default_application
(const char *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.
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
);
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).
a GList * where the elements are GnomeVFSMimeApplication *
representing applications that handle MIME type mime_type
.
GList * gnome_vfs_mime_get_all_applications_for_uri (const char *uri
,const char *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". |
a GList * where the elements are GnomeVFSMimeApplication * representing all possible handlers
Since: 2.10
GList *
gnome_vfs_mime_get_all_desktop_entries
(const char *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.
gchar *
gnome_vfs_mime_get_default_desktop_entry
(const char *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
.
Bonobo_ServerInfo *
gnome_vfs_mime_get_default_component (const char *mime_type
);
gnome_vfs_mime_get_default_component
is deprecated and should not be used in newly-written code.
GList *
gnome_vfs_mime_get_all_components (const char *mime_type
);
gnome_vfs_mime_get_all_components
is deprecated and should not be used in newly-written code.
const char *
gnome_vfs_mime_get_icon (const char *mime_type
);
gnome_vfs_mime_get_icon
is deprecated and should not be used in newly-written code.
Use gnome_icon_lookup()
function in libgnomeui instead.
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.
const char *
gnome_vfs_mime_get_description (const char *mime_type
);
Query the MIME database for a description of the mime_type
.
gboolean
gnome_vfs_mime_can_be_executable (const char *mime_type
);
Check whether files of mime_type
might conceivably be executable.
Default for known types if FALSE
. Default for unknown types is TRUE
.
GnomeVFSMimeApplication *
gnome_vfs_mime_application_new_from_desktop_id
(const char *id
);
Returns a new GnomeVFSMimeApplication for the id
.
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. |
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. |
Since: 2.4
const char *
gnome_vfs_mime_application_get_desktop_id
(GnomeVFSMimeApplication *app
);
Returns the identifier of the desktop entry.
Since: 2.10
const char *
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.
Since: 2.10
const char *
gnome_vfs_mime_application_get_name (GnomeVFSMimeApplication *app
);
Returns the name of the application app
Since: 2.10
const char *
gnome_vfs_mime_application_get_generic_name
(GnomeVFSMimeApplication *app
);
Returns the generic name of the application.
Since: 2.10
const char *
gnome_vfs_mime_application_get_icon (GnomeVFSMimeApplication *app
);
Returns an icon representing the specified application.
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
const char *
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.Since: 2.10
const char *
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.
Since: 2.10
gboolean
gnome_vfs_mime_application_requires_terminal
(GnomeVFSMimeApplication *app
);
Returns whether the application runs in a terminal window.
Since: 2.10
gboolean
gnome_vfs_mime_application_supports_uris
(GnomeVFSMimeApplication *app
);
Returns whether the application accept uris as command lines arguments.
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.
Since: 2.10
const char *
gnome_vfs_mime_application_get_startup_wm_class
(GnomeVFSMimeApplication *app
);
Returns the WM class of the main window of the application.
Since: 2.10
gboolean gnome_vfs_mime_application_equal (GnomeVFSMimeApplication *app_a
,GnomeVFSMimeApplication *app_b
);
Compare app_a
and app_b
.
Since: 2.10
GnomeVFSMimeApplication *
gnome_vfs_mime_application_copy (GnomeVFSMimeApplication *application
);
Creates a newly referenced copy of a GnomeVFSMimeApplication object.
void
gnome_vfs_mime_application_free (GnomeVFSMimeApplication *application
);
Frees a GnomeVFSMimeApplication *.
void
gnome_vfs_mime_application_list_free (GList *list
);
Frees lists of GnomeVFSApplications, as returned from functions such
as gnome_vfs_get_all_applications()
.
void
gnome_vfs_mime_component_list_free (GList *list
);
gnome_vfs_mime_component_list_free
is deprecated and should not be used in newly-written code.
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.