[l10n] Updated German help translation screen-shots
[evolution.git] / e-util / e-alert-sink.c
blobae3a7361e180fc86238172cc439fe97a9ce5d6ac
1 /*
2 * e-alert-sink.c
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/>
19 /**
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.
26 **/
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
32 #include "e-alert-sink.h"
34 #include "e-alert-dialog.h"
36 G_DEFINE_INTERFACE (
37 EAlertSink,
38 e_alert_sink,
39 GTK_TYPE_WIDGET)
41 static void
42 alert_sink_fallback (GtkWidget *widget,
43 EAlert *alert)
45 GtkWidget *dialog;
46 gpointer parent;
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);
56 static void
57 alert_sink_submit_alert (EAlertSink *alert_sink,
58 EAlert *alert)
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);
65 static void
66 e_alert_sink_default_init (EAlertSinkInterface *interface)
68 interface->submit_alert = alert_sink_submit_alert;
71 /**
72 * e_alert_sink_submit_alert:
73 * @alert_sink: an #EAlertSink
74 * @alert: an #EAlert
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.
79 **/
80 void
81 e_alert_sink_submit_alert (EAlertSink *alert_sink,
82 EAlert *alert)
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);