aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-11-12 18:39:29 +0800
committerMilan Crha <mcrha@redhat.com>2012-11-12 18:39:29 +0800
commita92d93fdf2df62908e25b61ef88d222e6b6ec690 (patch)
treecb90271d98d1791c2cd930d350f5e1d25fb0301c
parent303096a35e71541b3412d34bd63232e3939a15f8 (diff)
downloadgsoc2013-evolution-a92d93fdf2df62908e25b61ef88d222e6b6ec690.tar.gz
gsoc2013-evolution-a92d93fdf2df62908e25b61ef88d222e6b6ec690.tar.zst
gsoc2013-evolution-a92d93fdf2df62908e25b61ef88d222e6b6ec690.zip
Bug #687998 - Attachment dialog shown when storing assigned task
-rw-r--r--composer/e-msg-composer.c4
-rw-r--r--widgets/misc/e-attachment.c72
-rw-r--r--widgets/misc/e-attachment.h9
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 113312ac48..cd9385a76b 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,