aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-09-30 09:11:44 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-09-30 09:11:44 +0800
commit0e4c54eddced72c9639001849148fe1813c5dc4e (patch)
tree3ba53e853901d3b7e733b6aed145c5eb54e6a2fc /widgets/misc
parentd3b09614221d075452496a5198a3910d07eb2818 (diff)
downloadgsoc2013-evolution-0e4c54eddced72c9639001849148fe1813c5dc4e.tar
gsoc2013-evolution-0e4c54eddced72c9639001849148fe1813c5dc4e.tar.gz
gsoc2013-evolution-0e4c54eddced72c9639001849148fe1813c5dc4e.tar.bz2
gsoc2013-evolution-0e4c54eddced72c9639001849148fe1813c5dc4e.tar.lz
gsoc2013-evolution-0e4c54eddced72c9639001849148fe1813c5dc4e.tar.xz
gsoc2013-evolution-0e4c54eddced72c9639001849148fe1813c5dc4e.tar.zst
gsoc2013-evolution-0e4c54eddced72c9639001849148fe1813c5dc4e.zip
Messin around with EAlerts.
Trying out a new interface called EAlertSink. The idea is to centralize how errors are shown to the user. A GtkWindow subclass would implement the EAlertSink interface, which consists of a single method: void (*submit_alert) (EAlertSink *alert_sink, EAlert *alert); The subclass has complete control over what to do with the EAlert, although I imagine we'll wind up implementing various alert-handling policies as standalone widgets such as EAlertDialog. I'd like to try an EAlertInfoBar. Code that would otherwise display an error dialog itself would instead pass the EAlert to an appropriate EAlertSink and be done with it. Nothing is final yet. Still hacking on EAlert trying to find an API that feels right for these use cases.
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/e-signature-editor.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/widgets/misc/e-signature-editor.c b/widgets/misc/e-signature-editor.c
index 28c5819865..effbf8bc30 100644
--- a/widgets/misc/e-signature-editor.c
+++ b/widgets/misc/e-signature-editor.c
@@ -25,6 +25,7 @@
#include <glib/gi18n.h>
#include <e-util/e-alert-dialog.h>
+#include <e-util/e-alert-sink.h>
#include <e-util/e-signature-utils.h>
#include <misc/e-web-view.h>
@@ -64,10 +65,11 @@ static const gchar *ui =
" </toolbar>\n"
"</ui>";
-G_DEFINE_TYPE (
+G_DEFINE_TYPE_WITH_CODE (
ESignatureEditor,
e_signature_editor,
- GTKHTML_TYPE_EDITOR)
+ GTKHTML_TYPE_EDITOR,
+ G_IMPLEMENT_INTERFACE (E_TYPE_ALERT_SINK, NULL))
static void
handle_error (GError **error)
@@ -150,8 +152,8 @@ action_save_and_close_cb (GtkAction *action,
gtkhtml_editor_save (GTKHTML_EDITOR (editor), filename, html, &error);
if (error != NULL) {
- e_alert_run_dialog_for_args (
- GTK_WINDOW (editor),
+ e_alert_submit (
+ GTK_WIDGET (editor),
"mail:no-save-signature",
error->message, NULL);
g_clear_error (&error);
@@ -165,8 +167,8 @@ action_save_and_close_cb (GtkAction *action,
/* Make sure the signature name is not blank. */
if (*signature_name == '\0') {
- e_alert_run_dialog_for_args (
- GTK_WINDOW (editor),
+ e_alert_submit (
+ GTK_WIDGET (editor),
"mail:blank-signature", NULL);
gtk_widget_grab_focus (entry);
g_free (signature_name);
@@ -178,8 +180,8 @@ action_save_and_close_cb (GtkAction *action,
same_name = (ESignature *) e_signature_list_find (
signature_list, E_SIGNATURE_FIND_NAME, signature_name);
if (same_name != NULL && !e_signature_is_equal (signature, same_name)) {
- e_alert_run_dialog_for_args (
- GTK_WINDOW (editor),
+ e_alert_submit (
+ GTK_WIDGET (editor),
"mail:signature-already-exists",
signature_name, NULL);
gtk_widget_grab_focus (entry);