mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
Merge branch 'matthiasc/for-main' into 'main'
filechooserentry: Add a set_text api See merge request GNOME/gtk!5116
This commit is contained in:
commit
c8cbb3fbba
@ -1017,3 +1017,20 @@ _gtk_file_chooser_entry_set_file_filter (GtkFileChooserEntry *chooser_entry,
|
||||
{
|
||||
chooser_entry->current_filter = filter;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_file_chooser_entry_set_text (GtkFileChooserEntry *entry,
|
||||
const char *text)
|
||||
{
|
||||
GtkEntryCompletion *completion;
|
||||
gboolean popup;
|
||||
|
||||
completion = gtk_entry_get_completion (GTK_ENTRY (entry));
|
||||
popup = gtk_entry_completion_get_popup_completion (completion);
|
||||
|
||||
gtk_entry_completion_set_popup_completion (completion, FALSE);
|
||||
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), text);
|
||||
|
||||
gtk_entry_completion_set_popup_completion (completion, popup);
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ gboolean _gtk_file_chooser_entry_get_is_folder (GtkFileChooserEnt
|
||||
void _gtk_file_chooser_entry_select_filename (GtkFileChooserEntry *chooser_entry);
|
||||
void _gtk_file_chooser_entry_set_file_filter (GtkFileChooserEntry *chooser_entry,
|
||||
GtkFileFilter *filter);
|
||||
void gtk_file_chooser_entry_set_text (GtkFileChooserEntry *entry,
|
||||
const char *text);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -4771,19 +4771,11 @@ update_chooser_entry (GtkFileChooserWidget *impl)
|
||||
|
||||
if (change_entry && !impl->auto_selecting_first_row)
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
GtkEntryCompletion *completion = gtk_entry_get_completion (GTK_ENTRY (impl->location_entry));
|
||||
|
||||
if (completion)
|
||||
gtk_entry_completion_set_popup_completion (completion, FALSE);
|
||||
g_signal_handlers_block_by_func (impl->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
|
||||
gtk_editable_set_text (GTK_EDITABLE (impl->location_entry), impl->browse_files_last_selected_name);
|
||||
g_signal_handlers_unblock_by_func (impl->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
|
||||
if (completion)
|
||||
gtk_entry_completion_set_popup_completion (completion, TRUE);
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_file_chooser_entry_set_text (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->browse_files_last_selected_name);
|
||||
|
||||
g_signal_handlers_unblock_by_func (impl->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
|
||||
|
||||
if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
|
||||
_gtk_file_chooser_entry_select_filename (GTK_FILE_CHOOSER_ENTRY (impl->location_entry));
|
||||
@ -5124,22 +5116,12 @@ gtk_file_chooser_widget_set_current_name (GtkFileChooser *chooser,
|
||||
const char *name)
|
||||
{
|
||||
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
|
||||
GtkEntryCompletion *completion;
|
||||
|
||||
g_return_if_fail (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE);
|
||||
|
||||
pending_select_files_free (impl);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
completion = gtk_entry_get_completion (GTK_ENTRY (impl->location_entry));
|
||||
gtk_entry_completion_set_popup_completion (completion, FALSE);
|
||||
|
||||
gtk_editable_set_text (GTK_EDITABLE (impl->location_entry), name);
|
||||
|
||||
gtk_entry_completion_set_popup_completion (completion, TRUE);
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_file_chooser_entry_set_text (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), name);
|
||||
}
|
||||
|
||||
static char *
|
||||
@ -7122,7 +7104,7 @@ static void
|
||||
location_set_user_text (GtkFileChooserWidget *impl,
|
||||
const char *path)
|
||||
{
|
||||
gtk_editable_set_text (GTK_EDITABLE (impl->location_entry), path);
|
||||
gtk_file_chooser_entry_set_text (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), path);
|
||||
gtk_editable_set_position (GTK_EDITABLE (impl->location_entry), -1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user