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 #ifndef __FINGERPRINT_STRINGS_H__
24 #define __FINGERPRINT_STRINGS_H__
25
26 struct {
27 const char *dbus_name;
28 const char *place_str;
29 const char *swipe_str;
30 } fingers[11] = {
31 { "left-thumb", N_("Place your left thumb on %s"), N_("Swipe your left thumb on %s") },
32 { "left-index-finger", N_("Place your left index finger on %s"), N_("Swipe your left index finger on %s") },
33 { "left-middle-finger", N_("Place your left middle finger on %s"), N_("Swipe your left middle finger on %s") },
34 { "left-ring-finger", N_("Place your left ring finger on %s"), N_("Swipe your left ring finger on %s") },
35 { "left-little-finger", N_("Place your left little finger on %s"), N_("Swipe your left little finger on %s") },
36 { "right-thumb", N_("Place your right thumb on %s"), N_("Swipe your right thumb on %s") },
37 { "right-index-finger", N_("Place your right index finger on %s"), N_("Swipe your right index finger on %s") },
38 { "right-middle-finger", N_("Place your right middle finger on %s"), N_("Swipe your right middle finger on %s") },
39 { "right-ring-finger", N_("Place your right ring finger on %s"), N_("Swipe your right ring finger on %s") },
40 { "right-little-finger", N_("Place your right little finger on %s"), N_("Swipe your right little finger on %s") },
41 { NULL, NULL, NULL }
42 };
43
finger_str_to_msg(const char * finger_name,gboolean is_swipe)44 static const char *finger_str_to_msg(const char *finger_name, gboolean is_swipe)
45 {
46 int i;
47
48 if (finger_name == NULL)
49 return NULL;
50
51 for (i = 0; fingers[i].dbus_name != NULL; i++) {
52 if (g_str_equal (fingers[i].dbus_name, finger_name)) {
53 if (is_swipe == FALSE)
54 return fingers[i].place_str;
55 else
56 return fingers[i].swipe_str;
57 }
58 }
59
60 return NULL;
61 }
62
63 /* Cases not handled:
64 * enroll-completed
65 * enroll-failed
66 * enroll-unknown-error
67 */
enroll_result_str_to_msg(const char * result,gboolean is_swipe)68 static const char *enroll_result_str_to_msg(const char *result, gboolean is_swipe)
69 {
70 if (result == NULL)
71 return NULL;
72
73 if (strcmp (result, "enroll-retry-scan") == 0 || strcmp (result, "enroll-stage-passed") == 0) {
74 if (is_swipe == FALSE)
75 return N_("Place your finger on the reader again");
76 else
77 return N_("Swipe your finger again");
78 }
79 if (strcmp (result, "enroll-swipe-too-short") == 0)
80 return N_("Swipe was too short, try again");
81 if (strcmp (result, "enroll-finger-not-centered") == 0)
82 return N_("Your finger was not centered, try swiping your finger again");
83 if (strcmp (result, "enroll-remove-and-retry") == 0)
84 return N_("Remove your finger, and try swiping your finger again");
85
86 return NULL;
87 }
88
89 #endif /* __FINGERPRINT_STRINGS_H__ */
90