From eccfd921ed7a7017cf3b893c9146c4ee0438d86b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 24 Mar 2011 16:47:53 -0400 Subject: Fix alignment of extra widgets in EAlertDialogs. Add e_alert_dialog_get_content_area(), which returns the GtkVBox containing the primary and secondary labels. Use this instead of gtk_dialog_get_content_area() to maintain the dialog's left margin beneath the image. --- mail/e-mail-reader-utils.c | 10 ++---- mail/e-mail-reader.c | 79 +++++++++++++++++++++++++++------------------- mail/em-utils.c | 18 +++++++---- 3 files changed, 61 insertions(+), 46 deletions(-) (limited to 'mail') diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index a049e6eb84..c7b651b942 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -70,7 +70,7 @@ e_mail_reader_confirm_delete (EMailReader *reader) CamelFolder *folder; CamelStore *parent_store; GtkWidget *check_button; - GtkWidget *content_area; + GtkWidget *container; GtkWidget *dialog; GtkWindow *window; const gchar *label; @@ -104,15 +104,11 @@ e_mail_reader_confirm_delete (EMailReader *reader) window, "mail:ask-delete-vfolder-msg", camel_folder_get_full_name (folder), NULL); - /* XXX e-error should provide a widget layout and API suitable - * for packing additional widgets to the right of the alert - * icon. But for now, screw it. */ + container = e_alert_dialog_get_content_area (E_ALERT_DIALOG (dialog)); label = _("Do not ask me again"); - content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); check_button = gtk_check_button_new_with_label (label); - gtk_box_pack_start ( - GTK_BOX (content_area), check_button, TRUE, TRUE, 6); + gtk_box_pack_start (GTK_BOX (container), check_button, TRUE, TRUE, 6); gtk_widget_show (check_button); response = gtk_dialog_run (GTK_DIALOG (dialog)); diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index b70bebb7b9..79439d3f08 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -658,7 +658,8 @@ check_close_browser_reader (EMailReader *reader) if (!parent) parent = e_mail_reader_get_window (reader); - dialog = e_alert_dialog_new_for_args (parent, "mail:ask-reply-close-browser", NULL); + dialog = e_alert_dialog_new_for_args ( + parent, "mail:ask-reply-close-browser", NULL); response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); @@ -1254,18 +1255,22 @@ action_mail_reply_all_check (CamelFolder *folder, if (recip_count >= 15) { GtkWidget *dialog; - GtkWidget *content_area, *check; + GtkWidget *check; + GtkWidget *container; gint response; dialog = e_alert_dialog_new_for_args ( e_mail_reader_get_window (reader), "mail:ask-reply-many-recips", NULL); + container = e_alert_dialog_get_content_area ( + E_ALERT_DIALOG (dialog)); + /* Check buttons */ - check = gtk_check_button_new_with_mnemonic (_("_Do not ask me again.")); - gtk_container_set_border_width (GTK_CONTAINER (check), 12); - content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); - gtk_box_pack_start (GTK_BOX (content_area), check, FALSE, FALSE, 0); + check = gtk_check_button_new_with_mnemonic ( + _("_Do not ask me again.")); + gtk_box_pack_start ( + GTK_BOX (container), check, FALSE, FALSE, 0); gtk_widget_show (check); response = gtk_dialog_run (GTK_DIALOG (dialog)); @@ -1282,11 +1287,16 @@ action_mail_reply_all_check (CamelFolder *folder, gtk_widget_destroy (dialog); - if (response == GTK_RESPONSE_NO) - type = E_MAIL_REPLY_TO_SENDER; - else if (response == GTK_RESPONSE_CANCEL || response == GTK_RESPONSE_DELETE_EVENT) { - g_object_unref (message); - return; + switch (response) { + case GTK_RESPONSE_NO: + type = E_MAIL_REPLY_TO_SENDER; + break; + case GTK_RESPONSE_CANCEL: + case GTK_RESPONSE_DELETE_EVENT: + g_object_unref (message); + return; + default: + break; } } @@ -1411,20 +1421,22 @@ action_mail_reply_sender_check (CamelFolder *folder, it's a Reply-To: munged list message... unless we're ignoring munging */ if (ask_ignore_list_reply_to || !munged_list_message) { GtkWidget *dialog; - GtkWidget *content_area, *check; + GtkWidget *check; + GtkWidget *container; gint response; dialog = e_alert_dialog_new_for_args ( e_mail_reader_get_window (reader), "mail:ask-list-private-reply", NULL); + container = e_alert_dialog_get_content_area ( + E_ALERT_DIALOG (dialog)); + /* Check buttons */ check = gtk_check_button_new_with_mnemonic ( _("_Do not ask me again.")); - gtk_container_set_border_width ((GtkContainer *)check, 12); - content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); gtk_box_pack_start ( - GTK_BOX (content_area), check, FALSE, FALSE, 0); + GTK_BOX (container), check, FALSE, FALSE, 0); gtk_widget_show (check); response = gtk_dialog_run (GTK_DIALOG (dialog)); @@ -1446,8 +1458,7 @@ action_mail_reply_sender_check (CamelFolder *folder, } else if (ask_list_reply_to) { GtkWidget *dialog; - GtkWidget *content_area; - GtkWidget *vbox; + GtkWidget *container; GtkWidget *check_again; GtkWidget *check_always_ignore; gint response; @@ -1456,22 +1467,20 @@ action_mail_reply_sender_check (CamelFolder *folder, e_mail_reader_get_window (reader), "mail:ask-list-honour-reply-to", NULL); - /*Check buttons*/ - vbox = gtk_vbox_new (FALSE, 0); - content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); - gtk_box_pack_start (GTK_BOX (content_area), vbox, FALSE, FALSE, 0); - gtk_widget_show (vbox); + container = e_alert_dialog_get_content_area ( + E_ALERT_DIALOG (dialog)); check_again = gtk_check_button_new_with_mnemonic ( _("_Do not ask me again.")); - gtk_box_pack_start (GTK_BOX (vbox), check_again, FALSE, FALSE, 0); + gtk_box_pack_start ( + GTK_BOX (container), check_again, FALSE, FALSE, 0); gtk_widget_show (check_again); check_always_ignore = gtk_check_button_new_with_mnemonic ( _("_Always ignore Reply-To: for mailing lists.")); gtk_box_pack_start ( - GTK_BOX (vbox), check_always_ignore, FALSE, FALSE, 0); + GTK_BOX (container), check_always_ignore, + FALSE, FALSE, 0); gtk_widget_show (check_always_ignore); response = gtk_dialog_run (GTK_DIALOG (dialog)); @@ -1487,13 +1496,19 @@ action_mail_reply_sender_check (CamelFolder *folder, gtk_widget_destroy (dialog); - if (response == GTK_RESPONSE_NO) - type = E_MAIL_REPLY_TO_FROM; - else if (response == GTK_RESPONSE_OK) - type = E_MAIL_REPLY_TO_LIST; - else if (response == GTK_RESPONSE_CANCEL || response == GTK_RESPONSE_DELETE_EVENT) { - g_object_unref (message); - goto exit; + switch (response) { + case GTK_RESPONSE_NO: + type = E_MAIL_REPLY_TO_FROM; + break; + case GTK_RESPONSE_OK: + type = E_MAIL_REPLY_TO_LIST; + break; + case GTK_RESPONSE_CANCEL: + case GTK_RESPONSE_DELETE_EVENT: + g_object_unref (message); + goto exit; + default: + break; } } diff --git a/mail/em-utils.c b/mail/em-utils.c index 15008abd51..e674c61528 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -128,7 +128,8 @@ em_utils_prompt_user (GtkWindow *parent, const gchar *tag, ...) { - GtkWidget *mbox, *check = NULL; + GtkWidget *dialog; + GtkWidget *check = NULL; GtkWidget *container; va_list ap; gint button; @@ -146,24 +147,27 @@ em_utils_prompt_user (GtkWindow *parent, alert = e_alert_new_valist (tag, ap); va_end (ap); - mbox = e_alert_dialog_new (parent, alert); + dialog = e_alert_dialog_new (parent, alert); g_object_unref (alert); + container = e_alert_dialog_get_content_area (E_ALERT_DIALOG (dialog)); + if (promptkey) { - check = gtk_check_button_new_with_mnemonic (_("_Do not show this message again")); - container = gtk_dialog_get_content_area (GTK_DIALOG (mbox)); - gtk_box_pack_start (GTK_BOX (container), check, FALSE, FALSE, 0); + check = gtk_check_button_new_with_mnemonic ( + _("_Do not show this message again")); + gtk_box_pack_start ( + GTK_BOX (container), check, FALSE, FALSE, 0); gtk_widget_show (check); } - button = gtk_dialog_run ((GtkDialog *) mbox); + button = gtk_dialog_run (GTK_DIALOG (dialog)); if (promptkey) gconf_client_set_bool ( client, promptkey, !gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON (check)), NULL); - gtk_widget_destroy (mbox); + gtk_widget_destroy (dialog); g_object_unref (client); -- cgit