Skip to content

Commit 09adc8b

Browse files
committed
text: Provide clearer user prompts when requesting authorization.
1 parent 874b4f0 commit 09adc8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+6658
-6645
lines changed

modules/lsm/lsm_linux_drive_local.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ is_authed (GDBusMethodInvocation *invocation,
275275
UDISKS_OBJECT (block_object),
276276
LSM_POLICY_ACTION_ID,
277277
options,
278-
N_("Authentication is required to change $(drive) LED"),
278+
N_("Authentication is required to change $(device.name) LED"),
279279
invocation))
280280
goto out;
281281

po/af.po

+112-112
Large diffs are not rendered by default.

po/ar.po

+65-65
Large diffs are not rendered by default.

po/as.po

+65-65
Large diffs are not rendered by default.

po/az.po

+65-65
Large diffs are not rendered by default.

po/bg.po

+65-65
Large diffs are not rendered by default.

po/bn_IN.po

+65-65
Large diffs are not rendered by default.

po/ca.po

+113-113
Large diffs are not rendered by default.

po/[email protected]

+65-65
Large diffs are not rendered by default.

po/cs.po

+114-114
Large diffs are not rendered by default.

po/cy.po

+65-65
Large diffs are not rendered by default.

po/da.po

+114-114
Large diffs are not rendered by default.

po/de.po

+140-140
Large diffs are not rendered by default.

po/el.po

+110-110
Large diffs are not rendered by default.

po/en_GB.po

+107-107
Large diffs are not rendered by default.

po/eo.po

+65-65
Large diffs are not rendered by default.

po/es.po

+114-114
Large diffs are not rendered by default.

po/et.po

+65-65
Large diffs are not rendered by default.

po/eu.po

+76-76
Large diffs are not rendered by default.

po/fa.po

+65-65
Large diffs are not rendered by default.

po/fi.po

+98-98
Large diffs are not rendered by default.

po/fo.po

+65-65
Large diffs are not rendered by default.

po/fr.po

+145-145
Large diffs are not rendered by default.

po/fur.po

+114-114
Large diffs are not rendered by default.

po/ga.po

+65-65
Large diffs are not rendered by default.

po/gl.po

+110-110
Large diffs are not rendered by default.

po/gu.po

+65-65
Large diffs are not rendered by default.

po/he.po

+65-65
Large diffs are not rendered by default.

po/hi.po

+140-140
Large diffs are not rendered by default.

po/hr.po

+108-108
Large diffs are not rendered by default.

po/hu.po

+114-114
Large diffs are not rendered by default.

po/ia.po

+76-76
Large diffs are not rendered by default.

po/id.po

+140-140
Large diffs are not rendered by default.

po/it.po

+114-114
Large diffs are not rendered by default.

po/ja.po

+110-110
Large diffs are not rendered by default.

po/ka.po

+141-141
Large diffs are not rendered by default.

po/kk.po

+107-107
Large diffs are not rendered by default.

po/kn.po

+65-65
Large diffs are not rendered by default.

po/ko.po

+113-113
Large diffs are not rendered by default.

po/lt.po

+114-114
Large diffs are not rendered by default.

po/lv.po

+76-76
Large diffs are not rendered by default.

po/ml.po

+65-65
Large diffs are not rendered by default.

po/mr.po

+65-65
Large diffs are not rendered by default.

po/ms.po

+65-65
Large diffs are not rendered by default.

po/nb.po

+65-65
Large diffs are not rendered by default.

po/nl.po

+114-114
Large diffs are not rendered by default.

po/nn.po

+108-108
Large diffs are not rendered by default.

po/oc.po

+65-65
Large diffs are not rendered by default.

po/or.po

+65-65
Large diffs are not rendered by default.

po/pa.po

+76-76
Large diffs are not rendered by default.

po/pl.po

+140-140
Large diffs are not rendered by default.

po/pt.po

+78-78
Large diffs are not rendered by default.

po/pt_BR.po

+140-140
Large diffs are not rendered by default.

po/ro.po

+65-65
Large diffs are not rendered by default.

po/ru.po

+140-140
Large diffs are not rendered by default.

po/sk.po

+114-114
Large diffs are not rendered by default.

po/sl.po

+139-139
Large diffs are not rendered by default.

