commit 5ab9e6e799f34e73d648817a295051a8da981837 parent f01256abc54f28fc06a5abbe6b6897627b640ee7 Author: Andrej Kacian <ticho@claws-mail.org> Date: Fri, 9 Feb 2018 14:44:30 +0100 Rework of alertpanel default button focus handling. Instead of using "+" prefix with button labels and/or the default_value parameter, we introduce "focus" parameter, which will point to first, second or third button. Advantages: - we got rid of the "+" prefix, which won't work with GTK3 with GTK3 - instead of having two ways to indicate which button should have focus, which can be in conflict, and are not very straightforward, there is just one, arguably more intuitive - some small memory leaks fixed along the way (using g_strconcat() directly as function argument) Diffstat:
57 files changed, 294 insertions(+), 268 deletions(-)
diff --git a/src/account.c b/src/account.c @@ -1098,8 +1098,8 @@ static void account_delete(GtkWidget *widget, gpointer data) ac_prefs->account_name ? ac_prefs->account_name : _("(Untitled)")); if (alertpanel_full(_("Delete account"), buf, - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT) != G_ALERTALTERNATE) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING) != G_ALERTALTERNATE) return; account_list_dirty = TRUE; diff --git a/src/addrcustomattr.c b/src/addrcustomattr.c @@ -155,7 +155,7 @@ static void custom_attr_window_list_view_clear_list(GtkWidget *list_view, gboole { if (!warn || alertpanel(_("Delete all attribute names"), _("Do you really want to delete all attribute names?"), - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL) == G_ALERTALTERNATE) { + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST) == G_ALERTALTERNATE) { GtkListStore *list_store = GTK_LIST_STORE(gtk_tree_view_get_model (GTK_TREE_VIEW(list_view))); gtk_list_store_clear(list_store); @@ -180,7 +180,7 @@ static void custom_attr_popup_delete (void *obj, void *data) if (alertpanel(_("Delete attribute name"), _("Do you really want to delete this attribute name?"), - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL) == G_ALERTALTERNATE) { + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST) == G_ALERTALTERNATE) { gtk_list_store_remove(GTK_LIST_STORE(model), &sel); dirty = TRUE; } @@ -190,7 +190,7 @@ static void custom_attr_popup_factory_defaults (void *obj, void *data) { if (alertpanel(_("Reset to default"), _("Do you really want to replace all attribute names\nwith the default set?"), - GTK_STOCK_NO, GTK_STOCK_YES, NULL) == G_ALERTALTERNATE) { + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST) == G_ALERTALTERNATE) { GList *tmp = custom_attr_default_list(); custom_attr_window_load_list(tmp); if (tmp) { diff --git a/src/addrduplicates.c b/src/addrduplicates.c @@ -144,8 +144,8 @@ static gboolean create_dialog() val = alertpanel_full(_("Find address book email duplicates"), _("Claws Mail will now search for duplicate email " "addresses in the address book."), - GTK_STOCK_CANCEL,GTK_STOCK_FIND,NULL, FALSE, vbox, ALERT_NOTICE, - G_ALERTALTERNATE); + GTK_STOCK_CANCEL,GTK_STOCK_FIND, NULL, + ALERTFOCUS_SECOND, FALSE, vbox, ALERT_NOTICE); if(val == G_ALERTALTERNATE) { want_search = TRUE; @@ -792,7 +792,8 @@ static void cb_del_btn_clicked(GtkButton *button, gpointer data) aval = alertpanel(_("Delete address(es)"), _("Really delete the address(es)?"), - GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL); + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, + ALERTFOCUS_SECOND); if(aval != G_ALERTALTERNATE) return; @@ -841,7 +842,7 @@ gboolean addrduplicates_delete_item_person(ItemPerson *item, AddressDataSource * if( iface && iface->readOnly ) { alertpanel( _("Delete address"), _("This address data is readonly and cannot be deleted."), - GTK_STOCK_CLOSE, NULL, NULL ); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST ); return FALSE; } diff --git a/src/addressadd.c b/src/addressadd.c @@ -533,7 +533,7 @@ gboolean addressadd_selection(const gchar *name, const gchar *address, if (server->retVal != LDAPRC_SUCCESS) { alertpanel( _("Add address(es)"), _("Can't add the specified address"), - GTK_STOCK_CLOSE, NULL, NULL ); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST ); return server->retVal; } } diff --git a/src/addressbook.c b/src/addressbook.c @@ -1439,7 +1439,7 @@ static void addressbook_del_clicked(GtkButton *button, gpointer data) if( iface->readOnly ) { alertpanel( _("Delete address(es)"), _("This address data is readonly and cannot be deleted."), - GTK_STOCK_CLOSE, NULL, NULL ); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST); return; } @@ -1485,14 +1485,14 @@ static void addressbook_del_clicked(GtkButton *button, gpointer data) aval = alertpanel( _("Delete group"), _("Really delete the group(s)?\n" "The addresses it contains will not be lost."), - GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL ); + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_SECOND ); if( aval != G_ALERTALTERNATE ) { goto thaw_ret; } } else { aval = alertpanel( _("Delete address(es)"), _("Really delete the address(es)?"), - GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL ); + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_SECOND ); if( aval != G_ALERTALTERNATE ) { goto thaw_ret; } @@ -2913,7 +2913,7 @@ static void addressbook_treenode_delete_cb(GtkAction *action, gpointer data) "results and addresses in '%s'?" ), obj->name ); aval = alertpanel( _("Delete"), message, - GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL ); + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_SECOND ); g_free(message); if( aval == G_ALERTALTERNATE ) { delType = ADDRTREE_DEL_FOLDER_ADDR; @@ -2925,7 +2925,7 @@ static void addressbook_treenode_delete_cb(GtkAction *action, gpointer data) "If you delete the folder only, the addresses it contains will be moved into the parent folder." ), obj->name ); aval = alertpanel( _("Delete folder"), message, - GTK_STOCK_CANCEL, g_strconcat("+",_("Delete _folder only"), NULL), _("Delete folder and _addresses")); + GTK_STOCK_CANCEL, _("Delete _folder only"), _("Delete folder and _addresses"), ALERTFOCUS_SECOND); g_free(message); if( aval == G_ALERTALTERNATE ) { delType = ADDRTREE_DEL_FOLDER_ONLY; @@ -2939,14 +2939,14 @@ static void addressbook_treenode_delete_cb(GtkAction *action, gpointer data) message = g_strdup_printf(_("Do you want to delete '%s'?\n" "The addresses it contains will not be lost."), obj->name); aval = alertpanel(_("Delete"), message, GTK_STOCK_CANCEL, - "+" GTK_STOCK_DELETE, NULL); + GTK_STOCK_DELETE, NULL, ALERTFOCUS_SECOND); g_free(message); if( aval == G_ALERTALTERNATE ) delType = ADDRTREE_DEL_FOLDER_ONLY; } else { message = g_strdup_printf(_("Do you want to delete '%s'?\n" "The addresses it contains will be lost."), obj->name); aval = alertpanel(_("Delete"), message, GTK_STOCK_CANCEL, - "+" GTK_STOCK_DELETE, NULL); + GTK_STOCK_DELETE, NULL, ALERTFOCUS_SECOND); g_free(message); if( aval == G_ALERTALTERNATE ) delType = ADDRTREE_DEL_DATA; } @@ -3214,7 +3214,7 @@ static void addressbook_new_address_cb( GtkAction *action, gpointer data ) { if (server->retVal != LDAPRC_SUCCESS) { alertpanel( _("Add address(es)"), addressbook_err2string(_lutErrorsLDAP_, server->retVal), - GTK_STOCK_CLOSE, NULL, NULL ); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST ); server->retVal = LDAPRC_SUCCESS; return; } @@ -3265,7 +3265,7 @@ static void addressbook_new_address_cb( GtkAction *action, gpointer data ) { if (server->retVal != LDAPRC_SUCCESS) { alertpanel( _("Add address(es)"), addressbook_err2string(_lutErrorsLDAP_, server->retVal), - GTK_STOCK_CLOSE, NULL, NULL ); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST ); return; } } @@ -4134,14 +4134,14 @@ static gboolean addressbook_convert( AddressIndex *addrIndex ) { if( errFlag ) { debug_print( "Error\n%s\n", msg ); alertpanel_full(_("Addressbook conversion error"), msg, - GTK_STOCK_CLOSE, NULL, NULL, FALSE, - NULL, ALERT_ERROR, G_ALERTDEFAULT); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_ERROR); } else if( msg ) { debug_print( "Warning\n%s\n", msg ); alertpanel_full(_("Addressbook conversion error"), msg, - GTK_STOCK_CLOSE, NULL, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); } return retVal; @@ -4256,8 +4256,8 @@ void addressbook_read_file( void ) { addrindex_print_index( addrIndex, stdout ); alertpanel_full(_("Addressbook Error"), _("Could not read address index"), - GTK_STOCK_CLOSE, NULL, NULL, FALSE, - NULL, ALERT_ERROR, G_ALERTDEFAULT); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_ERROR); } debug_print( "done.\n" ); } diff --git a/src/addrindex.c b/src/addrindex.c @@ -1828,7 +1828,7 @@ gint addrindex_save_data( AddressIndex *addrIndex ) { if( abf->retVal != LDAPRC_SUCCESS ) { alertpanel( _("Address(es) update"), _("Update failed. Changes not written to Directory."), - GTK_STOCK_CLOSE, NULL, NULL ); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST ); } else { abf->retVal = MGU_SUCCESS; diff --git a/src/alertpanel.c b/src/alertpanel.c @@ -53,10 +53,10 @@ static void alertpanel_create (const gchar *title, const gchar *button1_label, const gchar *button2_label, const gchar *button3_label, + AlertFocus focus, gboolean can_disable, GtkWidget *custom_widget, - gint alert_type, - AlertValue default_value); + gint alert_type); static void alertpanel_button_toggled (GtkToggleButton *button, gpointer data); @@ -74,24 +74,23 @@ AlertValue alertpanel_with_widget(const gchar *title, const gchar *button1_label, const gchar *button2_label, const gchar *button3_label, + AlertFocus focus, gboolean can_disable, - AlertValue default_value, GtkWidget *widget) { return alertpanel_full(title, message, button1_label, - button2_label, button3_label, - can_disable, widget, ALERT_QUESTION, - default_value); + button2_label, button3_label, focus, + can_disable, widget, ALERT_QUESTION); } AlertValue alertpanel_full(const gchar *title, const gchar *message, const gchar *button1_label, const gchar *button2_label, const gchar *button3_label, + AlertFocus focus, gboolean can_disable, GtkWidget *widget, - AlertType alert_type, - AlertValue default_value) + AlertType alert_type) { if (alertpanel_is_open) return -1; @@ -100,8 +99,7 @@ AlertValue alertpanel_full(const gchar *title, const gchar *message, hooks_invoke(ALERTPANEL_OPENED_HOOKLIST, &alertpanel_is_open); } alertpanel_create(title, message, button1_label, button2_label, - button3_label, can_disable, widget, alert_type, - default_value); + button3_label, focus, can_disable, widget, alert_type); alertpanel_show(); debug_print("return value = %d\n", value); @@ -112,11 +110,11 @@ AlertValue alertpanel(const gchar *title, const gchar *message, const gchar *button1_label, const gchar *button2_label, - const gchar *button3_label) + const gchar *button3_label, + AlertFocus focus) { return alertpanel_full(title, message, button1_label, button2_label, - button3_label, FALSE, NULL, ALERT_QUESTION, - G_ALERTDEFAULT); + button3_label, focus, FALSE, NULL, ALERT_QUESTION); } static void alertpanel_message(const gchar *title, const gchar *message, gint type) @@ -129,7 +127,7 @@ static void alertpanel_message(const gchar *title, const gchar *message, gint ty } alertpanel_create(title, message, GTK_STOCK_CLOSE, NULL, NULL, - FALSE, NULL, type, G_ALERTDEFAULT); + ALERTFOCUS_FIRST, FALSE, NULL, type); alertpanel_show(); } @@ -193,8 +191,8 @@ void alertpanel_error_log(const gchar *format, ...) if (mainwin && mainwin->logwin) { mainwindow_clear_error(mainwin); val = alertpanel_full(_("Error"), buf, GTK_STOCK_CLOSE, - _("_View log"), NULL, FALSE, NULL, - ALERT_ERROR, G_ALERTDEFAULT); + _("_View log"), NULL, ALERTFOCUS_FIRST, FALSE, NULL, + ALERT_ERROR); if (val == G_ALERTALTERNATE) log_window_show(mainwin->logwin); } else @@ -228,10 +226,10 @@ static void alertpanel_create(const gchar *title, const gchar *button1_label, const gchar *button2_label, const gchar *button3_label, + AlertFocus focus, gboolean can_disable, GtkWidget *custom_widget, - gint alert_type, - AlertValue default_value) + gint alert_type) { static PangoFontDescription *font_desc; GtkWidget *image; @@ -243,6 +241,7 @@ static void alertpanel_create(const gchar *title, GtkWidget *button1; GtkWidget *button2; GtkWidget *button3; + GtkWidget *focusbutton; const gchar *label2; const gchar *label3; gchar *tmp = title?g_markup_printf_escaped("%s", title) @@ -359,8 +358,6 @@ static void alertpanel_create(const gchar *title, button1_label = GTK_STOCK_OK; label2 = button2_label; label3 = button3_label; - if (label2 && *label2 == '+') label2++; - if (label3 && *label3 == '+') label3++; gtkut_stock_button_set_create(&confirm_area, &button1, button1_label, @@ -370,18 +367,25 @@ static void alertpanel_create(const gchar *title, gtk_box_pack_end(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), confirm_area, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(confirm_area), 5); - gtk_widget_grab_default(button1); - gtk_widget_grab_focus(button1); - if (button2_label && - (default_value == G_ALERTALTERNATE || *button2_label == '+')) { - gtk_widget_grab_default(button2); - gtk_widget_grab_focus(button2); - } - if (button3_label && - (default_value == G_ALERTOTHER || *button3_label == '+')) { - gtk_widget_grab_default(button3); - gtk_widget_grab_focus(button3); + + /* Set focus on correct button as requested. */ + focusbutton = button1; + switch (focus) { + case ALERTFOCUS_SECOND: + if (button2_label != NULL) + focusbutton = button2; + break; + case ALERTFOCUS_THIRD: + if (button3_label != NULL) + focusbutton = button3; + break; + case ALERTFOCUS_FIRST: + default: + focusbutton = button1; + break; } + gtk_widget_grab_default(focusbutton); + gtk_widget_grab_focus(focusbutton); g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(alertpanel_button_clicked), diff --git a/src/alertpanel.h b/src/alertpanel.h @@ -42,30 +42,38 @@ typedef enum } AlertType; #define G_ALERT_VALUE_MASK 0x0000ffff +typedef enum +{ + ALERTFOCUS_FIRST, + ALERTFOCUS_SECOND, + ALERTFOCUS_THIRD +} AlertFocus; + #define ALERTPANEL_OPENED_HOOKLIST "alertpanel_opened_hooklist" AlertValue alertpanel_full(const gchar *title, const gchar *message, const gchar *button1_label, const gchar *button2_label, const gchar *button3_label, + AlertFocus focus, gboolean can_disable, GtkWidget *widget, - AlertType alert_type, - AlertValue default_value); + AlertType alert_type); AlertValue alertpanel (const gchar *title, const gchar *message, const gchar *button1_label, const gchar *button2_label, - const gchar *button3_label); + const gchar *button3_label, + AlertFocus focus); AlertValue alertpanel_with_widget (const gchar *title, const gchar *message, const gchar *button1_label, const gchar *button2_label, const gchar *button3_label, + AlertFocus focus, gboolean can_disable, - AlertValue default_value, GtkWidget *widget); void alertpanel_notice (const gchar *format, diff --git a/src/compose.c b/src/compose.c @@ -3643,7 +3643,8 @@ static ComposeInsertResult compose_insert_file(Compose *compose, const gchar *fi "in the message body. Are you sure you want to do that?"), to_human_readable(size)); aval = alertpanel_full(_("Are you sure?"), msg, GTK_STOCK_CANCEL, - g_strconcat("+", _("_Insert"), NULL), NULL, TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT); + _("_Insert"), NULL, ALERTFOCUS_SECOND, TRUE, + NULL, ALERT_QUESTION); g_free(msg); /* do we ask for confirmation next time? */ @@ -3769,8 +3770,8 @@ static gboolean compose_attach_append(Compose *compose, const gchar *file, if (size == 0 && !compose->batch) { gchar * msg = g_strdup_printf(_("File %s is empty."), filename); AlertValue aval = alertpanel_full(_("Empty file"), msg, - GTK_STOCK_CANCEL, g_strconcat("+", _("_Attach anyway"), NULL), NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, _("_Attach anyway"), NULL, + ALERTFOCUS_SECOND, FALSE, NULL, ALERT_WARNING); g_free(msg); if (aval != G_ALERTALTERNATE) { @@ -5068,7 +5069,7 @@ static gboolean compose_check_for_set_recipients(Compose *compose) prefs_common_translated_header_name("Cc")); aval = alertpanel(_("Send"), text, - GTK_STOCK_CANCEL, g_strconcat("+", _("_Send"), NULL), NULL); + GTK_STOCK_CANCEL, _("_Send"), NULL, ALERTFOCUS_SECOND); g_free(text); if (aval != G_ALERTALTERNATE) return FALSE; @@ -5105,7 +5106,7 @@ static gboolean compose_check_for_set_recipients(Compose *compose) prefs_common_translated_header_name("Bcc")); aval = alertpanel(_("Send"), text, - GTK_STOCK_CANCEL, g_strconcat("+", _("_Send"), NULL), NULL); + GTK_STOCK_CANCEL, _("_Send"), NULL, ALERTFOCUS_SECOND); g_free(text); if (aval != G_ALERTALTERNATE) return FALSE; @@ -5147,8 +5148,8 @@ static gboolean compose_check_entries(Compose *compose, gboolean check_everythin _("Queue it anyway?")); aval = alertpanel_full(compose->sending?_("Send"):_("Send later"), message, - GTK_STOCK_CANCEL, button_label, NULL, TRUE, NULL, - ALERT_QUESTION, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, button_label, NULL, ALERTFOCUS_FIRST, + TRUE, NULL, ALERT_QUESTION); g_free(message); g_free(button_label); if (aval & G_ALERTDISABLE) { @@ -5196,8 +5197,8 @@ static gboolean compose_check_entries(Compose *compose, gboolean check_everythin _("Queue it anyway?")); aval = alertpanel_full(compose->sending?_("Send"):_("Send later"), message, - GTK_STOCK_CANCEL, button_label, NULL, TRUE, NULL, - ALERT_QUESTION, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, button_label, NULL, ALERTFOCUS_FIRST, + TRUE, NULL, ALERT_QUESTION); g_free(message); if (aval & G_ALERTDISABLE) { aval &= ~G_ALERTDISABLE; @@ -5734,8 +5735,8 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool "to the specified %s charset.\n" "Send it as %s?"), out_codeset, src_codeset); aval = alertpanel_full(_("Error"), msg, GTK_STOCK_CANCEL, - g_strconcat("+", _("_Send"), NULL), NULL, FALSE, - NULL, ALERT_ERROR, G_ALERTDEFAULT); + _("_Send"), NULL, ALERTFOCUS_SECOND, FALSE, + NULL, ALERT_ERROR); g_free(msg); if (aval != G_ALERTALTERNATE) { @@ -5796,7 +5797,8 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool "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, GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL); + aval = alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL, + ALERTFOCUS_FIRST); g_free(msg); if (aval != G_ALERTALTERNATE) { g_free(buf); @@ -6025,8 +6027,8 @@ static gboolean compose_warn_encryption(Compose *compose) return TRUE; val = alertpanel_full(_("Encryption warning"), warning, - GTK_STOCK_CANCEL, g_strconcat("+", _("C_ontinue"), NULL), NULL, - TRUE, NULL, ALERT_WARNING, G_ALERTALTERNATE); + GTK_STOCK_CANCEL, _("C_ontinue"), NULL, ALERTFOCUS_SECOND, + TRUE, NULL, ALERT_WARNING); if (val & G_ALERTDISABLE) { val &= ~G_ALERTDISABLE; if (val == G_ALERTALTERNATE) @@ -6324,8 +6326,9 @@ static int compose_add_attachments(Compose *compose, MimeInfo *parent) if (!is_file_exist(ainfo->file)) { gchar *msg = g_strdup_printf(_("Attachment %s doesn't exist anymore. Ignore?"), ainfo->file); - AlertValue val = alertpanel_full(_("Warning"), msg, _("Cancel sending"), _("Ignore attachment"), - NULL, FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT); + AlertValue val = alertpanel_full(_("Warning"), msg, + _("Cancel sending"), _("Ignore attachment"), NULL, + ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING); g_free(msg); if (val == G_ALERTDEFAULT) { return -1; @@ -9723,7 +9726,8 @@ static gboolean compose_ext_editor_kill(Compose *compose) "Force terminating the process?\n" "process group id: %d"), -pgid); val = alertpanel_full(_("Notice"), msg, GTK_STOCK_NO, GTK_STOCK_YES, - NULL, FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT); + NULL, ALERTFOCUS_FIRST, FALSE, NULL, + ALERT_WARNING); g_free(msg); @@ -10399,8 +10403,8 @@ warn_err: val = alertpanel_full(_("Could not save draft"), _("Could not save draft.\n" "Do you want to cancel exit or discard this email?"), - _("_Cancel exit"), _("_Discard email"), NULL, - FALSE, NULL, ALERT_QUESTION, G_ALERTDEFAULT); + _("_Cancel exit"), _("_Discard email"), NULL, ALERTFOCUS_FIRST, + FALSE, NULL, ALERT_QUESTION); if (val == G_ALERTALTERNATE) { lock = FALSE; g_mutex_unlock(compose->mutex); /* must be done before closing */ @@ -10700,12 +10704,13 @@ static void compose_close_cb(GtkAction *action, gpointer data) if (!reedit) { val = alertpanel(_("Discard message"), _("This message has been modified. Discard it?"), - _("_Discard"), _("_Save to Drafts"), GTK_STOCK_CANCEL); + _("_Discard"), _("_Save to Drafts"), GTK_STOCK_CANCEL, + ALERTFOCUS_FIRST); } else { val = alertpanel(_("Save changes"), _("This message has been modified. Save the latest changes?"), - _("_Don't save"), g_strconcat("+", _("_Save to Drafts"), NULL), - GTK_STOCK_CANCEL); + _("_Don't save"), _("_Save to Drafts"), GTK_STOCK_CANCEL, + ALERTFOCUS_SECOND); } g_mutex_unlock(compose->mutex); switch (val) { @@ -10778,7 +10783,7 @@ static void compose_template_activate_cb(GtkWidget *widget, gpointer data) msg = g_strdup_printf(_("Do you want to apply the template '%s'?"), tmpl->name); val = alertpanel(_("Apply template"), msg, - _("_Replace"), _("_Insert"), GTK_STOCK_CANCEL); + _("_Replace"), _("_Insert"), GTK_STOCK_CANCEL, ALERTFOCUS_FIRST); g_free(msg); if (val == G_ALERTDEFAULT) @@ -11656,8 +11661,9 @@ static void compose_insert_drag_received_cb (GtkWidget *widget, num_files), num_files); val = alertpanel_full(_("Insert or attach?"), msg, - GTK_STOCK_CANCEL, g_strconcat("+", _("_Insert"), NULL), _("_Attach"), - TRUE, NULL, ALERT_QUESTION, G_ALERTALTERNATE); + GTK_STOCK_CANCEL, _("_Insert"), _("_Attach"), + ALERTFOCUS_SECOND, + TRUE, NULL, ALERT_QUESTION); g_free(msg); break; case COMPOSE_DND_INSERT: @@ -12179,8 +12185,8 @@ void compose_reply_from_messageview(MessageView *msgview, GSList *msginfo_list, "want to continue?"), g_slist_length(msginfo_list)); if (g_slist_length(msginfo_list) > 9 - && alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, "+" GTK_STOCK_YES, NULL) - != G_ALERTALTERNATE) { + && alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, GTK_STOCK_YES, NULL, + ALERTFOCUS_SECOND) != G_ALERTALTERNATE) { g_free(msg); return; } diff --git a/src/editaddress.c b/src/editaddress.c @@ -174,7 +174,7 @@ static void edit_person_ok(GtkWidget *widget, gboolean *cancelled) { "Click OK to keep editing this contact.\n" "Click Cancel to close without saving."), #endif - GTK_STOCK_CANCEL, "+"GTK_STOCK_OK, NULL ); + GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL, ALERTFOCUS_SECOND ); if( val == G_ALERTDEFAULT ) { edit_person_cancel(widget, cancelled); } diff --git a/src/edittags.c b/src/edittags.c @@ -215,7 +215,8 @@ static void apply_popup_delete (GtkAction *action, gpointer data) if (alertpanel(_("Delete tag"), _("Do you really want to delete this tag?"), - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL) != G_ALERTALTERNATE) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, + ALERTFOCUS_FIRST) != G_ALERTALTERNATE) return; APPLYWINDOW_LOCK(); @@ -250,7 +251,8 @@ static void apply_popup_delete_all (GtkAction *action, gpointer data) if (alertpanel(_("Delete all tags"), _("Do you really want to delete all tags?"), - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL) != G_ALERTALTERNATE) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, + ALERTFOCUS_FIRST) != G_ALERTALTERNATE) return; APPLYWINDOW_LOCK(); diff --git a/src/exphtmldlg.c b/src/exphtmldlg.c @@ -178,7 +178,7 @@ static gboolean exp_html_move_file( void ) { "does not exist. Do you want to create it?" ), _exportCtl_->dirOutput ); aval = alertpanel( _("Create directory" ), - msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL ); + msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST ); g_free( msg ); if( aval != G_ALERTALTERNATE ) return FALSE; @@ -189,8 +189,8 @@ static gboolean exp_html_move_file( void ) { "Could not create output directory for HTML file:\n%s" ), reason ); aval = alertpanel_full(_("Failed to Create Directory"), msg, - GTK_STOCK_CLOSE, NULL, NULL, FALSE, - NULL, ALERT_ERROR, G_ALERTDEFAULT); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_ERROR); g_free( msg ); return FALSE; } diff --git a/src/expldifdlg.c b/src/expldifdlg.c @@ -188,7 +188,7 @@ static gboolean exp_ldif_move_file( void ) { "does not exist. OK to create new directory?" ), _exportCtl_->dirOutput ); aval = alertpanel( _("Create Directory" ), - msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL ); + msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST ); g_free( msg ); if( aval != G_ALERTALTERNATE ) return FALSE; @@ -199,8 +199,8 @@ static gboolean exp_ldif_move_file( void ) { "Could not create output directory for LDIF file:\n%s" ), reason ); aval = alertpanel_full(_("Failed to Create Directory"), msg, - GTK_STOCK_CLOSE, NULL, NULL, FALSE, - NULL, ALERT_ERROR, G_ALERTDEFAULT); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_ERROR); g_free( msg ); return FALSE; } @@ -244,7 +244,7 @@ static gboolean exp_ldif_move_dn( void ) { "for an LDAP server. Are you sure you wish " \ "to proceed without a suffix?" ), - GTK_STOCK_NO, GTK_STOCK_YES, NULL ); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST ); if( aval != G_ALERTALTERNATE ) { gtk_widget_grab_focus( expldif_dlg.entrySuffix ); errFlag = TRUE; diff --git a/src/file_checker.c b/src/file_checker.c @@ -75,7 +75,8 @@ static gboolean verify_folderlist_xml() msg = g_strdup_printf (_("The file %s is missing! " "Do you want to use the backup file from %s?"), FOLDER_LIST,buf); - aval = alertpanel(_("Warning"), msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL); + aval = alertpanel(_("Warning"), msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL, + ALERTFOCUS_FIRST); g_free(msg); if (aval != G_ALERTALTERNATE) return FALSE; @@ -97,7 +98,8 @@ static gboolean verify_folderlist_xml() msg = g_strdup_printf (_("The file %s is empty or corrupted! " "Do you want to use the backup file from %s?"), FOLDER_LIST,buf); - aval = alertpanel(_("Warning"), msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL); + aval = alertpanel(_("Warning"), msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL, + ALERTFOCUS_FIRST); g_free(msg); if (aval != G_ALERTALTERNATE) return FALSE; diff --git a/src/folderview.c b/src/folderview.c @@ -877,8 +877,8 @@ static void mark_all_read_unread_handler(GtkAction *action, gpointer data, } if (prefs_common.ask_mark_all_read) { val = alertpanel_full(title, message, - GTK_STOCK_NO, GTK_STOCK_YES, NULL, - TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST, + TRUE, NULL, ALERT_QUESTION); if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE) return; @@ -1099,8 +1099,8 @@ void folderview_rescan_tree(Folder *folder, gboolean rebuild) alertpanel_full(_("Rebuild folder tree"), _("Rebuilding the folder tree will remove " "local caches. Do you want to continue?"), - GTK_STOCK_NO, GTK_STOCK_YES, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT) + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST, + FALSE, NULL, ALERT_WARNING) != G_ALERTALTERNATE) { return; } @@ -2482,7 +2482,8 @@ static void folderview_empty_trash_cb(GtkAction *action, gpointer data) if (prefs_common.ask_on_clean) { if (alertpanel(_("Empty trash"), _("Delete all messages in trash?"), - GTK_STOCK_CANCEL, g_strconcat("+", _("_Empty trash"), NULL), NULL) != G_ALERTALTERNATE) + GTK_STOCK_CANCEL, _("_Empty trash"), NULL, + ALERTFOCUS_SECOND) != G_ALERTALTERNATE) return; } @@ -2528,7 +2529,7 @@ static void folderview_send_queue_cb(GtkAction *action, gpointer data) if (alertpanel(_("Offline warning"), _("You're working offline. Override?"), GTK_STOCK_NO, GTK_STOCK_YES, - NULL) != G_ALERTALTERNATE) + NULL, ALERTFOCUS_FIRST) != G_ALERTALTERNATE) return; /* ask for confirmation before sending queued messages only @@ -2540,7 +2541,7 @@ static void folderview_send_queue_cb(GtkAction *action, gpointer data) if (alertpanel(_("Send queued messages"), _("Send all queued messages?"), GTK_STOCK_CANCEL, _("_Send"), - NULL) != G_ALERTALTERNATE) + NULL, ALERTFOCUS_FIRST) != G_ALERTALTERNATE) return; } } @@ -2629,8 +2630,8 @@ void folderview_move_folder(FolderView *folderview, FolderItem *from_folder, _("Do you really want to make folder '%s' a subfolder of '%s'?"), from_folder->name, to_folder->name); status = alertpanel_full(copy ? _("Copy folder"):_("Move folder"), buf, - GTK_STOCK_NO, GTK_STOCK_YES, NULL, TRUE, - NULL, ALERT_QUESTION, G_ALERTDEFAULT); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST, + TRUE, NULL, ALERT_QUESTION); g_free(buf); if ((status & ~G_ALERTDISABLE) != G_ALERTALTERNATE) diff --git a/src/gtk/sslcertwindow.c b/src/gtk/sslcertwindow.c @@ -301,7 +301,7 @@ void sslcertwindow_show_cert(SSLCertificate *cert) buf = g_strdup_printf(_("SSL/TLS certificate for %s"), cert->host); alertpanel_full(buf, NULL, GTK_STOCK_CLOSE, NULL, NULL, - FALSE, cert_widget, ALERT_NOTICE, G_ALERTDEFAULT); + ALERTFOCUS_FIRST, FALSE, cert_widget, ALERT_NOTICE); g_free(buf); } @@ -367,7 +367,7 @@ static gboolean sslcertwindow_ask_new_cert(SSLCertificate *cert) val = alertpanel_full(title, NULL, _("_Cancel connection"), _("_Accept and save"), NULL, - FALSE, vbox, ALERT_QUESTION, G_ALERTDEFAULT); + ALERTFOCUS_FIRST, FALSE, vbox, ALERT_QUESTION); return (val == G_ALERTALTERNATE); } @@ -417,7 +417,7 @@ static gboolean sslcertwindow_ask_expired_cert(SSLCertificate *cert) val = alertpanel_full(title, NULL, _("_Cancel connection"), _("_Accept"), NULL, - FALSE, vbox, ALERT_QUESTION, G_ALERTDEFAULT); + ALERTFOCUS_FIRST, FALSE, vbox, ALERT_QUESTION); return (val == G_ALERTALTERNATE); } @@ -479,7 +479,7 @@ static gboolean sslcertwindow_ask_changed_cert(SSLCertificate *old_cert, SSLCert title = _("SSL/TLS certificate changed"); val = alertpanel_full(title, NULL, _("_Cancel connection"), _("_Accept and save"), NULL, - FALSE, vbox2, ALERT_WARNING, G_ALERTDEFAULT); + ALERTFOCUS_FIRST, FALSE, vbox2, ALERT_WARNING); return (val == G_ALERTALTERNATE); } diff --git a/src/imap_gtk.c b/src/imap_gtk.c @@ -366,8 +366,8 @@ static void delete_folder_cb(GtkAction *action, gpointer data) "Recovery will not be possible.\n\n" "Do you really want to delete?"), name); avalue = alertpanel_full(_("Delete folder"), message, - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); g_free(message); if (avalue != G_ALERTALTERNATE) return; @@ -512,8 +512,8 @@ static void subscribe_cb_full(FolderView *folderview, guint action) G_CALLBACK(chk_update_val), &recurse); avalue = alertpanel_full(_("Subscriptions"), message, - GTK_STOCK_CANCEL, g_strconcat("+", _("_Search"), NULL), - NULL, FALSE, rec_chk, ALERT_QUESTION, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, _("_Search"), NULL, ALERTFOCUS_SECOND, + FALSE, rec_chk, ALERT_QUESTION); g_free(message); if (avalue != G_ALERTALTERNATE) return; @@ -571,9 +571,8 @@ static void subscribe_cb_full(FolderView *folderview, guint action) G_CALLBACK(chk_update_val), &recurse); avalue = alertpanel_full(_("Subscriptions"), message, - GTK_STOCK_CANCEL, action?g_strconcat("+", _("_Subscribe"), NULL): - g_strconcat("+", _("_Unsubscribe"), NULL), NULL, FALSE, - rec_chk, ALERT_QUESTION, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, action?_("_Subscribe"):_("_Unsubscribe"), NULL, + ALERTFOCUS_SECOND, FALSE, rec_chk, ALERT_QUESTION); g_free(message); if (avalue != G_ALERTALTERNATE) return; diff --git a/src/import.c b/src/import.c @@ -205,7 +205,7 @@ static void import_ok_cb(GtkWidget *widget, gpointer data) } if (destdir && !*destdir) { if (alertpanel(_("Import mbox file"), _("Destination folder is not set.\nImport mbox file to the Inbox folder?"), - GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL) + GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL, ALERTFOCUS_FIRST) == G_ALERTALTERNATE) { gtk_widget_grab_focus(dest_entry); return; diff --git a/src/inc.c b/src/inc.c @@ -1532,8 +1532,8 @@ gboolean inc_offline_should_override(gboolean force_ask, const gchar *msg) answer = alertpanel(_("Offline warning"), tmp, - GTK_STOCK_NO, "+" GTK_STOCK_YES, - !force_ask? _("On_ly once"):NULL); + GTK_STOCK_NO, GTK_STOCK_YES, + !force_ask? _("On_ly once"):NULL, ALERTFOCUS_SECOND); g_free(tmp); if (answer == G_ALERTALTERNATE) { overridden_yes = time(NULL); diff --git a/src/main.c b/src/main.c @@ -393,8 +393,8 @@ static gboolean migrate_old_config(const gchar *old_cfg_dir, const gchar *new_cf G_CALLBACK(chk_update_val), &backup); if (alertpanel_full(_("Migration of configuration"), message, - GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL, FALSE, - keep_backup_chk, ALERT_QUESTION, G_ALERTDEFAULT) != G_ALERTALTERNATE) { + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND, FALSE, + keep_backup_chk, ALERT_QUESTION) != G_ALERTALTERNATE) { return FALSE; } @@ -2178,7 +2178,7 @@ void app_will_exit(GtkWidget *widget, gpointer data) if (prefs_common.warn_queued_on_exit && procmsg_have_queued_mails_fast()) { if (alertpanel(_("Queued messages"), _("Some unsent messages are queued. Exit now?"), - GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL) + GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL, ALERTFOCUS_FIRST) != G_ALERTALTERNATE) { main_window_popup(mainwin); sc_exiting = FALSE; diff --git a/src/mainwindow.c b/src/mainwindow.c @@ -2901,11 +2901,13 @@ gboolean main_window_empty_trash(MainWindow *mainwin, gboolean confirm, gboolean if (for_quit) val = alertpanel(_("Empty trash"), _("Delete all messages in trash folders?"), - GTK_STOCK_NO, "+" GTK_STOCK_YES, _("Don't quit")); + GTK_STOCK_NO, GTK_STOCK_YES, _("Don't quit"), + ALERTFOCUS_SECOND); else val = alertpanel(_("Empty trash"), _("Delete all messages in trash folders?"), - GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, + ALERTFOCUS_SECOND); if (val == G_ALERTALTERNATE) { debug_print("will empty trash\n"); } else if (val == G_ALERTDEFAULT) { @@ -4059,7 +4061,7 @@ static void app_exit_cb(GtkAction *action, gpointer data) if (prefs_common.confirm_on_exit) { if (alertpanel(_("Exit"), _("Exit Claws Mail?"), - GTK_STOCK_CANCEL, GTK_STOCK_QUIT, NULL) + GTK_STOCK_CANCEL, GTK_STOCK_QUIT, NULL, ALERTFOCUS_FIRST) != G_ALERTALTERNATE) return; manage_window_focus_in(mainwin->window, NULL, NULL); @@ -4251,7 +4253,7 @@ static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask) if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"), _("Do you want to synchronise your folders now?"), - GTK_STOCK_CANCEL, g_strconcat("+", _("_Synchronise"), NULL), NULL) != G_ALERTALTERNATE) + GTK_STOCK_CANCEL, _("_Synchronise"), NULL, ALERTFOCUS_SECOND) != G_ALERTALTERNATE) return; if (offline_ask_sync) diff --git a/src/mbox.c b/src/mbox.c @@ -548,8 +548,8 @@ gint export_list_to_mbox(GSList *mlist, const gchar *mbox) if (g_file_test(mbox, G_FILE_TEST_EXISTS) == TRUE) { if (alertpanel_full(_("Overwrite mbox file"), _("This file already exists. Do you want to overwrite it?"), - GTK_STOCK_CANCEL, _("Overwrite"), NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT) + GTK_STOCK_CANCEL, _("Overwrite"), NULL, + ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING) != G_ALERTALTERNATE) { return -2; } diff --git a/src/message_search.c b/src/message_search.c @@ -306,7 +306,7 @@ static void message_search_execute(gboolean backward) alertpanel_full(_("Search failed"), _("Search string not found."), GTK_STOCK_CLOSE, NULL, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + ALERTFOCUS_FIRST, NULL, ALERT_WARNING); break; } @@ -320,7 +320,7 @@ static void message_search_execute(gboolean backward) "continue from beginning?"); val = alertpanel(_("Search finished"), str, - GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); if (G_ALERTALTERNATE == val) { manage_window_focus_in(search_window.window, NULL, NULL); diff --git a/src/messageview.c b/src/messageview.c @@ -853,8 +853,8 @@ static gint disposition_notification_send(MsgInfo *msginfo) "It is advised to not send the return receipt."), to, buf); val = alertpanel_full(_("Warning"), message, - _("_Don't Send"), _("_Send"), NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + _("_Don't Send"), _("_Send"), NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); g_free(message); if (val != G_ALERTALTERNATE) { g_free(buf); @@ -881,8 +881,8 @@ static gint disposition_notification_send(MsgInfo *msginfo) prefs_common_translated_header_name("Cc")); val = alertpanel_full(_("Warning"), text, - _("_Don't Send"), _("_Send"), NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + _("_Don't Send"), _("_Send"), NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); g_free(text); g_free(tr); if (val != G_ALERTALTERNATE) @@ -1863,7 +1863,7 @@ static void messageview_save_as(MessageView *messageview) aval = alertpanel(_("Overwrite"), _("Overwrite existing file?"), - GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL); + GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL, ALERTFOCUS_FIRST); if (G_ALERTALTERNATE != aval) return; } @@ -2114,8 +2114,8 @@ static PrefsAccount *select_account_from_list(GList *ac_list) "address that this message was sent to.\n" "Please choose which account you want to " "use for sending the receipt notification:"), - _("_Cancel"), _("_Send Notification"), NULL, - FALSE, G_ALERTDEFAULT, optmenu) != G_ALERTALTERNATE) + _("_Cancel"), _("_Send Notification"), NULL, ALERTFOCUS_FIRST, + FALSE, optmenu) != G_ALERTALTERNATE) return NULL; return account_find_from_id(account_id); } diff --git a/src/mh_gtk.c b/src/mh_gtk.c @@ -204,8 +204,8 @@ static void delete_folder_cb(GtkAction *action, gpointer data) "Recovery will not be possible.\n\n" "Do you really want to delete?"), name); avalue = alertpanel_full(_("Delete folder"), message, - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); g_free(message); if (avalue != G_ALERTALTERNATE) return; @@ -372,8 +372,8 @@ static void remove_mailbox_cb(GtkAction *action, gpointer data) (_("Really remove the mailbox '%s'?\n" "(The messages are NOT deleted from the disk)"), name); avalue = alertpanel_full(_("Remove mailbox"), message, - GTK_STOCK_CANCEL, _("_Remove"), NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, _("_Remove"), NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); g_free(message); g_free(name); diff --git a/src/mimeview.c b/src/mimeview.c @@ -1839,7 +1839,7 @@ static gboolean mimeview_write_part(const gchar *filename, tmp); g_free(tmp); aval = alertpanel(_("Overwrite"), res, GTK_STOCK_CANCEL, - GTK_STOCK_OK, NULL); + GTK_STOCK_OK, NULL, ALERTFOCUS_FIRST); g_free(res); if (G_ALERTALTERNATE != aval) return FALSE; } @@ -1864,7 +1864,7 @@ static AlertValue mimeview_save_all_error_ask(gint n) "continue?"), n); AlertValue av = alertpanel_full(_("Error saving all message parts"), message, GTK_STOCK_CANCEL, _("Skip"), _("Skip all"), - FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT); + ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING); g_free(message); return av; } diff --git a/src/news_gtk.c b/src/news_gtk.c @@ -249,8 +249,8 @@ static void unsubscribe_newsgroup_cb(GtkAction *action, gpointer data) name = trim_string(item->path, 32); message = g_strdup_printf(_("Really unsubscribe newsgroup '%s'?"), name); avalue = alertpanel_full(_("Unsubscribe newsgroup"), message, - GTK_STOCK_CANCEL, _("_Unsubscribe"), NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, _("_Unsubscribe"), NULL, + ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING); g_free(message); g_free(name); if (avalue != G_ALERTALTERNATE) return; diff --git a/src/plugins/archive/archiver_gtk.c b/src/plugins/archive/archiver_gtk.c @@ -571,8 +571,8 @@ static gboolean archiver_save_files(struct ArchivePage* page) { AlertValue aval; aval = alertpanel_full(_("Creating archive"), msg, - GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); g_free(msg); if (aval != G_ALERTALTERNATE) return FALSE; @@ -618,8 +618,8 @@ static gboolean archiver_save_files(struct ArchivePage* page) { "\nContinue anyway?"), orig_file, g_slist_length(list)); aval = alertpanel_full(_("Creating archive"), msg, - GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); g_free(msg); if (aval != G_ALERTALTERNATE) { archive_free_file_list(page->md5, page->rename); diff --git a/src/plugins/att_remover/att_remover.c b/src/plugins/att_remover/att_remover.c @@ -423,8 +423,8 @@ static void remove_attachments(GSList *msglist) _("Do you really want to remove all attachments from " "the selected messages?\n\n" "The deleted data will be unrecoverable."), - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, - FALSE, NULL, ALERT_QUESTION, G_ALERTALTERNATE) != G_ALERTALTERNATE) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_SECOND, + FALSE, NULL, ALERT_QUESTION) != G_ALERTALTERNATE) return; main_window_cursor_wait(summaryview->mainwin); diff --git a/src/plugins/attachwarner/attachwarner.c b/src/plugins/attachwarner/attachwarner.c @@ -201,16 +201,9 @@ static gboolean attwarn_before_send_hook(gpointer source, gpointer data) mention = are_attachments_mentioned(compose); if (does_not_have_attachments(compose) && mention != NULL) { AlertValue aval; - gchar *button_label; gchar *message; gchar *bold_text; - debug_print("user has to decide\n"); - if (compose->sending) - button_label = g_strconcat("+", _("_Send"), NULL); - else - button_label = g_strconcat("+", _("_Queue"), NULL); - bold_text = g_strdup_printf("<span weight=\"bold\">%.20s</span>...", mention->context); message = g_strdup_printf( @@ -221,10 +214,12 @@ static gboolean attwarn_before_send_hook(gpointer source, gpointer data) bold_text, compose->sending?_("Send it anyway?"):_("Queue it anyway?")); aval = alertpanel(_("Attachment warning"), message, - GTK_STOCK_CANCEL, button_label, NULL); + GTK_STOCK_CANCEL, + compose->sending ? _("_Send") : _("Queue"), + NULL, + ALERTFOCUS_SECOND); g_free(message); g_free(bold_text); - g_free(button_label); if (aval != G_ALERTALTERNATE) return TRUE; } diff --git a/src/plugins/libravatar/libravatar_prefs.c b/src/plugins/libravatar/libravatar_prefs.c @@ -163,8 +163,8 @@ static void cache_clean_button_clicked_cb(GtkButton *button, gpointer data) val = alertpanel_full(_("Clear icon cache"), _("Are you sure you want to remove all cached avatar icons?"), - GTK_STOCK_NO, GTK_STOCK_YES, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); if (val != G_ALERTALTERNATE) return; diff --git a/src/plugins/mailmbox/plugin_gtk.c b/src/plugins/mailmbox/plugin_gtk.c @@ -298,8 +298,8 @@ static void remove_mailbox_cb(GtkAction *action, gpointer data) (_("Really remove the mailbox '%s'?\n" "(The messages are NOT deleted from the disk)"), name); avalue = alertpanel_full(_("Remove mailbox"), message, - GTK_STOCK_CANCEL, _("_Remove"), NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, _("_Remove"), NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); g_free(message); g_free(name); if (avalue != G_ALERTALTERNATE) return; @@ -330,8 +330,8 @@ static void delete_folder_cb(GtkAction *action, gpointer data) (_("All folders and messages under '%s' will be deleted.\n" "Do you really want to delete?"), name); avalue = alertpanel_full(_("Delete folder"), message, - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, FALSE, - NULL, ALERT_NOTICE, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_NOTICE); g_free(message); if (avalue != G_ALERTALTERNATE) return; diff --git a/src/plugins/managesieve/sieve_editor.c b/src/plugins/managesieve/sieve_editor.c @@ -333,7 +333,7 @@ static void sieve_editor_revert_cb(GtkAction *action, SieveEditorPage *page) if (!page->modified || alertpanel(_("Revert script"), _("This script has been modified. Revert the unsaved changes?"), - _("_Revert"), NULL, GTK_STOCK_CANCEL) == G_ALERTDEFAULT) + _("_Revert"), NULL, GTK_STOCK_CANCEL, ALERTFOCUS_FIRST) == G_ALERTDEFAULT) sieve_editor_revert(page); } @@ -430,7 +430,8 @@ static gboolean sieve_editor_confirm_close(SieveEditorPage *page) if (page->modified) { switch (alertpanel(_("Save changes"), _("This script has been modified. Save the latest changes?"), - _("_Discard"), g_strconcat("+", _("_Save"), NULL), GTK_STOCK_CANCEL)) { + _("_Discard"), _("_Save"), GTK_STOCK_CANCEL, + ALERTFOCUS_SECOND)) { case G_ALERTDEFAULT: return TRUE; case G_ALERTALTERNATE: diff --git a/src/plugins/managesieve/sieve_manager.c b/src/plugins/managesieve/sieve_manager.c @@ -322,8 +322,8 @@ static void filter_delete(GtkWidget *widget, SieveManagerPage *page) g_snprintf(buf, sizeof(buf), _("Do you really want to delete the filter '%s'?"), filter_name); if (alertpanel_full(_("Delete filter"), buf, - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT) != G_ALERTALTERNATE) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING) != G_ALERTALTERNATE) return; cmd_data = g_new(CommandDataName, 1); diff --git a/src/plugins/notification/notification_trayicon.c b/src/plugins/notification/notification_trayicon.c @@ -549,7 +549,7 @@ static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget) if(prefs_common_get_prefs()->confirm_on_exit) { if(alertpanel(_("Exit"), _("Exit Claws Mail?"), GTK_STOCK_CANCEL, GTK_STOCK_OK, - NULL) != G_ALERTALTERNATE) { + NULL, ALERTFOCUS_FIRST) != G_ALERTALTERNATE) { return; } manage_window_focus_in(mainwin->window, NULL, NULL); diff --git a/src/plugins/pdf_viewer/poppler_viewer.c b/src/plugins/pdf_viewer/poppler_viewer.c @@ -1204,8 +1204,9 @@ static void pdf_viewer_button_print_cb(GtkButton *button, PdfViewer *viewer) static void pdf_viewer_button_document_info_cb(GtkButton *button, PdfViewer *viewer) { alertpanel_full(_("PDF properties"), NULL, GTK_STOCK_CLOSE, NULL, NULL, - FALSE, (GtkWidget *) pdf_viewer_fill_info_table(viewer), - ALERT_NOTICE, G_ALERTDEFAULT); + ALERTFOCUS_FIRST, FALSE, + GTK_WIDGET(pdf_viewer_fill_info_table(viewer)), + ALERT_NOTICE); } /* diff --git a/src/plugins/perl/perl_plugin.c b/src/plugins/perl/perl_plugin.c @@ -1606,7 +1606,8 @@ static int perl_load_file(void) message = g_strdup_printf("Error processing Perl script file: " "(line numbers may not be valid)\n%s", SvPV(ERRSV,n_a)); - val = alertpanel("Perl Plugin error",message,"Retry","Abort","Edit"); + val = alertpanel("Perl Plugin error",message,"Retry","Abort","Edit", + ALERTFOCUS_FIRST); g_free(message); if(val == G_ALERTOTHER) { diff --git a/src/plugins/pgpcore/pgp_viewer.c b/src/plugins/pgpcore/pgp_viewer.c @@ -174,7 +174,7 @@ static void pgpview_show_mime_part(TextView *textview, MimeInfo *partinfo) _("This key is not in your keyring. Do you want " "Claws Mail to try and import it from a " "keyserver?"), - GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); GTK_EVENTS_FLUSH(); } if (val == G_ALERTDEFAULT) { diff --git a/src/plugins/pgpcore/select-keys.c b/src/plugins/pgpcore/select-keys.c @@ -623,9 +623,8 @@ use_untrusted (gpgme_key_t key, gpgme_user_id_t uid, gpgme_protocol_t proto) "Key details: ID %s, primary identity %s <%s>\n\n" "Do you trust this key enough to use it anyway?"), key->subkeys->keyid, key->uids->name, key->uids->email); - aval = alertpanel - (title, buf, - GTK_STOCK_NO, GTK_STOCK_YES, NULL); + aval = alertpanel(title, buf, + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST); g_free(buf); g_free(title); if (aval == G_ALERTALTERNATE) diff --git a/src/plugins/pgpcore/sgpgme.c b/src/plugins/pgpcore/sgpgme.c @@ -807,8 +807,8 @@ void sgpgme_init() _("GnuPG is not installed properly, or needs " "to be upgraded.\n" "OpenPGP support disabled."), - GTK_STOCK_CLOSE, NULL, NULL, TRUE, NULL, - ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST, TRUE, NULL, + ALERT_WARNING); if (val & G_ALERTDISABLE) prefs_gpg_get_config()->gpg_warning = FALSE; } @@ -891,7 +891,7 @@ void sgpgme_create_secret_key(PrefsAccount *account, gboolean ask_create) "which means that you won't be able to sign " "emails or receive encrypted emails.\n" "Do you want to create a new key pair now?"), - GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); if (val == G_ALERTDEFAULT) { return; } @@ -1013,7 +1013,7 @@ again: "to a keyserver?"), key->fpr ? key->fpr:"null"); AlertValue val = alertpanel(_("Key generated"), buf, - GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); g_free(buf); if (val == G_ALERTALTERNATE) { gchar *gpgbin = get_gpg_executable_name(); diff --git a/src/plugins/rssyl/rssyl_cb_menu.c b/src/plugins/rssyl/rssyl_cb_menu.c @@ -153,8 +153,8 @@ void rssyl_remove_folder_cb(GtkAction *action, "Recovery will not be possible.\n\n" "Do you really want to delete?"), name); avalue = alertpanel_full(_("Delete folder"), message, - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); g_free(message); if (avalue != G_ALERTALTERNATE) return; @@ -313,8 +313,8 @@ void rssyl_remove_mailbox_cb(GtkAction *action, gpointer data) n = trim_string(item->folder->name, 32); message = g_strdup_printf(_("Really remove the feed tree `%s' ?\n"), n); avalue = alertpanel_full(_("Remove feed tree"), message, - GTK_STOCK_CANCEL, _("_Remove"), NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, _("_Remove"), NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_WARNING); g_free(message); g_free(n); diff --git a/src/plugins/vcalendar/vcal_folder.c b/src/plugins/vcalendar/vcal_folder.c @@ -1985,8 +1985,8 @@ static void unsubscribe_cal_cb(GtkAction *action, gpointer data) message = g_strdup_printf (_("Do you really want to unsubscribe?")); avalue = alertpanel_full(_("Delete subscription"), message, - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, - FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST, + FALSE, NULL, ALERT_WARNING); g_free(message); if (avalue != G_ALERTALTERNATE) return; diff --git a/src/plugins/vcalendar/vcal_meeting_gtk.c b/src/plugins/vcalendar/vcal_meeting_gtk.c @@ -967,8 +967,8 @@ static gboolean find_availability(const gchar *dtstart, const gchar *dtend, GSLi msg = get_avail_msg(unavailable_persons, (total > 1), FALSE, offset_before, offset_after); val = alertpanel_full(_("Not everyone is available"), msg, - GTK_STOCK_CANCEL, _("Send anyway"), NULL, FALSE, - NULL, ALERT_QUESTION, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, _("Send anyway"), NULL, ALERTFOCUS_FIRST, + FALSE, NULL, ALERT_QUESTION); g_free(msg); } msg = get_avail_msg(unavailable_persons, TRUE, TRUE, offset_before, offset_after); @@ -1887,8 +1887,8 @@ gboolean vcal_meeting_alert_check(gpointer data) postpone_min > 1 ? 2:1), postpone_min); aval = alertpanel_full(title, message, - label, GTK_STOCK_OK, NULL, FALSE, - NULL, ALERT_NOTICE, G_ALERTDEFAULT); + label, GTK_STOCK_OK, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_NOTICE); g_free(label); g_free(title); @@ -2011,8 +2011,8 @@ gboolean vcal_meeting_export_calendar(const gchar *path, if (!automatic) { alertpanel_full(_("Empty calendar"), _("There is nothing to export."), - GTK_STOCK_OK, NULL, NULL, FALSE, - NULL, ALERT_NOTICE, G_ALERTDEFAULT); + GTK_STOCK_OK, NULL, NULL, ALERTFOCUS_FIRST, FALSE, + NULL, ALERT_NOTICE); return FALSE; } else { str_write_to_file("", tmpfile); diff --git a/src/plugins/vcalendar/vcalendar.c b/src/plugins/vcalendar/vcalendar.c @@ -121,7 +121,8 @@ static void create_meeting_from_message_cb_ui(GtkAction *action, gpointer data) "want to continue?"), total); if (total > 9 - && alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, "+" GTK_STOCK_YES, NULL) + && alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, GTK_STOCK_YES, NULL, + ALERTFOCUS_SECOND) != G_ALERTALTERNATE) { g_free(msg); return; @@ -986,8 +987,8 @@ void vcalendar_cancel_meeting(FolderItem *item, const gchar *uid) val = alertpanel_full(_("Cancel meeting"), _("Are you sure you want to cancel this meeting?"), - GTK_STOCK_NO, GTK_STOCK_YES, NULL, FALSE, - send_notify_chkbtn, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST, FALSE, + send_notify_chkbtn, ALERT_WARNING); if (val != G_ALERTALTERNATE) return; @@ -1083,8 +1084,8 @@ static gboolean vcalviewer_action_cb(GtkButton *widget, gpointer data) AlertValue val = alertpanel_full(_("No account found"), _("You have no account matching any attendee.\n" "Do you want to reply anyway?"), - GTK_STOCK_CANCEL, g_strconcat("+", _("Reply anyway"), NULL), - NULL, FALSE, NULL, ALERT_QUESTION, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, _("Reply anyway"), NULL, + ALERTFOCUS_SECOND, FALSE, NULL, ALERT_QUESTION); if (val == G_ALERTALTERNATE) { account = account_get_default(); vcal_manager_update_answer(event, account->address, diff --git a/src/prefs_actions.c b/src/prefs_actions.c @@ -706,7 +706,7 @@ static void prefs_actions_delete_cb(gpointer gtk_action, gpointer data) if (alertpanel(_("Delete action"), _("Do you really want to delete this action?"), - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL) != G_ALERTALTERNATE) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST) != G_ALERTALTERNATE) return; /* XXX: Here's the reason why we need to store the original @@ -727,7 +727,7 @@ static void prefs_actions_delete_all_cb(gpointer gtk_action, gpointer data) if (alertpanel(_("Delete all actions"), _("Do you really want to delete all the actions?"), - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL) != G_ALERTDEFAULT) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST) != G_ALERTDEFAULT) return; list_store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(actions.actions_list_view))); @@ -891,13 +891,13 @@ static void prefs_actions_cancel(GtkWidget *w, gpointer data) if (modified && alertpanel(_("Entry not saved"), _("The entry was not saved. Close anyway?"), - GTK_STOCK_CLOSE, g_strconcat("+", _("_Continue editing"), NULL), - NULL) != G_ALERTDEFAULT) { + GTK_STOCK_CLOSE, _("_Continue editing"), NULL, + ALERTFOCUS_SECOND) != G_ALERTDEFAULT) { return; } else if (modified_list && alertpanel(_("Actions list not saved"), _("The actions list has been modified. Close anyway?"), - GTK_STOCK_CLOSE, g_strconcat("+", _("_Continue editing"), NULL), - NULL) != G_ALERTDEFAULT) { + GTK_STOCK_CLOSE, _("_Continue editing"), NULL, + ALERTFOCUS_SECOND) != G_ALERTDEFAULT) { return; } modified = FALSE; @@ -922,8 +922,8 @@ static void prefs_actions_ok(GtkWidget *widget, gpointer data) if (modified && alertpanel(_("Entry not saved"), _("The entry was not saved. Close anyway?"), - GTK_STOCK_CLOSE, g_strconcat("+", _("_Continue editing"), NULL), - NULL) != G_ALERTDEFAULT) { + GTK_STOCK_CLOSE, _("_Continue editing"), + NULL, ALERTFOCUS_SECOND) != G_ALERTDEFAULT) { return; } modified = FALSE; diff --git a/src/prefs_customheader.c b/src/prefs_customheader.c @@ -698,7 +698,7 @@ static void prefs_custom_header_delete_cb(void) if (alertpanel(_("Delete header"), _("Do you really want to delete this header?"), - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL) != G_ALERTALTERNATE) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST) != G_ALERTALTERNATE) return; gtk_tree_model_get(model, &sel, diff --git a/src/prefs_filtering.c b/src/prefs_filtering.c @@ -1208,7 +1208,7 @@ static void prefs_filtering_delete_cb(gpointer action, gpointer data) if (alertpanel(_("Delete rule"), _("Do you really want to delete this rule?"), - GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL) == G_ALERTDEFAULT) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_SECOND) == G_ALERTDEFAULT) return; model = gtk_tree_view_get_model(list_view); @@ -1227,7 +1227,7 @@ static void prefs_filtering_delete_all_cb(gpointer action, gpointer data) if (alertpanel(_("Delete all rules"), _("Do you really want to delete all the rules?"), - GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL) == G_ALERTDEFAULT) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_SECOND) == G_ALERTDEFAULT) return; list_store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(filtering.cond_list_view))); @@ -1478,8 +1478,8 @@ static gboolean prefs_filtering_check_mod(gboolean check_changed_list) if (check_changed_list) { if (modified && alertpanel(_("Filtering rules not saved"), _("The list of filtering rules have been modified. Close anyway?"), - GTK_STOCK_CLOSE, g_strconcat("+", _("_Continue editing"), NULL), - NULL) != G_ALERTDEFAULT) { + GTK_STOCK_CLOSE, _("_Continue editing"), NULL, + ALERTFOCUS_SECOND) != G_ALERTDEFAULT) { return TRUE; } } @@ -1500,7 +1500,7 @@ static gboolean prefs_filtering_check_mod(gboolean check_changed_list) if (!filtering_str) { val = alertpanel(_("Entry not saved"), _("The entry was not saved. Close anyway?"), - GTK_STOCK_CLOSE, g_strconcat("+", _("_Continue editing"),NULL), NULL); + GTK_STOCK_CLOSE, _("_Continue editing"), NULL, ALERTFOCUS_SECOND); if (G_ALERTDEFAULT != val) { g_free(filtering_str); g_free(str); /* fixed two leaks: huzzah! */ @@ -1522,7 +1522,7 @@ static gboolean prefs_filtering_check_mod(gboolean check_changed_list) strlen(action)) { val = alertpanel(_("Entry not saved"), _("The entry was not saved. Close anyway?"), - GTK_STOCK_CLOSE, g_strconcat("+", _("_Continue editing"), NULL), NULL); + GTK_STOCK_CLOSE, _("_Continue editing"), NULL, ALERTFOCUS_SECOND); if (G_ALERTDEFAULT != val) { g_free(name); g_free(condition); diff --git a/src/prefs_folder_item.c b/src/prefs_folder_item.c @@ -1691,8 +1691,8 @@ static void clean_cache_cb(GtkWidget *widget, gpointer data) if (alertpanel_full(_("Discard cache"), _("Do you really want to discard the local cached " "data for this folder?"), - GTK_STOCK_CANCEL, g_strconcat("+", _("Discard"), NULL), - NULL, FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT) + GTK_STOCK_CANCEL, _("Discard"), NULL, ALERTFOCUS_SECOND, + FALSE, NULL, ALERT_WARNING) != G_ALERTALTERNATE) return; diff --git a/src/prefs_matcher.c b/src/prefs_matcher.c @@ -2112,8 +2112,9 @@ static void prefs_matcher_ok(void) val = alertpanel(_("Entry not saved"), _("The entry was not saved.\nClose anyway?"), GTK_STOCK_CLOSE, - g_strconcat("+", _("_Continue editing"), NULL), - NULL); + _("_Continue editing"), + NULL, + ALERTFOCUS_SECOND); if (G_ALERTDEFAULT != val) { g_free(matcher_str); g_free(str); diff --git a/src/prefs_migration.c b/src/prefs_migration.c @@ -57,9 +57,8 @@ gboolean _version_check(gint ver) markup, "</span></a>"); g_free(markup); av = alertpanel_full(_("Configuration warning"), msg, - GTK_STOCK_NO, GTK_STOCK_YES, NULL, - FALSE, NULL, - ALERT_ERROR, G_ALERTALTERNATE); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND, + FALSE, NULL, ALERT_ERROR); g_free(msg); if (av != G_ALERTDEFAULT) diff --git a/src/prefs_template.c b/src/prefs_template.c @@ -570,8 +570,8 @@ static void prefs_template_ok_cb(gpointer action, gpointer data) if (modified && alertpanel(_("Entry not saved"), _("The entry was not saved. Close anyway?"), - GTK_STOCK_CLOSE, g_strconcat("+", _("_Continue editing"), NULL), - NULL) != G_ALERTDEFAULT) { + GTK_STOCK_CLOSE, _("_Continue editing"), NULL, + ALERTFOCUS_SECOND) != G_ALERTDEFAULT) { return; } @@ -595,13 +595,13 @@ static void prefs_template_cancel_cb(gpointer action, gpointer data) if (modified && alertpanel(_("Entry not saved"), _("The entry was not saved. Close anyway?"), - GTK_STOCK_CLOSE, g_strconcat("+", _("_Continue editing"), NULL), - NULL) != G_ALERTDEFAULT) { + GTK_STOCK_CLOSE, _("_Continue editing"), NULL, + ALERTFOCUS_SECOND) != G_ALERTDEFAULT) { return; } else if (modified_list && alertpanel(_("Templates list not saved"), _("The templates list has been modified. Close anyway?"), - GTK_STOCK_CLOSE, g_strconcat("+", _("_Continue editing"), NULL), - NULL) != G_ALERTDEFAULT) { + GTK_STOCK_CLOSE, _("_Continue editing"), NULL, + ALERTFOCUS_SECOND) != G_ALERTDEFAULT) { return; } @@ -902,8 +902,8 @@ static void prefs_template_delete_cb(gpointer action, gpointer data) if (alertpanel(_("Delete template"), _("Do you really want to delete this template?"), - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, - NULL) != G_ALERTALTERNATE) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, + ALERTFOCUS_FIRST) != G_ALERTALTERNATE) return; gtk_list_store_remove(GTK_LIST_STORE(model), &iter); @@ -915,7 +915,8 @@ static void prefs_template_delete_all_cb(gpointer action, gpointer data) { if (alertpanel(_("Delete all templates"), _("Do you really want to delete all the templates?"), - GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL) == G_ALERTDEFAULT) + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, + ALERTFOCUS_SECOND) == G_ALERTDEFAULT) return; prefs_template_clear_list(); diff --git a/src/prefs_themes.c b/src/prefs_themes.c @@ -511,7 +511,7 @@ static void prefs_themes_btn_remove_clicked_cb(GtkWidget *widget, gpointer data) val = alertpanel(alert_title, _("Are you sure you want to remove this theme?"), - GTK_STOCK_NO, GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST); g_free(alert_title); if (G_ALERTALTERNATE == val) { @@ -566,14 +566,14 @@ static void prefs_themes_btn_install_clicked_cb(GtkWidget *widget, gpointer data if (file_exist(themeinfo, FALSE) == FALSE) { val = alertpanel(alert_title, _("This folder doesn't seem to be a theme folder.\nInstall anyway?"), - GTK_STOCK_NO, GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST); if (G_ALERTALTERNATE != val) goto end_inst; } if (superuser_p ()) { val = alertpanel(alert_title, _("Do you want to install theme for all users?"), - GTK_STOCK_NO, GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST); switch (val) { case G_ALERTALTERNATE: cinfo->dest = stock_pixmap_get_system_theme_dir_for_theme( @@ -595,8 +595,8 @@ static void prefs_themes_btn_install_clicked_cb(GtkWidget *widget, gpointer data AlertValue val = alertpanel_full(_("Theme exists"), _("A theme with the same name is\nalready installed in this location.\n\n" "Do you want to replace it?"), - GTK_STOCK_CANCEL, _("Overwrite"), NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, _("Overwrite"), NULL, ALERTFOCUS_FIRST, + FALSE, NULL, ALERT_WARNING); if (val == G_ALERTALTERNATE) { if (remove_dir_recursive(cinfo->dest) < 0) { alertpanel_error(_("Couldn't delete the old theme in %s."), cinfo->dest); diff --git a/src/ssl_manager.c b/src/ssl_manager.c @@ -409,8 +409,8 @@ static void ssl_manager_delete_cb(GtkWidget *widget, val = alertpanel_full(_("Delete certificate"), _("Do you really want to delete this certificate?"), - GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST, + FALSE, NULL, ALERT_WARNING); if (val != G_ALERTALTERNATE) diff --git a/src/summary_search.c b/src/summary_search.c @@ -780,8 +780,8 @@ static void summary_search_execute(gboolean backward, gboolean search_all) if (all_searched) { alertpanel_full(_("Search failed"), _("Search string not found."), - GTK_STOCK_CLOSE, NULL, NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST, + FALSE, NULL, ALERT_WARNING); break; } @@ -791,7 +791,8 @@ static void summary_search_execute(gboolean backward, gboolean search_all) str = _("End of list reached; continue from beginning?"); val = alertpanel(_("Search finished"), str, - GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, + ALERTFOCUS_SECOND); if (G_ALERTALTERNATE == val) { if (backward) { node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list_end); diff --git a/src/summaryview.c b/src/summaryview.c @@ -1279,7 +1279,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item) val = alertpanel(_("Process mark"), _("Some marks are left. Process them?"), - GTK_STOCK_NO, GTK_STOCK_YES, GTK_STOCK_CANCEL); + GTK_STOCK_NO, GTK_STOCK_YES, GTK_STOCK_CANCEL, ALERTFOCUS_FIRST); if (G_ALERTALTERNATE == val) { summary_unlock(summaryview); summary_execute(summaryview); @@ -1907,7 +1907,7 @@ void summary_select_prev_unread(SummaryView *summaryview) val = alertpanel(_("No more unread messages"), _("No unread message found. " "Search from the end?"), - GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); break; case NEXTUNREADMSGDIALOG_ASSUME_YES: val = G_ALERTALTERNATE; @@ -1955,7 +1955,7 @@ void summary_select_next_unread(SummaryView *summaryview) val = alertpanel(_("No more unread messages"), _("No unread message found. " "Go to next folder?"), - GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); break; case NEXTUNREADMSGDIALOG_ASSUME_YES: val = G_ALERTALTERNATE; @@ -1992,7 +1992,7 @@ void summary_select_prev_new(SummaryView *summaryview) val = alertpanel(_("No more new messages"), _("No new message found. " "Search from the end?"), - GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); break; case NEXTUNREADMSGDIALOG_ASSUME_YES: val = G_ALERTALTERNATE; @@ -2040,7 +2040,7 @@ void summary_select_next_new(SummaryView *summaryview) val = alertpanel(_("No more new messages"), _("No new message found. " "Go to next folder?"), - GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); break; case NEXTUNREADMSGDIALOG_ASSUME_YES: val = G_ALERTALTERNATE; @@ -2074,7 +2074,7 @@ void summary_select_prev_marked(SummaryView *summaryview) val = alertpanel(_("No more marked messages"), _("No marked message found. " "Search from the end?"), - GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); if (val != G_ALERTALTERNATE) return; node = summary_find_prev_flagged_msg(summaryview, NULL, MSG_MARKED, TRUE); @@ -2107,7 +2107,7 @@ void summary_select_next_marked(SummaryView *summaryview) val = alertpanel(_("No more marked messages"), _("No marked message found. " "Go to next folder?"), - GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); break; case NEXTUNREADMSGDIALOG_ASSUME_YES: val = G_ALERTALTERNATE; @@ -2141,7 +2141,7 @@ void summary_select_prev_labeled(SummaryView *summaryview) val = alertpanel(_("No more labeled messages"), _("No labeled message found. " "Search from the end?"), - GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); if (val != G_ALERTALTERNATE) return; node = summary_find_prev_flagged_msg(summaryview, NULL, MSG_CLABEL_FLAG_MASK, TRUE); @@ -2170,7 +2170,7 @@ void summary_select_next_labeled(SummaryView *summaryview) val = alertpanel(_("No more labeled messages"), _("No labeled message found. " "Search from the beginning?"), - GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND); if (val != G_ALERTALTERNATE) return; if (summaryview->sort_type == SORT_ASCENDING) node = summary_find_next_flagged_msg(summaryview, NULL, @@ -4205,8 +4205,8 @@ void summary_mark_all_read(SummaryView *summaryview, gboolean ask_if_needed) if (ask_if_needed && prefs_common.ask_mark_all_read) { val = alertpanel_full(_("Mark all as read"), _("Do you really want to mark all mails in this folder as read?"), - GTK_STOCK_NO, GTK_STOCK_YES, NULL, - TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST, + TRUE, NULL, ALERT_QUESTION); if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE) return; @@ -4244,8 +4244,8 @@ void summary_mark_all_unread(SummaryView *summaryview, gboolean ask_if_needed) if (ask_if_needed && prefs_common.ask_mark_all_read) { val = alertpanel_full(_("Mark all as unread"), _("Do you really want to mark all mails in this folder as unread?"), - GTK_STOCK_NO, GTK_STOCK_YES, NULL, - TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT); + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST, + TRUE, NULL, ALERT_QUESTION); if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE) return; @@ -4472,7 +4472,7 @@ void summary_delete(SummaryView *summaryview) num); aval = alertpanel(ngettext("Delete message", "Delete messages", num), buf, - GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL); + GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_SECOND); g_free(buf); if (aval != G_ALERTALTERNATE) { END_LONG_OPERATION(summaryview); @@ -4912,8 +4912,8 @@ void summary_save_as(SummaryView *summaryview) if (is_file_exist(dest)) { aval = alertpanel(_("Append or Overwrite"), _("Append or overwrite existing file?"), - _("_Append"), _("_Overwrite"), - GTK_STOCK_CANCEL); + _("_Append"), _("_Overwrite"), GTK_STOCK_CANCEL, + ALERTFOCUS_FIRST); if (aval != 0 && aval != 1) return; } @@ -4958,8 +4958,8 @@ void summary_print(SummaryView *summaryview) "want to continue?"), g_list_length(clist->selection)); if (g_list_length(clist->selection) > 9 - && alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, "+" GTK_STOCK_YES, NULL) - != G_ALERTALTERNATE) { + && alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, GTK_STOCK_YES, + NULL, ALERTFOCUS_SECOND) != G_ALERTALTERNATE) { g_free(msg); return; } @@ -5697,7 +5697,8 @@ static gboolean summary_filter_get_mode(void) _("Filtering"), _("There are some filtering rules that belong to an account.\n" "Please choose what to do with these rules:"), - GTK_STOCK_CANCEL, _("_Filter"), NULL, TRUE, G_ALERTALTERNATE, vbox); + GTK_STOCK_CANCEL, _("_Filter"), NULL, ALERTFOCUS_SECOND, + TRUE, vbox); if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE) { return FALSE; diff --git a/src/textview.c b/src/textview.c @@ -2916,8 +2916,8 @@ gboolean textview_uri_security_check(TextView *textview, ClickableText *uri) _("Real URL:"), uri->uri, _("Open it anyway?")); aval = alertpanel_full(_("Phishing attempt warning"), msg, - GTK_STOCK_CANCEL, _("_Open URL"), NULL, FALSE, - NULL, ALERT_WARNING, G_ALERTDEFAULT); + GTK_STOCK_CANCEL, _("_Open URL"), NULL, ALERTFOCUS_FIRST, + FALSE, NULL, ALERT_WARNING); g_free(msg); if (aval == G_ALERTALTERNATE) retval = TRUE; @@ -3093,7 +3093,7 @@ static void save_file_cb (GtkAction *action, TextView *textview) res = g_strdup_printf(_("Overwrite existing file '%s'?"), filename); aval = alertpanel(_("Overwrite"), res, GTK_STOCK_CANCEL, - GTK_STOCK_OK, NULL); + GTK_STOCK_OK, NULL, ALERTFOCUS_FIRST); g_free(res); if (G_ALERTALTERNATE != aval) return; diff --git a/src/toolbar.c b/src/toolbar.c @@ -3008,7 +3008,7 @@ void send_queue_cb(gpointer data, guint action, GtkWidget *widget) if (alertpanel(_("Offline warning"), _("You're working offline. Override?"), GTK_STOCK_NO, GTK_STOCK_YES, - NULL) != G_ALERTALTERNATE) + NULL, ALERTFOCUS_FIRST) != G_ALERTALTERNATE) return; /* ask for confirmation before sending queued messages only @@ -3028,7 +3028,7 @@ void send_queue_cb(gpointer data, guint action, GtkWidget *widget) if (alertpanel(_("Send queued messages"), _("Send all queued messages?"), GTK_STOCK_CANCEL, _("_Send"), - NULL) != G_ALERTALTERNATE) + NULL, ALERTFOCUS_FIRST) != G_ALERTALTERNATE) return; } }