From e0053bce8e3e5e7f18bea009f3bbfb1e51234f65 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 17 Jan 2003 23:31:27 +0000 Subject: Updated. (request_password): Same. 2003-01-17 Jeffrey Stedfast * mail-session.c (do_get_pass): Updated. (request_password): Same. * mail-send-recv.c (mail_send): Fixed to use EAccountService. * mail-config-druid.c (make_account): Updated to use EAccount and friends. * mail-account-gui.c (service_check_supported): Updated to use EAccountService. (mail_account_gui_new): Ref the account passed in and also update to use EAccount objects. (save_service): Updated to use an EAccountService. (add_new_store): Updated to use an EAccount. (mail_account_gui_save): Updated to use EAccounts. (setup_signatures): Updated because the new account->id->def_sig is now an int and not a structure pointer. * mail-account-editor.c (construct): Updated. (mail_account_editor_new): Now takes an EAccount object as an argument instead of a MailConfigAccount. * mail-crypto.c (mail_crypto_get_pgp_cipher_context): Updated to use EAccounts. * subscribe-dialog.c (populate_store_foreach): Removed. (populate_store_list): Can't use populate_store_foreach here because of the change to EAccountList so do it manually. * mail-vfolder.c (uri_is_ignore): Rewrote to use EAccountList and EIterator and all that fun. * mail-send-recv.c (build_dialogue): Updated to use EAccountList and EAccount object stuff. *ugh* (mail_send_receive): Here too. (mail_autoreceive_setup): Same. * mail-callbacks.c (check_send_configuration): Updated. (composer_get_message): Updated. (compose_msg): " (list_add_addresses): " (guess_me): " (guess_me_from_accounts): Same. (forward_get_composer): Here too. (mail_generate_reply): Same. (redirect_get_composer): " (empty_trash): And finally here. * mail-accounts.c (account_edit_clicked): Updated. (account_delete_clicked): Same. (account_default_clicked): Here too. (account_able_clicked): " (account_cursor_change): " (mail_accounts_load): Again here. * folder-browser.c (folder_browser_is_drafts): Updated to use EAccountList and EAccount stuff. (folder_browser_is_sent): Same. * component-factory.c (mail_load_storages): Updated to use EAccount and EAccountList stuff. (owner_set_cb): Same. (send_receive_cb): Here too. * mail-config.c: Rewritten to use EAccount and EAccountList objects. svn path=/trunk/; revision=19509 --- mail/mail-config-druid.c | 205 ++++++++++++++++++++++++----------------------- 1 file changed, 103 insertions(+), 102 deletions(-) (limited to 'mail/mail-config-druid.c') diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c index 639d2e31d0..c7791e3646 100644 --- a/mail/mail-config-druid.c +++ b/mail/mail-config-druid.c @@ -74,7 +74,7 @@ typedef enum { typedef struct { MailAccountGui *gui; - MailConfigAccount *account; + EAccount *account; EvolutionWizard *wizard; gboolean identity_copied; @@ -135,7 +135,7 @@ mail_config_druid_destroy (GtkObject *obj) bonobo_object_unref (BONOBO_OBJECT (druid->listener)); } - ((GtkObjectClass *)(parent_class))->destroy(obj); + ((GtkObjectClass *)(parent_class))->destroy(obj); } @@ -460,26 +460,27 @@ management_changed (GtkWidget *widget, gpointer data) gtk_widget_grab_focus (GTK_WIDGET (gui->gui->account_name)); } -static MailConfigAccount * +static EAccount * make_account (void) { - MailConfigAccount *account; const char *name, *user; + EAccountService *xport; struct utsname uts; + EAccount *account; - account = g_new0 (MailConfigAccount, 1); + account = e_account_new (); account->enabled = TRUE; - account->uid = e_account_gen_uid (); - account->id = g_new0 (MailConfigIdentity, 1); name = g_get_real_name (); account->id->name = g_strdup (name); user = g_get_user_name (); if (user && !uname (&uts) && strchr (uts.nodename, '.')) account->id->address = g_strdup_printf ("%s@%s", user, uts.nodename); - if (mail_config_get_default_transport ()) - account->transport = service_copy (mail_config_get_default_transport ()); + if ((xport = mail_config_get_default_transport ())) { + account->transport->url = g_strdup (xport->url); + account->transport->save_passwd = xport->save_passwd; + } return account; } @@ -763,15 +764,15 @@ management_activate_cb (GtkEntry *ent, gpointer user_data) static BonoboControl * get_fn (EvolutionWizard *wizard, - int page_num, - void *closure) + int page_num, + void *closure) { - MailConfigWizard *gui = closure; - BonoboControl *control; - GtkWidget *vbox, *widget; + MailConfigWizard *gui = closure; + BonoboControl *control; + GtkWidget *vbox, *widget; static gboolean first_time = TRUE; - if (gui->gui == NULL) { + if (gui->gui == NULL) { if (gui->account == NULL) { gui->account = make_account (); g_object_set_data ((GObject *) wizard, "account-data", gui->account); @@ -784,7 +785,7 @@ get_fn (EvolutionWizard *wizard, G_CALLBACK (management_changed), gui); g_signal_connect (gui->gui->full_name, "changed", G_CALLBACK (identity_changed), gui); - g_signal_connect (gui->gui->email_address, "changed", + g_signal_connect (gui->gui->email_address, "changed", G_CALLBACK (identity_changed), gui); g_signal_connect (gui->gui->reply_to,"changed", G_CALLBACK (identity_changed), gui); @@ -806,11 +807,11 @@ get_fn (EvolutionWizard *wizard, g_signal_connect (gui->gui->full_name, "activate", G_CALLBACK (identity_activate_cb), gui); - g_signal_connect (gui->gui->email_address, "activate", + g_signal_connect (gui->gui->email_address, "activate", G_CALLBACK (identity_activate_cb), gui); - g_signal_connect (gui->gui->reply_to,"activate", + g_signal_connect (gui->gui->reply_to,"activate", G_CALLBACK (identity_activate_cb), gui); - g_signal_connect (gui->gui->organization, "activate", + g_signal_connect (gui->gui->organization, "activate", G_CALLBACK (identity_activate_cb), gui); g_signal_connect (gui->gui->source.hostname, "activate", @@ -825,12 +826,12 @@ get_fn (EvolutionWizard *wizard, g_signal_connect (gui->gui->transport.username, "activate", G_CALLBACK (transport_activate_cb), gui); first_time = TRUE; - } + } - /* Fill in the druid pages */ + /* Fill in the druid pages */ vbox = gtk_vbox_new (FALSE, 0); - switch (page_num) { - case 0: + switch (page_num) { + case 0: widget = create_label ("identity_html"); gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); widget = glade_xml_get_widget (gui->gui->xml, "identity_required_frame"); @@ -839,89 +840,89 @@ get_fn (EvolutionWizard *wizard, widget = glade_xml_get_widget (gui->gui->xml, "identity_optional_frame"); gtk_widget_reparent (widget, vbox); gtk_box_set_child_packing (GTK_BOX (vbox), widget, FALSE, FALSE, 0, GTK_PACK_START); - break; - case 1: + break; + case 1: widget = create_label ("source_html"); gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); widget = glade_xml_get_widget (gui->gui->xml, "source_vbox"); - gtk_widget_reparent (widget, vbox); + gtk_widget_reparent (widget, vbox); gtk_widget_show (widget); - break; - case 2: + break; + case 2: widget = create_label ("extra_html"); gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); - widget = glade_xml_get_widget (gui->gui->xml, "extra_vbox"); - gtk_widget_reparent (widget, vbox); - break; - case 3: + widget = glade_xml_get_widget (gui->gui->xml, "extra_vbox"); + gtk_widget_reparent (widget, vbox); + break; + case 3: widget = create_label ("transport_html"); gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); - widget = glade_xml_get_widget (gui->gui->xml, "transport_vbox"); - gtk_widget_reparent (widget, vbox); + widget = glade_xml_get_widget (gui->gui->xml, "transport_vbox"); + gtk_widget_reparent (widget, vbox); gtk_widget_show (widget); - break; - case 4: + break; + case 4: widget = glade_xml_get_widget (gui->gui->xml, "management_frame"); gtk_widget_reparent (widget, vbox); break; - default: - return NULL; - } + default: + return NULL; + } - gtk_widget_show (vbox); - control = bonobo_control_new (vbox); + gtk_widget_show (vbox); + control = bonobo_control_new (vbox); if (first_time) { mail_account_gui_setup (gui->gui, NULL); first_time = FALSE; } - return control; + return control; } typedef gboolean (*NextFunc)(EvolutionWizard *wizard, gpointer data); typedef void (*PrepFunc)(EvolutionWizard *wizard, gpointer data); static struct { - NextFunc next_func; - PrepFunc prepare_func; - NextFunc back_func; - GtkSignalFunc finish_func; - GtkSignalFunc help_func; + NextFunc next_func; + PrepFunc prepare_func; + NextFunc back_func; + GtkSignalFunc finish_func; + GtkSignalFunc help_func; } wizard_pages[] = { - { identity_next, - identity_prepare, - NULL, - G_CALLBACK (NULL), - G_CALLBACK (NULL) }, - { source_next, - source_prepare, - NULL, - G_CALLBACK (NULL), - G_CALLBACK (NULL) }, - { NULL, - extra_prepare, - NULL, - G_CALLBACK (NULL), - G_CALLBACK (NULL) }, - { transport_next, - transport_prepare, - transport_back, - G_CALLBACK (NULL), - G_CALLBACK (NULL) }, - { NULL, - management_prepare, - NULL, - G_CALLBACK (NULL), - G_CALLBACK (NULL) } + { identity_next, + identity_prepare, + NULL, + G_CALLBACK (NULL), + G_CALLBACK (NULL) }, + { source_next, + source_prepare, + NULL, + G_CALLBACK (NULL), + G_CALLBACK (NULL) }, + { NULL, + extra_prepare, + NULL, + G_CALLBACK (NULL), + G_CALLBACK (NULL) }, + { transport_next, + transport_prepare, + transport_back, + G_CALLBACK (NULL), + G_CALLBACK (NULL) }, + { NULL, + management_prepare, + NULL, + G_CALLBACK (NULL), + G_CALLBACK (NULL) } }; static void wizard_next_cb (EvolutionWizard *wizard, - int page_num, - MailConfigWizard *gui) + int page_num, + MailConfigWizard *gui) { - if (wizard_pages[page_num].next_func == NULL + if (wizard_pages[page_num].next_func == NULL || !(wizard_pages[page_num].next_func (wizard, gui))) { if (page_num < 5-1) { evolution_wizard_set_page(wizard, page_num+1, NULL); @@ -931,26 +932,26 @@ wizard_next_cb (EvolutionWizard *wizard, static void wizard_prepare_cb (EvolutionWizard *wizard, - int page_num, - MailConfigWizard *gui) + int page_num, + MailConfigWizard *gui) { - if (wizard_pages[page_num].prepare_func != NULL) { - wizard_pages[page_num].prepare_func (wizard, gui); - } + if (wizard_pages[page_num].prepare_func != NULL) { + wizard_pages[page_num].prepare_func (wizard, gui); + } } static void wizard_back_cb (EvolutionWizard *wizard, - int page_num, - MailConfigWizard *gui) + int page_num, + MailConfigWizard *gui) { if (page_num >= 5) evolution_wizard_set_page(wizard, 4, NULL); - else if (wizard_pages[page_num].back_func == NULL + else if (wizard_pages[page_num].back_func == NULL || !(wizard_pages[page_num].back_func (wizard, gui))) { if (page_num > 0) evolution_wizard_set_page(wizard, page_num-1, NULL); - } + } } static void @@ -974,8 +975,8 @@ wizard_finish_cb (EvolutionWizard *wizard, static void wizard_cancel_cb (EvolutionWizard *wizard, - int page_num, - MailConfigWizard *gui) + int page_num, + MailConfigWizard *gui) { mail_account_gui_destroy (gui->gui); gui->gui = NULL; @@ -983,8 +984,8 @@ wizard_cancel_cb (EvolutionWizard *wizard, static void wizard_help_cb (EvolutionWizard *wizard, - int page_num, - MailConfigWizard *gui) + int page_num, + MailConfigWizard *gui) { } @@ -1001,34 +1002,34 @@ wizard_free (MailConfigWizard *wizard) } BonoboObject * -evolution_mail_config_wizard_new(void) +evolution_mail_config_wizard_new (void) { EvolutionWizard *wizard; - MailConfigAccount *account; - MailConfigWizard *gui; + MailConfigWizard *gui; + EAccount *account; - account = make_account (); + account = make_account (); - gui = g_new (MailConfigWizard, 1); + gui = g_new (MailConfigWizard, 1); gui->gui = NULL; - gui->account = account; + gui->account = account; gui->identity_copied = FALSE; gui->last_source = NULL; gui->page = MAIL_CONFIG_WIZARD_PAGE_NONE; - wizard = evolution_wizard_new (get_fn, 5, gui); + wizard = evolution_wizard_new (get_fn, 5, gui); account_wizard = wizard; g_object_set_data_full ((GObject *) account_wizard, "account-data", gui, (GDestroyNotify) wizard_free); gui->wizard = wizard; - g_signal_connect (wizard, "next", G_CALLBACK (wizard_next_cb), gui); - g_signal_connect (wizard, "prepare", G_CALLBACK (wizard_prepare_cb), gui); - g_signal_connect (wizard, "back", G_CALLBACK (wizard_back_cb), gui); - g_signal_connect (wizard, "finish", G_CALLBACK (wizard_finish_cb), gui); - g_signal_connect (wizard, "cancel", G_CALLBACK (wizard_cancel_cb), gui); - g_signal_connect (wizard, "help", G_CALLBACK (wizard_help_cb), gui); + g_signal_connect (wizard, "next", G_CALLBACK (wizard_next_cb), gui); + g_signal_connect (wizard, "prepare", G_CALLBACK (wizard_prepare_cb), gui); + g_signal_connect (wizard, "back", G_CALLBACK (wizard_back_cb), gui); + g_signal_connect (wizard, "finish", G_CALLBACK (wizard_finish_cb), gui); + g_signal_connect (wizard, "cancel", G_CALLBACK (wizard_cancel_cb), gui); + g_signal_connect (wizard, "help", G_CALLBACK (wizard_help_cb), gui); - return BONOBO_OBJECT (wizard); + return BONOBO_OBJECT (wizard); } -- cgit v1.2.3