Skip to content

Commit 5f0ad00

Browse files
committed
caja-file-operations: avoid gtk_dialog_add_buttons with stock ids
1 parent 01cec7e commit 5f0ad00

File tree

1 file changed

+71
-39
lines changed

1 file changed

+71
-39
lines changed

libcaja-private/caja-file-operations.c

Lines changed: 71 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,11 @@ typedef struct {
183183

184184
#define IS_IO_ERROR(__error, KIND) (((__error)->domain == G_IO_ERROR && (__error)->code == G_IO_ERROR_ ## KIND))
185185

186+
#define CANCEL _("_Cancel")
186187
#define SKIP _("_Skip")
187188
#define SKIP_ALL _("S_kip All")
188189
#define RETRY _("_Retry")
190+
#define DELETE _("_Delete")
189191
#define DELETE_ALL _("Delete _All")
190192
#define REPLACE _("_Replace")
191193
#define REPLACE_ALL _("Replace _All")
@@ -1083,6 +1085,24 @@ typedef struct {
10831085
int result;
10841086
} RunSimpleDialogData;
10851087

1088+
static void
1089+
mate_dialog_add_button (GtkDialog *dialog,
1090+
const gchar *button_text,
1091+
const gchar *icon_name,
1092+
gint response_id)
1093+
{
1094+
GtkWidget *button;
1095+
1096+
button = gtk_button_new_with_mnemonic (button_text);
1097+
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
1098+
1099+
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
1100+
gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
1101+
gtk_widget_set_can_default (button, TRUE);
1102+
gtk_widget_show (button);
1103+
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, response_id);
1104+
}
1105+
10861106
static gboolean
10871107
do_run_simple_dialog (gpointer _data)
10881108
{
@@ -1112,7 +1132,13 @@ do_run_simple_dialog (gpointer _data)
11121132
continue;
11131133
}
11141134

1115-
gtk_dialog_add_button (GTK_DIALOG (dialog), button_title, response_id);
1135+
if (g_strcmp0 (button_title, CANCEL) == 0)
1136+
mate_dialog_add_button (GTK_DIALOG (dialog), button_title, "process-stop", response_id);
1137+
else if (g_strcmp0 (button_title, DELETE) == 0)
1138+
mate_dialog_add_button (GTK_DIALOG (dialog), button_title, "edit-delete", response_id);
1139+
else
1140+
gtk_dialog_add_button (GTK_DIALOG (dialog), button_title, response_id);
1141+
11161142
gtk_dialog_set_default_response (GTK_DIALOG (dialog), response_id);
11171143
}
11181144

@@ -1367,7 +1393,7 @@ confirm_delete_from_trash (CommonJob *job,
13671393
f (_("If you delete an item, it will be permanently lost.")),
13681394
NULL,
13691395
FALSE,
1370-
"gtk-cancel", "gtk-delete",
1396+
CANCEL, DELETE,
13711397
NULL);
13721398

13731399
return (response == 1);
@@ -1391,7 +1417,7 @@ confirm_empty_trash (CommonJob *job)
13911417
f(_("All items in the Trash will be permanently deleted.")),
13921418
NULL,
13931419
FALSE,
1394-
"gtk-cancel", _("Empty _Trash"),
1420+
CANCEL, _("Empty _Trash"),
13951421
NULL);
13961422

13971423
return (response == 1);
@@ -1433,7 +1459,7 @@ confirm_delete_directly (CommonJob *job,
14331459
f (_("If you delete an item, it will be permanently lost.")),
14341460
NULL,
14351461
FALSE,
1436-
"gtk-cancel", "gtk-delete",
1462+
CANCEL, DELETE,
14371463
NULL);
14381464

14391465
return response == 1;
@@ -1475,7 +1501,7 @@ confirm_trash (CommonJob *job,
14751501
f (_("Items moved to the trash may be recovered until the trash is emptied.")),
14761502
NULL,
14771503
FALSE,
1478-
"gtk-cancel", _("Move to _Trash"),
1504+
CANCEL, _("Move to _Trash"),
14791505
NULL);
14801506

14811507
return response == 1;
@@ -1609,7 +1635,7 @@ delete_dir (CommonJob *job, GFile *dir,
16091635
secondary,
16101636
details,
16111637
FALSE,
1612-
"gtk-cancel", _("_Skip files"),
1638+
CANCEL, _("_Skip files"),
16131639
NULL);
16141640

16151641
g_error_free (error);
@@ -1642,7 +1668,7 @@ delete_dir (CommonJob *job, GFile *dir,
16421668
secondary,
16431669
details,
16441670
FALSE,
1645-
"gtk-cancel", SKIP, RETRY,
1671+
CANCEL, SKIP, RETRY,
16461672
NULL);
16471673

16481674
g_error_free (error);
@@ -1675,7 +1701,7 @@ delete_dir (CommonJob *job, GFile *dir,
16751701
secondary,
16761702
details,
16771703
(source_info->num_files - transfer_info->num_files) > 1,
1678-
"gtk-cancel", SKIP_ALL, SKIP,
1704+
CANCEL, SKIP_ALL, SKIP,
16791705
NULL);
16801706

16811707
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -1752,7 +1778,7 @@ delete_file (CommonJob *job, GFile *file,
17521778
secondary,
17531779
details,
17541780
(source_info->num_files - transfer_info->num_files) > 1,
1755-
"gtk-cancel", SKIP_ALL, SKIP,
1781+
CANCEL, SKIP_ALL, SKIP,
17561782
NULL);
17571783

17581784
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -1895,7 +1921,7 @@ trash_files (CommonJob *job, GList *files, int *files_skipped)
18951921
secondary,
18961922
details,
18971923
(total_files - files_trashed) > 1,
1898-
"gtk-cancel", SKIP_ALL, SKIP, DELETE_ALL, "gtk-delete",
1924+
CANCEL, SKIP_ALL, SKIP, DELETE_ALL, DELETE,
18991925
NULL);
19001926

19011927
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -2314,10 +2340,16 @@ prompt_empty_trash (GtkWindow *parent_window)
23142340
"the trash must be emptied. "
23152341
"All trashed items on the volume "
23162342
"will be permanently lost."));
2317-
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
2318-
_("Do _not Empty Trash"), GTK_RESPONSE_REJECT,
2319-
"gtk-cancel", GTK_RESPONSE_CANCEL,
2320-
_("Empty _Trash"), GTK_RESPONSE_ACCEPT, NULL);
2343+
2344+
gtk_dialog_add_button (GTK_DIALOG (dialog),
2345+
_("Do _not Empty Trash"), GTK_RESPONSE_REJECT);
2346+
2347+
mate_dialog_add_button (GTK_DIALOG (dialog),
2348+
CANCEL, "process-stop", GTK_RESPONSE_CANCEL);
2349+
2350+
gtk_dialog_add_button (GTK_DIALOG (dialog),
2351+
_("Empty _Trash"), GTK_RESPONSE_ACCEPT);
2352+
23212353
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
23222354
gtk_window_set_title (GTK_WINDOW (dialog), ""); /* as per HIG */
23232355
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), TRUE);
@@ -2631,7 +2663,7 @@ scan_dir (GFile *dir,
26312663
secondary,
26322664
details,
26332665
FALSE,
2634-
"gtk-cancel", RETRY, SKIP,
2666+
CANCEL, RETRY, SKIP,
26352667
NULL);
26362668

26372669
g_error_free (error);
@@ -2672,7 +2704,7 @@ scan_dir (GFile *dir,
26722704
secondary,
26732705
details,
26742706
TRUE,
2675-
"gtk-cancel", SKIP_ALL, SKIP, RETRY,
2707+
CANCEL, SKIP_ALL, SKIP, RETRY,
26762708
NULL);
26772709

26782710
g_error_free (error);
@@ -2750,7 +2782,7 @@ scan_file (GFile *file,
27502782
secondary,
27512783
details,
27522784
TRUE,
2753-
"gtk-cancel", SKIP_ALL, SKIP, RETRY,
2785+
CANCEL, SKIP_ALL, SKIP, RETRY,
27542786
NULL);
27552787

27562788
g_error_free (error);
@@ -2854,7 +2886,7 @@ verify_destination (CommonJob *job,
28542886
secondary,
28552887
details,
28562888
FALSE,
2857-
"gtk-cancel", RETRY,
2889+
CANCEL, RETRY,
28582890
NULL);
28592891

28602892
g_error_free (error);
@@ -2889,7 +2921,7 @@ verify_destination (CommonJob *job,
28892921
secondary,
28902922
NULL,
28912923
FALSE,
2892-
"gtk-cancel",
2924+
CANCEL,
28932925
NULL);
28942926

28952927
abort_job (job);
@@ -2924,7 +2956,7 @@ verify_destination (CommonJob *job,
29242956
secondary,
29252957
details,
29262958
FALSE,
2927-
"gtk-cancel",
2959+
CANCEL,
29282960
COPY_FORCE,
29292961
RETRY,
29302962
NULL);
@@ -2952,7 +2984,7 @@ verify_destination (CommonJob *job,
29522984
secondary,
29532985
NULL,
29542986
FALSE,
2955-
"gtk-cancel",
2987+
CANCEL,
29562988
NULL);
29572989

29582990
g_error_free (error);
@@ -3472,7 +3504,7 @@ create_dest_dir (CommonJob *job,
34723504
secondary,
34733505
details,
34743506
FALSE,
3475-
"gtk-cancel", SKIP, RETRY,
3507+
CANCEL, SKIP, RETRY,
34763508
NULL);
34773509

34783510
g_error_free (error);
@@ -3613,7 +3645,7 @@ copy_move_directory (CopyMoveJob *copy_job,
36133645
secondary,
36143646
details,
36153647
FALSE,
3616-
"gtk-cancel", _("_Skip files"),
3648+
CANCEL, _("_Skip files"),
36173649
NULL);
36183650

36193651
g_error_free (error);
@@ -3658,7 +3690,7 @@ copy_move_directory (CopyMoveJob *copy_job,
36583690
secondary,
36593691
details,
36603692
FALSE,
3661-
"gtk-cancel", SKIP, RETRY,
3693+
CANCEL, SKIP, RETRY,
36623694
NULL);
36633695

36643696
g_error_free (error);
@@ -3700,7 +3732,7 @@ copy_move_directory (CopyMoveJob *copy_job,
37003732
secondary,
37013733
details,
37023734
(source_info->num_files - transfer_info->num_files) > 1,
3703-
"gtk-cancel", SKIP_ALL, SKIP,
3735+
CANCEL, SKIP_ALL, SKIP,
37043736
NULL);
37053737

37063738
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -3789,7 +3821,7 @@ remove_target_recursively (CommonJob *job,
37893821
secondary,
37903822
details,
37913823
TRUE,
3792-
"gtk-cancel", SKIP_ALL, SKIP,
3824+
CANCEL, SKIP_ALL, SKIP,
37933825
NULL);
37943826

37953827
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -3830,7 +3862,7 @@ remove_target_recursively (CommonJob *job,
38303862
secondary,
38313863
details,
38323864
TRUE,
3833-
"gtk-cancel", SKIP_ALL, SKIP,
3865+
CANCEL, SKIP_ALL, SKIP,
38343866
NULL);
38353867

38363868
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -4147,7 +4179,7 @@ copy_move_file (CopyMoveJob *copy_job,
41474179
secondary,
41484180
NULL,
41494181
(source_info->num_files - transfer_info->num_files) > 1,
4150-
"gtk-cancel", SKIP_ALL, SKIP,
4182+
CANCEL, SKIP_ALL, SKIP,
41514183
NULL);
41524184

