diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-09-30 09:11:44 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-09-30 09:11:44 +0800 |
commit | 0e4c54eddced72c9639001849148fe1813c5dc4e (patch) | |
tree | 3ba53e853901d3b7e733b6aed145c5eb54e6a2fc /calendar | |
parent | d3b09614221d075452496a5198a3910d07eb2818 (diff) | |
download | gsoc2013-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 'calendar')
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 2213d478bc..63196abea4 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -37,6 +37,7 @@ #include <gdk/gdkkeysyms.h> #include <e-util/e-util.h> #include <e-util/e-binding.h> +#include <e-util/e-alert-sink.h> #include <e-util/e-dialog-utils.h> #include <e-util/e-util-private.h> #include <e-util/gconf-bridge.h> @@ -193,7 +194,9 @@ static void page_dates_changed_cb (CompEditor *editor, static void obj_modified_cb (ECal *client, GList *objs, CompEditor *editor); static void obj_removed_cb (ECal *client, GList *uids, CompEditor *editor); -G_DEFINE_TYPE (CompEditor, comp_editor, GTK_TYPE_WINDOW) +G_DEFINE_TYPE_WITH_CODE ( + CompEditor, comp_editor, GTK_TYPE_WINDOW, + G_IMPLEMENT_INTERFACE (E_TYPE_ALERT_SINK, NULL)) enum { OBJECT_CREATED, @@ -831,9 +834,8 @@ action_save_cb (GtkAction *action, } if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) { - e_alert_run_dialog_for_args ( - (GtkWindow *) gtk_widget_get_toplevel ( - GTK_WIDGET (editor)), + e_alert_submit ( + GTK_WIDGET (editor), "calendar:prompt-read-only-cal-editor", e_source_peek_name ( e_cal_get_source (priv->client)), @@ -1878,9 +1880,8 @@ prompt_and_save_changes (CompEditor *editor, gboolean send) switch (save_component_dialog (GTK_WINDOW (editor), priv->comp)) { case GTK_RESPONSE_YES: /* Save */ if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) { - e_alert_run_dialog_for_args ( - (GtkWindow *) gtk_widget_get_toplevel ( - GTK_WIDGET (editor)), + e_alert_submit ( + GTK_WIDGET (editor), "calendar:prompt-read-only-cal-editor", e_source_peek_name ( e_cal_get_source (priv->client)), |