[nautilus] Make clear icon active when there is any text in uri entry
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Make clear icon active when there is any text in uri entry
- Date: Mon, 17 Sep 2012 14:22:35 +0000 (UTC)
commit dda81eda2f197e157b9a03af539ae35692e6ddd3
Author: William Jon McCann <jmccann redhat com>
Date: Mon Sep 17 10:10:15 2012 -0400
Make clear icon active when there is any text in uri entry
src/nautilus-connect-server-dialog.c | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/src/nautilus-connect-server-dialog.c b/src/nautilus-connect-server-dialog.c
index da94d40..2848d4a 100644
--- a/src/nautilus-connect-server-dialog.c
+++ b/src/nautilus-connect-server-dialog.c
@@ -275,34 +275,31 @@ static void
check_uri_entry (NautilusConnectServerDialog *dialog)
{
guint length;
- gboolean active = FALSE;
+ gboolean button_active = FALSE;
+ gboolean icon_active = FALSE;
const char *text = NULL;
- const char *icon_name = NULL;
length = gtk_entry_get_text_length (GTK_ENTRY (dialog->details->uri_entry));
if (length > 0) {
GError *error = NULL;
text = gtk_entry_get_text (GTK_ENTRY (dialog->details->uri_entry));
- active = validate_uri (dialog, text, &error);
+ button_active = validate_uri (dialog, text, &error);
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED)) {
gtk_label_set_text (GTK_LABEL (dialog->details->error_label), error->message);
} else {
reset_example_label (dialog);
}
g_clear_error (&error);
+ icon_active = TRUE;
}
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, active);
-
- if (length > 0) {
- icon_name = "edit-clear-symbolic";
- }
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, button_active);
g_object_set (dialog->details->uri_entry,
- "secondary-icon-name", icon_name,
- "secondary-icon-activatable", active,
- "secondary-icon-sensitive", active,
+ "secondary-icon-name", icon_active ? "edit-clear-symbolic" : NULL,
+ "secondary-icon-activatable", icon_active,
+ "secondary-icon-sensitive", icon_active,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]