Skip to content

Commit

Permalink
avoid 'gtk_dialog_add_buttons' with stock ids
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0w committed Mar 27, 2018
1 parent 78648af commit 15f06ce
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 38 deletions.
11 changes: 3 additions & 8 deletions plugins/spell/pluma-spell-language-dialog.c
Expand Up @@ -129,14 +129,9 @@ create_dialog (PlumaSpellLanguageDialog *dlg,
NULL
};

gtk_dialog_add_buttons (GTK_DIALOG (dlg),
"gtk-cancel",
GTK_RESPONSE_CANCEL,
"gtk-ok",
GTK_RESPONSE_OK,
"gtk-help",
GTK_RESPONSE_HELP,
NULL);
pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Cancel"), "process-stop", GTK_RESPONSE_CANCEL);
pluma_dialog_add_button (GTK_DIALOG (dlg), _("_OK"), "gtk-ok", GTK_RESPONSE_OK);
pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Help"), "help-browser", GTK_RESPONSE_HELP);

gtk_window_set_title (GTK_WINDOW (dlg), _("Set language"));
gtk_window_set_modal (GTK_WINDOW (dlg), TRUE);
Expand Down
23 changes: 16 additions & 7 deletions pluma/dialogs/pluma-close-confirmation-dialog.c
Expand Up @@ -151,8 +151,10 @@ set_logout_mode (PlumaCloseConfirmationDialog *dlg,
_("Close _without Saving"),
GTK_RESPONSE_NO);

gtk_dialog_add_button (GTK_DIALOG (dlg),
"gtk-cancel", GTK_RESPONSE_CANCEL);
pluma_dialog_add_button (GTK_DIALOG (dlg),
_("_Cancel"),
"process-stop",
GTK_RESPONSE_CANCEL);
}

if (dlg->priv->disable_save_to_disk)
Expand All @@ -162,7 +164,7 @@ set_logout_mode (PlumaCloseConfirmationDialog *dlg,
}
else
{
const gchar *icon_id = "gtk-save";
const gchar *icon_id = "document-save";

if (GET_MODE (dlg->priv) == SINGLE_DOC_MODE)
{
Expand All @@ -172,12 +174,19 @@ set_logout_mode (PlumaCloseConfirmationDialog *dlg,

if (pluma_document_get_readonly (doc) ||
pluma_document_is_untitled (doc))
icon_id = "gtk-save-as";
icon_id = "document-save-as";
}

gtk_dialog_add_button (GTK_DIALOG (dlg),
icon_id,
GTK_RESPONSE_YES);
if (g_strcmp0 (icon_id, "document-save") == 0)
pluma_dialog_add_button (GTK_DIALOG (dlg),
_("_Save"),
icon_id,
GTK_RESPONSE_YES);
else
pluma_dialog_add_button (GTK_DIALOG (dlg),
_("Save _As"),
icon_id,
GTK_RESPONSE_YES);

gtk_dialog_set_default_response (GTK_DIALOG (dlg),
GTK_RESPONSE_YES);
Expand Down
11 changes: 3 additions & 8 deletions pluma/dialogs/pluma-encodings-dialog.c
Expand Up @@ -309,14 +309,9 @@ pluma_encodings_dialog_init (PlumaEncodingsDialog *dlg)

dlg->priv = PLUMA_ENCODINGS_DIALOG_GET_PRIVATE (dlg);

gtk_dialog_add_buttons (GTK_DIALOG (dlg),
"gtk-cancel",
GTK_RESPONSE_CANCEL,
"gtk-ok",
GTK_RESPONSE_OK,
"gtk-help",
GTK_RESPONSE_HELP,
NULL);
pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Cancel"), "process-stop", GTK_RESPONSE_CANCEL);
pluma_dialog_add_button (GTK_DIALOG (dlg), _("_OK"), "gtk-ok", GTK_RESPONSE_OK);
pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Help"), "help-browser", GTK_RESPONSE_HELP);

gtk_window_set_title (GTK_WINDOW (dlg), _("Character Encodings"));
gtk_window_set_default_size (GTK_WINDOW (dlg), 650, 400);
Expand Down
8 changes: 2 additions & 6 deletions pluma/dialogs/pluma-preferences-dialog.c
Expand Up @@ -1081,12 +1081,8 @@ pluma_preferences_dialog_init (PlumaPreferencesDialog *dlg)

dlg->priv = PLUMA_PREFERENCES_DIALOG_GET_PRIVATE (dlg);

gtk_dialog_add_buttons (GTK_DIALOG (dlg),
"gtk-close",
GTK_RESPONSE_CLOSE,
"gtk-help",
GTK_RESPONSE_HELP,
NULL);
pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Close"), "window-close", GTK_RESPONSE_CLOSE);
pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Help"), "help-browser", GTK_RESPONSE_HELP);

gtk_window_set_title (GTK_WINDOW (dlg), _("Pluma Preferences"));
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
Expand Down
4 changes: 1 addition & 3 deletions pluma/dialogs/pluma-search-dialog.c
Expand Up @@ -330,9 +330,7 @@ pluma_search_dialog_init (PlumaSearchDialog *dlg)
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);

gtk_dialog_add_buttons (GTK_DIALOG (dlg),
"gtk-close", GTK_RESPONSE_CANCEL,
NULL);
pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Close"), "window-close", GTK_RESPONSE_CANCEL);

/* HIG defaults */
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
Expand Down
14 changes: 8 additions & 6 deletions pluma/pluma-commands-file.c
Expand Up @@ -579,9 +579,10 @@ replace_read_only_file (GtkWindow *parent, GFile *file)
_("Do you want to try to replace it "
"with the one you are saving?"));

gtk_dialog_add_button (GTK_DIALOG (dialog),
"gtk-cancel",
GTK_RESPONSE_CANCEL);
pluma_dialog_add_button (GTK_DIALOG (dialog),
_("_Cancel"),
"process-stop",
GTK_RESPONSE_CANCEL);

pluma_dialog_add_button (GTK_DIALOG (dialog),
_("_Replace"),
Expand Down Expand Up @@ -1218,9 +1219,10 @@ revert_dialog (PlumaWindow *window,

gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);

gtk_dialog_add_button (GTK_DIALOG (dialog),
"gtk-cancel",
GTK_RESPONSE_CANCEL);
pluma_dialog_add_button (GTK_DIALOG (dialog),
_("_Cancel"),
"process-stop",
GTK_RESPONSE_CANCEL);

pluma_dialog_add_button (GTK_DIALOG (dialog),
_("_Revert"),
Expand Down

0 comments on commit 15f06ce

Please sign in to comment.