diff options
author | Dan Winship <danw@src.gnome.org> | 2000-09-06 03:43:08 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-09-06 03:43:08 +0800 |
commit | 362fa5361015a75817e6990331a295e96efa6dd4 (patch) | |
tree | 7a7bddff1336ab7509dee702df6f423a1794226a | |
parent | 84680074b11f7a20f8e1e76975321b6daf706966 (diff) | |
download | gsoc2013-evolution-362fa5361015a75817e6990331a295e96efa6dd4.tar gsoc2013-evolution-362fa5361015a75817e6990331a295e96efa6dd4.tar.gz gsoc2013-evolution-362fa5361015a75817e6990331a295e96efa6dd4.tar.bz2 gsoc2013-evolution-362fa5361015a75817e6990331a295e96efa6dd4.tar.lz gsoc2013-evolution-362fa5361015a75817e6990331a295e96efa6dd4.tar.xz gsoc2013-evolution-362fa5361015a75817e6990331a295e96efa6dd4.tar.zst gsoc2013-evolution-362fa5361015a75817e6990331a295e96efa6dd4.zip |
Replace mail_do_setup_draftbox, mail_do_setup_outbox, and
* mail-ops.c: Replace mail_do_setup_draftbox,
mail_do_setup_outbox, and mail_do_setup_sentbox with
mail_do_setup_folder.
(do_send_mail, do_send_queue): s/sentbox_folder/sent_folder/
* component-factory.c (owner_set_cb): Use mail_do_setup_folder,
rename sentbox_folder to sent_folder, and call
mail_operation_wait_for_finish after the setup_folder calls in
case anything needs to use the _folder variables.
svn path=/trunk/; revision=5200
-rw-r--r-- | mail/ChangeLog | 12 | ||||
-rw-r--r-- | mail/component-factory.c | 11 | ||||
-rw-r--r-- | mail/mail-ops.c | 187 | ||||
-rw-r--r-- | mail/mail-ops.h | 4 |
4 files changed, 66 insertions, 148 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index a0e178f417..fc6ccbc06a 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,15 @@ +2000-09-05 Dan Winship <danw@helixcode.com> + + * mail-ops.c: Replace mail_do_setup_draftbox, + mail_do_setup_outbox, and mail_do_setup_sentbox with + mail_do_setup_folder. + (do_send_mail, do_send_queue): s/sentbox_folder/sent_folder/ + + * component-factory.c (owner_set_cb): Use mail_do_setup_folder, + rename sentbox_folder to sent_folder, and call + mail_operation_wait_for_finish after the setup_folder calls in + case anything needs to use the _folder variables. + 2000-09-04 Jeffrey Stedfast <fejj@helixcode.com> * mail-format.c (mail_generate_reply): Applied Jesse's patch that diff --git a/mail/component-factory.c b/mail/component-factory.c index db6e86118d..636776692d 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -44,7 +44,7 @@ CamelFolder *drafts_folder = NULL; CamelFolder *outbox_folder = NULL; -CamelFolder *sentbox_folder = NULL; /* this one should be configurable? */ +CamelFolder *sent_folder = NULL; /* this one should be configurable? */ char *evolution_dir; static void create_vfolder_storage (EvolutionShellComponent *shell_component); @@ -117,9 +117,12 @@ owner_set_cb (EvolutionShellComponent *shell_component, evolution_dir = g_strdup (evolution_homedir); mail_config_init (); - mail_do_setup_draftbox (); - mail_do_setup_outbox (); - mail_do_setup_sentbox (); + mail_do_setup_folder ("Drafts", &drafts_folder); + mail_do_setup_folder ("Outbox", &outbox_folder); + mail_do_setup_folder ("Sent Messages", &sent_folder); + /* Don't proceed until those _folder variables are valid. */ + mail_operation_wait_for_finish (); + create_vfolder_storage (shell_component); corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); diff --git a/mail/mail-ops.c b/mail/mail-ops.c index a856d30435..a122f19a33 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -303,7 +303,7 @@ static void do_send_mail (gpointer in_data, gpointer op_data, CamelException *ex) { send_mail_input_t *input = (send_mail_input_t *) in_data; - extern CamelFolder *sentbox_folder; + extern CamelFolder *sent_folder; CamelTransport *xport; char *x_mailer; @@ -340,15 +340,15 @@ do_send_mail (gpointer in_data, gpointer op_data, CamelException *ex) mail_tool_camel_lock_down (); } - /* now to save the message in Sentbox */ - if (sentbox_folder) { + /* now to save the message in Sent */ + if (sent_folder) { CamelMessageInfo *info; mail_tool_camel_lock_up (); info = g_new0 (CamelMessageInfo, 1); info->flags = 0; - camel_folder_append_message (sentbox_folder, input->message, info, ex); + camel_folder_append_message (sent_folder, input->message, info, ex); g_free (info); mail_tool_camel_lock_down (); @@ -457,7 +457,7 @@ static void do_send_queue (gpointer in_data, gpointer op_data, CamelException *ex) { send_queue_input_t *input = (send_queue_input_t *) in_data; - extern CamelFolder *sentbox_folder; + extern CamelFolder *sent_folder; CamelTransport *xport; GPtrArray *uids; char *x_mailer; @@ -503,15 +503,15 @@ do_send_queue (gpointer in_data, gpointer op_data, CamelException *ex) CAMEL_MESSAGE_DELETED, ~set); mail_tool_camel_lock_down (); - /* now to save the message in Sentbox */ - if (sentbox_folder) { + /* now to save the message in Sent */ + if (sent_folder) { CamelMessageInfo *info; mail_tool_camel_lock_up (); info = g_new0 (CamelMessageInfo, 1); info->flags = 0; - camel_folder_append_message (sentbox_folder, message, info, ex); + camel_folder_append_message (sent_folder, message, info, ex); g_free (info); mail_tool_camel_lock_down (); @@ -2101,171 +2101,76 @@ mail_do_edit_messages (CamelFolder *folder, GPtrArray *uids, mail_operation_queue (&op_edit_messages, input, TRUE); } -/* ** SETUP DRAFTBOX ****************************************************** */ +/* ** SETUP FOLDER ****************************************************** */ -static gchar *describe_setup_draftbox (gpointer in_data, gboolean gerund); -static void noop_setup_draftbox (gpointer in_data, gpointer op_data, - CamelException *ex); -static void do_setup_draftbox (gpointer in_data, gpointer op_data, - CamelException *ex); - -static gchar * -describe_setup_draftbox (gpointer in_data, gboolean gerund) -{ - if (gerund) - return g_strdup_printf (_("Loading Draftbox")); - else - return g_strdup_printf (_("Load Draftbox")); -} - -static void -noop_setup_draftbox (gpointer in_data, gpointer op_data, CamelException *ex) -{ -} - -static void -do_setup_draftbox (gpointer in_data, gpointer op_data, CamelException *ex) -{ - extern CamelFolder *drafts_folder; - gchar *url; +typedef struct setup_folder_input_s { + const char *name; + CamelFolder **folder; +} setup_folder_input_t; - url = g_strdup_printf ("mbox://%s/local/Drafts", evolution_dir); - drafts_folder = mail_tool_get_folder_from_urlname (url, "mbox", TRUE, ex); - g_free (url); -} - -/* - *static void - *cleanup_setup_draftbox (gpointer in_data, gpointer op_data, - * CamelException *ex) - *{ - *} - */ - -static const mail_operation_spec op_setup_draftbox = { - describe_setup_draftbox, - 0, - noop_setup_draftbox, - do_setup_draftbox, - noop_setup_draftbox -}; - -void -mail_do_setup_draftbox (void) -{ - mail_operation_queue (&op_setup_draftbox, NULL, FALSE); -} - -/* ** SETUP OUTBOX ****************************************************** */ - -static gchar *describe_setup_outbox (gpointer in_data, gboolean gerund); -static void noop_setup_outbox (gpointer in_data, gpointer op_data, - CamelException *ex); -static void do_setup_outbox (gpointer in_data, gpointer op_data, +static gchar *describe_setup_folder (gpointer in_data, gboolean gerund); +static void setup_setup_folder (gpointer in_data, gpointer op_data, + CamelException *ex); +static void do_setup_folder (gpointer in_data, gpointer op_data, CamelException *ex); +static void cleanup_setup_folder (gpointer in_data, gpointer op_data, + CamelException *ex); static gchar * -describe_setup_outbox (gpointer in_data, gboolean gerund) +describe_setup_folder (gpointer in_data, gboolean gerund) { + setup_folder_input_t *input = (setup_folder_input_t *) in_data; + if (gerund) - return g_strdup_printf (_("Loading Outbox")); + return g_strdup_printf (_("Loading %s Folder"), input->name); else - return g_strdup_printf (_("Load Outbox")); + return g_strdup_printf (_("Load %s Folder"), input->name); } static void -noop_setup_outbox (gpointer in_data, gpointer op_data, CamelException *ex) +setup_setup_folder (gpointer in_data, gpointer op_data, CamelException *ex) { } static void -do_setup_outbox (gpointer in_data, gpointer op_data, CamelException *ex) +do_setup_folder (gpointer in_data, gpointer op_data, CamelException *ex) { - extern CamelFolder *outbox_folder; + setup_folder_input_t *input = (setup_folder_input_t *) in_data; gchar *url; - url = g_strdup_printf ("mbox://%s/local/Outbox", evolution_dir); - outbox_folder = mail_tool_get_folder_from_urlname (url, "mbox", TRUE, ex); + url = g_strdup_printf ("mbox://%s/local/%s", evolution_dir, + input->name); + *(input->folder) = mail_tool_get_folder_from_urlname (url, "mbox", + TRUE, ex); g_free (url); } -/* - *static void - *cleanup_setup_outbox (gpointer in_data, gpointer op_data, - * CamelException *ex) - *{ - *} - */ - -static const mail_operation_spec op_setup_outbox = { - describe_setup_outbox, - 0, - noop_setup_outbox, - do_setup_outbox, - noop_setup_outbox -}; - -void -mail_do_setup_outbox (void) -{ - mail_operation_queue (&op_setup_outbox, NULL, FALSE); -} - -/* ** SETUP SENTBOX ****************************************************** */ - -static gchar *describe_setup_sentbox (gpointer in_data, gboolean gerund); -static void noop_setup_sentbox (gpointer in_data, gpointer op_data, - CamelException *ex); -static void do_setup_sentbox (gpointer in_data, gpointer op_data, - CamelException *ex); - -static gchar * -describe_setup_sentbox (gpointer in_data, gboolean gerund) -{ - if (gerund) - return g_strdup_printf (_("Loading Sentbox")); - else - return g_strdup_printf (_("Load Sentbox")); -} - static void -noop_setup_sentbox (gpointer in_data, gpointer op_data, CamelException *ex) +cleanup_setup_folder (gpointer in_data, gpointer op_data, CamelException *ex) { -} + setup_folder_input_t *input = (setup_folder_input_t *) in_data; -static void -do_setup_sentbox (gpointer in_data, gpointer op_data, CamelException *ex) -{ - extern CamelFolder *sentbox_folder; - gchar *url; - - url = g_strdup_printf ("mbox://%s/local/Sentbox", evolution_dir); - sentbox_folder = mail_tool_get_folder_from_urlname (url, "mbox", TRUE, ex); - g_free (url); + g_free (input->name); } -/* - *static void - *cleanup_setup_sentbox (gpointer in_data, gpointer op_data, - * CamelException *ex) - *{ - *} - */ - -static const mail_operation_spec op_setup_sentbox = { - describe_setup_sentbox, +static const mail_operation_spec op_setup_folder = { + describe_setup_folder, 0, - noop_setup_sentbox, - do_setup_sentbox, - noop_setup_sentbox + setup_setup_folder, + do_setup_folder, + cleanup_setup_folder }; void -mail_do_setup_sentbox (void) +mail_do_setup_folder (const char *name, CamelFolder **folder) { - mail_operation_queue (&op_setup_sentbox, NULL, FALSE); -} + setup_folder_input_t *input; + input = g_new (setup_folder_input_t, 1); + input->name = name; + input->folder = folder; + mail_operation_queue (&op_setup_folder, input, TRUE); +} /* ** VIEW MESSAGES ******************************************************* */ diff --git a/mail/mail-ops.h b/mail/mail-ops.h index 47758a03e7..9321f8807a 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -64,9 +64,7 @@ void mail_do_display_message (MessageList *ml, const char *uid, gint (*timeout) (gpointer)); void mail_do_edit_messages (CamelFolder *folder, GPtrArray *uids, GtkSignalFunc signal); -void mail_do_setup_draftbox (void); -void mail_do_setup_outbox (void); -void mail_do_setup_sentbox (void); +void mail_do_setup_folder (const char *name, CamelFolder **folder); void mail_do_view_messages (CamelFolder *folder, GPtrArray *uids, FolderBrowser *fb); |