ThunarVfsMimeDatabase

ThunarVfsMimeDatabase — Provides access to the MIME database.

Synopsis

#include <thunar-vfs/thunar-vfs.h>

                    ThunarVfsMimeDatabase;
ThunarVfsMimeDatabase * thunar_vfs_mime_database_get_default
                                                        (void);
ThunarVfsMimeInfo * thunar_vfs_mime_database_get_info   (ThunarVfsMimeDatabase *database,
                                                         const gchar *mime_type);
ThunarVfsMimeInfo * thunar_vfs_mime_database_get_info_for_data
                                                        (ThunarVfsMimeDatabase *database,
                                                         gconstpointer data,
                                                         gsize length);
ThunarVfsMimeInfo * thunar_vfs_mime_database_get_info_for_name
                                                        (ThunarVfsMimeDatabase *database,
                                                         const gchar *name);
ThunarVfsMimeInfo * thunar_vfs_mime_database_get_info_for_file
                                                        (ThunarVfsMimeDatabase *database,
                                                         const gchar *path,
                                                         const gchar *name);
GList *             thunar_vfs_mime_database_get_infos_for_info
                                                        (ThunarVfsMimeDatabase *database,
                                                         ThunarVfsMimeInfo *info);
GList *             thunar_vfs_mime_database_get_applications
                                                        (ThunarVfsMimeDatabase *database,
                                                         ThunarVfsMimeInfo *info);
ThunarVfsMimeApplication * thunar_vfs_mime_database_get_default_application
                                                        (ThunarVfsMimeDatabase *database,
                                                         ThunarVfsMimeInfo *info);
gboolean            thunar_vfs_mime_database_set_default_application
                                                        (ThunarVfsMimeDatabase *database,
                                                         ThunarVfsMimeInfo *info,
                                                         ThunarVfsMimeApplication *application,
                                                         GError **error);
ThunarVfsMimeApplication * thunar_vfs_mime_database_add_application
                                                        (ThunarVfsMimeDatabase *database,
                                                         ThunarVfsMimeInfo *info,
                                                         const gchar *name,
                                                         const gchar *exec,
                                                         GError **error);
gboolean            thunar_vfs_mime_database_remove_application
                                                        (ThunarVfsMimeDatabase *database,
                                                         ThunarVfsMimeApplication *application,
                                                         GError **error);

Object Hierarchy

  GObject
   +----ThunarVfsMimeDatabase

Description

Details

ThunarVfsMimeDatabase

typedef struct _ThunarVfsMimeDatabase ThunarVfsMimeDatabase;

The ThunarVfsMimeDatabase contains private data only, and should be accessed using the functions below.


thunar_vfs_mime_database_get_default ()

ThunarVfsMimeDatabase * thunar_vfs_mime_database_get_default
                                                        (void);

Returns a reference on the shared ThunarVfsMimeDatabase instance. The caller is responsible to call g_object_unref() on the returned object when no longer needed.

Returns :

the shared ThunarVfsMimeDatabase.

thunar_vfs_mime_database_get_info ()

ThunarVfsMimeInfo * thunar_vfs_mime_database_get_info   (ThunarVfsMimeDatabase *database,
                                                         const gchar *mime_type);

Determines the ThunarVfsMimeInfo which corresponds to mime_type in database. The caller is responsible to call thunar_vfs_mime_info_unref() on the returned instance.

database :

a ThunarVfsMimeDatabase.

mime_type :

the string representation of the mime type.

Returns :

the ThunarVfsMimeInfo corresponding to mime_type in database.

thunar_vfs_mime_database_get_info_for_data ()

ThunarVfsMimeInfo * thunar_vfs_mime_database_get_info_for_data
                                                        (ThunarVfsMimeDatabase *database,
                                                         gconstpointer data,
                                                         gsize length);

Determines the ThunarVfsMimeInfo for data in database. The caller is responsible to call thunar_vfs_mime_info_unref() on the returned instance.

database :

a ThunarVfsMimeDatabase.

data :

the data to check.

length :

the length of data in bytes.

Returns :

the ThunarVfsMimeInfo determined for data.

thunar_vfs_mime_database_get_info_for_name ()

ThunarVfsMimeInfo * thunar_vfs_mime_database_get_info_for_name
                                                        (ThunarVfsMimeDatabase *database,
                                                         const gchar *name);

Determines the ThunarVfsMimeInfo for the filename given in name from database. The caller is responsible to call thunar_vfs_mime_info_unref() on the returned instance.

The name must be a valid filename in UTF-8 encoding and it may not contained any slashes!

database :

a ThunarVfsMimeDatabase.

name :

a filename (must be valid UTF-8!).

Returns :

the ThunarVfsMimeInfo for name in database.

thunar_vfs_mime_database_get_info_for_file ()

ThunarVfsMimeInfo * thunar_vfs_mime_database_get_info_for_file
                                                        (ThunarVfsMimeDatabase *database,
                                                         const gchar *path,
                                                         const gchar *name);

Determines the ThunarVfsMimeInfo for path in database. The caller is responsible to free the returned instance using thunar_vfs_mime_info_unref().

The name parameter is optional. If the caller already knows the basename of path in UTF-8 encoding, it should be specified here to speed up the lookup process.

database :

a ThunarVfsMimeDatabase.

path :

the path to a file in the local filesystem (in the filesystem encoding).

name :

the basename of path in UTF-8 encoding or NULL.

Returns :

the ThunarVfsMimeInfo for path in database.

thunar_vfs_mime_database_get_infos_for_info ()

GList *             thunar_vfs_mime_database_get_infos_for_info
                                                        (ThunarVfsMimeDatabase *database,
                                                         ThunarVfsMimeInfo *info);

Returns a list of all ThunarVfsMimeInfos, that are related to info in database. Currently this is the list of parent MIME-types for info, as defined in the Shared Mime Database.

Note that the returned list will also include a reference info itself. In addition, this method also handles details specified by the Shared Mime Database Specification like the fact that every "text/xxxx" MIME-type is a subclass of "text/plain" and every MIME-type is a subclass of "application/octet-stream".

The caller is responsible to free the returned list using #thunar_vfs_mime_info_list_free() when done with it.

database :

a ThunarVfsMimeDatabase.

info :

a ThunarVfsMimeInfo.

Returns :

the list of ThunarVfsMimeInfos related to info.

thunar_vfs_mime_database_get_applications ()

GList *             thunar_vfs_mime_database_get_applications
                                                        (ThunarVfsMimeDatabase *database,
                                                         ThunarVfsMimeInfo *info);

Looks up all ThunarVfsMimeApplications in database, which claim to be able to open files whose MIME-type is represented by info.

The caller is responsible to free the returned list using something like:

1
2
3
4
5