summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechooserentry.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnu.org>2008-03-13 00:38:31 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2008-03-13 00:38:31 +0000
commit11a9457ee1f3ffe3066bd092ac62496325ea9159 (patch)
tree466f8b3245d8deb4d2d4c78a3aae26d9a7004b11 /gtk/gtkfilechooserentry.c
parente7009432b2c9b8f6d18b082e40a2472acea053c5 (diff)
downloadgtk+-11a9457ee1f3ffe3066bd092ac62496325ea9159.tar.gz
Clear pending completions thoroughly
Signed-off-by: Federico Mena Quintero <federico@gnu.org> svn path=/trunk/; revision=19828
Diffstat (limited to 'gtk/gtkfilechooserentry.c')
-rw-r--r--gtk/gtkfilechooserentry.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index 03397c3f51..6ce875822b 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -595,6 +595,13 @@ gtk_file_chooser_entry_do_insert_text (GtkEditable *editable,
}
static void
+clear_completions (GtkFileChooserEntry *chooser_entry)
+{
+ chooser_entry->has_completion = FALSE;
+ chooser_entry->load_complete_action = LOAD_COMPLETE_NOTHING;
+}
+
+static void
gtk_file_chooser_entry_do_delete_text (GtkEditable *editable,
gint start_pos,
gint end_pos)
@@ -606,7 +613,7 @@ gtk_file_chooser_entry_do_delete_text (GtkEditable *editable,
if (chooser_entry->in_change)
return;
- chooser_entry->load_complete_action = LOAD_COMPLETE_NOTHING;
+ clear_completions (chooser_entry);
}
static void
@@ -620,7 +627,7 @@ gtk_file_chooser_entry_set_position (GtkEditable *editable,
if (chooser_entry->in_change)
return;
- chooser_entry->load_complete_action = LOAD_COMPLETE_NOTHING;
+ clear_completions (chooser_entry);
}
static void
@@ -635,7 +642,7 @@ gtk_file_chooser_entry_set_selection_bounds (GtkEditable *editable,
if (chooser_entry->in_change)
return;
- chooser_entry->load_complete_action = LOAD_COMPLETE_NOTHING;
+ clear_completions (chooser_entry);
}
static void
@@ -680,10 +687,13 @@ gtk_file_chooser_entry_focus (GtkWidget *widget,
if (chooser_entry->has_completion)
{
+ gboolean has_selection;
gint sel_end;
- if (gtk_editable_get_selection_bounds (editable, NULL, &sel_end))
- gtk_editable_set_position (editable, sel_end);
+ has_selection = gtk_editable_get_selection_bounds (editable, NULL, &sel_end);
+ g_assert (has_selection && sel_end == GTK_ENTRY (entry)->text_length);
+
+ gtk_editable_set_position (editable, sel_end);
}
else
{