summaryrefslogtreecommitdiff
path: root/src/nautilus-location-entry.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2009-05-28 15:55:55 +0200
committerCosimo Cecchi <cosimoc@gnome.org>2009-05-28 15:55:55 +0200
commit0133e979531cd41ca7f1d76ff5adf66ddfa7d67a (patch)
tree601d6851c82566070e15f55705d6031e1cca5be2 /src/nautilus-location-entry.c
parent7b86b78e2ff6a0f1b45ac8f8a9c30cf3d0c6ae96 (diff)
downloadnautilus-0133e979531cd41ca7f1d76ff5adf66ddfa7d67a.tar.gz
Clear text in the location entry
Add a clear text icon in the location entry, now that the icon entry is available in GTK+ 2.16 (#145732).
Diffstat (limited to 'src/nautilus-location-entry.c')
-rw-r--r--src/nautilus-location-entry.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index 247eafd9d..5f6392e57 100644
--- a/src/nautilus-location-entry.c
+++ b/src/nautilus-location-entry.c
@@ -282,6 +282,15 @@ nautilus_location_entry_text_changed (NautilusLocationEntry *entry,
entry->details->has_special_text = FALSE;
}
+static void
+nautilus_location_entry_icon_release (GtkEntry *gentry,
+ GtkEntryIconPosition position,
+ GdkEvent *event,
+ gpointer unused)
+{
+ gtk_entry_set_text (gentry, "");
+}
+
static gboolean
nautilus_location_entry_focus_in (GtkWidget *widget,
GdkEventFocus *event)
@@ -322,6 +331,9 @@ nautilus_location_entry_init (NautilusLocationEntry *entry)
entry->details->completer = g_filename_completer_new ();
g_filename_completer_set_dirs_only (entry->details->completer, TRUE);
+
+ gtk_entry_set_icon_from_stock (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY,
+ GTK_STOCK_CLEAR);
nautilus_entry_set_special_tab_handling (NAUTILUS_ENTRY (entry), TRUE);
@@ -331,6 +343,9 @@ nautilus_location_entry_init (NautilusLocationEntry *entry)
g_signal_connect (entry, "notify::text",
G_CALLBACK (nautilus_location_entry_text_changed), NULL);
+ g_signal_connect (entry, "icon-release",
+ G_CALLBACK (nautilus_location_entry_icon_release), NULL);
+
g_signal_connect (entry->details->completer, "got_completion_data",
G_CALLBACK (got_completion_data_callback), entry);
}