Top |
enum | ThunarFileDateType |
enum | ThunarFileIconState |
enum | ThunarFileThumbState |
enum | ThunarFileAskExecuteResponse |
#define | THUNAR_FILE_EMBLEM_NAME_SYMBOLIC_LINK |
#define | THUNAR_FILE_EMBLEM_NAME_CANT_READ |
#define | THUNAR_FILE_EMBLEM_NAME_CANT_WRITE |
#define | THUNAR_FILE_EMBLEM_NAME_DESKTOP |
#define | DEFAULT_CONTENT_TYPE |
void (*ThunarFileGetFunc) (GFile *location
,ThunarFile *file
,GError *error
,gpointer user_data
);
Callback type for loading ThunarFiles asynchronously. If you want to keep the ThunarFile, you need to ref it, else it will be destroyed.
ThunarFile * thunar_file_get (GFile *file
,GError **error
);
Looks up the ThunarFile referred to by file
. This function may return a
ThunarFile even though the file doesn't actually exist. This is the case
with remote URIs (like SFTP) for instance, if they are not mounted.
The caller is responsible to call g_object_unref()
when done with the returned object.
ThunarFile * thunar_file_get_with_info (GFile *file
,GFileInfo *info
,GFileInfo *recent_info
,gboolean not_mounted
);
Looks up the ThunarFile referred to by file
. This function may return a
ThunarFile even though the file doesn't actually exist. This is the case
with remote URIs (like SFTP) for instance, if they are not mounted.
This function does not use g_file_query_info()
to get the info,
but takes a reference on the info
,
The caller is responsible to call g_object_unref()
when done with the returned object.
ThunarFile * thunar_file_get_for_uri (const gchar *uri
,GError **error
);
Convenience wrapper function for thunar_file_get_for_path()
, as its
often required to determine a ThunarFile for a given uri
.
The caller is responsible to free the returned object using
g_object_unref()
when no longer needed.
void thunar_file_get_async (GFile *location
,GCancellable *cancellable
,ThunarFileGetFunc func
,gpointer user_data
);
GFile *
thunar_file_get_file (const ThunarFile *file
);
Returns the GFile that refers to the location of file
.
The returned GFile is owned by file
and must not be released
with g_object_unref()
.
GFileInfo *
thunar_file_get_info (const ThunarFile *file
);
Returns the GFileInfo for file
.
Note, that there's no reference taken for the caller on the
returned GFileInfo, so if you need the object for a longer
perioud, you'll need to take a reference yourself using the
g_object_ref()
method.
ThunarFile * thunar_file_get_parent (const ThunarFile *file
,GError **error
);
Determines the parent ThunarFile for file
. If file
has no parent or
the user is not allowed to open the parent folder of file
, NULL
will
be returned and error
will be set to point to a GError that
describes the cause. Else, the ThunarFile will be returned, and
the caller must call g_object_unref()
on it.
You may want to call thunar_file_has_parent()
first to
determine whether file
has a parent.
gboolean
thunar_file_check_loaded (ThunarFile *file
);
Check if file
has its information loaded, if not, try this once else
return FALSE
.
gboolean thunar_file_execute (ThunarFile *file
,GFile *working_directory
,gpointer parent
,gboolean in_terminal
,GList *path_list
,const gchar *startup_id
,GError **error
);
Tries to execute file
on the specified screen
. If file
is executable
and could have been spawned successfully, TRUE
is returned, else FALSE
will be returned and error
will be set to point to the error location.
file |
a ThunarFile instance. |
|
working_directory |
the working directory used to resolve relative filenames
in |
|
parent |
|
|
file_list |
the list of GFiles to supply to |
|
startup_id |
startup id for the new window (send over for dbus) or |
|
error |
return location for errors or |
gboolean thunar_file_launch (ThunarFile *file
,gpointer parent
,const gchar *startup_id
,GError **error
);
If file
is an executable file, tries to execute it. Else if file
is
a directory, opens a new ThunarWindow to display the directory. Else,
the default handler for file
is determined and run.
The parent
can be either a GtkWidget or a GdkScreen, on which to
launch the file
. If parent
is a GtkWidget, the chooser dialog (if
no default application is available for file
) will be transient for
parent
. Else if parent
is a GdkScreen it specifies the screen on
which to launch file
.
file |
a ThunarFile instance. |
|
parent |
a GtkWidget or a GdkScreen on which to launch the |
|
startup_id |
startup id for the new window (send over for dbus) or |
|
error |
return location for errors or |
gboolean thunar_file_rename (ThunarFile *file
,const gchar *name
,GCancellable *cancellable
,gboolean called_from_job
,GError **error
);
Tries to rename file
to the new name
. If file
cannot be renamed,
FALSE
will be returned and error
will be set accordingly. Else, if
the operation succeeds, TRUE
will be returned, and file
will have
a new URI and a new display name.
When offering a rename action in the user interface, the implementation
should first check whether the file is available, using the
thunar_file_is_renameable()
method.
file |
a ThunarFile instance. |
|
name |
the new file name in UTF-8 encoding. |
|
error |
return location for errors or |
GdkDragAction thunar_file_accepts_drop (ThunarFile *file
,GList *path_list
,GdkDragContext *context
,GdkDragAction *suggested_action_return
);
Checks whether file
can accept file_list
for the given context
and
returns the GdkDragActions that can be used or 0 if no actions
apply.
If any GdkDragActions apply and suggested_action_return
is not
NULL
, the suggested GdkDragAction for this drop will be stored to the
location pointed to by suggested_action_return
.
file |
a ThunarFile instance. |
|
file_list |
the list of GFiles that will be dropped. |
|
context |
the current GdkDragContext, which is used for the drop. |
|
suggested_action_return |
return location for the suggested GdkDragAction or |
guint64 thunar_file_get_date (const ThunarFile *file
,ThunarFileDateType date_type
);
Queries the given date_type
from file
and returns the result.
gchar * thunar_file_get_date_string (const ThunarFile *file
,ThunarFileDateType date_type
,ThunarDateStyle date_style
,const gchar *date_custom_style
);
Tries to determine the date_type
of file
, and if file
supports the
given date_type
, it'll be formatted as string and returned. The
caller is responsible for freeing the string using the g_free()
function.
file |
a ThunarFile instance. |
|
date_type |
the kind of date you are interested to know about |
|
date_style |
the style used to format the date. |
|
date_custom_style |
custom style to apply, if |
gchar *
thunar_file_get_mode_string (const ThunarFile *file
);
Returns the mode of file
as text. You'll need to free
the result using g_free()
when you're done with it.
gchar *
thunar_file_get_size_string (const ThunarFile *file
);
Returns the size of the file as text in a human readable
format. You'll need to free the result using g_free()
if you're done with it.
gchar *
thunar_file_get_size_in_bytes_string (const ThunarFile *file
);
Returns the size in bytes of the file as text.
You'll need to free the result using g_free()
if you're done with it.
gchar * thunar_file_get_size_string_formatted (const ThunarFile *file
,const gboolean file_size_binary
);
Returns the size of the file as text in a human readable
format in decimal or binary format. You'll need to free
the result using g_free()
if you're done with it.
file |
a ThunarFile instance. |
|
file_size_binary |
indicates if file size format should be binary or not. |
gchar * thunar_file_get_size_string_long (const ThunarFile *file
,const gboolean file_size_binary
);
Returns the size of the file as text in a human readable
format in decimal or binary format, including the exact
size in bytes. You'll need to free the result using
g_free()
if you're done with it.
file |
a ThunarFile instance. |
|
file_size_binary |
indicates if file size format should be binary or not. |
GVolume *
thunar_file_get_volume (const ThunarFile *file
);
Attempts to determine the GVolume on which file
is located. If file
cannot
determine it's volume, then NULL
will be returned. Else a GVolume instance
is returned which has to be released by the caller using g_object_unref()
.
ThunarGroup *
thunar_file_get_group (const ThunarFile *file
);
Determines the ThunarGroup for file
. If there's no
group associated with file
or if the system is unable to
determine the group, NULL
will be returned.
The caller is responsible for freeing the returned object
using g_object_unref()
.
ThunarUser *
thunar_file_get_user (const ThunarFile *file
);
Determines the ThunarUser for file
. If there's no
user associated with file
or if the system is unable
to determine the user, NULL
will be returned.
The caller is responsible for freeing the returned object
using g_object_unref()
.
const gchar *
thunar_file_get_content_type (ThunarFile *file
);
Returns the content type of file
.
void thunar_file_set_content_type (ThunarFile *file
,const gchar *content_type
);
Sets the conetnt type of a ThunarFile.
const gchar *
thunar_file_get_symlink_target (const ThunarFile *file
);
Returns the path of the symlink target or NULL
if the file
is not a symlink.
const gchar *
thunar_file_get_basename (const ThunarFile *file
);
Returns the basename of the file
in UTF-8 encoding.
gboolean
thunar_file_is_symlink (const ThunarFile *file
);
Returns TRUE
if file
is a symbolic link.
guint64
thunar_file_get_size (const ThunarFile *file
);
Tries to determine the size of file
in bytes and
returns the size.
guint64
thunar_file_get_size_on_disk (const ThunarFile *file
);
Tries to determine the allocated size of file
in bytes and
returns the allocated size if available, otherwise returns -1.
GAppInfo *
thunar_file_get_default_handler (const ThunarFile *file
);
Returns the default GAppInfo for file
or NULL
if there is none.
The caller is responsible to free the returned GAppInfo using
g_object_unref()
.
GFileType
thunar_file_get_kind (const ThunarFile *file
);
Returns the kind of file
.
GFile *
thunar_file_get_target_location (const ThunarFile *file
);
ThunarFileMode
thunar_file_get_mode (const ThunarFile *file
);
Returns the permission bits of file
.
gboolean
thunar_file_is_directory (const ThunarFile *file
);
Checks whether file
refers to a directory.
gboolean
thunar_file_is_shortcut (const ThunarFile *file
);
Checks whether file
refers to a shortcut to something else.
gboolean
thunar_file_is_mountable (const ThunarFile *file
);
Checks whether file
refers to a mountable file/directory.
gboolean
thunar_file_is_local (const ThunarFile *file
);
Returns TRUE
if file
is a local file with the
file:// URI scheme.
gboolean thunar_file_is_parent (const ThunarFile *file
,const ThunarFile *child
);
Determines whether file
is the parent directory of child
.
gboolean thunar_file_is_gfile_ancestor (const ThunarFile *file
,GFile *ancestor
);
gboolean thunar_file_is_ancestor (const ThunarFile *file
,const ThunarFile *ancestor
);
Determines whether file
is somewhere inside ancestor
,
possibly with intermediate folders.
gboolean thunar_file_can_execute (ThunarFile *file
,gboolean *ask_execute
);
Determines whether the owner of the current process is allowed
to execute the file
(or enter the directory refered to by
file
). On UNIX it also returns TRUE
if file
refers to a
desktop entry.
gboolean
thunar_file_is_writable (const ThunarFile *file
);
Determines whether the owner of the current process is allowed
to write the file
.
gboolean
thunar_file_is_hidden (const ThunarFile *file
);
Checks whether file
can be considered a hidden file.
gboolean
thunar_file_is_home (const ThunarFile *file
);
Checks whether file
refers to the users home directory.
gboolean
thunar_file_is_regular (const ThunarFile *file
);
Checks whether file
refers to a regular file.
gboolean
thunar_file_is_trash (const ThunarFile *file
);
Returns TRUE
if file
is the trash bin.
gboolean
thunar_file_is_trashed (const ThunarFile *file
);
Returns TRUE
if file
is a local file that resides in
the trash bin.
gboolean
thunar_file_is_recent (const ThunarFile *file
);
Returns TRUE
if file
is the recent folder.
void
thunar_file_add_to_recent (const ThunarFile *file
);
Adds the file to recent:/// if it is not a directory
gboolean
thunar_file_is_desktop_file (const ThunarFile *file
);
Returns TRUE
if file
is a .desktop file.
const gchar *
thunar_file_get_display_name (const ThunarFile *file
);
Returns the file
name in the UTF-8 encoding, which is
suitable for displaying the file name in the GUI.
gchar * thunar_file_get_deletion_date (const ThunarFile *file
,ThunarDateStyle date_style
,const gchar *date_custom_style
);
Returns the deletion date of the file
if the file
is located in the trash. Otherwise NULL
will be
returned.
The caller is responsible to free the returned string
using g_free()
when no longer needed.
file |
a ThunarFile instance. |
|
date_style |
the style used to format the date. |
|
date_custom_style |
custom style to apply, if |
gchar * thunar_file_get_recency (const ThunarFile *file
,ThunarDateStyle date_style
,const gchar *date_custom_style
);
Returns the recency date of the file
if the file
is in the recent:///
location. Recency differs from date accessed and date
modified. It refers to the time of the last metadata change of a file in recent:///
.
file |
a ThunarFile instance. |
|
date_style |
the style used to format the date. |
|
date_custom_style |
custom style to apply, if |
const gchar *
thunar_file_get_original_path (const ThunarFile *file
);
Returns the original path of the file
if the file
is located in the trash. Otherwise NULL
will be
returned.
guint32
thunar_file_get_item_count (const ThunarFile *file
);
Returns the number of items in the trash, if file
refers to the
trash root directory. Otherwise returns 0.
gboolean
thunar_file_is_chmodable (const ThunarFile *file
);
Determines whether the owner of the current process is allowed
to changed the file mode of file
.
gboolean
thunar_file_is_renameable (const ThunarFile *file
);
Determines whether file
can be renamed using
thunar_file_rename()
. Note that the return
value is just a guess and thunar_file_rename()
may fail even if this method returns TRUE
.
gint thunar_file_get_file_count (ThunarFile *file
,GCallback callback
,gpointer data
);
Returns the number of items in the directory Counts the number of files in the directory as fast as possible. Will use cached data to do calculations only when the file has been modified since the last time its contents were counted.
Will return -1 if the file info cannot be loaded
file |
a ThunarFile instance. |
|
callback |
a GCallback to be executed after the file count |
|
data |
a gpointer containing user data to pass to the callback |
void thunar_file_set_file_count (ThunarFile *file
,const guint count
);
Set file
's count to the given number if it is a directory.
Does *NOT* update the file's count timestamp.
GList *
thunar_file_get_emblem_names (ThunarFile *file
);
Determines the names of the emblems that should be displayed for
file
. Sfter usage the returned list must released with g_list_free_full (list,g_free)
const gchar *
thunar_file_get_custom_icon (const ThunarFile *file
);
Queries the custom icon from file
if any, else NULL
is returned.
The custom icon can be either a themed icon name or an absolute path
to an icon file in the local file system.
gboolean thunar_file_set_custom_icon (ThunarFile *file
,const gchar *custom_icon
,GError **error
);
Tries to change the custom icon of the .desktop file referred
to by file
. If that fails, FALSE
is returned and the
error
is set accordingly.
file |
a ThunarFile instance. |
|
custom_icon |
the new custom icon for the |
|
error |
return location for errors or |
void thunar_file_set_is_thumbnail (ThunarFile *file
,gboolean is_thumbnail
);
const gchar * thunar_file_get_thumbnail_path (ThunarFile *file
,ThunarThumbnailSize thumbnail_size
);
ThunarFileThumbState thunar_file_get_thumb_state (const ThunarFile *file
,ThunarThumbnailSize size
);
Returns the current ThunarFileThumbState for file
. This
method is intended to be used by ThunarIconFactory only.
GIcon *
thunar_file_get_preview_icon (const ThunarFile *file
);
Returns the preview icon for file
if any, else NULL
is returned.
const gchar * thunar_file_get_icon_name (ThunarFile *file
,ThunarFileIconState icon_state
,GtkIconTheme *icon_theme
);
Returns the name of the icon that can be used to present file
, based
on the given icon_state
and icon_theme
.
file |
a ThunarFile instance. |
|
icon_state |
the state of the |
|
icon_theme |
the GtkIconTheme on which to lookup up the icon name. |
const gchar *
thunar_file_get_device_type (ThunarFile *file
);
Returns : (transfer none) (nullable): the string of the device type.
void
thunar_file_watch (ThunarFile *file
);
Tells file
to watch itself for changes. Not all ThunarFile
implementations must support this, but if a ThunarFile
implementation implements the thunar_file_watch()
method,
it must also implement the thunar_file_unwatch()
method.
The ThunarFile base class implements automatic "ref
counting" for watches, that says, you can call thunar_file_watch()
multiple times, but the virtual method will be invoked only
once. This also means that you MUST call thunar_file_unwatch()
for every thunar_file_watch()
invokation, else the application
will abort.
void
thunar_file_unwatch (ThunarFile *file
);
See thunar_file_watch()
for a description of how watching
ThunarFiles works.
gboolean
thunar_file_reload (ThunarFile *file
);
Tells file
to reload its internal state, e.g. by reacquiring
the file info from the underlying media.
You must be able to handle the case that file
is
destroyed during the reload call.
void
thunar_file_reload_idle (ThunarFile *file
);
Schedules a single reload of the file
by calling thunar_file_reload
when idle.
void
thunar_file_reload_idle_unref (ThunarFile *file
);
Schedules a reload of the file
by calling thunar_file_reload
when idle. When scheduled function returns file
object will be
unreferenced.
void
thunar_file_destroy (ThunarFile *file
);
Emits the ::destroy signal notifying all reference holders
that they should release their references to the file
.
gint thunar_file_compare_by_type (ThunarFile *file_a
,ThunarFile *file_b
);
Compares items so that directories come before files and ancestors come before descendants.
gint thunar_file_compare_by_name (const ThunarFile *file_a
,const ThunarFile *file_b
,gboolean case_sensitive
);
Compares file_a
and file_b
by their display names. If case_sensitive
is TRUE
the comparison will be case-sensitive.
file_a |
the first ThunarFile. |
|
file_b |
the second ThunarFile. |
|
case_sensitive |
whether the comparison should be case-sensitive. |
ThunarFile *
thunar_file_cache_lookup (const GFile *file
);
Looks up the ThunarFile for file
in the internal file
cache and returns the file present for file
in the
cache or NULL
if no ThunarFile is cached for file
.
Note that no reference is taken for the caller.
This method should not be used but in very rare cases.
Consider using thunar_file_get()
instead.
the ThunarFile for file
in the internal
cache, or NULL
. If you are done with the
file, use g_object_unref to release.
GList *
thunar_file_list_get_applications (GList *file_list
);
Returns the GList of GAppInfos that can be used to open
all ThunarFiles in the given file_list
.
The caller is responsible to free the returned list using something like:
1 |
g_list_free_full (list, g_object_unref); |
GList *
thunar_file_list_to_thunar_g_file_list
(GList *file_list
);
Transforms the file_list
to a GList of GFiles for
the ThunarFiles contained within file_list
.
The caller is responsible to free the returned list using
thunar_g_list_free_full()
when no longer needed.
gboolean
thunar_file_is_desktop (const ThunarFile *file
);
Checks whether file
refers to the users desktop directory.
gchar * thunar_file_get_metadata_setting (ThunarFile *file
,const gchar *setting_name
);
Gets the stored value of the metadata setting setting_name
for file
. Returns NULL
if there is no stored setting. After usage the returned string needs to be released with 'g_free'
file |
a GFile instance. |
|
info |
GFileInfo instance to extract the setting |
|
type |
ThunarGType of the metadata |
|
setting_name |
the name of the setting to get |
void thunar_file_set_metadata_setting (ThunarFile *file
,const gchar *setting_name
,const gchar *setting_value
,gboolean async
);
Sets the setting setting_name
of file
to setting_value
and stores it in
the file
s metadata.
file |
a ThunarFile instance. |
|
setting_name |
the name of the setting to set |
|
setting_value |
the value to set |
|
async |
whether g_file_set_attributes_async or g_file_set_attributes_from_info should be used |
void thunar_file_clear_metadata_setting (ThunarFile *file
,const gchar *setting_name
);
Clear the metadata setting setting_name
of file
void
thunar_file_clear_directory_specific_settings
(ThunarFile *file
);
Clears all directory specific settings stored in the metadata of the folder represented by file
gboolean
thunar_file_has_directory_specific_settings
(ThunarFile *file
);
Checks whether file
has any directory specific settings stored in its metadata.
void thunar_file_move_thumbnail_cache_file (GFile *old_file
,GFile *new_file
);
gint thunar_cmp_files_by_date (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
,ThunarFileDateType type
);
gint thunar_cmp_files_by_date_created (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_date_accessed (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_date_modified (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_date_deleted (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_recency (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_location (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_group (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_mime_type (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_owner (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_permissions (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_size (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_size_in_bytes (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_size_and_items_count (ThunarFile *a
,ThunarFile *b
,gboolean case_sensitive
);
gint thunar_cmp_files_by_type (const ThunarFile *a
,const ThunarFile *b
,gboolean case_sensitive
);
void thunar_file_request_thumbnail (ThunarFile *file
,ThunarThumbnailSize size
);
void thunar_file_update_thumbnail (ThunarFile *file
,ThunarFileThumbState state
,ThunarThumbnailSize size
);
Sets the ThunarFileThumbState for file
to thumb_state
, loads the thumbnail path and triggers a redraw, if required
file |
a ThunarFile. |
|
thumb_state |
the new ThunarFileThumbState. |
|
thumb_size |
the required ThunarThumbnailSize |
void
thunar_file_changed (ThunarFile *file
);
Emits the ::changed signal on file
. This function is meant to be called
by derived classes whenever they notice changes to the file
.
#define thunar_file_is_root(file) (thunar_g_file_is_root (thunar_file_get_file (file)))
Checks whether file
refers to the root directory.
#define thunar_file_has_parent(file) (!thunar_file_is_root (THUNAR_FILE ((file))))
Checks whether it is possible to determine the parent ThunarFile
for file
.
#define thunar_file_dup_uri(file) (g_file_get_uri (thunar_file_get_file (file)))
Returns the URI for the file
. The caller is responsible
to free the returned string when no longer needed.
The various dates that can be queried about a ThunarFile. Note, that not all
ThunarFile implementations support all types listed above. See the documentation
of the thunar_file_get_date()
method for details.
#define THUNAR_FILE_EMBLEM_NAME_SYMBOLIC_LINK "emblem-symbolic-link"
“destroy”
signalvoid user_function (ThunarFile *file, gpointer user_data)
Emitted when file
is destroyed.
file |
the ThunarFile instance. |
|
user_data |
user data set when the signal handler was connected. |
Flags: No Hooks
“thumbnail-updated”
signalvoid user_function (ThunarFile *file, int size, gpointer user_data)
Emitted when the file got a new thumbnail, or the thumbnail was removed
file |
the ThunarFile instance. |
|
size |
The ThunarThumbnailSize for which the thumbnail was updated |
|
user_data |
user data set when the signal handler was connected. |
Flags: No Hooks