Top | ![]() |
![]() |
![]() |
![]() |
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.
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.
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.
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!
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.
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.
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 |
g_list_foreach (list, (GFunc) g_object_unref, NULL); g_list_free (list); |
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.
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
.
database |
||
info |
a valid ThunarVfsMimeInfo for |
|
application |
||
error |
return location for errors or |
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.
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.
typedef struct _ThunarVfsMimeDatabase ThunarVfsMimeDatabase;
The ThunarVfsMimeDatabase contains private data only, and should be accessed using the functions below.