Skip to content

Commit 752155c

Browse files
authored
Make biometrics optional (#268)
1 parent af82c5c commit 752155c

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
option('biometrics', type : 'boolean', value : false, description : 'Include settings for fingerprint readers etc')

src/Views/UserSettingsView.vala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ namespace SwitchboardPlugUserAccounts.Widgets {
2323

2424
private UserUtils utils;
2525
private DeltaUser delta_user;
26+
#if BIOMETRICS
2627
private FPUtils fp_utils;
27-
28+
#endif
2829
private Gtk.ListStore language_store;
2930
private Gtk.ListStore region_store;
3031

@@ -66,11 +67,13 @@ namespace SwitchboardPlugUserAccounts.Widgets {
6667
construct {
6768
utils = new UserUtils (user, this);
6869
delta_user = new DeltaUser (user);
70+
#if BIOMETRICS
6971
try {
7072
fp_utils = new FPUtils ();
7173
} catch (Error e) {
7274
warning ("Fingerprint reader not available: %s", e.message);
7375
}
76+
#endif
7477

7578
default_regions = get_default_regions ();
7679

@@ -232,6 +235,7 @@ namespace SwitchboardPlugUserAccounts.Widgets {
232235
autologin_box.append (autologin_switch);
233236

234237
Gtk.Box fp_box;
238+
#if BIOMETRICS
235239
if (fp_utils != null) {
236240
fingerprint_button = new Gtk.Button.with_label (_("Set Up Fingerprint…")) {
237241
sensitive = false
@@ -283,6 +287,7 @@ namespace SwitchboardPlugUserAccounts.Widgets {
283287
}
284288
});
285289
}
290+
#endif
286291

287292
password_button = new Gtk.Button.with_label (_("Change Password…"));
288293
password_button.clicked.connect (() => {
@@ -409,21 +414,25 @@ namespace SwitchboardPlugUserAccounts.Widgets {
409414
user_type_dropdown.sensitive = false;
410415
password_button.sensitive = false;
411416
autologin_switch.sensitive = false;
417+
#if BIOMETRICS
412418
if (fp_utils != null) {
413419
remove_fp_button.sensitive = false;
414420
fingerprint_button.sensitive = false;
415421
}
422+
#endif
416423

417424
autologin_label.secondary_text = NO_PERMISSION_STRING;
418425
user_type_label.secondary_text = NO_PERMISSION_STRING;
419426
}
420427

421428
lang_label.secondary_text = null;
422429

430+
#if BIOMETRICS
423431
if (fp_utils != null) {
424432
remove_fp_button.sensitive = current_user && fp_utils.is_enrolled ();
425433
fingerprint_button.sensitive = current_user;
426434
}
435+
#endif
427436

428437
if (current_user || allowed) {
429438
full_name_entry.sensitive = true;

src/meson.build

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ plug_files = files(
88
'Plug.vala',
99
'Dialogs/AvatarDialog.vala',
1010
'Dialogs/ChangePasswordDialog.vala',
11-
'Dialogs/FingerprintDialog.vala',
1211
'Dialogs/NewUserDialog.vala',
1312
'Misc/DeltaUser.vala',
1413
'Misc/UserUtils.vala',
15-
'Misc/FPUtils.vala',
1614
'Misc/Utils.vala',
1715
'Views/GuestSettingsView.vala',
1816
'Views/MainView.vala',
@@ -29,6 +27,16 @@ run_passwd_files = files(
2927
'run-passwd.h'
3028
)
3129

30+
args = []
31+
if get_option('biometrics')
32+
args += '--define=BIOMETRICS'
33+
34+
plug_files += files(
35+
'Dialogs' / 'FingerprintDialog.vala',
36+
'Misc' /' FPUtils.vala'
37+
)
38+
endif
39+
3240
shared_module(
3341
meson.project_name(),
3442
pkgdatadir_declaration,
@@ -51,6 +59,7 @@ shared_module(
5159
posix_dep,
5260
switchboard_dep,
5361
],
62+
vala_args: args,
5463
install: true,
5564
install_dir : join_paths(switchboard_plugsdir, 'system')
5665
)

0 commit comments

Comments
 (0)