filechooserentry: Keep finished_loading variable ourselves

This will be useful in the next commits when the GtkFolder code
previously keeping that variable gets repalced.
This commit is contained in:
Benjamin Otte
2011-11-03 14:11:57 +01:00
committed by Federico Mena Quintero
parent 0e6d18eaef
commit bdb4727f7f

View File

@@ -87,6 +87,7 @@ struct _GtkFileChooserEntry
GtkWidget *completion_feedback_label;
guint completion_feedback_timeout_id;
guint current_folder_loaded : 1;
guint has_completion : 1;
guint in_change : 1;
guint eat_tabs : 1;
@@ -1078,7 +1079,7 @@ explicitly_complete (GtkFileChooserEntry *chooser_entry)
CommonPrefixResult result;
g_assert (chooser_entry->current_folder != NULL);
g_assert (_gtk_folder_is_finished_loading (chooser_entry->current_folder));
g_assert (chooser_entry->current_folder_loaded);
/* FIXME: see what Emacs does in case there is no common prefix, or there is more than one match:
*
@@ -1151,7 +1152,7 @@ start_explicit_completion (GtkFileChooserEntry *chooser_entry)
case REFRESH_OK:
g_assert (chooser_entry->current_folder_file != NULL);
if (chooser_entry->current_folder && _gtk_folder_is_finished_loading (chooser_entry->current_folder))
if (chooser_entry->current_folder && chooser_entry->current_folder_loaded)
explicitly_complete (chooser_entry);
else
{
@@ -1393,6 +1394,7 @@ finished_loading_cb (GtkFolder *folder,
{
GtkFileChooserEntry *chooser_entry = GTK_FILE_CHOOSER_ENTRY (data);
chooser_entry->current_folder_loaded = TRUE;
finish_folder_load (chooser_entry);
}
@@ -1437,7 +1439,8 @@ load_directory_get_folder_callback (GCancellable *cancellable,
discard_completion_store (chooser_entry);
if (_gtk_folder_is_finished_loading (chooser_entry->current_folder))
chooser_entry->current_folder_loaded = _gtk_folder_is_finished_loading (chooser_entry->current_folder);
if (chooser_entry->current_folder_loaded)
finish_folder_load (chooser_entry);
else
g_signal_connect (chooser_entry->current_folder, "finished-loading",
@@ -1608,7 +1611,7 @@ static void
autocomplete (GtkFileChooserEntry *chooser_entry)
{
if (!(chooser_entry->current_folder != NULL
&& _gtk_folder_is_finished_loading (chooser_entry->current_folder)
&& chooser_entry->current_folder_loaded
&& gtk_editable_get_position (GTK_EDITABLE (chooser_entry)) == gtk_entry_get_text_length (GTK_ENTRY (chooser_entry))))
return;
@@ -1627,7 +1630,7 @@ start_autocompletion (GtkFileChooserEntry *chooser_entry)
case REFRESH_OK:
g_assert (chooser_entry->current_folder_file != NULL);
if (chooser_entry->current_folder && _gtk_folder_is_finished_loading (chooser_entry->current_folder))
if (chooser_entry->current_folder && chooser_entry->current_folder_loaded)
autocomplete (chooser_entry);
else
chooser_entry->load_complete_action = LOAD_COMPLETE_AUTOCOMPLETE;