[gtk+/wip/otherlocations-fixes: 4/6] gtkplacesview: add a clear button to address entry
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otherlocations-fixes: 4/6] gtkplacesview: add a clear button to address entry
- Date: Thu, 24 Sep 2015 13:02:11 +0000 (UTC)
commit 0fc59460c969a93fade31756cd98a990ec973e0d
Author: Carlos Soriano <csoriano gnome org>
Date: Thu Sep 24 11:26:59 2015 +0200
gtkplacesview: add a clear button to address entry
So it allows a quick way to clear the entry.
gtk/gtkplacesview.c | 10 ++++++++++
gtk/ui/gtkplacesview.ui | 2 ++
2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index 328b52a..ff3b9b1 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -1870,6 +1870,15 @@ out:
}
static void
+on_address_entry_clear_pressed (GtkPlacesView *view,
+ GtkEntryIconPosition icon_pos,
+ GdkEvent *event,
+ GtkEntry *entry)
+{
+ gtk_entry_set_text (entry, "");
+}
+
+static void
on_recent_servers_listbox_row_activated (GtkPlacesView *view,
GtkPlacesViewRow *row,
GtkWidget *listbox)
@@ -2243,6 +2252,7 @@ gtk_places_view_class_init (GtkPlacesViewClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkPlacesView, stack);
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);
gtk_widget_class_bind_template_callback (widget_class, on_connect_button_clicked);
gtk_widget_class_bind_template_callback (widget_class, on_key_press_event);
gtk_widget_class_bind_template_callback (widget_class, on_listbox_row_activated);
diff --git a/gtk/ui/gtkplacesview.ui b/gtk/ui/gtkplacesview.ui
index 6978255..58665e7 100644
--- a/gtk/ui/gtkplacesview.ui
+++ b/gtk/ui/gtkplacesview.ui
@@ -245,8 +245,10 @@
<property name="width_chars">20</property>
<property name="placeholder_text" translatable="yes">Enter server address…</property>
<property name="completion">address_entry_completion</property>
+ <property name="secondary-icon-name">edit-clear-symbolic</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"/>
+ <signal name="icon-press" handler="on_address_entry_clear_pressed" object="GtkPlacesView"
swapped="yes"/>
</object>
</child>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]