[gtk/matthiasc/for-master] placeview: Hide the protocols grid when its empty
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] placeview: Hide the protocols grid when its empty
- Date: Fri, 8 May 2020 13:08:42 +0000 (UTC)
commit 96fb34f91ab76c24ad07a80a3d6ae9870427f2d0
Author: Matthias Clasen <mclasen redhat com>
Date: Fri May 8 09:07:29 2020 -0400
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.
gtk/gtkplacesview.c | 46 ++++++++++++++++++++++++++++++++++------------
1 file changed, 34 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index 6d32dc3b48..b41bd66515 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -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://");
+ {
+ 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://"));
+ {
+ 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://");
+ {
+ 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://");
+ {
+ 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://"));
+ {
+ 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://"));
+ {
+ 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 (grid);
}
static GMenuModel *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]