forked from AuroraMiddleware/gtk
filechooserentry: Start autocomplete immediately
Don't do idle handlers for this.
This commit is contained in:
parent
9ee577d5ee
commit
242afcfeff
@ -76,8 +76,6 @@ struct _GtkFileChooserEntry
|
|||||||
|
|
||||||
GtkTreeModel *completion_store;
|
GtkTreeModel *completion_store;
|
||||||
|
|
||||||
guint start_autocompletion_idle_id;
|
|
||||||
|
|
||||||
GtkWidget *completion_feedback_window;
|
GtkWidget *completion_feedback_window;
|
||||||
GtkWidget *completion_feedback_label;
|
GtkWidget *completion_feedback_label;
|
||||||
guint completion_feedback_timeout_id;
|
guint completion_feedback_timeout_id;
|
||||||
@ -154,7 +152,7 @@ static void finished_loading_cb (GtkFileSystemModel *model,
|
|||||||
GError *error,
|
GError *error,
|
||||||
GtkFileChooserEntry *chooser_entry);
|
GtkFileChooserEntry *chooser_entry);
|
||||||
static void autocomplete (GtkFileChooserEntry *chooser_entry);
|
static void autocomplete (GtkFileChooserEntry *chooser_entry);
|
||||||
static void install_start_autocompletion_idle (GtkFileChooserEntry *chooser_entry);
|
static void start_autocompletion (GtkFileChooserEntry *chooser_entry);
|
||||||
static void remove_completion_feedback (GtkFileChooserEntry *chooser_entry);
|
static void remove_completion_feedback (GtkFileChooserEntry *chooser_entry);
|
||||||
static void pop_up_completion_feedback (GtkFileChooserEntry *chooser_entry,
|
static void pop_up_completion_feedback (GtkFileChooserEntry *chooser_entry,
|
||||||
const gchar *feedback);
|
const gchar *feedback);
|
||||||
@ -267,12 +265,6 @@ gtk_file_chooser_entry_dispose (GObject *object)
|
|||||||
remove_completion_feedback (chooser_entry);
|
remove_completion_feedback (chooser_entry);
|
||||||
discard_loading_and_current_folder_file (chooser_entry);
|
discard_loading_and_current_folder_file (chooser_entry);
|
||||||
|
|
||||||
if (chooser_entry->start_autocompletion_idle_id != 0)
|
|
||||||
{
|
|
||||||
g_source_remove (chooser_entry->start_autocompletion_idle_id);
|
|
||||||
chooser_entry->start_autocompletion_idle_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chooser_entry->completion_store)
|
if (chooser_entry->completion_store)
|
||||||
{
|
{
|
||||||
g_object_unref (chooser_entry->completion_store);
|
g_object_unref (chooser_entry->completion_store);
|
||||||
@ -826,7 +818,7 @@ gtk_file_chooser_entry_do_insert_text (GtkEditable *editable,
|
|||||||
if ((chooser_entry->action == GTK_FILE_CHOOSER_ACTION_OPEN
|
if ((chooser_entry->action == GTK_FILE_CHOOSER_ACTION_OPEN
|
||||||
|| chooser_entry->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
|
|| chooser_entry->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
|
||||||
&& insert_pos == old_text_len)
|
&& insert_pos == old_text_len)
|
||||||
install_start_autocompletion_idle (chooser_entry);
|
start_autocompletion (chooser_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1608,27 +1600,6 @@ start_autocompletion (GtkFileChooserEntry *chooser_entry)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
start_autocompletion_idle_handler (gpointer data)
|
|
||||||
{
|
|
||||||
GtkFileChooserEntry *chooser_entry = GTK_FILE_CHOOSER_ENTRY (data);
|
|
||||||
|
|
||||||
start_autocompletion (chooser_entry);
|
|
||||||
|
|
||||||
chooser_entry->start_autocompletion_idle_id = 0;
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
install_start_autocompletion_idle (GtkFileChooserEntry *chooser_entry)
|
|
||||||
{
|
|
||||||
if (chooser_entry->start_autocompletion_idle_id != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
chooser_entry->start_autocompletion_idle_id = gdk_threads_add_idle (start_autocompletion_idle_handler, chooser_entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
static gint
|
static gint
|
||||||
insert_text_callback (GtkFileChooserEntry *chooser_entry,
|
insert_text_callback (GtkFileChooserEntry *chooser_entry,
|
||||||
|
Loading…
Reference in New Issue
Block a user