[gtk+/wip/gbsneto/other-locations] placesview: fill url entry on recent selection
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/gbsneto/other-locations] placesview: fill url entry on recent selection
- Date: Fri, 3 Jul 2015 03:39:57 +0000 (UTC)
commit 6f9e501d72557fe206a7e6da02aa51fee9655dbc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Jul 3 00:37:45 2015 -0300
placesview: fill url entry on recent selection
When a recent server is selected from the list, it
now copy the selected URI to the address entry. The
next logical step now it to add completion for the
entry.
gtk/gtkplacesview.c | 28 +++++++++++++++++++++++++---
gtk/ui/gtkplacesview.ui | 1 +
2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index 2ab47c2..a750d13 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -61,6 +61,7 @@ struct _GtkPlacesViewPrivate
GtkWidget *network_listbox;
GtkWidget *popup_menu;
GtkWidget *recent_servers_listbox;
+ GtkWidget *recent_servers_popover;
guint local_only : 1;
};
@@ -428,6 +429,7 @@ populate_servers (GtkPlacesView *view)
name = g_bookmark_file_get_title (server_list, uris[i], NULL);
row = gtk_list_box_row_new ();
+ g_object_set_data_full (G_OBJECT (row), "uri", g_strdup (uris[i]), g_free);
grid = g_object_new (GTK_TYPE_GRID,
"orientation", GTK_ORIENTATION_VERTICAL,
@@ -1240,12 +1242,31 @@ out:
static void
on_listbox_row_activated (GtkPlacesView *view,
- GtkPlacesViewRow *row)
+ GtkPlacesViewRow *row,
+ GtkWidget *listbox)
{
+ GtkPlacesViewPrivate *priv;
+
g_return_if_fail (GTK_IS_PLACES_VIEW (view));
- g_return_if_fail (GTK_IS_PLACES_VIEW_ROW (row));
- activate_row (view, row, GTK_PLACES_OPEN_NORMAL);
+ priv = view->priv;
+
+ if (listbox == priv->recent_servers_listbox)
+ {
+ gchar *uri;
+
+ uri = g_object_get_data (G_OBJECT (row), "uri");
+
+ gtk_entry_set_text (GTK_ENTRY (priv->address_entry), uri);
+
+ gtk_widget_hide (priv->recent_servers_popover);
+ }
+ else
+ {
+ g_return_if_fail (GTK_IS_PLACES_VIEW_ROW (row));
+
+ activate_row (view, row, GTK_PLACES_OPEN_NORMAL);
+ }
}
static void
@@ -1348,6 +1369,7 @@ gtk_places_view_class_init (GtkPlacesViewClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, network_grid);
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, network_listbox);
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, recent_servers_listbox);
+ gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, recent_servers_popover);
gtk_widget_class_bind_template_callback (widget_class, on_address_entry_text_changed);
gtk_widget_class_bind_template_callback (widget_class, on_connect_button_clicked);
diff --git a/gtk/ui/gtkplacesview.ui b/gtk/ui/gtkplacesview.ui
index ce4ef83..f51318c 100644
--- a/gtk/ui/gtkplacesview.ui
+++ b/gtk/ui/gtkplacesview.ui
@@ -41,6 +41,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">none</property>
+ <signal name="row-activated" handler="on_listbox_row_activated" object="GtkPlacesView"
swapped="yes" />
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]