From 442ed02adb1d86a177b465fa656f2148a71230b1 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Mon, 25 Nov 2002 04:04:20 +0000 Subject: [ roll forward from the 1.2 branch. fixes #25540, part of #29630, as well 2002-11-23 Chris Toshok [ roll forward from the 1.2 branch. fixes #25540, part of #29630, as well as other selection issues in the contact editor and ACL issues in the ldap backend ] * backend/pas/pas-backend-ldap.c (check_schema_support): reset the schema check state to FALSE if the read returned nothing (and the user had not authenticated). we'll requery if/when they auth. (query_ldap_root_dse): free the schema dn before assigning over it. (pas_backend_ldap_connect): added a diagnostic warning about the root dse query failing in anonymous mode (if it in fact did fail.) (pas_backend_ldap_process_authenticate_user): if we successfully authed, requery the root dse to pick up any attributes that might be protected, and retry the schema query if that failed before. * gui/contact-editor/e-contact-editor.c (full_name_clicked): set the dialog's editable state based on the new field "fullname_editable", and only do the Ok button handling if this flag is TRUE. (full_addr_clicked): set the dialog's editable state based on the editable state for the particular address (from editor->address_editable[]). also, only do the Ok button handling if this flag is TRUE. (_address_arrow_pressed): use the address_editable array to determine whether the address text and the mailing address checkbutton are sensitive. (enable_writable_fields): figure out if fullname_editable is TRUE/FALSE, also, init the address_editable flags based on the field list, and handle the address checkbutton. * gui/contact-editor/fulladdr.glade: change the label names to label- to match {entry,combo}-. * gui/contact-editor/fullname.glade: same. * gui/contact-editor/e-contact-editor-fullname.c (e_contact_editor_fullname_class_init): rename ARG_IS_READ_ONLY to ARG_EDITABLE, to reflect the correct sense of the flag. (e_contact_editor_fullname_set_arg): same, and make the labels sensitive/insensitive depending on the editable state of the dialog. * gui/contact-editor/e-contact-editor-address.c (e_contact_editor_address_class_init): rename ARG_IS_READ_ONLY to ARG_EDITABLE, to reflect the correct sense of the flag. (e_contact_editor_address_set_arg): same, and make the labels sensitive/insensitive depending on the editable state of the dialog. svn path=/trunk/; revision=18910 --- addressbook/gui/contact-editor/e-contact-editor.c | 24 ++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'addressbook/gui/contact-editor/e-contact-editor.c') diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index d48066f72b..ef45fbe426 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -759,13 +759,13 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor) int result; g_object_set (dialog, - "editable", editor->editable, + "editable", editor->fullname_editable, NULL); gtk_widget_show(GTK_WIDGET(dialog)); result = gtk_dialog_run (dialog); gtk_widget_hide (GTK_WIDGET (dialog)); - if (result == GTK_RESPONSE_OK) { + if (editor->fullname_editable && result == GTK_RESPONSE_OK) { ECardName *name; GtkWidget *fname_widget; int style = 0; @@ -802,7 +802,7 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor) dialog = GTK_DIALOG(e_contact_editor_address_new(address)); g_object_set (dialog, - "editable", editor->editable, + "editable", editor->address_editable[editor->address_choice], NULL); gtk_widget_show(GTK_WIDGET(dialog)); @@ -810,7 +810,7 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor) gtk_widget_hide (GTK_WIDGET (dialog)); - if (result == GTK_RESPONSE_OK) { + if (editor->address_editable[editor->address_choice] && result == GTK_RESPONSE_OK) { ECardDeliveryAddress *new_address; GtkWidget *address_widget; @@ -2026,7 +2026,8 @@ _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEdito /* make sure the buttons/entry is/are sensitive */ enable_widget (glade_xml_get_widget (editor->gui, "label-address"), TRUE); - enable_widget (glade_xml_get_widget (editor->gui, "text-address"), editor->editable); + enable_widget (glade_xml_get_widget (editor->gui, "text-address"), editor->address_editable[result]); + enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-mailingaddress"), editor->address_editable[result]); } } @@ -2398,14 +2399,18 @@ enable_writable_fields(EContactEditor *editor) enable_widget (glade_xml_get_widget (editor->gui, "label-email1"), FALSE); enable_widget (glade_xml_get_widget (editor->gui, "entry-email1"), FALSE); enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), FALSE); + enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-mailingaddress"), FALSE); enable_widget (glade_xml_get_widget (editor->gui, "label-address"), FALSE); enable_widget (glade_xml_get_widget (editor->gui, "text-address"), FALSE); + editor->fullname_editable = FALSE; + /* enable widgets that map directly from a field to a widget (the drop down items) */ iter = e_list_get_iterator (fields); for (; e_iterator_is_valid (iter); e_iterator_next (iter)) { char *field = (char*)e_iterator_get (iter); GtkWidget *widget = g_hash_table_lookup (dropdown_hash, field); + int i; if (widget) { enable_widget (widget, TRUE); @@ -2417,6 +2422,12 @@ enable_writable_fields(EContactEditor *editor) g_hash_table_insert (supported_hash, field, field); } + for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) { + if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_address_to_field(i)))) { + editor->address_editable [i] = TRUE; + } + } + /* ugh - this is needed to make sure we don't have a disabled label next to a drop down when the item in the menu (the one reflected in the label) is @@ -2428,6 +2439,7 @@ enable_writable_fields(EContactEditor *editor) } else if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_address_to_field(editor->address_choice)))) { enable_widget (glade_xml_get_widget (editor->gui, "label-address"), TRUE); + enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-mailingaddress"), editor->editable); enable_widget (glade_xml_get_widget (editor->gui, "text-address"), editor->editable); } else for (i = 0; i < 4; i ++) { @@ -2467,6 +2479,8 @@ enable_writable_fields(EContactEditor *editor) enable_widget (w, enabled); } + editor->fullname_editable = (g_hash_table_lookup (supported_hash, "full_name") != NULL); + g_hash_table_destroy (dropdown_hash); g_hash_table_destroy (supported_hash); g_object_unref (simple); -- cgit v1.2.3