filechooser: When stopping/clearing BROWSE model, really ensure that we end up in LOAD_EMPTY state
Previously we could end up in a situation where browse_list_model==NULL, and yet load_state==LOAD_FINISHED. This is not a valid state. So, when we get rid of the list model, really ensure that we end up in LOAD_EMPTY so nothing assumes that there is a valid list model around. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
parent
039cc929ad
commit
2deb41fe63
@ -392,7 +392,7 @@ static void remove_bookmark_button_clicked_cb (GtkButton *button,
|
|||||||
|
|
||||||
static void update_cell_renderer_attributes (GtkFileChooserDefault *impl);
|
static void update_cell_renderer_attributes (GtkFileChooserDefault *impl);
|
||||||
|
|
||||||
static void load_remove_timer (GtkFileChooserDefault *impl);
|
static void load_remove_timer (GtkFileChooserDefault *impl, LoadState new_load_state);
|
||||||
static void browse_files_center_selected_row (GtkFileChooserDefault *impl);
|
static void browse_files_center_selected_row (GtkFileChooserDefault *impl);
|
||||||
|
|
||||||
static void location_button_toggled_cb (GtkToggleButton *toggle,
|
static void location_button_toggled_cb (GtkToggleButton *toggle,
|
||||||
@ -6316,9 +6316,9 @@ load_setup_timer (GtkFileChooserDefault *impl)
|
|||||||
impl->load_state = LOAD_PRELOAD;
|
impl->load_state = LOAD_PRELOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Removes the load timeout and switches to the LOAD_FINISHED state */
|
/* Removes the load timeout; changes the impl->load_state to the specified value. */
|
||||||
static void
|
static void
|
||||||
load_remove_timer (GtkFileChooserDefault *impl)
|
load_remove_timer (GtkFileChooserDefault *impl, LoadState new_load_state)
|
||||||
{
|
{
|
||||||
if (impl->load_timeout_id != 0)
|
if (impl->load_timeout_id != 0)
|
||||||
{
|
{
|
||||||
@ -6326,12 +6326,16 @@ load_remove_timer (GtkFileChooserDefault *impl)
|
|||||||
|
|
||||||
g_source_remove (impl->load_timeout_id);
|
g_source_remove (impl->load_timeout_id);
|
||||||
impl->load_timeout_id = 0;
|
impl->load_timeout_id = 0;
|
||||||
impl->load_state = LOAD_EMPTY;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_assert (impl->load_state == LOAD_EMPTY ||
|
g_assert (impl->load_state == LOAD_EMPTY ||
|
||||||
impl->load_state == LOAD_LOADING ||
|
impl->load_state == LOAD_LOADING ||
|
||||||
impl->load_state == LOAD_FINISHED);
|
impl->load_state == LOAD_FINISHED);
|
||||||
|
|
||||||
|
g_assert (new_load_state == LOAD_EMPTY ||
|
||||||
|
new_load_state == LOAD_LOADING ||
|
||||||
|
new_load_state == LOAD_FINISHED);
|
||||||
|
impl->load_state = new_load_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Selects the first row in the file list */
|
/* Selects the first row in the file list */
|
||||||
@ -6546,7 +6550,7 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
|
|||||||
|
|
||||||
if (impl->load_state == LOAD_PRELOAD)
|
if (impl->load_state == LOAD_PRELOAD)
|
||||||
{
|
{
|
||||||
load_remove_timer (impl);
|
load_remove_timer (impl, LOAD_FINISHED);
|
||||||
load_set_model (impl);
|
load_set_model (impl);
|
||||||
}
|
}
|
||||||
else if (impl->load_state == LOAD_LOADING)
|
else if (impl->load_state == LOAD_LOADING)
|
||||||
@ -6579,7 +6583,7 @@ static void
|
|||||||
stop_loading_and_clear_list_model (GtkFileChooserDefault *impl,
|
stop_loading_and_clear_list_model (GtkFileChooserDefault *impl,
|
||||||
gboolean remove_from_treeview)
|
gboolean remove_from_treeview)
|
||||||
{
|
{
|
||||||
load_remove_timer (impl); /* This changes the state to LOAD_EMPTY */
|
load_remove_timer (impl, LOAD_EMPTY);
|
||||||
|
|
||||||
if (impl->browse_files_model)
|
if (impl->browse_files_model)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user