aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-07-08 07:27:24 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-07-08 07:27:24 +0000
commita07b24d01ccce1cfa58e74782f8b5b05c5a7055d (patch)
tree154f9c6d11b22a587ea365677836f192b493e279 /src
parent8f85197cc2c306abc3bceee155afddf34e59f643 (diff)
modified alert dialogs.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@408 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/account.c6
-rw-r--r--src/alertpanel.c52
-rw-r--r--src/alertpanel.h19
-rw-r--r--src/compose.c29
-rw-r--r--src/folderview.c25
5 files changed, 87 insertions, 44 deletions
diff --git a/src/account.c b/src/account.c
index 2c57fcda..bd1bf2f8 100644
--- a/src/account.c
+++ b/src/account.c
@@ -811,8 +811,10 @@ static void account_delete(void)
_("Do you really want to delete the account '%s'?"),
ac_prefs->account_name ? ac_prefs->account_name :
_("(Untitled)"));
- if (alertpanel(_("Delete account"), buf,
- _("Yes"), _("+No"), NULL) != G_ALERTDEFAULT)
+ if (alertpanel_full(_("Delete account"), buf,
+ ALERT_QUESTION, G_ALERTALTERNATE, FALSE,
+ GTK_STOCK_YES, GTK_STOCK_NO, NULL)
+ != G_ALERTDEFAULT)
return;
if (ac_prefs->folder) {
diff --git a/src/alertpanel.c b/src/alertpanel.c
index 46d7dd5a..e1454d3f 100644
--- a/src/alertpanel.c
+++ b/src/alertpanel.c
@@ -47,11 +47,12 @@ static GtkWidget *dialog;
static void alertpanel_show (void);
static void alertpanel_create (const gchar *title,
const gchar *message,
+ AlertType type,
+ AlertValue default_value,
+ gboolean can_disable,
const gchar *button1_label,
const gchar *button2_label,
- const gchar *button3_label,
- gboolean can_disable,
- AlertType type);
+ const gchar *button3_label);
static void alertpanel_button_toggled (GtkToggleButton *button,
gpointer data);
@@ -64,25 +65,37 @@ static gboolean alertpanel_close (GtkWidget *widget,
GdkEventAny *event,
gpointer data);
-AlertValue alertpanel(const gchar *title,
- const gchar *message,
- const gchar *button1_label,
- const gchar *button2_label,
- const gchar *button3_label)
+AlertValue alertpanel_full(const gchar *title, const gchar *message,
+ AlertType type, AlertValue default_value,
+ gboolean can_disable,
+ const gchar *button1_label,
+ const gchar *button2_label,
+ const gchar *button3_label)
{
if (alertpanel_is_open)
return -1;
else
alertpanel_is_open = TRUE;
- alertpanel_create(title, message, button1_label, button2_label,
- button3_label, FALSE, ALERT_QUESTION);
+ alertpanel_create(title, message, type, default_value, can_disable,
+ button1_label, button2_label, button3_label);
alertpanel_show();
debug_print("return value = %d\n", value);
return value;
}
+AlertValue alertpanel(const gchar *title,
+ const gchar *message,
+ const gchar *button1_label,
+ const gchar *button2_label,
+ const gchar *button3_label)
+{
+ return alertpanel_full(title, message, ALERT_QUESTION, G_ALERTDEFAULT,
+ FALSE,
+ button1_label, button2_label, button3_label);
+}
+
void alertpanel_message(const gchar *title, const gchar *message,
AlertType type)
{
@@ -91,7 +104,8 @@ void alertpanel_message(const gchar *title, const gchar *message,
else
alertpanel_is_open = TRUE;
- alertpanel_create(title, message, NULL, NULL, NULL, FALSE, type);
+ alertpanel_create(title, message, type, G_ALERTDEFAULT, FALSE,
+ NULL, NULL, NULL);
alertpanel_show();
}
@@ -104,7 +118,8 @@ AlertValue alertpanel_message_with_disable(const gchar *title,
else
alertpanel_is_open = TRUE;
- alertpanel_create(title, message, NULL, NULL, NULL, TRUE, type);
+ alertpanel_create(title, message, type, G_ALERTDEFAULT, TRUE,
+ NULL, NULL, NULL);
alertpanel_show();
return value;
@@ -168,11 +183,12 @@ static void alertpanel_show(void)
static void alertpanel_create(const gchar *title,
const gchar *message,
+ AlertType type,
+ AlertValue default_value,
+ gboolean can_disable,
const gchar *button1_label,
const gchar *button2_label,
- const gchar *button3_label,
- gboolean can_disable,
- AlertType type)
+ const gchar *button3_label)
{
static PangoFontDescription *font_desc;
GtkWidget *image;
@@ -294,11 +310,13 @@ static void alertpanel_create(const gchar *title,
gtk_container_set_border_width(GTK_CONTAINER(confirm_area), 5);
gtk_widget_grab_default(button1);
gtk_widget_grab_focus(button1);
- if (button2_label && *button2_label == '+') {
+ if (button2_label &&
+ (default_value == G_ALERTALTERNATE || *button2_label == '+')) {
gtk_widget_grab_default(button2);
gtk_widget_grab_focus(button2);
}
- if (button3_label && *button3_label == '+') {
+ if (button3_label &&
+ (default_value == G_ALERTOTHER || *button3_label == '+')) {
gtk_widget_grab_default(button3);
gtk_widget_grab_focus(button3);
}
diff --git a/src/alertpanel.h b/src/alertpanel.h
index 3e03323b..ac8e2eb9 100644
--- a/src/alertpanel.h
+++ b/src/alertpanel.h
@@ -43,11 +43,20 @@ typedef enum
ALERT_ERROR
} AlertType;
-AlertValue alertpanel (const gchar *title,
- const gchar *message,
- const gchar *button1_label,
- const gchar *button2_label,
- const gchar *button3_label);
+AlertValue alertpanel_full (const gchar *title,
+ const gchar *message,
+ AlertType type,
+ AlertValue default_value,
+ gboolean can_disable,
+ const gchar *button1_label,
+ const gchar *button2_label,
+ const gchar *button3_label);
+
+AlertValue alertpanel (const gchar *title,
+ const gchar *message,
+ const gchar *button1_label,
+ const gchar *button2_label,
+ const gchar *button3_label);
void alertpanel_message (const gchar *title,
const gchar *message,
diff --git a/src/compose.c b/src/compose.c
index ee02ac50..3ed07ed5 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -2412,7 +2412,7 @@ static gboolean compose_check_entries(Compose *compose)
if (*str == '\0') {
AlertValue aval;
- aval = alertpanel(_("Send"),
+ aval = alertpanel(_("Empty subject"),
_("Subject is empty. Send it anyway?"),
GTK_STOCK_YES, GTK_STOCK_NO, NULL);
if (aval != G_ALERTDEFAULT)
@@ -2668,11 +2668,14 @@ static gint compose_write_to_file(Compose *compose, const gchar *file,
g_free(buf);
msg = g_strdup_printf(_("Can't convert the character encoding of the message body from %s to %s.\n"
+ "\n"
"Send it as %s anyway?"),
src_charset, body_charset,
src_charset);
- aval = alertpanel
- (_("Error"), msg, _("Yes"), _("+No"), NULL);
+ aval = alertpanel_full
+ (_("Code conversion error"), msg, ALERT_ERROR,
+ G_ALERTALTERNATE,
+ FALSE, GTK_STOCK_YES, GTK_STOCK_NO, NULL);
g_free(msg);
if (aval != G_ALERTDEFAULT) {
@@ -2743,7 +2746,10 @@ static gint compose_write_to_file(Compose *compose, const gchar *file,
"The contents of the message might be broken on the way to the delivery.\n"
"\n"
"Send it anyway?"), line + 1);
- aval = alertpanel(_("Warning"), msg, _("Yes"), _("+No"), NULL);
+ aval = alertpanel_full(_("Line length limit"),
+ msg, ALERT_WARNING,
+ G_ALERTALTERNATE, FALSE,
+ GTK_STOCK_YES, GTK_STOCK_NO, NULL);
if (aval != G_ALERTDEFAULT) {
g_free(msg);
fclose(fp);
@@ -5118,7 +5124,9 @@ static gboolean compose_ext_editor_kill(Compose *compose)
(_("The external editor is still working.\n"
"Force terminating the process?\n"
"process group id: %d"), -pgid);
- val = alertpanel(_("Notice"), msg, _("Yes"), _("+No"), NULL);
+ val = alertpanel_full(_("Notice"), msg, ALERT_NOTICE,
+ G_ALERTALTERNATE, FALSE,
+ GTK_STOCK_YES, GTK_STOCK_NO, NULL);
g_free(msg);
if (val == G_ALERTDEFAULT) {
@@ -5667,16 +5675,17 @@ static void compose_close_cb(gpointer data, guint action, GtkWidget *widget)
}
if (compose->modified) {
- val = alertpanel(_("Discard message"),
- _("This message has been modified. discard it?"),
- _("Discard"), _("to Draft"), GTK_STOCK_CANCEL);
+ val = alertpanel(_("Save message"),
+ _("This message has been modified. Save it to draft folder?"),
+ GTK_STOCK_SAVE, GTK_STOCK_CANCEL,
+ _("Close _without saving"));
switch (val) {
case G_ALERTDEFAULT:
- break;
- case G_ALERTALTERNATE:
compose_draft_cb(data, 0, NULL);
return;
+ case G_ALERTOTHER:
+ break;
default:
return;
}
diff --git a/src/folderview.c b/src/folderview.c
index 6cee00af..5491d6e6 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -2122,8 +2122,9 @@ static void folderview_delete_folder_cb(FolderView *folderview, guint action,
(_("All folders and messages under `%s' will be permanently deleted.\n"
"Recovery will not be possible.\n\n"
"Do you really want to delete?"), name);
- avalue = alertpanel(_("Delete folder"), message,
- _("Yes"), _("+No"), NULL);
+ avalue = alertpanel_full(_("Delete folder"), message,
+ ALERT_WARNING, G_ALERTALTERNATE, FALSE,
+ GTK_STOCK_YES, GTK_STOCK_NO, NULL);
g_free(message);
if (avalue != G_ALERTDEFAULT) return;
@@ -2218,8 +2219,9 @@ static void folderview_remove_mailbox_cb(FolderView *folderview, guint action,
message = g_strdup_printf
(_("Really remove the mailbox `%s' ?\n"
"(The messages are NOT deleted from the disk)"), name);
- avalue = alertpanel(_("Remove mailbox"), message,
- _("Yes"), _("+No"), NULL);
+ avalue = alertpanel_full(_("Remove mailbox"), message,
+ ALERT_WARNING, G_ALERTALTERNATE, FALSE,
+ GTK_STOCK_YES, GTK_STOCK_NO, NULL);
g_free(message);
g_free(name);
if (avalue != G_ALERTDEFAULT) return;
@@ -2264,8 +2266,9 @@ static void folderview_rm_imap_server_cb(FolderView *folderview, guint action,
name = trim_string(item->folder->name, 32);
message = g_strdup_printf(_("Really delete IMAP4 account `%s'?"), name);
- avalue = alertpanel(_("Delete IMAP4 account"), message,
- _("Yes"), _("+No"), NULL);
+ avalue = alertpanel_full(_("Delete IMAP4 account"), message,
+ ALERT_WARNING, G_ALERTALTERNATE, FALSE,
+ GTK_STOCK_YES, GTK_STOCK_NO, NULL);
g_free(message);
g_free(name);
@@ -2406,8 +2409,9 @@ static void folderview_rm_news_group_cb(FolderView *folderview, guint action,
name = trim_string_before(item->path, 32);
message = g_strdup_printf(_("Really delete newsgroup `%s'?"), name);
- avalue = alertpanel(_("Delete newsgroup"), message,
- _("Yes"), _("+No"), NULL);
+ avalue = alertpanel_full(_("Delete newsgroup"), message,
+ ALERT_WARNING, G_ALERTALTERNATE, FALSE,
+ GTK_STOCK_YES, GTK_STOCK_NO, NULL);
g_free(message);
g_free(name);
if (avalue != G_ALERTDEFAULT) return;
@@ -2452,8 +2456,9 @@ static void folderview_rm_news_server_cb(FolderView *folderview, guint action,
name = trim_string(item->folder->name, 32);
message = g_strdup_printf(_("Really delete news account `%s'?"), name);
- avalue = alertpanel(_("Delete news account"), message,
- _("Yes"), _("+No"), NULL);
+ avalue = alertpanel_full(_("Delete news account"), message,
+ ALERT_WARNING, G_ALERTALTERNATE, FALSE,
+ GTK_STOCK_YES, GTK_STOCK_NO, NULL);
g_free(message);
g_free(name);