From 7449add82ba4ce15d47f1b1cdb4f7e389e2b8628 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 26 Apr 2016 09:57:36 -0300 Subject: [PATCH] placesview: provide guidance on server addresses GtkPlacesView currently provides no example of server addresses, which may confuse users. To fix that, add a helper popover with some guidance on server addresses. https://bugzilla.gnome.org/show_bug.cgi?id=756570 --- gtk/gtkplacesview.c | 24 ++-- gtk/ui/gtkplacesview.ui | 242 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 256 insertions(+), 10 deletions(-) diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c index b91394f7e7..79d2e21944 100644 --- a/gtk/gtkplacesview.c +++ b/gtk/gtkplacesview.c @@ -69,6 +69,7 @@ struct _GtkPlacesViewPrivate GtkWidget *recent_servers_popover; GtkWidget *recent_servers_stack; GtkWidget *stack; + GtkWidget *server_adresses_popover; GtkWidget *network_placeholder; GtkWidget *network_placeholder_label; @@ -1812,15 +1813,6 @@ on_address_entry_text_changed (GtkPlacesView *view) address = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->address_entry))); scheme = g_uri_parse_scheme (address); - if (strlen (address) > 0) - gtk_entry_set_icon_from_icon_name (GTK_ENTRY (priv->address_entry), - GTK_ENTRY_ICON_SECONDARY, - "edit-clear-symbolic"); - else - gtk_entry_set_icon_from_icon_name (GTK_ENTRY (priv->address_entry), - GTK_ENTRY_ICON_SECONDARY, - NULL); - if (!supported_protocols) goto out; @@ -1842,7 +1834,18 @@ on_address_entry_clear_pressed (GtkPlacesView *view, GdkEvent *event, GtkEntry *entry) { - gtk_entry_set_text (entry, ""); + GtkPlacesViewPrivate *priv; + GdkRectangle rect; + + priv = gtk_places_view_get_instance_private (view); + + /* Setup the auxiliary popover's rectangle */ + gtk_entry_get_icon_area (GTK_ENTRY (priv->address_entry), + GTK_ENTRY_ICON_SECONDARY, + &rect); + + gtk_popover_set_pointing_to (GTK_POPOVER (priv->server_adresses_popover), &rect); + gtk_widget_set_visible (priv->server_adresses_popover, TRUE); } static void @@ -2217,6 +2220,7 @@ gtk_places_view_class_init (GtkPlacesViewClass *klass) gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, recent_servers_popover); gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, recent_servers_stack); gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, stack); + gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, server_adresses_popover); gtk_widget_class_bind_template_callback (widget_class, on_address_entry_text_changed); gtk_widget_class_bind_template_callback (widget_class, on_address_entry_clear_pressed); diff --git a/gtk/ui/gtkplacesview.ui b/gtk/ui/gtkplacesview.ui index 90cd44226d..c31a335d86 100644 --- a/gtk/ui/gtkplacesview.ui +++ b/gtk/ui/gtkplacesview.ui @@ -15,6 +15,247 @@ 1 0 + + False + address_entry + + + True + False + 12 + vertical + 12 + + + True + False + True + Server Addresses + + + + + + + False + True + 0 + + + + + True + False + True + Server addresses are made up of a protocol prefix and an address. Examples: + +smb://foo.example.com, ssh://192.168.0.1 + True + 40 + 40 + 0 + + + False + True + 1 + + + + + True + False + 6 + True + 6 + 12 + + + True + False + True + Available Protocols + 0 + + + + + + 0 + 0 + + + + + True + False + AppleTalk + 0 + + + 0 + 1 + + + + + True + False + File Transfer Protocol + 0 + + + 0 + 2 + + + + + True + False + Samba + 0 + + + 0 + 3 + + + + + True + False + Secure File Transfer Protocol + 0 + + + 0 + 4 + + + + + True + False + Secure Shell + 0 + + + 0 + 5 + + + + + True + False + WebDav + 0 + + + 0 + 6 + + + + + True + False + Prefix + 0 + + + + + + 1 + 0 + + + + + True + False + afp:// + 0 + + + 1 + 1 + + + + + True + False + ftp:// + 0 + + + 1 + 2 + + + + + True + False + smb:// + 0 + + + 1 + 3 + + + + + True + False + sftp:// + 0 + + + 1 + 4 + + + + + True + False + ssh:// + 0 + + + 1 + 5 + + + + + True + False + http:// or https:// + 0 + + + 1 + 6 + + + + + False + True + 2 + + + + + @@ -245,6 +486,7 @@ 1 20 Enter server address… + dialog-question-symbolic address_entry_completion