Commit b839b29d authored by Harald Judt's avatar Harald Judt

Extend reload functions to allow a full reload

Usually a folder is reloaded automatically on file changes, and the user
shouldn't have to do it manually. However, when the user *wants* to do
it manually, everything is expected to be reloaded, even the files in
cache, because their info may have changed. At the moment, this does not
happen, and there can be various issues with cached file info, so extension
is a first step to allow the user to decide to reload everything in the
folder.
parent 2283dcdb
......@@ -497,7 +497,7 @@ thunar_application_launch_finished (ThunarJob *job,
/* the job completed, refresh the interface
* directly to make it feel snappy */
thunar_view_reload (view);
thunar_view_reload (view, FALSE);
}
......
......@@ -139,7 +139,8 @@ static ThunarZoomLevel thunar_standard_view_get_zoom_level (Thu
static void thunar_standard_view_set_zoom_level (ThunarView *view,
ThunarZoomLevel zoom_level);
static void thunar_standard_view_reset_zoom_level (ThunarView *view);
static void thunar_standard_view_reload (ThunarView *view);
static void thunar_standard_view_reload (ThunarView *view,
gboolean reload_info);
static gboolean thunar_standard_view_get_visible_range (ThunarView *view,
ThunarFile **start_file,
ThunarFile **end_file);
......@@ -1704,7 +1705,8 @@ thunar_standard_view_reset_zoom_level (ThunarView *view)
static void
thunar_standard_view_reload (ThunarView *view)
thunar_standard_view_reload (ThunarView *view,
gboolean reload_info)
{
ThunarStandardView *standard_view = THUNAR_STANDARD_VIEW (view);
ThunarFolder *folder;
......@@ -2954,7 +2956,7 @@ thunar_standard_view_new_files (ThunarStandardView *standard_view,
/* when performing dnd between 2 views, we force a reload on the source as well */
source_view = g_object_get_data (G_OBJECT (standard_view), I_("source-view"));
if (THUNAR_IS_VIEW (source_view))
thunar_view_reload (THUNAR_VIEW (source_view));
thunar_view_reload (THUNAR_VIEW (source_view), FALSE);
}
......
......@@ -253,15 +253,18 @@ thunar_view_reset_zoom_level (ThunarView *view)
/**
* thunar_view_reload:
* @view : a #ThunarView instance.
* @reload_info : whether to reload file info for all files too
*
* Tells @view to reread the currently displayed folder
* contents from the underlying media.
* contents from the underlying media. If reload_info is
* TRUE, it will reload information for all files too.
**/
void
thunar_view_reload (ThunarView *view)
thunar_view_reload (ThunarView *view,
gboolean reload_info)
{
_thunar_return_if_fail (THUNAR_IS_VIEW (view));
(*THUNAR_VIEW_GET_IFACE (view)->reload) (view);
(*THUNAR_VIEW_GET_IFACE (view)->reload) (view, reload_info);
}
......
......@@ -51,7 +51,8 @@ struct _ThunarViewIface
ThunarZoomLevel zoom_level);
void (*reset_zoom_level) (ThunarView *view);
void (*reload) (ThunarView *view);
void (*reload) (ThunarView *view,
gboolean reload_info);
gboolean (*get_visible_range) (ThunarView *view,
ThunarFile **start_file,
......@@ -79,7 +80,8 @@ void thunar_view_set_zoom_level (ThunarView *view,
ThunarZoomLevel zoom_level);
void thunar_view_reset_zoom_level (ThunarView *view);
void thunar_view_reload (ThunarView *view);
void thunar_view_reload (ThunarView *view,
gboolean reload_info);
gboolean thunar_view_get_visible_range (ThunarView *view,
ThunarFile **start_file,
......
......@@ -104,7 +104,8 @@ static void thunar_window_set_property (GObject
const GValue *value,
GParamSpec *pspec);
static gboolean thunar_window_back (ThunarWindow *window);
static gboolean thunar_window_reload (ThunarWindow *window);
static gboolean thunar_window_reload (ThunarWindow *window,
gboolean reload_info);
static gboolean thunar_window_toggle_sidepane (ThunarWindow *window);
static gboolean thunar_window_toggle_menubar (ThunarWindow *window);
static void thunar_window_toggle_menubar_deactivate (GtkWidget *menubar,
......@@ -257,7 +258,8 @@ struct _ThunarWindowClass
/* internal action signals */
gboolean (*back) (ThunarWindow *window);
gboolean (*reload) (ThunarWindow *window);
gboolean (*reload) (ThunarWindow *window,
gboolean reload_info);
gboolean (*toggle_sidepane) (ThunarWindow *window);
gboolean (*toggle_menubar) (ThunarWindow *window);
gboolean (*zoom_in) (ThunarWindow *window);
......@@ -514,8 +516,9 @@ thunar_window_class_init (ThunarWindowClass *klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (ThunarWindowClass, reload),
g_signal_accumulator_true_handled, NULL,
_thunar_marshal_BOOLEAN__VOID,
G_TYPE_BOOLEAN, 0);
_thunar_marshal_BOOLEAN__BOOLEAN,
G_TYPE_BOOLEAN, 1,
G_TYPE_BOOLEAN);
/**
* ThunarWindow::toggle-sidepane:
......@@ -1130,14 +1133,15 @@ thunar_window_back (ThunarWindow *window)
static gboolean
thunar_window_reload (ThunarWindow *window)
thunar_window_reload (ThunarWindow *window,
gboolean reload_info)
{
_thunar_return_val_if_fail (THUNAR_IS_WINDOW (window), FALSE);
/* force the view to reload */
if (G_LIKELY (window->view != NULL))
{
thunar_view_reload (THUNAR_VIEW (window->view));
thunar_view_reload (THUNAR_VIEW (window->view), reload_info);
return TRUE;
}
......@@ -2478,7 +2482,7 @@ thunar_window_action_reload (GtkAction *action,
_thunar_return_if_fail (THUNAR_IS_WINDOW (window));
/* force the view to reload */
g_signal_emit (G_OBJECT (window), window_signals[RELOAD], 0, &result);
g_signal_emit (G_OBJECT (window), window_signals[RELOAD], 0, TRUE, &result);
/* update the location bar to show the current directory */
if (window->location_bar != NULL)
......
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