Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
* Helper functions to translate statuses and actions to strings |
3 |
|
|
* Copyright (C) 2008 Bastien Nocera <hadess@hadess.net> |
4 |
|
|
* |
5 |
|
|
* Experimental code. This will be moved out of fprintd into it's own |
6 |
|
|
* package once the system has matured. |
7 |
|
|
* |
8 |
|
|
* This program is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License as published by |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
11 |
|
|
* (at your option) any later version. |
12 |
|
|
* |
13 |
|
|
* This program is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU General Public License along |
19 |
|
|
* with this program; if not, write to the Free Software Foundation, Inc., |
20 |
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
#pragma once |
24 |
|
|
|
25 |
|
|
struct { |
26 |
|
|
const char *dbus_name; |
27 |
|
|
const char *place_str_generic; |
28 |
|
|
const char *place_str_specific; |
29 |
|
|
const char *swipe_str_generic; |
30 |
|
|
const char *swipe_str_specific; |
31 |
|
|
} fingers[] = { |
32 |
|
|
{ "any", |
33 |
|
|
N_("Place your finger on the fingerprint reader"), |
34 |
|
|
N_("Place your finger on %s"), |
35 |
|
|
N_("Swipe your finger across the fingerprint reader"), |
36 |
|
|
N_("Swipe your finger across %s") }, |
37 |
|
|
{ "left-thumb", |
38 |
|
|
N_("Place your left thumb on the fingerprint reader"), |
39 |
|
|
N_("Place your left thumb on %s"), |
40 |
|
|
N_("Swipe your left thumb across the fingerprint reader"), |
41 |
|
|
N_("Swipe your left thumb across %s") }, |
42 |
|
|
{ "left-index-finger", |
43 |
|
|
N_("Place your left index finger on the fingerprint reader"), |
44 |
|
|
N_("Place your left index finger on %s"), |
45 |
|
|
N_("Swipe your left index finger across the fingerprint reader"), |
46 |
|
|
N_("Swipe your left index finger across %s") }, |
47 |
|
|
{ "left-middle-finger", |
48 |
|
|
N_("Place your left middle finger on the fingerprint reader"), |
49 |
|
|
N_("Place your left middle finger on %s"), |
50 |
|
|
N_("Swipe your left middle finger across the fingerprint reader"), |
51 |
|
|
N_("Swipe your left middle finger across %s") }, |
52 |
|
|
{ "left-ring-finger", |
53 |
|
|
N_("Place your left ring finger on the fingerprint reader"), |
54 |
|
|
N_("Place your left ring finger on %s"), |
55 |
|
|
N_("Swipe your left ring finger across the fingerprint reader"), |
56 |
|
|
N_("Swipe your left ring finger across %s") }, |
57 |
|
|
{ "left-little-finger", |
58 |
|
|
N_("Place your left little finger on the fingerprint reader"), |
59 |
|
|
N_("Place your left little finger on %s"), |
60 |
|
|
N_("Swipe your left little finger across the fingerprint reader"), |
61 |
|
|
N_("Swipe your left little finger across %s") }, |
62 |
|
|
{ "right-thumb", |
63 |
|
|
N_("Place your right thumb on the fingerprint reader"), |
64 |
|
|
N_("Place your right thumb on %s"), |
65 |
|
|
N_("Swipe your right thumb across the fingerprint reader"), |
66 |
|
|
N_("Swipe your right thumb across %s") }, |
67 |
|
|
{ "right-index-finger", |
68 |
|
|
N_("Place your right index finger on the fingerprint reader"), |
69 |
|
|
N_("Place your right index finger on %s"), |
70 |
|
|
N_("Swipe your right index finger across the fingerprint reader"), |
71 |
|
|
N_("Swipe your right index finger across %s") }, |
72 |
|
|
{ "right-middle-finger", |
73 |
|
|
N_("Place your right middle finger on the fingerprint reader"), |
74 |
|
|
N_("Place your right middle finger on %s"), |
75 |
|
|
N_("Swipe your right middle finger across the fingerprint reader"), |
76 |
|
|
N_("Swipe your right middle finger across %s") }, |
77 |
|
|
{ "right-ring-finger", |
78 |
|
|
N_("Place your right ring finger on the fingerprint reader"), |
79 |
|
|
N_("Place your right ring finger on %s"), |
80 |
|
|
N_("Swipe your right ring finger across the fingerprint reader"), |
81 |
|
|
N_("Swipe your right ring finger across %s") }, |
82 |
|
|
{ "right-little-finger", |
83 |
|
|
N_("Place your right little finger on the fingerprint reader"), |
84 |
|
|
N_("Place your right little finger on %s"), |
85 |
|
|
N_("Swipe your right little finger across the fingerprint reader"), |
86 |
|
|
N_("Swipe your right little finger across %s") }, |
87 |
|
|
{ NULL, NULL, NULL, NULL, NULL } |
88 |
|
|
}; |
89 |
|
|
|
90 |
|
|
#pragma GCC diagnostic push |
91 |
|
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral" |
92 |
|
|
|
93 |
|
✗ |
G_GNUC_UNUSED static char *finger_str_to_msg(const char *finger_name, const char *driver_name, gboolean is_swipe) |
94 |
|
|
{ |
95 |
|
|
int i; |
96 |
|
|
|
97 |
|
✗ |
if (finger_name == NULL) |
98 |
|
✗ |
return NULL; |
99 |
|
|
|
100 |
|
✗ |
for (i = 0; fingers[i].dbus_name != NULL; i++) { |
101 |
|
✗ |
if (g_str_equal (fingers[i].dbus_name, finger_name)) { |
102 |
|
✗ |
if (is_swipe == FALSE) { |
103 |
|
✗ |
if (driver_name) |
104 |
|
✗ |
return g_strdup_printf (TR (fingers[i].place_str_specific), driver_name); |
105 |
|
|
else |
106 |
|
✗ |
return g_strdup (TR (fingers[i].place_str_generic)); |
107 |
|
|
} else { |
108 |
|
✗ |
if (driver_name) |
109 |
|
✗ |
return g_strdup_printf (TR (fingers[i].swipe_str_specific), driver_name); |
110 |
|
|
else |
111 |
|
✗ |
return g_strdup (TR (fingers[i].swipe_str_generic)); |
112 |
|
|
} |
113 |
|
|
} |
114 |
|
|
} |
115 |
|
|
|
116 |
|
✗ |
return NULL; |
117 |
|
|
} |
118 |
|
|
|
119 |
|
|
#pragma GCC diagnostic pop |
120 |
|
|
|
121 |
|
|
/* Cases not handled: |
122 |
|
|
* verify-no-match |
123 |
|
|
* verify-match |
124 |
|
|
* verify-unknown-error |
125 |
|
|
*/ |
126 |
|
✗ |
G_GNUC_UNUSED static const char *verify_result_str_to_msg(const char *result, gboolean is_swipe) |
127 |
|
|
{ |
128 |
|
✗ |
if (result == NULL) |
129 |
|
✗ |
return NULL; |
130 |
|
|
|
131 |
|
✗ |
if (strcmp (result, "verify-retry-scan") == 0) { |
132 |
|
✗ |
if (is_swipe == FALSE) |
133 |
|
✗ |
return TR (N_("Place your finger on the reader again")); |
134 |
|
|
else |
135 |
|
✗ |
return TR (N_("Swipe your finger again")); |
136 |
|
|
} |
137 |
|
✗ |
if (strcmp (result, "verify-swipe-too-short") == 0) |
138 |
|
✗ |
return TR (N_("Swipe was too short, try again")); |
139 |
|
✗ |
if (strcmp (result, "verify-finger-not-centered") == 0) |
140 |
|
✗ |
return TR (N_("Your finger was not centered, try swiping your finger again")); |
141 |
|
✗ |
if (strcmp (result, "verify-remove-and-retry") == 0) |
142 |
|
✗ |
return TR (N_("Remove your finger, and try swiping your finger again")); |
143 |
|
|
|
144 |
|
✗ |
return NULL; |
145 |
|
|
} |
146 |
|
|
|
147 |
|
|
/* Cases not handled: |
148 |
|
|
* enroll-completed |
149 |
|
|
* enroll-failed |
150 |
|
|
* enroll-unknown-error |
151 |
|
|
*/ |
152 |
|
✗ |
G_GNUC_UNUSED static const char *enroll_result_str_to_msg(const char *result, gboolean is_swipe) |
153 |
|
|
{ |
154 |
|
✗ |
if (result == NULL) |
155 |
|
✗ |
return NULL; |
156 |
|
|
|
157 |
|
✗ |
if (strcmp (result, "enroll-retry-scan") == 0 || strcmp (result, "enroll-stage-passed") == 0) { |
158 |
|
✗ |
if (is_swipe == FALSE) |
159 |
|
✗ |
return TR (N_("Place your finger on the reader again")); |
160 |
|
|
else |
161 |
|
✗ |
return TR (N_("Swipe your finger again")); |
162 |
|
|
} |
163 |
|
✗ |
if (strcmp (result, "enroll-swipe-too-short") == 0) |
164 |
|
✗ |
return TR (N_("Swipe was too short, try again")); |
165 |
|
✗ |
if (strcmp (result, "enroll-finger-not-centered") == 0) |
166 |
|
✗ |
return TR (N_("Your finger was not centered, try swiping your finger again")); |
167 |
|
✗ |
if (strcmp (result, "enroll-remove-and-retry") == 0) |
168 |
|
✗ |
return TR (N_("Remove your finger, and try swiping your finger again")); |
169 |
|
|
|
170 |
|
✗ |
return NULL; |
171 |
|
|
} |
172 |
|
|
|
173 |
|
|
|