[evolution] Add em_folder_tree_new_activity().



commit 1d7900e57e97f75096a43f5a942b44bbc1df4c77
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue May 24 11:55:19 2011 -0400

    Add em_folder_tree_new_activity().
    
    Similar to e_mail_reader_new_activity().  Creates, configures and
    submits a new EActivity instance, so asynchronous operations can easily
    be dispatched without a lot of boilerplate code.

 mail/em-folder-tree.c |   25 +++++++++++++++++++++++++
 mail/em-folder-tree.h |    1 +
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 8d856c1..aa15a79 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -1767,6 +1767,31 @@ em_folder_tree_new (EMailBackend *backend,
 		"backend", backend, NULL);
 }
 
+EActivity *
+em_folder_tree_new_activity (EMFolderTree *folder_tree)
+{
+	EActivity *activity;
+	EMailBackend *backend;
+	EAlertSink *alert_sink;
+	GCancellable *cancellable;
+
+	g_return_val_if_fail (EM_IS_FOLDER_TREE (folder_tree), NULL);
+
+	activity = e_activity_new ();
+
+	alert_sink = em_folder_tree_get_alert_sink (folder_tree);
+	e_activity_set_alert_sink (activity, alert_sink);
+
+	cancellable = camel_operation_new ();
+	e_activity_set_cancellable (activity, cancellable);
+	g_object_unref (cancellable);
+
+	backend = em_folder_tree_get_backend (folder_tree);
+	e_shell_backend_add_activity (E_SHELL_BACKEND (backend), activity);
+
+	return activity;
+}
+
 PangoEllipsizeMode
 em_folder_tree_get_ellipsize (EMFolderTree *folder_tree)
 {
diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h
index d2cd643..0e6eba4 100644
--- a/mail/em-folder-tree.h
+++ b/mail/em-folder-tree.h
@@ -92,6 +92,7 @@ struct _EMFolderTreeClass {
 GType		em_folder_tree_get_type		(void);
 GtkWidget *	em_folder_tree_new		(EMailBackend *backend,
 						 EAlertSink *alert_sink);
+EActivity *	em_folder_tree_new_activity	(EMFolderTree *folder_tree);
 PangoEllipsizeMode
 		em_folder_tree_get_ellipsize	(EMFolderTree *folder_tree);
 void		em_folder_tree_set_ellipsize	(EMFolderTree *folder_tree,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]