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 /mail/mail-ops.c | |
parent | 84680074b11f7a20f8e1e76975321b6daf706966 (diff) | |
download | gsoc2013-evolution-362fa5361015a75817e6990331a295e96efa6dd4.tar.gz 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
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 187 |
1 files changed, 46 insertions, 141 deletions
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 ******************************************************* */ |