[evolution-kolab/ek-wip-acl] EPlugin: new util function for creating an EAlert from GError
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-acl] EPlugin: new util function for creating an EAlert from GError
- Date: Thu, 27 Sep 2012 13:28:51 +0000 (UTC)
commit 0dff6f16eb8de2af1ec40f39ab7e0910c9fcb445
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Thu Sep 27 15:00:57 2012 +0200
EPlugin: new util function for creating an EAlert from GError
* we use GError for error propagation
* errors in Evolution are displayed via
EAlertBar instances, which take EAlert
instances for displaying
* the util function creates a very basic
EAlert instance from a GError
src/eplugin/e-kolab-plugin-util.c | 18 ++++++++++++++++++
src/eplugin/e-kolab-plugin-util.h | 4 ++++
2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/eplugin/e-kolab-plugin-util.c b/src/eplugin/e-kolab-plugin-util.c
index c5bd30b..2d5bec0 100644
--- a/src/eplugin/e-kolab-plugin-util.c
+++ b/src/eplugin/e-kolab-plugin-util.c
@@ -45,6 +45,10 @@
#include "e-kolab-plugin-util.h"
/*----------------------------------------------------------------------------*/
+
+#define KOLAB_E_ERROR_SIMPLE_SYSTEM_ERROR "system:simple-error"
+
+/*----------------------------------------------------------------------------*/
/* internal statics (non-UI) */
@@ -422,4 +426,18 @@ e_kolab_plugin_util_ui_get_selected_foldername (EShellView *shell_view)
return foldername;
}
+EAlert*
+e_kolab_plugin_util_ui_alert_new_from_gerror (GError *err)
+{
+ EAlert *alert = NULL;
+
+ g_return_val_if_fail (err != NULL, NULL);
+ g_return_val_if_fail (err->message != NULL, NULL);
+
+ alert = e_alert_new (KOLAB_E_ERROR_SIMPLE_SYSTEM_ERROR,
+ err->message,
+ NULL);
+ return alert;
+}
+
/*----------------------------------------------------------------------------*/
diff --git a/src/eplugin/e-kolab-plugin-util.h b/src/eplugin/e-kolab-plugin-util.h
index bcea0ac..6cd7f32 100644
--- a/src/eplugin/e-kolab-plugin-util.h
+++ b/src/eplugin/e-kolab-plugin-util.h
@@ -35,6 +35,7 @@
#include <gtk/gtk.h>
#include <shell/e-shell-view.h>
+#include <libevolution-utils/e-alert.h>
#include <libekolab/camel-kolab-imapx-store.h>
@@ -73,6 +74,9 @@ e_kolab_plugin_util_ui_get_selected_sourcename (EShellView *shell_view);
gchar*
e_kolab_plugin_util_ui_get_selected_foldername (EShellView *shell_view);
+EAlert*
+e_kolab_plugin_util_ui_alert_new_from_gerror (GError *err);
+
/*----------------------------------------------------------------------------*/
#endif /* _E_KOLAB_PLUGIN_UTIL_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]