po/sq.po

+65-65
Large diffs are not rendered by default.

po/sr.po

+110-110
Large diffs are not rendered by default.

po/[email protected]

+65-65
Large diffs are not rendered by default.

po/sv.po

+140-140
Large diffs are not rendered by default.

po/ta.po

+65-65
Large diffs are not rendered by default.

po/te.po

+65-65
Large diffs are not rendered by default.

po/th.po

+65-65
Large diffs are not rendered by default.

po/tr.po

+114-114
Large diffs are not rendered by default.

po/uk.po

+139-139
Large diffs are not rendered by default.

po/vi.po

+65-65
Large diffs are not rendered by default.

po/wa.po

+65-65
Large diffs are not rendered by default.

po/zh_CN.po

+111-111
Large diffs are not rendered by default.

po/zh_HK.po

+65-65
Large diffs are not rendered by default.

po/zh_TW.po

+110-110
Large diffs are not rendered by default.

src/udisksdaemonutil.c

+15-2
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,9 @@ check_authorization_no_polkit (UDisksDaemon *daemon,
716716
* can be used in @message but note that not all variables can be used
717717
* in all checks. For example, any check involving a #UDisksDrive or a
718718
* #UDisksBlock object can safely include the fragment
719-
* <quote>$(drive)</quote> since it will always expand to the name of
720-
* the drive, e.g. <quote>INTEL SSDSA2MH080G1GC (/dev/sda1)</quote> or
719+
* <quote>$(device.name)</quote> since it will always expand to the name of
720+
* the partition or drive, e.g. <quote>MyUDisks (/dev/sda1)</quote> or
721+
* <quote>INTEL SSDSA2MH080G1GC (/dev/sda1)</quote> or
721722
* the block device file e.g. <quote>/dev/vg_lucifer/lv_root</quote>
722723
* or <quote>/dev/sda1</quote>. However this won't work for operations
723724
* that isn't on a drive or block device, for example calls on the
@@ -774,6 +775,8 @@ udisks_daemon_util_check_authorization_sync_with_error (UDisksDaemon *
774775
gboolean auth_no_user_interaction = FALSE;
775776
const gchar *details_device = NULL;
776777
gchar *details_drive = NULL;
778+
gchar *device_name = NULL;
779+
const gchar *id_label = NULL;
777780

778781
authority = udisks_daemon_get_authority (daemon);
779782
if (authority == NULL)
@@ -890,6 +893,10 @@ udisks_daemon_util_check_authorization_sync_with_error (UDisksDaemon *
890893
_safe_polkit_details_insert (details, "id.version", udisks_block_get_id_version (block));
891894
_safe_polkit_details_insert (details, "id.label", udisks_block_get_id_label (block));
892895
_safe_polkit_details_insert (details, "id.uuid", udisks_block_get_id_uuid (block));
896+
897+
id_label = udisks_block_get_id_label (block);
898+
if (id_label != NULL)
899+
device_name = g_strdup_printf ("%s (%s)", id_label, udisks_block_get_preferred_device (block));
893900
}
894901

895902
if (partition != NULL)
@@ -910,6 +917,11 @@ udisks_daemon_util_check_authorization_sync_with_error (UDisksDaemon *
910917
if (details_drive != NULL)
911918
polkit_details_insert (details, "drive", details_drive);
912919

920+
if (device_name == NULL && details_drive != NULL)
921+
device_name = g_strdup (details_drive);
922+
if (device_name != NULL)
923+
polkit_details_insert (details, "device.name", device_name);
924+
913925
sub_error = NULL;
914926
result = polkit_authority_check_authorization_sync (authority,
915927
subject,
@@ -962,6 +974,7 @@ udisks_daemon_util_check_authorization_sync_with_error (UDisksDaemon *
962974

963975
out:
964976
g_free (details_drive);
977+
g_free (device_name);
965978
g_clear_object (&block_object);
966979
g_clear_object (&drive_object);
967980
g_clear_object (&block);

src/udiskslinuxblock.c

+14-14
Original file line numberDiff line numberDiff line change
@@ -2907,10 +2907,10 @@ format_check_auth (UDisksDaemon *daemon,
29072907
* requests erasing a hard disk using the SECURE ERASE UNIT
29082908
* command.
29092909
*
2910-
* Do not translate $(drive), it's a placeholder and
2910+
* Do not translate $(device.name), it's a placeholder and
29112911
* will be replaced by the name of the drive/device in question
29122912
*/
2913-
message = N_("Authentication is required to perform a secure erase of $(drive)");
2913+
message = N_("Authentication is required to perform a secure erase of $(device.name)");
29142914
action_id = "org.freedesktop.udisks2.ata-secure-erase";
29152915
}
29162916
else
@@ -2919,10 +2919,10 @@ format_check_auth (UDisksDaemon *daemon,
29192919
* device. This includes both creating a filesystem or partition
29202920
* table.
29212921
*
2922-
* Do not translate $(drive), it's a placeholder and will
2922+
* Do not translate $(device.name), it's a placeholder and will
29232923
* be replaced by the name of the drive/device in question
29242924
*/
2925-
message = N_("Authentication is required to format $(drive)");
2925+
message = N_("Authentication is required to format $(device.name)");
29262926
action_id = format_extra_args ? "org.freedesktop.udisks2.modify-device-system" :
29272927
"org.freedesktop.udisks2.modify-device";
29282928
if (!udisks_daemon_util_setup_by_user (daemon, object, caller_uid))
@@ -3913,10 +3913,10 @@ handle_open_for_backup (UDisksBlock *block,
39133913
/* Translators: Shown in authentication dialog when creating a
39143914
* disk image file.
39153915
*
3916-
* Do not translate $(drive), it's a placeholder and will
3916+
* Do not translate $(device.name), it's a placeholder and will
39173917
* be replaced by the name of the drive/device in question
39183918
*/
3919-
N_("Authentication is required to open $(drive) for reading"),
3919+
N_("Authentication is required to open $(device.name) for reading"),
39203920
invocation))
39213921
goto out;
39223922

@@ -3984,10 +3984,10 @@ handle_open_for_restore (UDisksBlock *block,
39843984
/* Translators: Shown in authentication dialog when restoring
39853985
* from a disk image file.
39863986
*
3987-
* Do not translate $(drive), it's a placeholder and will
3987+
* Do not translate $(device.name), it's a placeholder and will
39883988
* be replaced by the name of the drive/device in question
39893989
*/
3990-
N_("Authentication is required to open $(drive) for writing"),
3990+
N_("Authentication is required to open $(device.name) for writing"),
39913991
invocation))
39923992
goto out;
39933993

@@ -4058,10 +4058,10 @@ handle_open_for_benchmark (UDisksBlock *block,
40584058
/* Translators: Shown in authentication dialog when an application
40594059
* wants to benchmark a device.
40604060
*
4061-
* Do not translate $(drive), it's a placeholder and will
4061+
* Do not translate $(device.name), it's a placeholder and will
40624062
* be replaced by the name of the drive/device in question
40634063
*/
4064-
N_("Authentication is required to open $(drive) for benchmarking"),
4064+
N_("Authentication is required to open $(device.name) for benchmarking"),
40654065
invocation))
40664066
goto out;
40674067

@@ -4141,10 +4141,10 @@ handle_open_device (UDisksBlock *block,
41414141
/* Translators: Shown in authentication dialog when an application
41424142
* wants to benchmark a device.
41434143
*
4144-
* Do not translate $(drive), it's a placeholder and will
4144+
* Do not translate $(device.name), it's a placeholder and will
41454145
* be replaced by the name of the drive/device in question
41464146
*/
4147-
N_("Authentication is required to open $(drive)."),
4147+
N_("Authentication is required to open $(device.name)."),
41484148
invocation))
41494149
goto out;
41504150

@@ -4198,10 +4198,10 @@ handle_rescan (UDisksBlock *block,
41984198
/* Translators: Shown in authentication dialog when an application
41994199
* wants to rescan a device.
42004200
*
4201-
* Do not translate $(drive), it's a placeholder and will
4201+
* Do not translate $(device.name), it's a placeholder and will
42024202
* be replaced by the name of the drive/device in question
42034203
*/
4204-
message = N_("Authentication is required to rescan $(drive)");
4204+
message = N_("Authentication is required to rescan $(device.name)");
42054205
action_id = "org.freedesktop.udisks2.rescan";
42064206

42074207
if (!udisks_daemon_util_check_authorization_sync (daemon,

src/udiskslinuxdrive.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -1114,10 +1114,10 @@ handle_eject (UDisksDrive *_drive,
11141114
/* Translators: Shown in authentication dialog when the user
11151115
* requests ejecting media from a drive.
11161116
*
1117-
* Do not translate $(drive), it's a placeholder and
1117+
* Do not translate $(device.name), it's a placeholder and
11181118
* will be replaced by the name of the drive/device in question
11191119
*/
1120-
message = N_("Authentication is required to eject $(drive)");
1120+
message = N_("Authentication is required to eject $(device.name)");
11211121
action_id = "org.freedesktop.udisks2.eject-media";
11221122
if (udisks_block_get_hint_system (block))
11231123
{
@@ -1203,10 +1203,10 @@ handle_set_configuration (UDisksDrive *_drive,
12031203
/* Translators: Shown in authentication dialog when the user
12041204
* changes settings for a drive.
12051205
*
1206-
* Do not translate $(drive), it's a placeholder and will be
1206+
* Do not translate $(device.name), it's a placeholder and will be
12071207
* replaced by the name of the drive/device in question
12081208
*/
1209-
message = N_("Authentication is required to configure settings for $(drive)");
1209+
message = N_("Authentication is required to configure settings for $(device.name)");
12101210
action_id = "org.freedesktop.udisks2.modify-drive-settings";
12111211

12121212
/* Check that the user is actually authorized */
@@ -1518,10 +1518,10 @@ handle_power_off (UDisksDrive *_drive,
15181518
/* Translators: Shown in authentication dialog when the user
15191519
* requests ejecting media from a drive.
15201520
*
1521-
* Do not translate $(drive), it's a placeholder and
1521+
* Do not translate $(device.name), it's a placeholder and
15221522
* will be replaced by the name of the drive/device in question
15231523
*/
1524-
message = N_("Authentication is required to power off $(drive)");
1524+
message = N_("Authentication is required to power off $(device.name)");
15251525
action_id = "org.freedesktop.udisks2.power-off-drive";
15261526
if (udisks_block_get_hint_system (block))
15271527
{

src/udiskslinuxdriveata.c

+19-19
Original file line numberDiff line numberDiff line change
@@ -752,21 +752,21 @@ handle_smart_update (UDisksDriveAta *_drive,
752752
/* Translators: Shown in authentication dialog when the user
753753
* refreshes SMART data from a disk.
754754
*
755-
* Do not translate $(drive), it's a placeholder and
755+
* Do not translate $(device.name), it's a placeholder and
756756
* will be replaced by the name of the drive/device in question
757757
*/
758-
message = N_("Authentication is required to update SMART data from $(drive)");
758+
message = N_("Authentication is required to update SMART data from $(device.name)");
759759
action_id = "org.freedesktop.udisks2.ata-smart-update";
760760

761761
if (atasmart_blob != NULL)
762762
{
763763
/* Translators: Shown in authentication dialog when the user
764764
* tries to simulate SMART data from a libatasmart blob.
765765
*
766-
* Do not translate $(drive), it's a placeholder and
766+
* Do not translate $(device.name), it's a placeholder and
767767
* will be replaced by the name of the drive/device in question
768768
*/
769-
message = N_("Authentication is required to set SMART data from a blob on $(drive)");
769+
message = N_("Authentication is required to set SMART data from a blob on $(device.name)");
770770
action_id = "org.freedesktop.udisks2.ata-smart-simulate";
771771
}
772772
else
@@ -920,10 +920,10 @@ handle_smart_selftest_abort (UDisksDriveAta *_drive,
920920
/* Translators: Shown in authentication dialog when the user
921921
* aborts a running SMART self-test.
922922
*
923-
* Do not translate $(drive), it's a placeholder and
923+
* Do not translate $(device.name), it's a placeholder and
924924
* will be replaced by the name of the drive/device in question
925925
*/
926-
N_("Authentication is required to abort a SMART self-test on $(drive)"),
926+
N_("Authentication is required to abort a SMART self-test on $(device.name)"),
927927
invocation))
928928
goto out;
929929

@@ -1168,10 +1168,10 @@ handle_smart_selftest_start (UDisksDriveAta *_drive,
11681168
/* Translators: Shown in authentication dialog when the user
11691169
* initiates a SMART self-test.
11701170
*
1171-
* Do not translate $(drive), it's a placeholder and
1171+
* Do not translate $(device.name), it's a placeholder and
11721172
* will be replaced by the name of the drive/device in question
11731173
*/
1174-
N_("Authentication is required to start a SMART self-test on $(drive)"),
1174+
N_("Authentication is required to start a SMART self-test on $(device.name)"),
11751175
invocation))
11761176
goto out;
11771177

@@ -1264,20 +1264,20 @@ handle_smart_set_enabled (UDisksDriveAta *_drive,
12641264
/* Translators: Shown in authentication dialog when the user
12651265
* requests enabling SMART on a disk.
12661266
*
1267-
* Do not translate $(drive), it's a placeholder and
1267+
* Do not translate $(device.name), it's a placeholder and
12681268
* will be replaced by the name of the drive/device in question
12691269
*/
1270-
message = N_("Authentication is required to enable SMART on $(drive)");
1270+
message = N_("Authentication is required to enable SMART on $(device.name)");
12711271
}
12721272
else
12731273
{
12741274
/* Translators: Shown in authentication dialog when the user
12751275
* requests enabling SMART on a disk.
12761276
*
1277-
* Do not translate $(drive), it's a placeholder and
1277+
* Do not translate $(device.name), it's a placeholder and
12781278
* will be replaced by the name of the drive/device in question
12791279
*/
1280-
message = N_("Authentication is required to disable SMART on $(drive)");
1280+
message = N_("Authentication is required to disable SMART on $(device.name)");
12811281
}
12821282
action_id = "org.freedesktop.udisks2.ata-smart-enable-disable";
12831283

@@ -1497,10 +1497,10 @@ handle_pm_get_state (UDisksDriveAta *_drive,
14971497
/* Translators: Shown in authentication dialog when the user
14981498
* requests the power state of a drive.
14991499
*
1500-
* Do not translate $(drive), it's a placeholder and
1500+
* Do not translate $(device.name), it's a placeholder and
15011501
* will be replaced by the name of the drive/device in question
15021502
*/
1503-
message = N_("Authentication is required to check power state for $(drive)");
1503+
message = N_("Authentication is required to check power state for $(device.name)");
15041504
action_id = "org.freedesktop.udisks2.ata-check-power";
15051505

15061506
/* TODO: maybe not check with polkit if this is OK (consider gnome-disks(1) polling all drives every few seconds) */
@@ -1593,11 +1593,11 @@ handle_pm_standby_wakeup (UDisksDriveAta *_drive,
15931593
* tries to wake up a drive from standby mode or tries to put a drive into
15941594
* standby mode.
15951595
*
1596-
* Do not translate $(drive), it's a placeholder and
1596+
* Do not translate $(device.name), it's a placeholder and
15971597
* will be replaced by the name of the drive/device in question
15981598
*/
1599-
message = (do_wakeup) ? N_("Authentication is required to wake up $(drive) from standby mode") :
1600-
N_("Authentication is required to put $(drive) in standby mode");
1599+
message = (do_wakeup) ? N_("Authentication is required to wake up $(device.name) from standby mode") :
1600+
N_("Authentication is required to put $(device.name) in standby mode");
16011601
action_id = "org.freedesktop.udisks2.ata-standby";
16021602
if (udisks_block_get_hint_system (block))
16031603
{
@@ -2454,10 +2454,10 @@ handle_security_erase_unit (UDisksDriveAta *_drive,
24542454
/* Translators: Shown in authentication dialog when the user
24552455
* requests erasing a hard disk using the SECURE ERASE UNIT command.
24562456
*
2457-
* Do not translate $(drive), it's a placeholder and
2457+
* Do not translate $(device.name), it's a placeholder and
24582458
* will be replaced by the name of the drive/device in question
24592459
*/
2460-
message = N_("Authentication is required to perform a secure erase of $(drive)");
2460+
message = N_("Authentication is required to perform a secure erase of $(device.name)");
24612461
action_id = "org.freedesktop.udisks2.ata-secure-erase";
24622462

24632463
/* Check that the user is authorized */

0 commit comments

Comments
 (0)