aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-11-01 04:02:30 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-11-01 10:54:30 +0800
commit82925c6be94e9e48e4ef521a88a9feec24cf9eef (patch)
tree715d8578cd7b94eda1e7e0ade89057ea4fac5349
parentcce2026f452ec3171a2211fb83651c90e71182a2 (diff)
downloadgsoc2013-evolution-82925c6be94e9e48e4ef521a88a9feec24cf9eef.tar
gsoc2013-evolution-82925c6be94e9e48e4ef521a88a9feec24cf9eef.tar.gz
gsoc2013-evolution-82925c6be94e9e48e4ef521a88a9feec24cf9eef.tar.bz2
gsoc2013-evolution-82925c6be94e9e48e4ef521a88a9feec24cf9eef.tar.lz
gsoc2013-evolution-82925c6be94e9e48e4ef521a88a9feec24cf9eef.tar.xz
gsoc2013-evolution-82925c6be94e9e48e4ef521a88a9feec24cf9eef.tar.zst
gsoc2013-evolution-82925c6be94e9e48e4ef521a88a9feec24cf9eef.zip
Pass an EAlertSink to e_alert_sink_submit_alert().
Passing a random GtkWidget and then searching its ancestors for an EAlertSink turned out to be not as useful as I thought. Most of the time we know about and have access to the widget that implements EAlertSink, so just pass it directly as an EAlertSink.
-rw-r--r--calendar/gui/dialogs/comp-editor.c4
-rw-r--r--composer/e-composer-actions.c4
-rw-r--r--composer/e-msg-composer.c8
-rw-r--r--e-util/e-alert-sink.c25
-rw-r--r--e-util/e-alert-sink.h2
-rw-r--r--e-util/e-alert.c10
-rw-r--r--e-util/e-alert.h6
-rw-r--r--mail/e-mail-backend.c3
-rw-r--r--mail/em-composer-utils.c9
-rw-r--r--mail/mail-mt.c5
-rw-r--r--modules/offline-alert/evolution-offline-alert.c5
-rw-r--r--widgets/misc/e-signature-editor.c6
12 files changed, 41 insertions, 46 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index eb908d1e33..af5b23d384 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -834,7 +834,7 @@ action_save_cb (GtkAction *action,
if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) {
e_alert_submit (
- GTK_WIDGET (editor),
+ E_ALERT_SINK (editor),
"calendar:prompt-read-only-cal-editor",
e_source_peek_name (
e_cal_get_source (priv->client)),
@@ -1881,7 +1881,7 @@ prompt_and_save_changes (CompEditor *editor, gboolean send)
case GTK_RESPONSE_YES: /* Save */
if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) {
e_alert_submit (
- GTK_WIDGET (editor),
+ E_ALERT_SINK (editor),
"calendar:prompt-read-only-cal-editor",
e_source_peek_name (
e_cal_get_source (priv->client)),
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c
index 5e57e6df2f..3b2aabfefc 100644
--- a/composer/e-composer-actions.c
+++ b/composer/e-composer-actions.c
@@ -131,7 +131,7 @@ action_save_cb (GtkAction *action,
return;
} else {
e_alert_submit (
- GTK_WIDGET (composer),
+ E_ALERT_SINK (composer),
E_ALERT_NO_SAVE_FILE, filename,
g_strerror (errno_saved), NULL);
return;
@@ -141,7 +141,7 @@ action_save_cb (GtkAction *action,
if (!gtkhtml_editor_save (editor, filename, TRUE, &error)) {
e_alert_submit (
- GTK_WIDGET (composer),
+ E_ALERT_SINK (composer),
E_ALERT_NO_SAVE_FILE,
filename, error->message, NULL);
g_error_free (error);
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 4edaeea610..2bca57d3fd 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -3516,7 +3516,7 @@ msg_composer_send_cb (EMsgComposer *composer,
g_warn_if_fail (message == NULL);
async_context_free (context);
e_alert_submit (
- GTK_WIDGET (composer),
+ E_ALERT_SINK (composer),
"mail-composer:no-build-message",
error->message, NULL);
g_error_free (error);
@@ -3600,7 +3600,7 @@ msg_composer_save_to_drafts_cb (EMsgComposer *composer,
g_warn_if_fail (message == NULL);
async_context_free (context);
e_alert_submit (
- GTK_WIDGET (composer),
+ E_ALERT_SINK (composer),
"mail-composer:no-build-message",
error->message, NULL);
g_error_free (error);
@@ -3676,7 +3676,7 @@ msg_composer_save_to_outbox_cb (EMsgComposer *composer,
g_warn_if_fail (message == NULL);
async_context_free (context);
e_alert_submit (
- GTK_WIDGET (composer),
+ E_ALERT_SINK (composer),
"mail-composer:no-build-message",
error->message, NULL);
g_error_free (error);
@@ -3759,7 +3759,7 @@ msg_composer_print_cb (EMsgComposer *composer,
g_warn_if_fail (message == NULL);
async_context_free (context);
e_alert_submit (
- GTK_WIDGET (composer),
+ E_ALERT_SINK (composer),
"mail-composer:no-build-message",
error->message, NULL);
g_error_free (error);
diff --git a/e-util/e-alert-sink.c b/e-util/e-alert-sink.c
index f26f114c71..2a8db40afb 100644
--- a/e-util/e-alert-sink.c
+++ b/e-util/e-alert-sink.c
@@ -66,35 +66,24 @@ e_alert_sink_default_init (EAlertSinkInterface *interface)
/**
* e_alert_sink_submit_alert:
- * @widget: a #GtkWidget, either itself an #EAlertSink or a child of one
+ * @alert_sink: an #EAlertSink
* @alert: an #EAlert
*
* This function is a place to pass #EAlert objects. Beyond that it has no
* well-defined behavior. It's up to the widget implementing the #EAlertSink
* interface to decide what to do with them.
- *
- * Either @widget or one of its ancestors must implement #EAlertSink.
- *
- * The default behavior is to display the @alert in a dialog.
**/
void
-e_alert_sink_submit_alert (GtkWidget *widget,
+e_alert_sink_submit_alert (EAlertSink *alert_sink,
EAlert *alert)
{
- GtkWidget *ancestor;
+ EAlertSinkInterface *interface;
- g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (E_IS_ALERT_SINK (alert_sink));
g_return_if_fail (E_IS_ALERT (alert));
- ancestor = gtk_widget_get_ancestor (widget, E_TYPE_ALERT_SINK);
-
- if (E_IS_ALERT_SINK (ancestor)) {
- EAlertSinkInterface *interface;
-
- interface = E_ALERT_SINK_GET_INTERFACE (ancestor);
- g_return_if_fail (interface->submit_alert != NULL);
+ interface = E_ALERT_SINK_GET_INTERFACE (alert_sink);
+ g_return_if_fail (interface->submit_alert != NULL);
- interface->submit_alert (E_ALERT_SINK (ancestor), alert);
- } else
- alert_sink_fallback (widget, alert);
+ interface->submit_alert (alert_sink, alert);
}
diff --git a/e-util/e-alert-sink.h b/e-util/e-alert-sink.h
index 35c56f95b1..da5ae7b06f 100644
--- a/e-util/e-alert-sink.h
+++ b/e-util/e-alert-sink.h
@@ -54,7 +54,7 @@ struct _EAlertSinkInterface {
};
GType e_alert_sink_get_type (void);
-void e_alert_sink_submit_alert (GtkWidget *widget,
+void e_alert_sink_submit_alert (EAlertSink *alert_sink,
EAlert *alert);
G_END_DECLS
diff --git a/e-util/e-alert.c b/e-util/e-alert.c
index 12bee6d78c..9f7a80162a 100644
--- a/e-util/e-alert.c
+++ b/e-util/e-alert.c
@@ -907,28 +907,28 @@ e_alert_response (EAlert *alert,
}
void
-e_alert_submit (GtkWidget *widget,
+e_alert_submit (EAlertSink *alert_sink,
const gchar *tag,
...)
{
va_list va;
va_start (va, tag);
- e_alert_submit_valist (widget, tag, va);
+ e_alert_submit_valist (alert_sink, tag, va);
va_end (va);
}
void
-e_alert_submit_valist (GtkWidget *widget,
+e_alert_submit_valist (EAlertSink *alert_sink,
const gchar *tag,
va_list va)
{
EAlert *alert;
- g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (E_IS_ALERT_SINK (alert_sink));
g_return_if_fail (tag != NULL);
alert = e_alert_new_valist (tag, va);
- e_alert_sink_submit_alert (widget, alert);
+ e_alert_sink_submit_alert (alert_sink, alert);
g_object_unref (alert);
}
diff --git a/e-util/e-alert.h b/e-util/e-alert.h
index f9f0fc8559..4d6b2671b4 100644
--- a/e-util/e-alert.h
+++ b/e-util/e-alert.h
@@ -57,6 +57,8 @@
G_BEGIN_DECLS
+struct _EAlertSink;
+
typedef struct _EAlert EAlert;
typedef struct _EAlertClass EAlertClass;
typedef struct _EAlertPrivate EAlertPrivate;
@@ -103,10 +105,10 @@ GtkWidget * e_alert_create_image (EAlert *alert,
void e_alert_response (EAlert *alert,
gint response_id);
-void e_alert_submit (GtkWidget *widget,
+void e_alert_submit (struct _EAlertSink *alert_sink,
const gchar *tag,
...) G_GNUC_NULL_TERMINATED;
-void e_alert_submit_valist (GtkWidget *widget,
+void e_alert_submit_valist (struct _EAlertSink *alert_sink,
const gchar *tag,
va_list va);
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index 36b244d8d4..09cbcae8ef 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -29,6 +29,7 @@
#include "e-util/e-account-utils.h"
#include "e-util/e-alert-dialog.h"
+#include "e-util/e-alert-sink.h"
#include "misc/e-account-combo-box.h"
@@ -637,6 +638,6 @@ e_mail_backend_submit_alert (EMailBackend *backend,
shell_content = e_shell_view_get_shell_content (shell_view);
va_start (va, tag);
- e_alert_submit_valist (GTK_WIDGET (shell_content), tag, va);
+ e_alert_submit_valist (E_ALERT_SINK (shell_content), tag, va);
va_end (va);
}
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 6aebe52dc7..85d5bb26d4 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -39,6 +39,7 @@
#include "e-util/e-account-utils.h"
#include "e-util/e-alert-dialog.h"
+#include "e-util/e-alert-sink.h"
#include "e-util/e-util.h"
#include "shell/e-shell.h"
@@ -302,7 +303,7 @@ composer_presend_check_recipients (EMsgComposer *composer)
/* I'm sensing a lack of love, er, I mean recipients. */
if (num == 0 && num_post == 0) {
e_alert_submit (
- GTK_WIDGET (composer),
+ E_ALERT_SINK (composer),
"mail:send-no-recipients", NULL);
goto finished;
}
@@ -349,7 +350,7 @@ composer_presend_check_account (EMsgComposer *composer)
if (!check_passed)
e_alert_submit (
- GTK_WIDGET (composer),
+ E_ALERT_SINK (composer),
"mail:send-no-account-enabled", NULL);
return check_passed;
@@ -614,7 +615,7 @@ composer_save_to_drafts_cleanup (CamelFolder *drafts_folder,
if (error != NULL) {
g_warn_if_fail (context->message_uid == NULL);
e_alert_submit (
- GTK_WIDGET (context->composer),
+ E_ALERT_SINK (context->composer),
"mail-composer:save-to-drafts-error",
error->message, NULL);
async_context_free (context);
@@ -774,7 +775,7 @@ composer_save_to_outbox_completed (CamelFolder *outbox_folder,
if (error != NULL) {
e_alert_submit (
- GTK_WIDGET (context->composer),
+ E_ALERT_SINK (context->composer),
"mail-composer:append-to-outbox-error",
error->message, NULL);
g_error_free (error);
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 8e507e46fc..21471c5108 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -27,6 +27,7 @@
#include <libedataserver/e-flag.h>
+#include <e-util/e-alert-sink.h>
#include <shell/e-shell-view.h>
#include "mail-mt.h"
@@ -252,13 +253,13 @@ mail_msg_check_error (gpointer msg)
if (m->info->desc && (what = m->info->desc (m))) {
e_alert_submit (
- GTK_WIDGET (shell_content),
+ E_ALERT_SINK (shell_content),
"mail:async-error", what,
m->error->message, NULL);
g_free (what);
} else
e_alert_submit (
- GTK_WIDGET (shell_content),
+ E_ALERT_SINK (shell_content),
"mail:async-error-nodescribe",
m->error->message, NULL);
}
diff --git a/modules/offline-alert/evolution-offline-alert.c b/modules/offline-alert/evolution-offline-alert.c
index 8b1de84d6c..c759e50249 100644
--- a/modules/offline-alert/evolution-offline-alert.c
+++ b/modules/offline-alert/evolution-offline-alert.c
@@ -96,7 +96,8 @@ offline_alert_network_available_cb (EShell *shell,
if (!E_IS_SHELL_WINDOW (window))
continue;
- e_alert_sink_submit_alert (window, extension->alert);
+ e_alert_sink_submit_alert (
+ E_ALERT_SINK (window), extension->alert);
}
g_object_unref (extension->alert);
@@ -148,7 +149,7 @@ offline_alert_window_created_cb (EShell *shell,
g_object_add_weak_pointer (
G_OBJECT (extension->alert), &extension->alert);
- e_alert_sink_submit_alert (GTK_WIDGET (window), extension->alert);
+ e_alert_sink_submit_alert (E_ALERT_SINK (window), extension->alert);
g_object_unref (extension->alert);
}
diff --git a/widgets/misc/e-signature-editor.c b/widgets/misc/e-signature-editor.c
index 6a18d58b8d..fcc76c8cb9 100644
--- a/widgets/misc/e-signature-editor.c
+++ b/widgets/misc/e-signature-editor.c
@@ -153,7 +153,7 @@ action_save_and_close_cb (GtkAction *action,
if (error != NULL) {
e_alert_submit (
- GTK_WIDGET (editor),
+ E_ALERT_SINK (editor),
"mail:no-save-signature",
error->message, NULL);
g_clear_error (&error);
@@ -168,7 +168,7 @@ action_save_and_close_cb (GtkAction *action,
/* Make sure the signature name is not blank. */
if (*signature_name == '\0') {
e_alert_submit (
- GTK_WIDGET (editor),
+ E_ALERT_SINK (editor),
"mail:blank-signature", NULL);
gtk_widget_grab_focus (entry);
g_free (signature_name);
@@ -180,7 +180,7 @@ action_save_and_close_cb (GtkAction *action,
e_signature_list_find_by_name (signature_list, signature_name);
if (same_name != NULL && !e_signature_is_equal (signature, same_name)) {
e_alert_submit (
- GTK_WIDGET (editor),
+ E_ALERT_SINK (editor),
"mail:signature-already-exists",
signature_name, NULL);
gtk_widget_grab_focus (entry);