[evolution/email-factory-3-4: 18/38] Bug #440316 - Improve SSL Certificate check bad signature dialog
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/email-factory-3-4: 18/38] Bug #440316 - Improve SSL Certificate check bad signature dialog
- Date: Fri, 16 Dec 2011 11:55:58 +0000 (UTC)
commit f91d2955615d6e7ca25037fb4f2f4aec2ce1bfe7
Author: Srinivasa Ragavan <sragavan gnome org>
Date: Thu Nov 17 13:39:02 2011 +0530
Bug #440316 - Improve SSL Certificate check bad signature dialog
mail/e-mail-ui-session.c | 59 +++++++++++++++++++++++++++++++--------------
1 files changed, 40 insertions(+), 19 deletions(-)
---
diff --git a/mail/e-mail-ui-session.c b/mail/e-mail-ui-session.c
index 0f04101..e00e623 100644
--- a/mail/e-mail-ui-session.c
+++ b/mail/e-mail-ui-session.c
@@ -94,10 +94,10 @@ struct _user_message_msg {
CamelSessionAlertType type;
gchar *prompt;
+ GSList *button_captions;
EFlag *done;
- guint allow_cancel : 1;
- guint result : 1;
+ gint result;
guint ismain : 1;
};
@@ -132,8 +132,8 @@ user_message_response (GtkDialog *dialog,
struct _user_message_msg *m)
{
/* if !allow_cancel, then we've already replied */
- if (m->allow_cancel) {
- m->result = button == GTK_RESPONSE_OK;
+ if (m->button_captions) {
+ m->result = button;
e_flag_set (m->done);
}
@@ -147,6 +147,8 @@ user_message_exec (struct _user_message_msg *m,
{
GtkWindow *parent;
const gchar *error_type;
+ gint index;
+ GSList *iter;
if (!m->ismain && user_message_dialog != NULL) {
g_queue_push_tail (&user_message_queue, mail_msg_ref (m));
@@ -155,19 +157,13 @@ user_message_exec (struct _user_message_msg *m,
switch (m->type) {
case CAMEL_SESSION_ALERT_INFO:
- error_type = m->allow_cancel ?
- "mail:session-message-info-cancel" :
- "mail:session-message-info";
+ error_type = "mail:session-message-info";
break;
case CAMEL_SESSION_ALERT_WARNING:
- error_type = m->allow_cancel ?
- "mail:session-message-warning-cancel" :
- "mail:session-message-warning";
+ error_type = "mail:session-message-warning";
break;
case CAMEL_SESSION_ALERT_ERROR:
- error_type = m->allow_cancel ?
- "mail:session-message-error-cancel" :
- "mail:session-message-error";
+ error_type = "mail:session-message-error";
break;
default:
error_type = NULL;
@@ -180,6 +176,26 @@ user_message_exec (struct _user_message_msg *m,
parent, error_type, m->prompt, NULL);
g_object_set (user_message_dialog, "resizable", TRUE, NULL);
+ if (m->button_captions) {
+ GtkWidget *action_area;
+ GList *children, *child;
+
+ /* remove all default buttons and keep only those requested */
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (user_message_dialog));
+
+ children = gtk_container_get_children (GTK_CONTAINER (action_area));
+ for (child = children; child != NULL; child = child->next) {
+ gtk_container_remove (GTK_CONTAINER (action_area), child->data);
+ }
+
+ g_list_free (children);
+ }
+
+ for (index = 0, iter = m->button_captions; iter; index++, iter = iter->next) {
+ gtk_dialog_add_button (GTK_DIALOG (user_message_dialog), iter->data, index);
+ }
+
+
/* XXX This is a case where we need to be able to construct
* custom EAlerts without a predefined XML definition. */
if (m->ismain) {
@@ -200,6 +216,7 @@ static void
user_message_free (struct _user_message_msg *m)
{
g_free (m->prompt);
+ g_slist_free_full (m->button_captions, g_free);
e_flag_free (m->done);
}
@@ -397,24 +414,28 @@ mail_ui_session_constructed (GObject *object)
G_OBJECT_CLASS (e_mail_ui_session_parent_class)->constructed (object);
}
-static gboolean
+static gint
mail_ui_session_alert_user (CamelSession *session,
CamelSessionAlertType type,
const gchar *prompt,
- gboolean cancel)
+ GSList *button_captions)
{
struct _user_message_msg *m;
GCancellable *cancellable;
- gboolean result = TRUE;
+ gint result = -1;
+ GSList *iter;
m = mail_msg_new (&user_message_info);
m->ismain = mail_in_main_thread ();
m->type = type;
m->prompt = g_strdup (prompt);
m->done = e_flag_new ();
- m->allow_cancel = cancel;
+ m->button_captions = g_slist_copy (button_captions);
+
+ for (iter = m->button_captions; iter; iter = iter->next)
+ iter->data = g_strdup (iter->data);
- if (cancel)
+ if (g_slist_length (button_captions) > 1)
mail_msg_ref (m);
cancellable = m->base.cancellable;
@@ -424,7 +445,7 @@ mail_ui_session_alert_user (CamelSession *session,
else
mail_msg_main_loop_push (m);
- if (cancel) {
+ if (g_slist_length (button_captions) > 1) {
e_flag_wait (m->done);
result = m->result;
mail_msg_unref (m);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]