placeview: Hide the protocols grid when its empty

Seeing just the bold headings at the bottom of the
popover is confusing, so just hide the entire grid
in this case.
This commit is contained in:
Matthias Clasen 2020-05-08 09:07:29 -04:00
parent d06cdf6318
commit 6efdaa9ffd

View File

@ -1588,32 +1588,54 @@ static void
populate_available_protocols_grid (GtkGrid *grid)
{
const gchar* const *supported_protocols;
gboolean has_any = FALSE;
supported_protocols = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
if (g_strv_contains (supported_protocols, "afp"))
{
attach_protocol_row_to_grid (grid, _("AppleTalk"), "afp://");
has_any = TRUE;
}
if (g_strv_contains (supported_protocols, "ftp"))
{
attach_protocol_row_to_grid (grid, _("File Transfer Protocol"),
/* Translators: do not translate ftp:// and ftps:// */
_("ftp:// or ftps://"));
has_any = TRUE;
}
if (g_strv_contains (supported_protocols, "nfs"))
{
attach_protocol_row_to_grid (grid, _("Network File System"), "nfs://");
has_any = TRUE;
}
if (g_strv_contains (supported_protocols, "smb"))
{
attach_protocol_row_to_grid (grid, _("Samba"), "smb://");
has_any = TRUE;
}
if (g_strv_contains (supported_protocols, "ssh"))
{
attach_protocol_row_to_grid (grid, _("SSH File Transfer Protocol"),
/* Translators: do not translate sftp:// and ssh:// */
_("sftp:// or ssh://"));
has_any = TRUE;
}
if (g_strv_contains (supported_protocols, "dav"))
{
attach_protocol_row_to_grid (grid, _("WebDAV"),
/* Translators: do not translate dav:// and davs:// */
_("dav:// or davs://"));
has_any = TRUE;
}
if (!has_any)
gtk_widget_hide (GTK_WIDGET (grid));
}
static GMenuModel *