Merge branch 'matthiasc/for-master' into 'master'

Miscellaneous bug fixes

Closes #2666 and #2016

See merge request GNOME/gtk!1773
This commit is contained in:
Matthias Clasen 2020-04-27 12:11:37 +00:00
commit 5a25c7fd64
3 changed files with 38 additions and 9 deletions

View File

@ -647,14 +647,14 @@ gtk_file_chooser_remove_shortcut_folder (GtkFileChooser *chooser,
/**
* gtk_file_chooser_add_filter:
* @chooser: a #GtkFileChooser
* @filter: (transfer full): a #GtkFileFilter
* @filter: (transfer none): a #GtkFileFilter
*
* Adds @filter to the list of filters that the user can select between.
* When a filter is selected, only files that are passed by that
* filter are displayed.
*
* Note that the @chooser takes ownership of the filter, so you have to
* ref and sink it if you want to keep a reference.
* Note that the @chooser takes ownership of the filter if it is floating,
* so you have to ref and sink it if you want to keep a reference.
**/
void
gtk_file_chooser_add_filter (GtkFileChooser *chooser,

View File

@ -7658,6 +7658,26 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
}
static gboolean
captured_key (GtkEventControllerKey *controller,
guint keyval,
guint keycode,
GdkModifierType state,
gpointer data)
{
GtkFileChooserWidget *impl = data;
gboolean handled;
if (impl->operation_mode == OPERATION_MODE_SEARCH)
return GDK_EVENT_PROPAGATE;
handled = gtk_event_controller_key_forward (controller, GTK_WIDGET (impl->search_entry));
if (handled == GDK_EVENT_STOP)
operation_mode_set (impl, OPERATION_MODE_SEARCH);
return handled;
}
static void
post_process_ui (GtkFileChooserWidget *impl)
{
@ -7735,6 +7755,12 @@ post_process_ui (GtkFileChooserWidget *impl)
gtk_search_entry_set_key_capture_widget (GTK_SEARCH_ENTRY (impl->search_entry), impl->search_entry);
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed", G_CALLBACK (captured_key), impl);
g_signal_connect (controller, "key-released", G_CALLBACK (captured_key), impl);
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
gtk_widget_add_controller (GTK_WIDGET (impl), controller);
gtk_widget_set_parent (impl->rename_file_popover, GTK_WIDGET (impl));
gesture = gtk_gesture_click_new ();

View File

@ -1649,8 +1649,9 @@ populate_available_protocols_grid (GtkGrid *grid)
attach_protocol_row_to_grid (grid, _("AppleTalk"), "afp://");
if (g_strv_contains (supported_protocols, "ftp"))
/* Translators: do not translate ftp:// and ftps:// */
attach_protocol_row_to_grid (grid, _("File Transfer Protocol"), _("ftp:// or ftps://"));
attach_protocol_row_to_grid (grid, _("File Transfer Protocol"),
/* Translators: do not translate ftp:// and ftps:// */
_("ftp:// or ftps://"));
if (g_strv_contains (supported_protocols, "nfs"))
attach_protocol_row_to_grid (grid, _("Network File System"), "nfs://");
@ -1659,12 +1660,14 @@ populate_available_protocols_grid (GtkGrid *grid)
attach_protocol_row_to_grid (grid, _("Samba"), "smb://");
if (g_strv_contains (supported_protocols, "ssh"))
/* Translators: do not translate sftp:// and ssh:// */
attach_protocol_row_to_grid (grid, _("SSH File Transfer Protocol"), _("sftp:// or ssh://"));
attach_protocol_row_to_grid (grid, _("SSH File Transfer Protocol"),
/* Translators: do not translate sftp:// and ssh:// */
_("sftp:// or ssh://"));
if (g_strv_contains (supported_protocols, "dav"))
/* Translators: do not translate dav:// and davs:// */
attach_protocol_row_to_grid (grid, _("WebDAV"), _("dav:// or davs://"));
attach_protocol_row_to_grid (grid, _("WebDAV"),
/* Translators: do not translate dav:// and davs:// */
_("dav:// or davs://"));
}
static GMenuModel *