diff options
author | Milan Crha <mcrha@redhat.com> | 2012-11-12 18:39:57 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-11-12 18:39:57 +0800 |
commit | 3567165fc785070b57d0681d784da93cdbb946dc (patch) | |
tree | f484e66d761331f081dd12e4bb5936bc19eed7ef | |
parent | 86150d64de35e82ee295ef71842665cc4edb6385 (diff) | |
download | gsoc2013-evolution-3567165fc785070b57d0681d784da93cdbb946dc.tar.gz gsoc2013-evolution-3567165fc785070b57d0681d784da93cdbb946dc.tar.zst gsoc2013-evolution-3567165fc785070b57d0681d784da93cdbb946dc.zip |
Bug #687998 - Attachment dialog shown when storing assigned task
-rw-r--r-- | composer/e-msg-composer.c | 4 | ||||
-rw-r--r-- | widgets/misc/e-attachment.c | 72 | ||||
-rw-r--r-- | widgets/misc/e-attachment.h | 9 |
3 files changed, 82 insertions, 3 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 8354afad85..76cafab99f 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -4422,9 +4422,7 @@ e_msg_composer_attach (EMsgComposer *composer, attachment = e_attachment_new (); e_attachment_set_mime_part (attachment, mime_part); e_attachment_store_add_attachment (store, attachment); - e_attachment_load_async ( - attachment, (GAsyncReadyCallback) - e_attachment_load_handle_error, composer); + e_attachment_load (attachment, NULL); g_object_unref (attachment); } diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c index edbb39f788..32f79da244 100644 --- a/widgets/misc/e-attachment.c +++ b/widgets/misc/e-attachment.c @@ -2019,6 +2019,29 @@ e_attachment_load_handle_error (EAttachment *attachment, g_error_free (error); } +gboolean +e_attachment_load (EAttachment *attachment, + GError **error) +{ + EAsyncClosure *closure; + GAsyncResult *result; + gboolean success; + + g_return_val_if_fail (E_IS_ATTACHMENT (attachment), FALSE); + + closure = e_async_closure_new (); + + e_attachment_load_async (attachment, e_async_closure_callback, closure); + + result = e_async_closure_wait (closure); + + success = e_attachment_load_finish (attachment, result, error); + + e_async_closure_free (closure); + + return success; +} + /************************* e_attachment_open_async() *************************/ typedef struct _OpenContext OpenContext; @@ -2295,6 +2318,30 @@ e_attachment_open_handle_error (EAttachment *attachment, g_error_free (error); } +gboolean +e_attachment_open (EAttachment *attachment, + GAppInfo *app_info, + GError **error) +{ + EAsyncClosure *closure; + GAsyncResult *result; + gboolean success; + + g_return_val_if_fail (E_IS_ATTACHMENT (attachment), FALSE); + + closure = e_async_closure_new (); + + e_attachment_open_async (attachment, app_info, e_async_closure_callback, closure); + + result = e_async_closure_wait (closure); + + success = e_attachment_open_finish (attachment, result, error); + + e_async_closure_free (closure); + + return success; +} + /************************* e_attachment_save_async() *************************/ typedef struct _SaveContext SaveContext; @@ -2807,3 +2854,28 @@ e_attachment_save_handle_error (EAttachment *attachment, gtk_widget_destroy (dialog); g_error_free (error); } + +gboolean +e_attachment_save (EAttachment *attachment, + GFile *in_destination, + GFile **out_destination, + GError **error) +{ + EAsyncClosure *closure; + GAsyncResult *result; + + g_return_val_if_fail (E_IS_ATTACHMENT (attachment), FALSE); + g_return_val_if_fail (out_destination != NULL, FALSE); + + closure = e_async_closure_new (); + + e_attachment_save_async (attachment, in_destination, e_async_closure_callback, closure); + + result = e_async_closure_wait (closure); + + *out_destination = e_attachment_save_finish (attachment, result, error); + + e_async_closure_free (closure); + + return *out_destination != NULL; +} diff --git a/widgets/misc/e-attachment.h b/widgets/misc/e-attachment.h index 26eceeb830..890c13294e 100644 --- a/widgets/misc/e-attachment.h +++ b/widgets/misc/e-attachment.h @@ -115,6 +115,8 @@ void e_attachment_load_async (EAttachment *attachment, gboolean e_attachment_load_finish (EAttachment *attachment, GAsyncResult *result, GError **error); +gboolean e_attachment_load (EAttachment *attachment, + GError **error); void e_attachment_open_async (EAttachment *attachment, GAppInfo *app_info, GAsyncReadyCallback callback, @@ -122,6 +124,9 @@ void e_attachment_open_async (EAttachment *attachment, gboolean e_attachment_open_finish (EAttachment *attachment, GAsyncResult *result, GError **error); +gboolean e_attachment_open (EAttachment *attachment, + GAppInfo *app_info, + GError **error); void e_attachment_save_async (EAttachment *attachment, GFile *destination, GAsyncReadyCallback callback, @@ -129,6 +134,10 @@ void e_attachment_save_async (EAttachment *attachment, GFile * e_attachment_save_finish (EAttachment *attachment, GAsyncResult *result, GError **error); +gboolean e_attachment_save (EAttachment *attachment, + GFile *in_destination, + GFile **out_destination, + GError **error); /* Handy GAsyncReadyCallback Functions */ void e_attachment_load_handle_error (EAttachment *attachment, |