Commit 8dc2ea7e authored by Jannis Pohlmann's avatar Jannis Pohlmann

Don't cache the GFileInfo for the filesystem.

Thanks to this, file system information like free space is finally
updated again in the statusbar when the selection or folder changes.
parent 35109c75
......@@ -296,10 +296,6 @@ thunar_file_finalize (GObject *object)
if (file->info != NULL)
g_object_unref (file->info);
/* release filesystem info */
if (file->filesystem_info != NULL)
g_object_unref (file->filesystem_info);
/* free the custom icon name */
g_free (file->custom_icon_name);
......@@ -409,10 +405,9 @@ thunar_file_info_get_filesystem_info (ThunarxFileInfo *file_info)
{
_thunar_return_val_if_fail (THUNAR_IS_FILE (file_info), NULL);
if (THUNAR_FILE (file_info)->filesystem_info != NULL)
return g_object_ref (THUNAR_FILE (file_info)->filesystem_info);
else
return NULL;
return g_file_query_filesystem_info (THUNAR_FILE (file_info)->gfile,
THUNARX_FILESYSTEM_INFO_NAMESPACE,
NULL, NULL);
}
......@@ -628,7 +623,6 @@ thunar_file_get (GFile *gfile,
file = g_object_new (THUNAR_TYPE_FILE, NULL);
file->gfile = g_object_ref (gfile);
file->info = NULL;
file->filesystem_info = NULL;
file->custom_icon_name = NULL;
file->display_name = NULL;
file->basename = NULL;
......@@ -727,13 +721,6 @@ thunar_file_load (ThunarFile *file,
file->info = NULL;
}
/* release the current filesystem info */
if (file->filesystem_info != NULL)
{
g_object_unref (file->filesystem_info);
file->filesystem_info = NULL;
}
/* free the custom icon name */
g_free (file->custom_icon_name);
......@@ -771,12 +758,6 @@ thunar_file_load (ThunarFile *file,
}
}
/* query a new filesystem info */
file->filesystem_info = g_file_query_filesystem_info (file->gfile,
THUNARX_FILESYSTEM_INFO_NAMESPACE,
cancellable,
NULL);
/* determine the basename */
file->basename = g_file_get_basename (file->gfile);
_thunar_assert (file->basename != NULL);
......@@ -1902,16 +1883,28 @@ gboolean
thunar_file_get_free_space (const ThunarFile *file,
guint64 *free_space_return)
{
GFileInfo *filesystem_info;
gboolean success = FALSE;
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
if (file->filesystem_info == NULL)
return FALSE;
filesystem_info = g_file_query_filesystem_info (file->gfile,
THUNARX_FILESYSTEM_INFO_NAMESPACE,
NULL, NULL);
*free_space_return = g_file_info_get_attribute_uint64 (file->filesystem_info,
G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
return g_file_info_has_attribute (file->filesystem_info,
G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
if (filesystem_info != NULL)
{
*free_space_return =
g_file_info_get_attribute_uint64 (filesystem_info,
G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
success = g_file_info_has_attribute (filesystem_info,
G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
g_object_unref (filesystem_info);
}
return success;
}
......
......@@ -114,7 +114,6 @@ struct _ThunarFile
/*< private >*/
GFileMonitor *monitor;
GFileInfo *info;
GFileInfo *filesystem_info;
GFile *gfile;
gchar *custom_icon_name;
gchar *display_name;
......
......@@ -291,7 +291,7 @@ ttj_copy_file (ThunarTransferJob *job,
&& target_type == G_FILE_TYPE_DIRECTORY))
{
/* we tried to overwrite a directory with a directory. this normally results
* in a merge. ignore the error we actually *want* to merge */
* in a merge. ignore the error if we actually *want* to merge */
if (merge_directories)
g_clear_error (&err);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment