Skip to content

Commit 9778a3a

Browse files
committed
eel-stock-dialogs: avoid gtk_dialog_add_button with stock ids
1 parent 5f0ad00 commit 9778a3a

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

eel/eel-stock-dialogs.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@ trash_dialog_response_callback (GtkDialog *dialog,
191191
gtk_widget_destroy (GTK_WIDGET (dialog));
192192
}
193193

194+
static void
195+
mate_dialog_add_button (GtkDialog *dialog,
196+
const gchar *button_text,
197+
const gchar *icon_name,
198+
gint response_id)
199+
{
200+
GtkWidget *button;
201+
202+
button = gtk_button_new_with_mnemonic (button_text);
203+
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
204+
205+
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
206+
gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
207+
gtk_widget_set_can_default (button, TRUE);
208+
gtk_widget_show (button);
209+
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, response_id);
210+
}
211+
194212
static gboolean
195213
timed_wait_callback (gpointer callback_data)
196214
{
@@ -201,7 +219,7 @@ timed_wait_callback (gpointer callback_data)
201219
wait = callback_data;
202220

203221
/* Put up the timed wait window. */
204-
button = wait->cancel_callback != NULL ? "gtk-cancel" : "gtk-ok";
222+
button = wait->cancel_callback != NULL ? "process-stop" : "gtk-ok";
205223
dialog = GTK_DIALOG (gtk_message_dialog_new (wait->parent_window,
206224
0,
207225
GTK_MESSAGE_INFO,
@@ -213,7 +231,11 @@ timed_wait_callback (gpointer callback_data)
213231
"secondary-text", _("You can stop this operation by clicking cancel."),
214232
NULL);
215233

216-
gtk_dialog_add_button (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK);
234+
if (g_strcmp0 (button, "process-stop") == 0)
235+
mate_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), button, GTK_RESPONSE_OK);
236+
else
237+
mate_dialog_add_button (GTK_DIALOG (dialog), _("_OK"), button, GTK_RESPONSE_OK);
238+
217239
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
218240

219241
/* The contents are often very small, causing tiny little

0 commit comments

Comments
 (0)