aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-09-17 08:03:45 +0800
committerChris Toshok <toshok@src.gnome.org>2001-09-17 08:03:45 +0800
commit842aaaaa8c02daa7b0dc4651ee01a8e1d6c21910 (patch)
tree2839fe2d56096aab93de1e1ac7b5d5fbff5c2315 /addressbook
parente4d7cc62b0ad767294c2fa8e9472332b86d7ad67 (diff)
downloadgsoc2013-evolution-842aaaaa8c02daa7b0dc4651ee01a8e1d6c21910.tar
gsoc2013-evolution-842aaaaa8c02daa7b0dc4651ee01a8e1d6c21910.tar.gz
gsoc2013-evolution-842aaaaa8c02daa7b0dc4651ee01a8e1d6c21910.tar.bz2
gsoc2013-evolution-842aaaaa8c02daa7b0dc4651ee01a8e1d6c21910.tar.lz
gsoc2013-evolution-842aaaaa8c02daa7b0dc4651ee01a8e1d6c21910.tar.xz
gsoc2013-evolution-842aaaaa8c02daa7b0dc4651ee01a8e1d6c21910.tar.zst
gsoc2013-evolution-842aaaaa8c02daa7b0dc4651ee01a8e1d6c21910.zip
reorder the LDAP scopes so that they match the order of the option menus
2001-09-16 Chris Toshok <toshok@ximian.com> * gui/component/addressbook-storage.h: reorder the LDAP scopes so that they match the order of the option menus in the glade file. * gui/component/addressbook-config.c (auth_checkbutton_changed): new function, mostly there to house some #ifdef'ed out code. (option_menuitem_activated): new function, to keep track of changes to the ldap scope optionmenu. (addressbook_source_dialog_set_source): set the menu history as well as the dialog's copy of the scope. (addressbook_source_dialog_get_source): fill in the source's scope from the dialog's copy, and add more #if the_ui_gods_smile_on_me code. (add_activate_cb): new function, add an activate callback for the optionmenu's items. (addressbook_source_dialog): more #if the_ui_gods_smile_on_me code, always start the dialog on page 0, and hook up the scope optionmenu's items. svn path=/trunk/; revision=12865
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog20
-rw-r--r--addressbook/gui/component/addressbook-config.c62
-rw-r--r--addressbook/gui/component/addressbook-storage.h4
3 files changed, 82 insertions, 4 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 9f542ab200..bded8b13b9 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,23 @@
+2001-09-16 Chris Toshok <toshok@ximian.com>
+
+ * gui/component/addressbook-storage.h: reorder the LDAP scopes so
+ that they match the order of the option menus in the glade file.
+
+ * gui/component/addressbook-config.c (auth_checkbutton_changed):
+ new function, mostly there to house some #ifdef'ed out code.
+ (option_menuitem_activated): new function, to keep track of
+ changes to the ldap scope optionmenu.
+ (addressbook_source_dialog_set_source): set the menu history as
+ well as the dialog's copy of the scope.
+ (addressbook_source_dialog_get_source): fill in the source's scope
+ from the dialog's copy, and add more #if the_ui_gods_smile_on_me
+ code.
+ (add_activate_cb): new function, add an activate callback for the
+ optionmenu's items.
+ (addressbook_source_dialog): more #if the_ui_gods_smile_on_me
+ code, always start the dialog on page 0, and hook up the
+ scope optionmenu's items.
+
2001-09-15 Jon Trowbridge <trow@ximian.com>
* backend/ebook/e-card-compare.c (e_card_compare_name): No
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
index d7f8d43f1b..6c5d4c9d99 100644
--- a/addressbook/gui/component/addressbook-config.c
+++ b/addressbook/gui/component/addressbook-config.c
@@ -22,6 +22,7 @@ struct _AddressbookSourceDialog {
GtkWidget *dialog;
+ GtkWidget *notebook;
GtkWidget *basic_notebook;
GtkWidget *advanced_notebook;
@@ -31,7 +32,11 @@ struct _AddressbookSourceDialog {
GtkWidget *port;
GtkWidget *rootdn;
GtkWidget *scope_optionmenu;
+ AddressbookLDAPScopeType ldap_scope;
GtkWidget *auth_checkbutton;
+#if the_ui_gods_smile_upon_me
+ GtkWidget *remember_checkbutton;
+#endif
gint id; /* button we closed the dialog with */
@@ -71,6 +76,28 @@ addressbook_source_edit_changed (GtkWidget *item, AddressbookSourceDialog *dialo
gnome_dialog_set_sensitive (GNOME_DIALOG (dialog->dialog), 0, complete);
}
+static void
+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);
+
+#if the_ui_gods_smile_upon_me
+ gtk_widget_set_sensitive (dialog->remember_checkbutton,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton)));
+#endif
+}
+
+static void
+option_menuitem_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->ldap_scope = g_list_index (gtk_container_children (GTK_CONTAINER (item->parent)),
+ item);
+}
+
typedef struct {
GtkWidget *notebook;
int page_num;
@@ -105,8 +132,13 @@ addressbook_source_dialog_set_source (AddressbookSourceDialog *dialog, Addressbo
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 : "");
- gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), source ? source->scope : 0);
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL);
+ dialog->ldap_scope = source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton), source && source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE);
+#if the_ui_gods_smile_upon_me
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->remember_checkbutton), source && source->remember_passwd);
+#endif
}
static AddressbookSource *
@@ -118,7 +150,11 @@ addressbook_source_dialog_get_source (AddressbookSourceDialog *dialog)
source->host = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->host));
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->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;
+#if the_ui_gods_smile_upon_me
+ source->remember_passwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->remember_checkbutton));
+#endif
addressbook_storage_init_source_uri (source);
@@ -131,10 +167,18 @@ addressbook_source_dialog_ok_clicked (GtkWidget *widget, AddressbookSourceDialog
dialog->source = addressbook_source_dialog_get_source (dialog);
}
+static void
+add_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog)
+{
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ GTK_SIGNAL_FUNC (option_menuitem_activated), dialog);
+}
+
static AddressbookSourceDialog*
addressbook_source_dialog (GladeXML *gui, AddressbookSource *source, GtkWidget *parent)
{
AddressbookSourceDialog *dialog = g_new0 (AddressbookSourceDialog, 1);
+ GtkWidget *menu;
dialog->gui = gui;
@@ -150,6 +194,7 @@ addressbook_source_dialog (GladeXML *gui, AddressbookSource *source, GtkWidget *
gnome_dialog_set_parent (GNOME_DIALOG (dialog->dialog),
GTK_WINDOW (parent));
+ dialog->notebook = glade_xml_get_widget (gui, "add-addressbook-notebook");
dialog->basic_notebook = glade_xml_get_widget (gui, "basic-notebook");
dialog->advanced_notebook = glade_xml_get_widget (gui, "advanced-notebook");
@@ -167,7 +212,16 @@ addressbook_source_dialog (GladeXML *gui, AddressbookSource *source, GtkWidget *
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);
+
+#if the_ui_gods_smile_upon_me
+ dialog->remember_checkbutton = glade_xml_get_widget (gui, "remember-checkbutton");
+ add_focus_handler (dialog->auth_checkbutton, dialog->basic_notebook, 3);
+ gtk_signal_connect (GTK_OBJECT (dialog->remember_checkbutton), "toggled",
GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog);
+ gtk_widget_set_sensitive (dialog->remember_checkbutton,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton)));
+#endif
/* ADVANCED STUFF */
dialog->port = glade_xml_get_widget (gui, "port-entry");
@@ -182,11 +236,15 @@ 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);
- /* XXX changed */
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->scope_optionmenu));
+ gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_activate_cb, dialog);
/* fill in source info if there is some */
addressbook_source_dialog_set_source (dialog, source);
+ /* always start out on the first page. */
+ gtk_notebook_set_page (GTK_NOTEBOOK (dialog->notebook), 0);
+
gnome_dialog_set_sensitive (GNOME_DIALOG (dialog->dialog), 0, FALSE);
gnome_dialog_button_connect( GNOME_DIALOG (dialog->dialog), 0,
diff --git a/addressbook/gui/component/addressbook-storage.h b/addressbook/gui/component/addressbook-storage.h
index 8480f2c4de..d4a918fe50 100644
--- a/addressbook/gui/component/addressbook-storage.h
+++ b/addressbook/gui/component/addressbook-storage.h
@@ -40,9 +40,9 @@ typedef enum {
} AddressbookLDAPAuthType;
typedef enum {
- ADDRESSBOOK_LDAP_SCOPE_SUBTREE,
- ADDRESSBOOK_LDAP_SCOPE_BASE,
ADDRESSBOOK_LDAP_SCOPE_ONELEVEL,
+ ADDRESSBOOK_LDAP_SCOPE_BASE,
+ ADDRESSBOOK_LDAP_SCOPE_SUBTREE,
ADDRESSBOOK_LDAP_SCOPE_LAST
} AddressbookLDAPScopeType;