Commit eccfd921 authored by Matthew Barnes's avatar Matthew Barnes Committed by Rodrigo Moya
Browse files

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.
parent 9539cc3f
......@@ -186,7 +186,7 @@ send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gbo
}
dialog = e_alert_dialog_new_for_args (parent, id, NULL);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
content_area = e_alert_dialog_get_content_area (E_ALERT_DIALOG (dialog));
if (strip_alarms)
sa_checkbox = add_checkbox (GTK_BOX (content_area), _("Send my alarms with this event"));
......
......@@ -26,7 +26,7 @@
#include "e-util.h"
struct _EAlertDialogPrivate {
GtkWindow *parent;
GtkWidget *content_area; /* not referenced */
EAlert *alert;
};
......@@ -184,6 +184,7 @@ alert_dialog_constructed (GObject *object)
widget = gtk_vbox_new (FALSE, 12);
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
dialog->priv->content_area = widget;
gtk_widget_show (widget);
container = widget;
......@@ -334,7 +335,7 @@ e_alert_run_dialog_for_args (GtkWindow *parent,
/**
* e_alert_dialog_get_alert:
* @dialog: a #EAlertDialog
* @dialog: an #EAlertDialog
*
* Returns the #EAlert associated with @dialog.
*
......@@ -347,3 +348,21 @@ e_alert_dialog_get_alert (EAlertDialog *dialog)
return dialog->priv->alert;
}
/**
* e_alert_dialog_get_content_area:
* @dialog: an #EAlertDialog
*
* Returns the vertical box containing the primary and secondary labels.
* Use this to pack additional widgets into the dialog with the proper
* horizontal alignment (maintaining the left margin below the image).
*
* Returns: the content area #GtkBox
**/
GtkWidget *
e_alert_dialog_get_content_area (EAlertDialog *dialog)
{
g_return_val_if_fail (E_IS_ALERT_DIALOG (dialog), NULL);
return dialog->priv->content_area;
}
......@@ -73,6 +73,7 @@ gint e_alert_run_dialog_for_args (GtkWindow *parent,
const gchar *tag,
...) G_GNUC_NULL_TERMINATED;
EAlert * e_alert_dialog_get_alert (EAlertDialog *dialog);
GtkWidget * e_alert_dialog_get_content_area (EAlertDialog *dialog);
G_END_DECLS
......
......@@ -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));
......
......@@ -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;
}
}
......
......@@ -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);
......
......@@ -105,26 +105,29 @@ org_gnome_evolution_attachment_reminder (EPlugin *ep, EMEventTargetComposer *t)
static gboolean
ask_for_missing_attachment (EPlugin *ep, GtkWindow *window)
{
GtkWidget *check = NULL;
GtkDialog *dialog = NULL;
GtkWidget *content_area;
GtkWidget *check;
GtkWidget *dialog;
GtkWidget *container;
gint response;
dialog = (GtkDialog*) e_alert_dialog_new_for_args (
window, "org.gnome.evolution.plugins.attachment_reminder:attachment-reminder", NULL);
dialog = e_alert_dialog_new_for_args (
window, "org.gnome.evolution.plugins.attachment_reminder:"
"attachment-reminder", NULL);
container = e_alert_dialog_get_content_area (E_ALERT_DIALOG (dialog));
/*Check buttons*/
check = gtk_check_button_new_with_mnemonic (_("_Do not show this message again."));
content_area = gtk_dialog_get_content_area (dialog);
gtk_box_pack_start (GTK_BOX (content_area), 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);
response = gtk_dialog_run ((GtkDialog *) dialog);
response = gtk_dialog_run (GTK_DIALOG (dialog));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)))
e_plugin_enable (ep, FALSE);
gtk_widget_destroy ((GtkWidget *)dialog);
gtk_widget_destroy (dialog);
if (response == GTK_RESPONSE_OK)
gtk_action_activate (E_COMPOSER_ACTION_ATTACH (window));
......
......@@ -4,7 +4,7 @@
<error id="attachment-reminder" type="info">
<_primary>Message has no attachments</_primary>
<_secondary>Evolution has found some keywords that suggest that this message should contain an attachment, but cannot find one.</_secondary>
<button response="GTK_RESPONSE_OK" _label="_Add attachment..."/>
<button response="GTK_RESPONSE_OK" _label="_Add Attachment..."/>
<button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL" _label="_Edit Message"/>
<button response="GTK_RESPONSE_YES" _label="_Send"></button>
</error>
......
......@@ -113,7 +113,9 @@ sanity_check (const gchar *filename)
static guint32
dialog_prompt_user (GtkWindow *parent, const gchar *string, const gchar *tag, ...)
{
GtkWidget *mbox, *check = NULL;
GtkWidget *dialog;
GtkWidget *check = NULL;
GtkWidget *container;
va_list ap;
gint button;
guint32 mask = 0;
......@@ -123,24 +125,25 @@ dialog_prompt_user (GtkWindow *parent, const gchar *string, const gchar *tag, ..
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));
check = gtk_check_button_new_with_mnemonic (string);
/* We should hardcode this to true */
gtk_toggle_button_set_active ((GtkToggleButton *)check, TRUE);
gtk_container_set_border_width ((GtkContainer *)check, 12);
gtk_box_pack_start ((GtkBox *)gtk_dialog_get_content_area ((GtkDialog *) mbox), check, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
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 (button == GTK_RESPONSE_YES)
mask |= BR_OK;
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)))
mask |= BR_START;
gtk_widget_destroy (mbox);
gtk_widget_destroy (dialog);
return mask;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment