aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/addressbook-config.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-07-31 02:06:17 +0800
committerChris Toshok <toshok@src.gnome.org>2004-07-31 02:06:17 +0800
commit47912d36f7826239b9eb93d5db3fc26daed612f8 (patch)
tree69c5b0514f659026b172313c3f313bd391a5c2fe /addressbook/gui/component/addressbook-config.c
parenta07cfcb2bd8587ab0f52ec5539b426bac27de30e (diff)
downloadgsoc2013-evolution-47912d36f7826239b9eb93d5db3fc26daed612f8.tar
gsoc2013-evolution-47912d36f7826239b9eb93d5db3fc26daed612f8.tar.gz
gsoc2013-evolution-47912d36f7826239b9eb93d5db3fc26daed612f8.tar.bz2
gsoc2013-evolution-47912d36f7826239b9eb93d5db3fc26daed612f8.tar.lz
gsoc2013-evolution-47912d36f7826239b9eb93d5db3fc26daed612f8.tar.xz
gsoc2013-evolution-47912d36f7826239b9eb93d5db3fc26daed612f8.tar.zst
gsoc2013-evolution-47912d36f7826239b9eb93d5db3fc26daed612f8.zip
[ fixes #61365 and other misc issues with the addressbook source editors ]
2004-07-30 Chris Toshok <toshok@ximian.com> [ fixes #61365 and other misc issues with the addressbook source editors ] * gui/component/ldap-config.glade: change the supported-bases-dialog to be initially hidden. * gui/component/addressbook-view.c (editor_weak_notify): new function, remove the editor from our hash. (source_list_changed_cb): destroy the editors for given sources if they're up when the source disappears. (edit_addressbook_cb): add the editor (and some other misc info we need) to our uid_to_editor hash so we can look it up later. only create the editor if one doesn't exist for the given source. (destroy_editor): GHFunc that destroys the widgets. (addressbook_view_dispose): destroy uid_to_editor. (addressbook_view_init): init uid_to_editor. * gui/component/addressbook-config.h: change return values for _edit_source and _new_source - they both return GtkWidget*s now. * gui/component/addressbook-config.c (addressbook_ldap_init): attempt set the protocol version to LDAPv3. This makes the ldap_auth stuff work if the server requires v3. (addressbook_root_dse_query): we don't need the separate window arg, since all of this now happens *before* the supported bases dialog is shown. we just use the source dialog's window for the various error dialogs. (do_ldap_root_dse_query): same. (query_for_supported_bases): same, and set the supported bases dialog as transient-for the source dialog, and make it modal. Lastly, don't make the editor modal. (addressbook_config_edit_source): return the editor's window. (addressbook_config_create_new_source): same. svn path=/trunk/; revision=26778
Diffstat (limited to 'addressbook/gui/component/addressbook-config.c')
-rw-r--r--addressbook/gui/component/addressbook-config.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
index 0ed3b67b28..60d0afe432 100644
--- a/addressbook/gui/component/addressbook-config.c
+++ b/addressbook/gui/component/addressbook-config.c
@@ -393,15 +393,24 @@ addressbook_ldap_init (GtkWidget *window, ESource *source)
LDAP *ldap;
gchar *host;
gint port;
+ int ldap_error;
+ int protocol_version = LDAP_VERSION3;
if (!source_to_uri_parts (source, &host, NULL, NULL, &port))
return NULL;
- if (!(ldap = ldap_init (host, port)))
+ if (!(ldap = ldap_init (host, port))) {
e_error_run ((GtkWindow *) window, "addressbook:ldap-init", NULL);
+ goto done;
+ }
+
+ ldap_error = ldap_set_option (ldap, LDAP_OPT_PROTOCOL_VERSION, &protocol_version);
+ if (LDAP_OPT_SUCCESS != ldap_error)
+ g_warning ("failed to set protocol version to LDAPv3");
/* XXX do TLS if it's configured in */
+ done:
g_free (host);
return ldap;
}
@@ -420,7 +429,7 @@ addressbook_ldap_auth (GtkWidget *window, LDAP *ldap)
}
static int
-addressbook_root_dse_query (AddressbookSourceDialog *dialog, GtkWindow *window, LDAP *ldap,
+addressbook_root_dse_query (AddressbookSourceDialog *dialog, LDAP *ldap,
char **attrs, LDAPMessage **resp)
{
int ldap_error;
@@ -434,7 +443,7 @@ addressbook_root_dse_query (AddressbookSourceDialog *dialog, GtkWindow *window,
"(objectclass=*)",
attrs, 0, NULL, NULL, &timeout, LDAP_NO_LIMIT, resp);
if (LDAP_SUCCESS != ldap_error)
- e_error_run ((GtkWindow *) window, "addressbook:ldap-search-base", NULL);
+ e_error_run (GTK_WINDOW (dialog->window), "addressbook:ldap-search-base", NULL);
return ldap_error;
}
@@ -635,7 +644,7 @@ supported_bases_create_table (char *name, char *string1, char *string2, int num1
}
static gboolean
-do_ldap_root_dse_query (AddressbookSourceDialog *sdialog, GtkWidget *dialog, ETableModel *model, ESource *source, char ***rvalues)
+do_ldap_root_dse_query (AddressbookSourceDialog *sdialog, ETableModel *model, ESource *source, char ***rvalues)
{
LDAP *ldap;
char *attrs[2];
@@ -644,24 +653,24 @@ do_ldap_root_dse_query (AddressbookSourceDialog *sdialog, GtkWidget *dialog, ETa
LDAPMessage *resp;
int i;
- ldap = addressbook_ldap_init (dialog, source);
+ ldap = addressbook_ldap_init (sdialog->window, source);
if (!ldap)
return FALSE;
- if (LDAP_SUCCESS != addressbook_ldap_auth (dialog, ldap))
+ if (LDAP_SUCCESS != addressbook_ldap_auth (sdialog->window, ldap))
goto fail;
attrs[0] = "namingContexts";
attrs[1] = NULL;
- ldap_error = addressbook_root_dse_query (sdialog, GTK_WINDOW (dialog), ldap, attrs, &resp);
+ ldap_error = addressbook_root_dse_query (sdialog, ldap, attrs, &resp);
if (ldap_error != LDAP_SUCCESS)
goto fail;
values = ldap_get_values (ldap, resp, "namingContexts");
if (!values || values[0] == NULL) {
- e_error_run ((GtkWindow *) dialog, "addressbook:ldap-search-base", NULL);
+ e_error_run (GTK_WINDOW (sdialog->window), "addressbook:ldap-search-base", NULL);
goto fail;
}
@@ -704,6 +713,9 @@ query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog)
gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, "supported-bases-dialog", NULL);
dialog = glade_xml_get_widget (gui, "supported-bases-dialog");
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (sdialog->window));
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+
gtk_widget_realize (dialog);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
@@ -718,7 +730,9 @@ query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog)
search_base_selection_model_changed (selection_model, dialog);
- if (do_ldap_root_dse_query (sdialog, dialog, model, source, &values)) {
+ if (do_ldap_root_dse_query (sdialog, model, source, &values)) {
+ gtk_widget_show (dialog);
+
id = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_hide (dialog);
@@ -741,6 +755,8 @@ query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog)
e_table_memory_store_clear (E_TABLE_MEMORY_STORE (model));
}
+ gtk_widget_destroy (dialog);
+
g_object_unref (source);
}
@@ -974,7 +990,6 @@ addressbook_add_server_dialog (void)
source_to_dialog (sdialog);
gtk_window_set_type_hint (GTK_WINDOW (sdialog->window), GDK_WINDOW_TYPE_HINT_DIALOG);
- gtk_window_set_modal (GTK_WINDOW (sdialog->window), TRUE);
add_folder_modify (sdialog->window, sdialog);
@@ -1181,7 +1196,7 @@ edit_dialog_ok_clicked (GtkWidget *item, AddressbookSourceDialog *sdialog)
}
}
-void
+GtkWidget*
addressbook_config_edit_source (GtkWidget *parent, ESource *source)
{
AddressbookSourceDialog *sdialog = g_new0 (AddressbookSourceDialog, 1);
@@ -1249,15 +1264,17 @@ addressbook_config_edit_source (GtkWidget *parent, ESource *source)
gtk_widget_set_sensitive (sdialog->ok_button, FALSE);
- gtk_window_set_modal (GTK_WINDOW (sdialog->window), TRUE);
-
gtk_widget_show (sdialog->window);
+
+ return sdialog->window;
}
-void
+GtkWidget*
addressbook_config_create_new_source (GtkWidget *parent)
{
AddressbookSourceDialog *dialog;
dialog = addressbook_add_server_dialog ();
+
+ return dialog->window;
}