From 0133e979531cd41ca7f1d76ff5adf66ddfa7d67a Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 28 May 2009 15:55:55 +0200 Subject: 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). --- src/nautilus-location-entry.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/nautilus-location-entry.c') 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); } -- cgit v1.2.1