[evolution] Add e_shell_view_remote_delete_source().



commit 6055337bbac4e516c2c5b41b965fbffce6cf69c6
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Aug 2 17:19:55 2012 -0400

    Add e_shell_view_remote_delete_source().
    
    Convenience function wraps e_source_remote_delete() but handles
    user-facing activity and error display.

 shell/e-shell-view.c |   33 +++++++++++++++++++++++++++++++++
 shell/e-shell-view.h |    3 +++
 2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 06e99a8..a8e47d4 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -1954,3 +1954,36 @@ e_shell_view_remove_source (EShellView *shell_view,
 	e_shell_backend_add_activity (shell_backend, activity);
 }
 
+/**
+ * e_shell_view_remote_delete_source:
+ * @shell_view: an #EShellView
+ * @source: an #ESource
+ *
+ * Deletes the resource represented by @source from a remote server.
+ * The @source must be #ESource:remote-deletable.  This will also delete
+ * the key file for @source and broadcast its removal to all clients,
+ * similar to e_shell_view_remove_source().
+ *
+ * This function does not block; @shell_view will dispatch the operation
+ * asynchronously and handle any errors.
+ **/
+void
+e_shell_view_remote_delete_source (EShellView *shell_view,
+                                   ESource *source)
+{
+	EActivity *activity;
+	EAlertSink *alert_sink;
+	EShellBackend *shell_backend;
+	EShellContent *shell_content;
+
+	g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+	g_return_if_fail (E_IS_SOURCE (source));
+
+	shell_backend = e_shell_view_get_shell_backend (shell_view);
+	shell_content = e_shell_view_get_shell_content (shell_view);
+
+	alert_sink = E_ALERT_SINK (shell_content);
+	activity = e_source_util_remote_delete (source, alert_sink);
+	e_shell_backend_add_activity (shell_backend, activity);
+}
+
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index 726777f..84b3c69 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -234,6 +234,9 @@ void		e_shell_view_write_source	(EShellView *shell_view,
 						 ESource *source);
 void		e_shell_view_remove_source	(EShellView *shell_view,
 						 ESource *source);
+void		e_shell_view_remote_delete_source
+						(EShellView *shell_view,
+						 ESource *source);
 
 G_END_DECLS
 



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