Thank you Following your advices, this time I have created some functions on different object to complete encapsulating. And avoid unnecessary passing of toplevel widget. But I have to use connect serveral signals on some widget, because these handlers need different data, so different arguments. Or should I alter the argement(i.e. pass a struct as argument) of the very existing function? I think that can I be able to merge the existing handler and the change signal handler together on the same widget? Please spare some time to see if this patch meet us. Best Regards Charles Zhang Not Zed wrote: This isn't quite what i had in mind. - put the :changed method on the mail-account-editor object. probably namespace it too, i.e. call it mail_account_editor_changed. - dont go passing the widget around as an anonymous thing to be sensitised, i.e. revert the build_extra_conf change - you're still connecting to every widget, even though many already have changed/selected hooks (some which are called less often). On Tue, 2003-10-14 at 01:13, Charles Zhang wrote:Thank you. This time, I have insert an entry in ChangLog. And modified some places in file mail-account-editor.c mail-account-gui.c and mail-account-gui.h. The whole thing looks better now, but I have to alter some exist function declaration and defination to use this simplest way I can found. Please see and tell me if there is anything wrong. Best Regards Charles Zhang Not Zed wrote:first, this should include a ChangeLog entry. second, there are a few places that already hook onto some form of changed event, you should just call a function from there rather than hooking a signal onto every possible widget. last, i'm not sure if this breaks abstraction somewhat - you're poking about the internals of the dialog->editor directly (i.e. by changing the button sensitivity), perhaps you should have a 'changed' method on it instead. On Mon, 2003-10-13 at 00:44, Charles Zhang wrote:Dear all I posted a patch for bug 48998 here. It fixes a bug of "apply button always leave active". Because this happens in a dialog, and all the button and optionmenu are all in this dialog, so I connect all their "changed" signal to a function. Please review. Thank you all. Best Regards Charles Zhang ______________________________________________________________________ Index: mail/mail-account-editor.c =================================================================== RCS file: /cvs/gnome/evolution/mail/mail-account-editor.c,v retrieving revision 1.57 diff -u -p -r1.57 mail-account-editor.c --- mail/mail-account-editor.c 25 Mar 2003 15:49:19 -0000 1.57 +++ mail/mail-account-editor.c 12 Oct 2003 14:33:11 -0000 @@ -109,6 +109,9 @@ apply_changes (MailAccountEditor *editor /* save any changes we may have */ mail_config_write (); + gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), + GTK_RESPONSE_APPLY, FALSE); + /* FIXME: #1549: if the account was a remote store, delete it from the folder-tree and re-add it */ /* FIXME: preferably, we'd only do this if there were changes... oh well */ @@ -159,6 +162,9 @@ construct (MailAccountEditor *editor, EA mail_account_gui_build_extra_conf (editor->gui, source->url); gtk_widget_grab_focus (GTK_WIDGET (editor->gui->account_name)); + + gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), + GTK_RESPONSE_APPLY, FALSE); } MailAccountEditor * Index: mail/mail-account-gui.c =================================================================== RCS file: /cvs/gnome/evolution/mail/mail-account-gui.c,v retrieving revision 1.133.4.3 diff -u -p -r1.133.4.3 mail-account-gui.c --- mail/mail-account-gui.c 29 Sep 2003 15:43:30 -0000 1.133.4.3 +++ mail/mail-account-gui.c 12 Oct 2003 14:33:19 -0000 @@ -730,6 +730,15 @@ setup_toggle (GtkWidget *widget, const c toggle_sensitivity (toggle, widget); } +static void +mail_config_changed (GtkWidget *widget, gpointer user_data) +{ + MailAccountsTab *dialog = (MailAccountsTab *) user_data; + + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->editor), + GTK_RESPONSE_APPLY, TRUE); +} + void mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string) { @@ -742,6 +751,7 @@ mail_account_gui_build_extra_conf (MailA GList *children, *child; char *name; int i, rows; + MailAccountsTab *dialog = (MailAccountsTab *) gui->dialog; if (url_string) url = "" (url_string, NULL); @@ -874,6 +884,9 @@ mail_account_gui_build_extra_conf (MailA GTK_EXPAND | GTK_FILL, 0, 0, 0); rows++; g_hash_table_insert (gui->extra_config, entries[i].name, checkbox); + + g_signal_connect (checkbox, "toggled", G_CALLBACK (mail_config_changed), dialog); + if (entries[i].depname) setup_toggle (checkbox, entries[i].depname, gui); break; @@ -923,7 +936,9 @@ mail_account_gui_build_extra_conf (MailA } g_hash_table_insert (gui->extra_config, entries[i].name, entry); - + + g_signal_connect (entry, "changed", G_CALLBACK (mail_config_changed), dialog); + break; } @@ -1395,6 +1410,8 @@ prepare_signatures (MailAccountGui *gui) g_signal_connect (gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_menu)), "selection-done", G_CALLBACK(sig_changed), gui); + g_signal_connect (gui->sig_option_menu, "changed", G_CALLBACK (mail_config_changed), gui->dialog); + glade_xml_signal_connect_data (gui->xml, "sigAddNewClicked", G_CALLBACK (sig_add_new_signature), gui); @@ -1430,6 +1447,9 @@ mail_account_gui_new (EAccount *account, || (account == mail_config_get_default_account ())) gtk_toggle_button_set_active (gui->default_account, TRUE); + g_signal_connect (gui->account_name, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->default_account, "toggled", G_CALLBACK (mail_config_changed), dialog); + /* Identity */ gui->full_name = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_full_name")); gui->email_address = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_address")); @@ -1437,7 +1457,7 @@ mail_account_gui_new (EAccount *account, gui->organization = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_organization")); prepare_signatures (gui); - + if (account->id->name) gtk_entry_set_text (gui->full_name, account->id->name); if (account->id->address) @@ -1449,6 +1469,11 @@ mail_account_gui_new (EAccount *account, setup_signatures (gui); + g_signal_connect (gui->full_name, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->email_address, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->reply_to, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->organization, "changed", G_CALLBACK (mail_config_changed), dialog); + /* Source */ gui->source.provider_type = CAMEL_PROVIDER_STORE; gui->source.type = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "source_type_omenu")); @@ -1471,9 +1496,21 @@ mail_account_gui_new (EAccount *account, gui->source.check_supported = GTK_BUTTON (glade_xml_get_widget (gui->xml, "source_check_supported")); g_signal_connect (gui->source.check_supported, "clicked", G_CALLBACK (service_check_supported), &gui->source); + + g_signal_connect (gui->source.type, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->source.hostname, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->source.username, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->source.path, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->source.use_ssl, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->source.authtype, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->source.remember, "toggled", G_CALLBACK (mail_config_changed), dialog); + gui->source_auto_check = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "extra_auto_check")); gui->source_auto_check_min = GTK_SPIN_BUTTON (glade_xml_get_widget (gui->xml, "extra_auto_check_min")); + g_signal_connect (gui->source_auto_check, "toggled", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->source_auto_check_min, "value-changed", G_CALLBACK (mail_config_changed), dialog); + /* Transport */ gui->transport.provider_type = CAMEL_PROVIDER_TRANSPORT; gui->transport.type = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "transport_type_omenu")); @@ -1497,6 +1534,14 @@ mail_account_gui_new (EAccount *account, g_signal_connect (gui->transport.check_supported, "clicked", G_CALLBACK (service_check_supported), &gui->transport); + g_signal_connect (gui->transport.type, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->transport.hostname, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->transport.username, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->transport_needs_auth, "toggled", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->transport.use_ssl, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->transport.authtype, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->transport.remember, "toggled", G_CALLBACK (mail_config_changed), dialog); + /* Drafts folder */ gui->drafts_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "drafts_button")); g_signal_connect (gui->drafts_folder_button, "selected", @@ -1510,6 +1555,8 @@ mail_account_gui_new (EAccount *account, _("Select Folder"), gui->drafts_folder_uri, allowed_types); + + g_signal_connect (gui->drafts_folder_button, "clicked", G_CALLBACK (mail_config_changed), dialog); /* Sent folder */ gui->sent_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "sent_button")); @@ -1525,10 +1572,14 @@ mail_account_gui_new (EAccount *account, gui->sent_folder_uri, allowed_types); + g_signal_connect (gui->sent_folder_button, "clicked", G_CALLBACK (mail_config_changed), dialog); + /* Special Folders "Reset Defaults" button */ button = glade_xml_get_widget (gui->xml, "default_folders_button"); g_signal_connect (button, "clicked", G_CALLBACK (default_folders_clicked), gui); + g_signal_connect (button, "clicked", G_CALLBACK (mail_config_changed), dialog); + /* Always Cc */ gui->always_cc = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "always_cc")); gtk_toggle_button_set_active (gui->always_cc, account->always_cc); @@ -1536,6 +1587,9 @@ mail_account_gui_new (EAccount *account, if (account->cc_addrs) gtk_entry_set_text (gui->cc_addrs, account->cc_addrs); + g_signal_connect (gui->always_cc, "toggled", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->cc_addrs, "changed", G_CALLBACK (mail_config_changed), dialog); + /* Always Bcc */ gui->always_bcc = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "always_bcc")); gtk_toggle_button_set_active (gui->always_bcc, account->always_bcc); @@ -1543,6 +1597,9 @@ mail_account_gui_new (EAccount *account, if (account->bcc_addrs) gtk_entry_set_text (gui->bcc_addrs, account->bcc_addrs); + g_signal_connect (gui->always_bcc, "toggled", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->bcc_addrs, "changed", G_CALLBACK (mail_config_changed), dialog); + /* Security */ gui->pgp_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "pgp_key")); if (account->pgp_key) @@ -1555,7 +1612,13 @@ mail_account_gui_new (EAccount *account, gtk_toggle_button_set_active (gui->pgp_no_imip_sign, account->pgp_no_imip_sign); gui->pgp_always_trust = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "pgp_always_trust")); gtk_toggle_button_set_active (gui->pgp_always_trust, account->pgp_always_trust); - + + g_signal_connect (gui->pgp_key, "changed", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->pgp_encrypt_to_self, "clicked", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->pgp_always_sign, "clicked", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->pgp_no_imip_sign, "clicked", G_CALLBACK (mail_config_changed), dialog); + g_signal_connect (gui->pgp_always_trust, "clicked", G_CALLBACK (mail_config_changed), dialog); + #if defined (HAVE_NSS) && defined (SMIME_SUPPORTED) gui->smime_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "smime_key")); if (account->smime_key)______________________________________________________________________ Index: mail/ChangeLog =================================================================== RCS file: /cvs/gnome/evolution/mail/ChangeLog,v retrieving revision 1.2761.2.32 diff -u -p -r1.2761.2.32 ChangeLog --- mail/ChangeLog 8 Oct 2003 16:06:08 -0000 1.2761.2.32 +++ mail/ChangeLog 13 Oct 2003 14:56:06 -0000 @@ 0,0 +,16 @@ +2003-10-13 Charles Zhang <charles zhang sun com> + + * mail-account-gui.h: alter the declaration of function mail_ + account_gui_build_extra_conf to add necessary argument. + + * mail-account-gui.c (mail_config_change): enable apply button. + (mail_account_gui_connect_change_signal): connect change signal. + (mail_account_gui_setup): call function mail_account_gui_connect_ + change_signal. + (mail_account_gui_build_extra_conf): connect "changed" signal. + (source_type_changed): transfer neccesary argument to function + (default_folders_clicked): call function mail_config_change + + * mail-account-editor.c (apply_changes): disable apply button + (construct): disable apply button + 2003-10-08 Frederic Crozat <fcrozat mandrakesoft com> * mail-display.c: (pixbuf_gen_idle): Index: mail/mail-account-editor.c =================================================================== RCS file: /cvs/gnome/evolution/mail/mail-account-editor.c,v retrieving revision 1.57 diff -u -p -r1.57 mail-account-editor.c --- mail/mail-account-editor.c 25 Mar 2003 15:49:19 -0000 1.57 +++ mail/mail-account-editor.c 13 Oct 2003 14:56:07 -0000 @@ -109,6 +109,9 @@ apply_changes (MailAccountEditor *editor /* save any changes we may have */ mail_config_write (); + gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), + GTK_RESPONSE_APPLY, FALSE); + /* FIXME: #1549: if the account was a remote store, delete it from the folder-tree and re-add it */ /* FIXME: preferably, we'd only do this if there were changes... oh well */ @@ -156,9 +159,12 @@ construct (MailAccountEditor *editor, EA mail_account_gui_setup (editor->gui, GTK_WIDGET (editor)); - mail_account_gui_build_extra_conf (editor->gui, source->url); + mail_account_gui_build_extra_conf (editor->gui, GTK_WIDGET (editor), source->url); gtk_widget_grab_focus (GTK_WIDGET (editor->gui->account_name)); + + gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), + GTK_RESPONSE_APPLY, FALSE); } MailAccountEditor * Index: mail/mail-account-gui.c =================================================================== RCS file: /cvs/gnome/evolution/mail/mail-account-gui.c,v retrieving revision 1.133.4.3 diff -u -p -r1.133.4.3 mail-account-gui.c --- mail/mail-account-gui.c 29 Sep 2003 15:43:30 -0000 1.133.4.3 +++ mail/mail-account-gui.c 13 Oct 2003 14:56:17 -0000 @@ -475,7 +475,9 @@ transport_provider_set_available (MailAc static void source_type_changed (GtkWidget *widget, gpointer user_data) { - MailAccountGui *gui = user_data; + MailAccountEditor *editor = (MailAccountEditor *) user_data; + GtkWidget *top = GTK_WIDGET (editor); + MailAccountGui *gui = (MailAccountGui *) editor->gui; GtkWidget *file_entry, *label, *frame, *dwidget = NULL; CamelProvider *provider; @@ -570,7 +572,7 @@ source_type_changed (GtkWidget *widget, if (dwidget) gtk_widget_grab_focus (dwidget); - mail_account_gui_build_extra_conf (gui, gui && gui->account && gui->account->source ? gui->account->source->url : NULL); + mail_account_gui_build_extra_conf (gui, top, gui && gui->account && gui->account->source ? gui->account->source->url : NULL); if (provider && CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider)) transport_provider_set_available (gui, provider, TRUE); @@ -730,8 +732,14 @@ setup_toggle (GtkWidget *widget, const c toggle_sensitivity (toggle, widget); } +static void +mail_config_changed (GtkWidget *widget, gpointer user_data) +{ + gtk_dialog_set_response_sensitive (GTK_DIALOG (user_data), GTK_RESPONSE_APPLY, TRUE); +} + void -mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string) +mail_account_gui_build_extra_conf (MailAccountGui *gui, GtkWidget *top, const char *url_string) { CamelURL *url; GtkWidget *mailcheck_frame, *mailcheck_hbox; @@ -874,6 +882,9 @@ mail_account_gui_build_extra_conf (MailA GTK_EXPAND | GTK_FILL, 0, 0, 0); rows++; g_hash_table_insert (gui->extra_config, entries[i].name, checkbox); + + g_signal_connect (checkbox, "toggled", G_CALLBACK (mail_config_changed), top); + if (entries[i].depname) setup_toggle (checkbox, entries[i].depname, gui); break; @@ -923,7 +934,9 @@ mail_account_gui_build_extra_conf (MailA } g_hash_table_insert (gui->extra_config, entries[i].name, entry); - + + g_signal_connect (entry, "changed", G_CALLBACK (mail_config_changed), top); + break; } @@ -1076,6 +1089,7 @@ static void default_folders_clicked (GtkButton *button, gpointer user_data) { MailAccountGui *gui = user_data; + MailAccountsTab *dialog = (MailAccountsTab *) gui->dialog; /* Drafts folder */ g_free (gui->drafts_folder_uri); @@ -1088,6 +1102,8 @@ default_folders_clicked (GtkButton *butt gui->sent_folder_uri = g_strdup (default_sent_folder_uri); evolution_folder_selector_button_set_uri (EVOLUTION_FOLDER_SELECTOR_BUTTON (gui->sent_folder_button), gui->sent_folder_uri); + + mail_config_changed (GTK_WIDGET (button), dialog->editor); } GtkWidget *mail_account_gui_folder_selector_button_new (char *widget_name, char *string1, char *string2, int int1, int int2); @@ -1578,6 +1594,50 @@ mail_account_gui_new (EAccount *account, } void +mail_account_gui_connect_change_signal (MailAccountGui *gui, GtkWidget *top) +{ + g_signal_connect (gui->account_name, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->default_account, "toggled", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->full_name, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->email_address, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->reply_to, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->organization, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->sig_option_menu, "changed", G_CALLBACK (mail_config_changed), top); + + g_signal_connect (gui->source.type, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->source.hostname, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->source.username, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->source.path, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->source.use_ssl, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->source.authtype, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->source.remember, "toggled", G_CALLBACK (mail_config_changed), top); + + g_signal_connect (gui->source_auto_check, "toggled", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->source_auto_check_min, "value-changed", G_CALLBACK (mail_config_changed), top); + + g_signal_connect (gui->transport.type, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->transport.hostname, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->transport.username, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->transport_needs_auth, "toggled", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->transport.use_ssl, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->transport.authtype, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->transport.remember, "toggled", G_CALLBACK (mail_config_changed), top); + + g_signal_connect (gui->drafts_folder_button, "clicked", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->sent_folder_button, "clicked", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->always_cc, "toggled", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->cc_addrs, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->always_bcc, "toggled", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->bcc_addrs, "changed", G_CALLBACK (mail_config_changed), top); + + g_signal_connect (gui->pgp_key, "changed", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->pgp_encrypt_to_self, "toggled", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->pgp_always_sign, "toggled", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->pgp_no_imip_sign, "toggled", G_CALLBACK (mail_config_changed), top); + g_signal_connect (gui->pgp_always_trust, "toggled", G_CALLBACK (mail_config_changed), top); +} + +void mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top) { GtkWidget *stores, *transports, *item; @@ -1620,7 +1680,7 @@ mail_account_gui_setup (MailAccountGui * g_object_set_data ((GObject *) gui->source.type, provider->protocol, item); g_object_set_data ((GObject *) item, "provider", provider); g_object_set_data ((GObject *) item, "number", GUINT_TO_POINTER (si)); - g_signal_connect (item, "activate", G_CALLBACK (source_type_changed), gui); + g_signal_connect (item, "activate", G_CALLBACK (source_type_changed), top); gtk_menu_shell_append(GTK_MENU_SHELL(stores), item); @@ -1691,7 +1751,7 @@ mail_account_gui_setup (MailAccountGui * /* add a "None" option to the stores menu */ item = gtk_menu_item_new_with_label (_("None")); g_object_set_data ((GObject *) item, "provider", NULL); - g_signal_connect (item, "activate", G_CALLBACK (source_type_changed), gui); + g_signal_connect (item, "activate", G_CALLBACK (source_type_changed), top); gtk_menu_shell_append(GTK_MENU_SHELL(stores), item); @@ -1760,6 +1820,8 @@ mail_account_gui_setup (MailAccountGui * gui->transport.provider_type = CAMEL_PROVIDER_TRANSPORT; g_free (transport_proto); } + + mail_account_gui_connect_change_signal (gui, top); } static void Index: mail/mail-account-gui.h =================================================================== RCS file: /cvs/gnome/evolution/mail/mail-account-gui.h,v retrieving revision 1.24 diff -u -p -r1.24 mail-account-gui.h --- mail/mail-account-gui.h 25 Mar 2003 15:49:19 -0000 1.24 +++ mail/mail-account-gui.h 13 Oct 2003 14:56:17 -0000 @@ -124,7 +124,7 @@ gboolean mail_account_gui_source_complet gboolean mail_account_gui_transport_complete (MailAccountGui *gui, GtkWidget **incomplete); gboolean mail_account_gui_management_complete (MailAccountGui *gui, GtkWidget **incomplete); -void mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url); +void mail_account_gui_build_extra_conf (MailAccountGui *gui, GtkWidget *top, const char *url); void mail_account_gui_auto_detect_extra_conf (MailAccountGui *gui); |
Index: mail/ChangeLog =================================================================== RCS file: /cvs/gnome/evolution/mail/ChangeLog,v retrieving revision 1.2761.2.32 diff -u -p -r1.2761.2.32 ChangeLog --- mail/ChangeLog 8 Oct 2003 16:06:08 -0000 1.2761.2.32 +++ mail/ChangeLog 14 Oct 2003 16:19:28 -0000 @@ -0,0 +0,18 @@ +2003-10-13 Charles Zhang <charles zhang sun com> + + * mail-account-gui.c (mail_account_gui_changed): change signal + handler on gui object, callback func. + (mail_account_gui_signal_connect): connect widgets to change signal. + (mail_account_gui_setup): call func mail_account_gui_signal_connect. + (sig_changed): call change handler func. + (mail_account_gui_build_extra_conf): connect "changed" signal. + (default_folders_clicked): call change handler func. + + * mail-account-editor.c (apply_changes): disable apply button. + (construct): disable apply button. + (mail_account_editor_changed): change signal handler on editor + object. + + * mail_account_editor.h (mail_account_editor_changed): defination + of func above. + Index: mail/mail-account-editor.c =================================================================== RCS file: /cvs/gnome/evolution/mail/mail-account-editor.c,v retrieving revision 1.57 diff -u -p -r1.57 mail-account-editor.c --- mail/mail-account-editor.c 25 Mar 2003 15:49:19 -0000 1.57 +++ mail/mail-account-editor.c 14 Oct 2003 16:19:32 -0000 @@ -105,7 +105,10 @@ apply_changes (MailAccountEditor *editor if (mail_account_gui_save (editor->gui) == FALSE) return FALSE; - + + gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), + GTK_RESPONSE_APPLY, FALSE); + /* save any changes we may have */ mail_config_write (); @@ -151,7 +154,10 @@ construct (MailAccountEditor *editor, EA GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - + + gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), + GTK_RESPONSE_APPLY, FALSE); + g_signal_connect (editor, "response", G_CALLBACK (editor_response_cb), editor); mail_account_gui_setup (editor->gui, GTK_WIDGET (editor)); @@ -172,3 +178,10 @@ mail_account_editor_new (EAccount *accou return new; } + +void +mail_account_editor_changed (MailAccountEditor *editor) +{ + gtk_dialog_set_response_sensitive (GTK_WIDGET (editor), + GTK_RESPONSE_APPLY, TRUE); +} Index: mail/mail-account-editor.h =================================================================== RCS file: /cvs/gnome/evolution/mail/mail-account-editor.h,v retrieving revision 1.20 diff -u -p -r1.20 mail-account-editor.h --- mail/mail-account-editor.h 17 Jan 2003 23:31:25 -0000 1.20 +++ mail/mail-account-editor.h 14 Oct 2003 16:19:32 -0000 @@ -59,6 +59,7 @@ typedef struct { GtkType mail_account_editor_get_type (void); MailAccountEditor *mail_account_editor_new (EAccount *account, GtkWindow *parent, MailAccountsTab *dialog); +void mail_account_editor_changed (MailAccountEditor *editor); #ifdef __cplusplus } Index: mail/mail-account-gui.c =================================================================== RCS file: /cvs/gnome/evolution/mail/mail-account-gui.c,v retrieving revision 1.133.4.3 diff -u -p -r1.133.4.3 mail-account-gui.c --- mail/mail-account-gui.c 29 Sep 2003 15:43:30 -0000 1.133.4.3 +++ mail/mail-account-gui.c 14 Oct 2003 16:19:37 -0000 @@ -730,6 +730,14 @@ setup_toggle (GtkWidget *widget, const c toggle_sensitivity (toggle, widget); } +static void +mail_account_gui_changed (GtkWidget *widget, MailAccountGui *gui) +{ + MailAccountsTab *dialog = (MailAccountsTab *) gui->dialog; + MailAccountEditor *editor = (MailAccountEditor *) dialog->editor; + mail_account_editor_changed (editor); +} + void mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string) { @@ -876,6 +884,9 @@ mail_account_gui_build_extra_conf (MailA g_hash_table_insert (gui->extra_config, entries[i].name, checkbox); if (entries[i].depname) setup_toggle (checkbox, entries[i].depname, gui); + + g_signal_connect (checkbox, "toggled", G_CALLBACK (mail_account_gui_changed), gui); + break; } @@ -924,6 +935,8 @@ mail_account_gui_build_extra_conf (MailA g_hash_table_insert (gui->extra_config, entries[i].name, entry); + g_signal_connect (entry, "changed", G_CALLBACK (mail_account_gui_changed), gui); + break; } @@ -1088,6 +1101,8 @@ default_folders_clicked (GtkButton *butt gui->sent_folder_uri = g_strdup (default_sent_folder_uri); evolution_folder_selector_button_set_uri (EVOLUTION_FOLDER_SELECTOR_BUTTON (gui->sent_folder_button), gui->sent_folder_uri); + + mail_account_gui_changed (GTK_WIDGET (button), gui); } GtkWidget *mail_account_gui_folder_selector_button_new (char *widget_name, char *string1, char *string2, int int1, int int2); @@ -1281,6 +1296,8 @@ sig_changed (GtkWidget *w, MailAccountGu gui->def_signature = (MailConfigSignature *) g_object_get_data(G_OBJECT(active), "sig"); gui->auto_signature = index == 1 ? TRUE : FALSE; + + mail_account_gui_changed (w, gui); } static void @@ -1577,6 +1594,51 @@ mail_account_gui_new (EAccount *account, return gui; } +static void +mail_account_gui_signal_connect (MailAccountGui *gui) +{ +#define CHANGE_CONNECT(w, s) g_signal_connect (w, s, G_CALLBACK (mail_account_gui_changed), gui); + + CHANGE_CONNECT (gui->account_name, "changed"); + CHANGE_CONNECT (gui->default_account, "toggled"); + CHANGE_CONNECT (gui->full_name, "changed"); + CHANGE_CONNECT (gui->email_address, "changed"); + CHANGE_CONNECT (gui->reply_to, "changed"); + CHANGE_CONNECT (gui->organization, "changed"); + + CHANGE_CONNECT (gui->source.type, "changed"); + CHANGE_CONNECT (gui->source.hostname, "changed"); + CHANGE_CONNECT (gui->source.username, "changed"); + CHANGE_CONNECT (gui->source.path, "changed"); + CHANGE_CONNECT (gui->source.use_ssl, "changed"); + CHANGE_CONNECT (gui->source.authtype, "changed"); + CHANGE_CONNECT (gui->source.remember, "toggled"); + + CHANGE_CONNECT (gui->source_auto_check, "toggled"); + CHANGE_CONNECT (gui->source_auto_check_min, "value-changed"); + + CHANGE_CONNECT (gui->transport.type, "changed"); + CHANGE_CONNECT (gui->transport.hostname, "changed"); + CHANGE_CONNECT (gui->transport.username, "changed"); + CHANGE_CONNECT (gui->transport_needs_auth, "toggled"); + CHANGE_CONNECT (gui->transport.use_ssl, "changed"); + CHANGE_CONNECT (gui->transport.authtype, "changed"); + CHANGE_CONNECT (gui->transport.remember, "toggled"); + + CHANGE_CONNECT (gui->drafts_folder_button, "clicked"); + CHANGE_CONNECT (gui->sent_folder_button, "clicked"); + CHANGE_CONNECT (gui->always_cc, "toggled"); + CHANGE_CONNECT (gui->cc_addrs, "changed"); + CHANGE_CONNECT (gui->always_bcc, "toggled"); + CHANGE_CONNECT (gui->bcc_addrs, "changed"); + + CHANGE_CONNECT (gui->pgp_key, "changed"); + CHANGE_CONNECT (gui->pgp_encrypt_to_self, "toggled"); + CHANGE_CONNECT (gui->pgp_always_sign, "toggled"); + CHANGE_CONNECT (gui->pgp_no_imip_sign, "toggled"); + CHANGE_CONNECT (gui->pgp_always_trust, "toggled"); +} + void mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top) { @@ -1760,6 +1822,8 @@ mail_account_gui_setup (MailAccountGui * gui->transport.provider_type = CAMEL_PROVIDER_TRANSPORT; g_free (transport_proto); } + + mail_account_gui_signal_connect (gui); } static void