![]() |
![]() |
![]() |
Thunar-VFS Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
#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);
typedef struct _ThunarVfsMimeDatabase ThunarVfsMimeDatabase;
The ThunarVfsMimeDatabase contains private data only, and should be accessed using the functions below.
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. |
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.
|
a ThunarVfsMimeDatabase. |
|
the string representation of the mime type. |
Returns : |
the ThunarVfsMimeInfo corresponding to mime_type in database .
|
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.
|
a ThunarVfsMimeDatabase. |
|
the data to check. |
|
the length of data in bytes.
|
Returns : |
the ThunarVfsMimeInfo determined for data .
|
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!
|
a ThunarVfsMimeDatabase. |
|
a filename (must be valid UTF-8!). |
Returns : |
the ThunarVfsMimeInfo for name in database .
|
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.
|
a ThunarVfsMimeDatabase. |
|
the path to a file in the local filesystem (in the filesystem encoding). |
|
the basename of path in UTF-8 encoding or NULL .
|
Returns : |
the ThunarVfsMimeInfo for path in database .
|
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.
|
a ThunarVfsMimeDatabase. |
|
a ThunarVfsMimeInfo. |
Returns : |
the list of ThunarVfsMimeInfos
related to info .
|
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:
g_list_foreach (list, (GFunc) g_object_unref, NULL); g_list_free (list);
|
a ThunarVfsMimeDatabase. |
|
a ThunarVfsMimeInfo. |
Returns : |
the list of ThunarVfsMimeApplications, that
can handle info .
|
ThunarVfsMimeApplication * thunar_vfs_mime_database_get_default_application (ThunarVfsMimeDatabase *database, ThunarVfsMimeInfo *info);
Returns the default ThunarVfsMimeApplication to handle
files of type info
or NULL
if no default application
is set for info
.
The caller is responsible to free the returned instance
using g_object_unref()
when no longer needed.
|
a ThunarVfsMimeDatabase. |
|
a ThunarVfsMimeInfo. |
Returns : |
the default ThunarVfsMimeApplication for
info or NULL .
|
gboolean thunar_vfs_mime_database_set_default_application (ThunarVfsMimeDatabase *database, ThunarVfsMimeInfo *info, ThunarVfsMimeApplication *application, GError **error);
Sets application
to be the default ThunarVfsMimeApplication to open files
of type info
in database
.
|
a ThunarVfsMimeDatabase. |
|
a valid ThunarVfsMimeInfo for database .
|
|
a ThunarVfsMimeApplication. |
|
return location for errors or NULL .
|
Returns : |
TRUE if the operation was successfull, else FALSE .
|
ThunarVfsMimeApplication * thunar_vfs_mime_database_add_application (ThunarVfsMimeDatabase *database, ThunarVfsMimeInfo *info, const gchar *name, const gchar *exec, GError **error);
Adds a new ThunarVfsMimeApplication to the database
, whose
name is name
and command is exec
, and which can be used to
open files of type info
.
The caller is responsible to free the returned object
using g_object_unref()
when no longer needed.
|
a ThunarVfsMimeDatabase. |
|
a ThunarVfsMimeInfo. |
|
the name for the application. |
|
the command for the application. |
|
return location for errors or NULL .
|
Returns : |
the newly created ThunarVfsMimeApplication
or NULL on error.
|
gboolean thunar_vfs_mime_database_remove_application (ThunarVfsMimeDatabase *database, ThunarVfsMimeApplication *application, GError **error);
Undoes the effect of thunar_vfs_mime_database_add_application()
by removing
the user created application
from the database
. The application
must be
user created, and the removal will fail if its not (for example if its a
system-wide installed application launcher). See the documentation for
thunar_vfs_mime_application_is_usercreated()
for details.
|
a ThunarVfsMimeDatabase. |
|
a ThunarVfsMimeApplication. |
|
return location for errors or NULL .
|
Returns : |
TRUE if the removal was successfull, FALSE otherwise and
error will be set.
|