forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
dfdc7c3e0d
commit
7449add82b
@ -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);
|
||||
|
@ -15,6 +15,247 @@
|
||||
<property name="inline_completion">1</property>
|
||||
<property name="popup_completion">0</property>
|
||||
</object>
|
||||
<object class="GtkPopover" id="server_adresses_popover">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="relative_to">address_entry</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Server Addresses</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Server addresses are made up of a protocol prefix and an address. Examples:
|
||||
|
||||
smb://foo.example.com, ssh://192.168.0.1</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="width_chars">40</property>
|
||||
<property name="max_width_chars">40</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Available Protocols</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">AppleTalk</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">File Transfer Protocol</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Samba</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Secure File Transfer Protocol</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Secure Shell</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">WebDav</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Prefix</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">afp://</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">ftp://</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">smb://</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">sftp://</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">ssh://</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">http:// or https://</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="recent_servers_popover">
|
||||
<child>
|
||||
<object class="GtkStack" id="recent_servers_stack">
|
||||
@ -245,6 +486,7 @@
|
||||
<property name="hexpand">1</property>
|
||||
<property name="width_chars">20</property>
|
||||
<property name="placeholder_text" translatable="yes">Enter server address…</property>
|
||||
<property name="secondary_icon_name" translatable="yes">dialog-question-symbolic</property>
|
||||
<property name="completion">address_entry_completion</property>
|
||||
<signal name="notify::text" handler="on_address_entry_text_changed" object="GtkPlacesView" swapped="yes"/>
|
||||
<signal name="activate" handler="on_connect_button_clicked" object="GtkPlacesView" swapped="yes"/>
|
||||
|
Loading…
Reference in New Issue
Block a user