41534185
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -4180,7 +4212,7 @@ copy_move_file (CopyMoveJob *copy_job,
41804212
secondary,
41814213
NULL,
41824214
(source_info->num_files - transfer_info->num_files) > 1,
4183-
"gtk-cancel", SKIP_ALL, SKIP,
4215+
CANCEL, SKIP_ALL, SKIP,
41844216
NULL);
41854217

41864218
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -4400,7 +4432,7 @@ copy_move_file (CopyMoveJob *copy_job,
44004432
secondary,
44014433
details,
44024434
TRUE,
4403-
"gtk-cancel", SKIP_ALL, SKIP,
4435+
CANCEL, SKIP_ALL, SKIP,
44044436
NULL);
44054437

44064438
g_error_free (error);
@@ -4468,7 +4500,7 @@ copy_move_file (CopyMoveJob *copy_job,
44684500
secondary,
44694501
details,
44704502
(source_info->num_files - transfer_info->num_files) > 1,
4471-
"gtk-cancel", SKIP_ALL, SKIP,
4503+
CANCEL, SKIP_ALL, SKIP,
44724504
NULL);
44734505

44744506
g_error_free (error);
@@ -4832,7 +4864,7 @@ move_file_prepare (CopyMoveJob *move_job,
48324864
secondary,
48334865
NULL,
48344866
files_left > 1,
4835-
"gtk-cancel", SKIP_ALL, SKIP,
4867+
CANCEL, SKIP_ALL, SKIP,
48364868
NULL);
48374869

48384870
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
@@ -4986,7 +5018,7 @@ move_file_prepare (CopyMoveJob *move_job,
49865018
secondary,
49875019
details,
49885020
files_left > 1,
4989-
"gtk-cancel", SKIP_ALL, SKIP,
5021+
CANCEL, SKIP_ALL, SKIP,
49905022
NULL);
49915023

49925024
g_error_free (error);
@@ -5432,7 +5464,7 @@ link_file (CopyMoveJob *job,
54325464
secondary,
54335465
details,
54345466
files_left > 1,
5435-
"gtk-cancel", SKIP_ALL, SKIP,
5467+
CANCEL, SKIP_ALL, SKIP,
54365468
NULL);
54375469

54385470
if (error) {
@@ -6190,7 +6222,7 @@ create_job (GIOSchedulerJob *io_job,
61906222
secondary,
61916223
details,
61926224
FALSE,
6193-
"gtk-cancel", SKIP,
6225+
CANCEL, SKIP,
61946226
NULL);
61956227

61966228
g_error_free (error);
@@ -6513,7 +6545,7 @@ mark_desktop_file_trusted (CommonJob *common,
65136545
error->message,
65146546
NULL,
65156547
FALSE,
6516-
"gtk-cancel", RETRY,
6548+
CANCEL, RETRY,
65176549
NULL);
65186550
} else {
65196551
response = 0;
@@ -6554,7 +6586,7 @@ mark_desktop_file_trusted (CommonJob *common,
65546586
error->message,
65556587
NULL,
65566588
FALSE,
6557-
"gtk-cancel", RETRY,
6589+
CANCEL, RETRY,
65586590
NULL);
65596591
} else {
65606592
response = 0;
@@ -6589,7 +6621,7 @@ mark_desktop_file_trusted (CommonJob *common,
65896621
error->message,
65906622
NULL,
65916623
FALSE,
6592-
"gtk-cancel", RETRY,
6624+
CANCEL, RETRY,
65936625
NULL);
65946626
} else {
65956627
response = 0;
@@ -6624,7 +6656,7 @@ mark_desktop_file_trusted (CommonJob *common,
66246656
error->message,
66256657
NULL,
66266658
FALSE,
6627-
"gtk-cancel", RETRY,
6659+
CANCEL, RETRY,
66286660
NULL);
66296661
} else {
66306662
response = 0;

0 commit comments

Comments
 (0)