diff options
author | Jonny Lamb <jonnylamb@gnome.org> | 2011-01-28 21:18:59 +0800 |
---|---|---|
committer | Jonny Lamb <jonnylamb@gnome.org> | 2011-01-28 21:18:59 +0800 |
commit | fe7c6ed34c96c0b57b0294ccebdab20dd0b702ba (patch) | |
tree | bc6af4847d70b488697b1ca007c6a084069a84fd | |
parent | 703d75010df79a51d0781fec8b30cd8588769c10 (diff) | |
download | gsoc2013-empathy-fe7c6ed34c96c0b57b0294ccebdab20dd0b702ba.tar gsoc2013-empathy-fe7c6ed34c96c0b57b0294ccebdab20dd0b702ba.tar.gz gsoc2013-empathy-fe7c6ed34c96c0b57b0294ccebdab20dd0b702ba.tar.bz2 gsoc2013-empathy-fe7c6ed34c96c0b57b0294ccebdab20dd0b702ba.tar.lz gsoc2013-empathy-fe7c6ed34c96c0b57b0294ccebdab20dd0b702ba.tar.xz gsoc2013-empathy-fe7c6ed34c96c0b57b0294ccebdab20dd0b702ba.tar.zst gsoc2013-empathy-fe7c6ed34c96c0b57b0294ccebdab20dd0b702ba.zip |
chat: add clear secondary icon to password entry
Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 7742e0b90..489a0a69a 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -3067,6 +3067,27 @@ passwd_join_button_cb (GtkButton *button, } static void +clear_icon_released_cb (GtkEntry *entry, + GtkEntryIconPosition icon_pos, + GdkEvent *event, + PasswordData *data) +{ + gtk_entry_set_text (entry, ""); +} + +static void +password_entry_changed_cb (GtkEditable *entry, + PasswordData *data) +{ + const gchar *str; + + str = gtk_entry_get_text (GTK_ENTRY (entry)); + + gtk_entry_set_icon_sensitive (GTK_ENTRY (entry), + GTK_ENTRY_ICON_SECONDARY, !EMP_STR_EMPTY (str)); +} + +static void display_password_info_bar (EmpathyChat *self) { EmpathyChatPriv *priv = GET_PRIV (self); @@ -3106,6 +3127,16 @@ display_password_info_bar (EmpathyChat *self) gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); + gtk_entry_set_icon_from_stock (GTK_ENTRY (entry), + GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR); + gtk_entry_set_icon_sensitive (GTK_ENTRY (entry), + GTK_ENTRY_ICON_SECONDARY, FALSE); + + g_signal_connect (entry, "icon-release", + G_CALLBACK (clear_icon_released_cb), data); + g_signal_connect (entry, "changed", + G_CALLBACK (password_entry_changed_cb), data); + g_signal_connect (entry, "activate", G_CALLBACK (password_entry_activate_cb), data); |