diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2009-08-05 00:22:32 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-22 21:20:44 +0800 |
commit | caa57e8e5e3fbbad790e3825597a5b3ddd2f3175 (patch) | |
tree | ccaeb6e9a449af5905bc41ad196c4e97105dfc75 | |
parent | fa77756bd1db1c0b657fc784508890330bd5bfb3 (diff) | |
download | gsoc2013-empathy-caa57e8e5e3fbbad790e3825597a5b3ddd2f3175.tar gsoc2013-empathy-caa57e8e5e3fbbad790e3825597a5b3ddd2f3175.tar.gz gsoc2013-empathy-caa57e8e5e3fbbad790e3825597a5b3ddd2f3175.tar.bz2 gsoc2013-empathy-caa57e8e5e3fbbad790e3825597a5b3ddd2f3175.tar.lz gsoc2013-empathy-caa57e8e5e3fbbad790e3825597a5b3ddd2f3175.tar.xz gsoc2013-empathy-caa57e8e5e3fbbad790e3825597a5b3ddd2f3175.tar.zst gsoc2013-empathy-caa57e8e5e3fbbad790e3825597a5b3ddd2f3175.zip |
React to entry changes immediately
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 916de9502..27120c51a 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -76,6 +76,7 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountWidget) +#define CHANGED_TIMEOUT 300 static void account_widget_handle_apply_sensitivity (EmpathyAccountWidget *self) @@ -91,26 +92,30 @@ account_widget_handle_apply_sensitivity (EmpathyAccountWidget *self) g_signal_emit (self, signals[HANDLE_APPLY], 0, is_valid); } -static gboolean -account_widget_entry_focus_cb (GtkWidget *widget, - GdkEventFocus *event, - EmpathyAccountWidget *self) +static void +account_widget_entry_changed_common (EmpathyAccountWidget *self, + GtkEntry *entry, gboolean focus) { const gchar *str; const gchar *param_name; EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - str = gtk_entry_get_text (GTK_ENTRY (widget)); - param_name = g_object_get_data (G_OBJECT (widget), "param_name"); + str = gtk_entry_get_text (entry); + param_name = g_object_get_data (G_OBJECT (entry), "param_name"); if (EMP_STR_EMPTY (str)) { const gchar *value = NULL; empathy_account_settings_unset (priv->settings, param_name); - value = empathy_account_settings_get_string (priv->settings, param_name); - DEBUG ("Unset %s and restore to %s", param_name, value); - gtk_entry_set_text (GTK_ENTRY (widget), value ? value : ""); + + if (focus) + { + value = empathy_account_settings_get_string (priv->settings, + param_name); + DEBUG ("Unset %s and restore to %s", param_name, value); + gtk_entry_set_text (entry, value ? value : ""); + } } else { @@ -120,11 +125,26 @@ account_widget_entry_focus_cb (GtkWidget *widget, } account_widget_handle_apply_sensitivity (self); +} + +static gboolean +account_widget_entry_focus_cb (GtkWidget *widget, + GdkEventFocus *event, + EmpathyAccountWidget *self) +{ + account_widget_entry_changed_common (self, GTK_ENTRY (widget), TRUE); return FALSE; } static void +account_widget_entry_changed_cb (GtkEditable *entry, + EmpathyAccountWidget *self) +{ + account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE); +} + +static void account_widget_int_changed_cb (GtkWidget *widget, EmpathyAccountWidget *self) { @@ -314,6 +334,8 @@ account_widget_setup_widget (EmpathyAccountWidget *self, g_signal_connect (widget, "focus-out-event", G_CALLBACK (account_widget_entry_focus_cb), self); + g_signal_connect (widget, "changed", + G_CALLBACK (account_widget_entry_changed_cb), self); } else if (GTK_IS_TOGGLE_BUTTON (widget)) { |