Commit b2012f58 authored by Harald Judt's avatar Harald Judt

Implement reloading file information on manual reload

parent b839b29d
...@@ -109,6 +109,7 @@ struct _ThunarFolder ...@@ -109,6 +109,7 @@ struct _ThunarFolder
ThunarFile *corresponding_file; ThunarFile *corresponding_file;
GList *new_files; GList *new_files;
GList *files; GList *files;
gboolean reload_info;
GList *content_type_ptr; GList *content_type_ptr;
guint content_type_idle_id; guint content_type_idle_id;
...@@ -248,6 +249,7 @@ thunar_folder_init (ThunarFolder *folder) ...@@ -248,6 +249,7 @@ thunar_folder_init (ThunarFolder *folder)
g_signal_connect (G_OBJECT (folder->file_monitor), "file-destroyed", G_CALLBACK (thunar_folder_file_destroyed), folder); g_signal_connect (G_OBJECT (folder->file_monitor), "file-destroyed", G_CALLBACK (thunar_folder_file_destroyed), folder);
folder->monitor = NULL; folder->monitor = NULL;
folder->reload_info = FALSE;
} }
...@@ -545,6 +547,18 @@ thunar_folder_finished (ExoJob *job, ...@@ -545,6 +547,18 @@ thunar_folder_finished (ExoJob *job,
} }
} }
/* schedule a reload of the file information of all files if requested */
if (folder->reload_info)
{
for (lp = folder->files; lp != NULL; lp = lp->next)
thunar_file_reload_idle (lp->data);
/* reload folder information too */
thunar_file_reload_idle (folder->corresponding_file);
folder->reload_info = FALSE;
}
/* we did it, the folder is loaded */ /* we did it, the folder is loaded */
g_signal_handlers_disconnect_matched (folder->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, folder); g_signal_handlers_disconnect_matched (folder->job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, folder);
g_object_unref (folder->job); g_object_unref (folder->job);
...@@ -578,7 +592,7 @@ thunar_folder_file_changed (ThunarFileMonitor *file_monitor, ...@@ -578,7 +592,7 @@ thunar_folder_file_changed (ThunarFileMonitor *file_monitor,
if (G_UNLIKELY (folder->corresponding_file == file)) if (G_UNLIKELY (folder->corresponding_file == file))
{ {
/* ...and if so, reload the folder */ /* ...and if so, reload the folder */
thunar_folder_reload (folder); thunar_folder_reload (folder, FALSE);
} }
} }
...@@ -855,7 +869,7 @@ thunar_folder_get_for_file (ThunarFile *file) ...@@ -855,7 +869,7 @@ thunar_folder_get_for_file (ThunarFile *file)
g_object_set_qdata (G_OBJECT (file), thunar_folder_quark, folder); g_object_set_qdata (G_OBJECT (file), thunar_folder_quark, folder);
/* schedule the loading of the folder */ /* schedule the loading of the folder */
thunar_folder_reload (folder); thunar_folder_reload (folder, FALSE);
} }
return folder; return folder;
...@@ -923,15 +937,20 @@ thunar_folder_get_loading (const ThunarFolder *folder) ...@@ -923,15 +937,20 @@ thunar_folder_get_loading (const ThunarFolder *folder)
/** /**
* thunar_folder_reload: * thunar_folder_reload:
* @folder : a #ThunarFolder instance. * @folder : a #ThunarFolder instance.
* @reload_info : reload all information for the files too
* *
* Tells the @folder object to reread the directory * Tells the @folder object to reread the directory
* contents from the underlying media. * contents from the underlying media.
**/ **/
void void
thunar_folder_reload (ThunarFolder *folder) thunar_folder_reload (ThunarFolder *folder,
gboolean reload_info)
{ {
_thunar_return_if_fail (THUNAR_IS_FOLDER (folder)); _thunar_return_if_fail (THUNAR_IS_FOLDER (folder));
/* reload file info too? */
folder->reload_info = reload_info;
/* stop metadata collector */ /* stop metadata collector */
if (folder->content_type_idle_id != 0) if (folder->content_type_idle_id != 0)
g_source_remove (folder->content_type_idle_id); g_source_remove (folder->content_type_idle_id);
......
...@@ -42,7 +42,8 @@ ThunarFile *thunar_folder_get_corresponding_file (const ThunarFolder *folder); ...@@ -42,7 +42,8 @@ ThunarFile *thunar_folder_get_corresponding_file (const ThunarFolder *folder);
GList *thunar_folder_get_files (const ThunarFolder *folder); GList *thunar_folder_get_files (const ThunarFolder *folder);
gboolean thunar_folder_get_loading (const ThunarFolder *folder); gboolean thunar_folder_get_loading (const ThunarFolder *folder);
void thunar_folder_reload (ThunarFolder *folder); void thunar_folder_reload (ThunarFolder *folder,
gboolean reload_info);
G_END_DECLS; G_END_DECLS;
......
...@@ -1714,7 +1714,7 @@ thunar_standard_view_reload (ThunarView *view, ...@@ -1714,7 +1714,7 @@ thunar_standard_view_reload (ThunarView *view,
/* determine the folder for the view model */ /* determine the folder for the view model */
folder = thunar_list_model_get_folder (standard_view->model); folder = thunar_list_model_get_folder (standard_view->model);
if (G_LIKELY (folder != NULL)) if (G_LIKELY (folder != NULL))
thunar_folder_reload (folder); thunar_folder_reload (folder, reload_info);
/* schedule thumbnail reload update */ /* schedule thumbnail reload update */
if (!standard_view->priv->thumbnailing_scheduled) if (!standard_view->priv->thumbnailing_scheduled)
...@@ -3286,7 +3286,7 @@ thunar_standard_view_drag_data_received (GtkWidget *view, ...@@ -3286,7 +3286,7 @@ thunar_standard_view_drag_data_received (GtkWidget *view,
{ {
/* reload the folder corresponding to the file */ /* reload the folder corresponding to the file */
folder = thunar_folder_get_for_file (file); folder = thunar_folder_get_for_file (file);
thunar_folder_reload (folder); thunar_folder_reload (folder, FALSE);
g_object_unref (G_OBJECT (folder)); g_object_unref (G_OBJECT (folder));
} }
......
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