diff options
author | Milan Crha <mcrha@redhat.com> | 2012-09-14 17:38:20 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-09-14 17:38:20 +0800 |
commit | d98b94b16b0fcf853d260f9ebf042275060ee61c (patch) | |
tree | 541f7ad870abfb0bbf21f12ca5fe90d620a29ce9 /modules | |
parent | 8e88f65fbe94ca97df338ebc8054879d7bef9aa0 (diff) | |
download | gsoc2013-evolution-d98b94b16b0fcf853d260f9ebf042275060ee61c.tar.gz gsoc2013-evolution-d98b94b16b0fcf853d260f9ebf042275060ee61c.tar.zst gsoc2013-evolution-d98b94b16b0fcf853d260f9ebf042275060ee61c.zip |
Could not set custom port for LDAP addressbook
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book-config-ldap/evolution-book-config-ldap.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/modules/book-config-ldap/evolution-book-config-ldap.c b/modules/book-config-ldap/evolution-book-config-ldap.c index 01f6e5d671..3aa83de243 100644 --- a/modules/book-config-ldap/evolution-book-config-ldap.c +++ b/modules/book-config-ldap/evolution-book-config-ldap.c @@ -314,16 +314,16 @@ book_config_ldap_active_to_port (GBinding *binding, } if (active == -1) { - GObject *source; + GObject *target; GtkWidget *entry; const gchar *text; glong v_long; - source = g_binding_get_source (binding); - entry = gtk_bin_get_child (GTK_BIN (source)); + target = g_binding_get_target (binding); + entry = gtk_bin_get_child (GTK_BIN (target)); text = gtk_entry_get_text (GTK_ENTRY (entry)); - v_long = strtol (text, NULL, 10); + v_long = text ? strtol (text, NULL, 10) : 0; if (v_long != 0 && v_long == CLAMP (v_long, 0, G_MAXUINT16)) port = (guint) v_long; } @@ -333,6 +333,13 @@ book_config_ldap_active_to_port (GBinding *binding, return TRUE; } +static void +book_config_ldap_port_combo_changed (GtkComboBox *combo_box) +{ + if (gtk_combo_box_get_active (combo_box) == -1) + g_object_notify (G_OBJECT (combo_box), "active"); +} + static gboolean book_config_ldap_port_to_security (GBinding *binding, const GValue *source_value, @@ -864,6 +871,11 @@ book_config_ldap_insert_widgets (ESourceConfigBackend *backend, book_config_ldap_active_to_port, NULL, (GDestroyNotify) NULL); + /* "active" doesn't change when setting custom port in entry, + thus check also on the "changed" signal */ + g_signal_connect (context->port_combo, "changed", + G_CALLBACK (book_config_ldap_port_combo_changed), NULL); + g_object_bind_property ( extension, "user", context->auth_entry, "text", |