~ubuntu-branches/ubuntu/trusty/unity-control-center/trusty

« back to all changes in this revision

Viewing changes to panels/user-accounts/fingerprint-strings.h

  • Committer: Package Import Robot
  • Author(s): Robert Ancell
  • Date: 2014-01-08 16:29:18 UTC
  • Revision ID: package-import@ubuntu.com-20140108162918-g29dd08tr913y2qh
Tags: upstream-14.04.0
ImportĀ upstreamĀ versionĀ 14.04.0

Show diffs side-by-side

added added

removed removed

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