[evolution] Make sure EAlertDialog has at least one button, to be able to closed it



commit f2ab123afa50e8fa0c905a04c1a2e846edbe87a4
Author: Milan Crha <mcrha redhat com>
Date:   Thu Dec 22 17:22:24 2011 +0100

    Make sure EAlertDialog has at least one button, to be able to closed it
    
    This is a regression from commit 451179909849, which removes the default
    "Dismiss" action from each EAlert, but the EAlertDialog was using that
    button to allow users to close it.

 e-util/e-alert-dialog.c |   14 ++++++++++++++
 po/POTFILES.in          |    1 +
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c
index 70e5343..2f27a4f 100644
--- a/e-util/e-alert-dialog.c
+++ b/e-util/e-alert-dialog.c
@@ -25,6 +25,8 @@
 #include <config.h>
 #endif
 
+#include <glib/gi18n.h>
+
 #include "e-alert-dialog.h"
 
 #include "e-util.h"
@@ -150,6 +152,18 @@ alert_dialog_constructed (GObject *object)
 
 	/* Add buttons from actions. */
 	actions = e_alert_peek_actions (alert);
+	if (!actions) {
+		GtkAction *action;
+
+		/* Make sure there is at least one action, thus the dialog can be closed. */
+		action = gtk_action_new (
+			"alert-response-0", _("_Dismiss"), NULL, NULL);
+		e_alert_add_action (alert, action, GTK_RESPONSE_CLOSE);
+		g_object_unref (action);
+
+		actions = e_alert_peek_actions (alert);
+	}
+
 	while (actions != NULL) {
 		GtkWidget *button;
 		gpointer data;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b257780..36bf948 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -157,6 +157,7 @@ em-format/em-format.c
 em-format/em-format-quote.c
 e-util/e-activity.c
 e-util/e-alert.c
+e-util/e-alert-dialog.c
 e-util/e-categories-config.c
 e-util/e-charset.c
 e-util/e-datetime-format.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]