[nautilus] Clear text in the location entry
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: svn-commits-list gnome org
- Subject: [nautilus] Clear text in the location entry
- Date: Thu, 28 May 2009 09:56:55 -0400 (EDT)
commit 0133e979531cd41ca7f1d76ff5adf66ddfa7d67a
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu May 28 15:55:55 2009 +0200
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-connect-server-dialog.c | 2 ++
src/nautilus-location-entry.c | 15 +++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/nautilus-connect-server-dialog.c b/src/nautilus-connect-server-dialog.c
index ad1645b..3558024 100644
--- a/src/nautilus-connect-server-dialog.c
+++ b/src/nautilus-connect-server-dialog.c
@@ -887,6 +887,8 @@ nautilus_connect_server_dialog_init (NautilusConnectServerDialog *dialog)
table, TRUE, TRUE, 0);
dialog->details->uri_entry = nautilus_location_entry_new ();
+ /* hide the clean icon, as it doesn't make sense here */
+ g_object_set (dialog->details->uri_entry, "secondary-icon-name", NULL, NULL);
dialog->details->server_entry = gtk_entry_new ();
dialog->details->share_entry = gtk_entry_new ();
dialog->details->port_entry = gtk_entry_new ();
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index 247eafd..5f6392e 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]