diff options
author | Chris Toshok <toshok@ximian.com> | 2002-01-25 12:22:58 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2002-01-25 12:22:58 +0800 |
commit | 9b1f4e133bc79b2cac6cf342972c713739b075a6 (patch) | |
tree | 07066b05749e5327182a0a6b45df3f2ca29d952a /addressbook/gui/component/addressbook-config.c | |
parent | 19bf10036145eb24280ac5792dd85add67d4d238 (diff) | |
download | gsoc2013-evolution-9b1f4e133bc79b2cac6cf342972c713739b075a6.tar.gz gsoc2013-evolution-9b1f4e133bc79b2cac6cf342972c713739b075a6.tar.zst gsoc2013-evolution-9b1f4e133bc79b2cac6cf342972c713739b075a6.zip |
[ fixes bug 16097 ] gui love for the new auth stuff.
2002-01-24 Chris Toshok <toshok@ximian.com>
[ fixes bug 16097 ]
* gui/component/addressbook-config.glade: gui love for the new
auth stuff.
* gui/component/addressbook.c (load_uri_cb): track change to auth,
and offer up different prompt strings depending on which method
(binddn or email) we're using.
* gui/component/addressbook-storage.c (ldap_unparse_auth): use the
new auth types for ldap.
(ldap_parse_auth): same.
(addressbook_storage_auth_type_to_string): new function.
(load_source_data): get the binddn too.
(ldap_source_foreach): store out binddn or emailaddr, depending on
the auth type chosen.
* gui/component/addressbook-storage.h: add the more detailed auth
types, add "binddn" to the source structure, and add a prototype
for addressbook_storage_auth_type_to_string.
* gui/component/addressbook-config.c (auth_checkbutton_changed):
set the auth stuff (in)sensitive.
(auth_optionmenu_activated): new function.
(addressbook_source_dialog_set_source): track UI change.
(addressbook_source_dialog_get_source): same.
(add_scope_activate_cb): rename add_activate_cb to this to
distinguish it from the auth stuff.
(add_auth_activate_cb): new function.
(addressbook_source_dialog): track change to auth UI stuff.
(addressbook_storage_auth_type_to_string): new function.
* backend/ebook/e-book.h: add auth_method arg to
e_book_authenticate_user.
* backend/ebook/e-book.c (e_book_authenticate_user): track change
to prototype - add auth_method arg, and pass it along to the CORBA
call.
* backend/ebook/test-client.c (book_open_cb): track api change -
keep this building.
* backend/pas/pas-book.h: add auth_method slot in PASRequest.
* backend/pas/pas-book.c (pas_book_queue_authenticate_user): add
auth_method arg and add it to the PASRequest.
(impl_GNOME_Evolution_Addressbook_Book_authenticateUser): track
idl change, add auth_method and pass it along to
pas_book_queue_authenticate_user.
* backend/pas/pas-backend-ldap.c
(pas_backend_ldap_process_authenticate_user): support both
"ldap/simple-email" and "ldap/simple-binddn" auth methods.
* backend/idl/addressbook.idl: add "in string authMethod" to
authenticateUser.
svn path=/trunk/; revision=15467
Diffstat (limited to 'addressbook/gui/component/addressbook-config.c')
-rw-r--r-- | addressbook/gui/component/addressbook-config.c | 79 |
1 files changed, 58 insertions, 21 deletions
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c index 33feb391ab..5061e6368b 100644 --- a/addressbook/gui/component/addressbook-config.c +++ b/addressbook/gui/component/addressbook-config.c @@ -29,15 +29,19 @@ struct _AddressbookSourceDialog { GtkWidget *name; GtkWidget *host; + + GtkWidget *auth_checkbutton; + GtkWidget *auth_optionmenu; + GtkWidget *auth_notebook; GtkWidget *email; - GtkWidget *email_label; + GtkWidget *binddn; + int auth; GtkWidget *port; GtkWidget *rootdn; GtkWidget *limit; GtkWidget *scope_optionmenu; AddressbookLDAPScopeType ldap_scope; - GtkWidget *auth_checkbutton; gint id; /* button we closed the dialog with */ @@ -83,14 +87,14 @@ auth_checkbutton_changed (GtkWidget *item, AddressbookSourceDialog *dialog) /* make sure the change is reflected by the state of the dialog's OK button */ addressbook_source_edit_changed (item, dialog); - gtk_widget_set_sensitive (dialog->email_label, + gtk_widget_set_sensitive (dialog->auth_optionmenu, + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton))); + gtk_widget_set_sensitive (dialog->auth_notebook, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton))); - gtk_entry_set_editable (GTK_ENTRY(dialog->email), - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton))); } static void -option_menuitem_activated (GtkWidget *item, AddressbookSourceDialog *dialog) +scope_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog) { /* make sure the change is reflected by the state of the dialog's OK button */ addressbook_source_edit_changed (item, dialog); @@ -99,6 +103,18 @@ option_menuitem_activated (GtkWidget *item, AddressbookSourceDialog *dialog) item); } +static void +auth_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog) +{ + /* make sure the change is reflected by the state of the dialog's OK button */ + addressbook_source_edit_changed (item, dialog); + + dialog->auth = g_list_index (gtk_container_children (GTK_CONTAINER (item->parent)), + item) + 1; + + gtk_notebook_set_page (GTK_NOTEBOOK(dialog->auth_notebook), dialog->auth - 1); +} + typedef struct { GtkWidget *notebook; int page_num; @@ -132,18 +148,24 @@ addressbook_source_dialog_set_source (AddressbookSourceDialog *dialog, Addressbo e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->name), source ? source->name : ""); e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->host), source ? source->host : ""); e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->email), source ? source->email_addr : ""); + e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->binddn), source ? source->binddn : ""); e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->port), source ? source->port : "389"); e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->rootdn), source ? source->rootdn : ""); + string = g_strdup_printf ("%d", source ? source->limit : 100); e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->limit), string); g_free (string); - gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL); + dialog->auth = source ? source->auth : ADDRESSBOOK_LDAP_AUTH_NONE; + if (dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE) + gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->auth_optionmenu), dialog->auth - 1); + dialog->ldap_scope = source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL; + gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), dialog->ldap_scope); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton), source && source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE); - gtk_widget_set_sensitive (dialog->email_label, source && source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE); - gtk_entry_set_editable (GTK_ENTRY(dialog->email), source && source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton), source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE); + gtk_widget_set_sensitive (dialog->auth_optionmenu, source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE); + gtk_widget_set_sensitive (dialog->auth_notebook, source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE); } static AddressbookSource * @@ -154,12 +176,12 @@ addressbook_source_dialog_get_source (AddressbookSourceDialog *dialog) source->name = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->name)); source->host = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->host)); source->email_addr = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->email)); + source->binddn = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->binddn)); source->port = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->port)); source->rootdn = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->rootdn)); source->limit = atoi(e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->limit))); source->scope = dialog->ldap_scope; - source->auth = (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->auth_checkbutton)) - ? ADDRESSBOOK_LDAP_AUTH_SIMPLE : ADDRESSBOOK_LDAP_AUTH_NONE); + source->auth = dialog->auth; addressbook_storage_init_source_uri (source); @@ -173,12 +195,20 @@ addressbook_source_dialog_ok_clicked (GtkWidget *widget, AddressbookSourceDialog } static void -add_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog) +add_scope_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog) +{ + gtk_signal_connect (GTK_OBJECT (item), "activate", + GTK_SIGNAL_FUNC (scope_optionmenu_activated), dialog); +} + +static void +add_auth_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog) { gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (option_menuitem_activated), dialog); + GTK_SIGNAL_FUNC (auth_optionmenu_activated), dialog); } + static AddressbookSourceDialog* addressbook_source_dialog (GladeXML *gui, AddressbookSource *source, GtkWidget *parent) { @@ -214,18 +244,25 @@ addressbook_source_dialog (GladeXML *gui, AddressbookSource *source, GtkWidget * GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog); add_focus_handler (dialog->host, dialog->basic_notebook, 1); - dialog->email = glade_xml_get_widget (gui, "email-address-entry"); - gtk_signal_connect (GTK_OBJECT (dialog->email), "changed", - GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog); - add_focus_handler (dialog->email, dialog->basic_notebook, 2); - - dialog->email_label = glade_xml_get_widget (gui, "email-address-label"); + /* BASIC -> AUTH STUFF */ + dialog->auth_notebook = glade_xml_get_widget (gui, "auth-notebook"); dialog->auth_checkbutton = glade_xml_get_widget (gui, "auth-checkbutton"); add_focus_handler (dialog->auth_checkbutton, dialog->basic_notebook, 2); gtk_signal_connect (GTK_OBJECT (dialog->auth_checkbutton), "toggled", GTK_SIGNAL_FUNC (auth_checkbutton_changed), dialog); + dialog->auth_optionmenu = glade_xml_get_widget (gui, "auth-optionmenu"); + menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->auth_optionmenu)); + gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_auth_activate_cb, dialog); + add_focus_handler (dialog->auth_optionmenu, dialog->basic_notebook, 3); + + dialog->email = glade_xml_get_widget (gui, "email-entry"); + add_focus_handler (dialog->email, dialog->basic_notebook, 4); + + dialog->binddn = glade_xml_get_widget (gui, "dn-entry"); + add_focus_handler (dialog->binddn, dialog->basic_notebook, 5); + /* ADVANCED STUFF */ dialog->port = glade_xml_get_widget (gui, "port-entry"); gtk_signal_connect (GTK_OBJECT (dialog->port), "changed", @@ -240,7 +277,7 @@ addressbook_source_dialog (GladeXML *gui, AddressbookSource *source, GtkWidget * dialog->scope_optionmenu = glade_xml_get_widget (gui, "scope-optionmenu"); add_focus_handler (dialog->scope_optionmenu, dialog->advanced_notebook, 2); menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->scope_optionmenu)); - gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_activate_cb, dialog); + gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_scope_activate_cb, dialog); dialog->limit = glade_xml_get_widget (gui, "limit-entry"); gtk_signal_connect (GTK_OBJECT (dialog->limit), "changed", |