4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) version 3.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with the program; if not, see <http://www.gnu.org/licenses/>
20 * SECTION: e-alert-sink
21 * @short_description: an interface to handle alerts
22 * @include: e-util/e-alert-sink.h
24 * A widget that implements #EAlertSink means it can handle #EAlerts,
25 * usually by displaying them to the user.
32 #include "e-alert-sink.h"
34 #include "e-alert-dialog.h"
42 alert_sink_fallback (GtkWidget
*widget
,
48 parent
= gtk_widget_get_toplevel (widget
);
49 parent
= gtk_widget_is_toplevel (parent
) ? parent
: NULL
;
51 dialog
= e_alert_dialog_new (parent
, alert
);
52 gtk_dialog_run (GTK_DIALOG (dialog
));
53 gtk_widget_destroy (dialog
);
57 alert_sink_submit_alert (EAlertSink
*alert_sink
,
60 /* This is just a lame fallback handler. Implementors
61 * are strongly encouraged to override this method. */
62 alert_sink_fallback (GTK_WIDGET (alert_sink
), alert
);
66 e_alert_sink_default_init (EAlertSinkInterface
*interface
)
68 interface
->submit_alert
= alert_sink_submit_alert
;
72 * e_alert_sink_submit_alert:
73 * @alert_sink: an #EAlertSink
76 * This function is a place to pass #EAlert objects. Beyond that it has no
77 * well-defined behavior. It's up to the widget implementing the #EAlertSink
78 * interface to decide what to do with them.
81 e_alert_sink_submit_alert (EAlertSink
*alert_sink
,
84 EAlertSinkInterface
*interface
;
86 g_return_if_fail (E_IS_ALERT_SINK (alert_sink
));
87 g_return_if_fail (E_IS_ALERT (alert
));
89 interface
= E_ALERT_SINK_GET_INTERFACE (alert_sink
);
90 g_return_if_fail (interface
->submit_alert
!= NULL
);
92 interface
->submit_alert (alert_sink
, alert
);