summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk/gtkfilechooserentry.c15
-rw-r--r--gtk/gtkfilechooserwidget.c3
2 files changed, 14 insertions, 4 deletions
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index 02f9d5542f..01479fdef8 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -115,6 +115,7 @@ static void set_completion_folder (GtkFileChooserEntry *chooser_entry,
static void finished_loading_cb (GtkFileSystemModel *model,
GError *error,
GtkFileChooserEntry *chooser_entry);
+static void _gtk_file_chooser_entry_unselect_text (GtkFileChooserEntry *chooser_entry);
G_DEFINE_TYPE (GtkFileChooserEntry, _gtk_file_chooser_entry, GTK_TYPE_ENTRY)
@@ -483,7 +484,6 @@ static void
gtk_file_chooser_entry_grab_focus (GtkWidget *widget)
{
GTK_WIDGET_CLASS (_gtk_file_chooser_entry_parent_class)->grab_focus (widget);
- _gtk_file_chooser_entry_select_filename (GTK_FILE_CHOOSER_ENTRY (widget));
}
static void
@@ -543,6 +543,7 @@ gtk_file_chooser_entry_focus_out_event (GtkWidget *widget,
GtkFileChooserEntry *chooser_entry = GTK_FILE_CHOOSER_ENTRY (widget);
set_complete_on_load (chooser_entry, FALSE);
+ _gtk_file_chooser_entry_unselect_text (chooser_entry);
return GTK_WIDGET_CLASS (_gtk_file_chooser_entry_parent_class)->focus_out_event (widget, event);
}
@@ -1050,6 +1051,18 @@ _gtk_file_chooser_entry_select_filename (GtkFileChooserEntry *chooser_entry)
gtk_editable_select_region (GTK_EDITABLE (chooser_entry), 0, (gint) len);
}
+/*
+ * _gtk_file_chooser_entry_unselect_text:
+ * @chooser_entry: a #GtkFileChooserEntry
+ *
+ * Unselects any existing text selection.
+ */
+static void
+_gtk_file_chooser_entry_unselect_text (GtkFileChooserEntry *chooser_entry)
+{
+ gtk_editable_select_region (GTK_EDITABLE (chooser_entry), 0, 0);
+}
+
void
_gtk_file_chooser_entry_set_local_only (GtkFileChooserEntry *chooser_entry,
gboolean local_only)
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 6a29f3fcf8..f8cfcb4732 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -5466,9 +5466,6 @@ update_chooser_entry (GtkFileChooserWidget *impl)
g_signal_handlers_block_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
gtk_entry_set_text (GTK_ENTRY (priv->location_entry), priv->browse_files_last_selected_name);
g_signal_handlers_unblock_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
-
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
- _gtk_file_chooser_entry_select_filename (GTK_FILE_CHOOSER_ENTRY (priv->location_entry));
}
return;