Blame pam/fingerprint-strings.h

Packit Service f1aff6
/*
Packit Service f1aff6
 * Helper functions to translate statuses and actions to strings
Packit Service f1aff6
 * Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
Packit Service f1aff6
 * 
Packit Service f1aff6
 * Experimental code. This will be moved out of fprintd into it's own
Packit Service f1aff6
 * package once the system has matured.
Packit Service f1aff6
 *
Packit Service f1aff6
 * This program is free software; you can redistribute it and/or modify
Packit Service f1aff6
 * it under the terms of the GNU General Public License as published by
Packit Service f1aff6
 * the Free Software Foundation; either version 2 of the License, or
Packit Service f1aff6
 * (at your option) any later version.
Packit Service f1aff6
 * 
Packit Service f1aff6
 * This program is distributed in the hope that it will be useful,
Packit Service f1aff6
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service f1aff6
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service f1aff6
 * GNU General Public License for more details.
Packit Service f1aff6
 * 
Packit Service f1aff6
 * You should have received a copy of the GNU General Public License along
Packit Service f1aff6
 * with this program; if not, write to the Free Software Foundation, Inc.,
Packit Service f1aff6
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Packit Service f1aff6
 */
Packit Service f1aff6
Packit Service f1aff6
struct {
Packit Service f1aff6
	const char *dbus_name;
Packit Service f1aff6
	const char *place_str_generic;
Packit Service f1aff6
	const char *place_str_specific;
Packit Service f1aff6
	const char *swipe_str_generic;
Packit Service f1aff6
	const char *swipe_str_specific;
Packit Service f1aff6
} fingers[] = {
Packit Service f1aff6
	{ "any",
Packit Service f1aff6
	  N_("Place your finger on the fingerprint reader"),
Packit Service f1aff6
	  N_("Place your finger on %s"),
Packit Service f1aff6
	  N_("Swipe your finger across the fingerprint reader"),
Packit Service f1aff6
	  N_("Swipe your finger across %s") },
Packit Service f1aff6
	{ "left-thumb",
Packit Service f1aff6
	  N_("Place your left thumb on the fingerprint reader"),
Packit Service f1aff6
	  N_("Place your left thumb on %s"),
Packit Service f1aff6
	  N_("Swipe your left thumb across the fingerprint reader"),
Packit Service f1aff6
	  N_("Swipe your left thumb across %s") },
Packit Service f1aff6
	{ "left-index-finger",
Packit Service f1aff6
	  N_("Place your left index finger on the fingerprint reader"),
Packit Service f1aff6
	  N_("Place your left index finger on %s"),
Packit Service f1aff6
	  N_("Swipe your left index finger across the fingerprint reader"),
Packit Service f1aff6
	  N_("Swipe your left index finger across %s") },
Packit Service f1aff6
	{ "left-middle-finger",
Packit Service f1aff6
	  N_("Place your left middle finger on the fingerprint reader"),
Packit Service f1aff6
	  N_("Place your left middle finger on %s"),
Packit Service f1aff6
	  N_("Swipe your left middle finger across the fingerprint reader"),
Packit Service f1aff6
	  N_("Swipe your left middle finger across %s") },
Packit Service f1aff6
	{ "left-ring-finger",
Packit Service f1aff6
	  N_("Place your left ring finger on the fingerprint reader"),
Packit Service f1aff6
	  N_("Place your left ring finger on %s"),
Packit Service f1aff6
	  N_("Swipe your left ring finger across the fingerprint reader"),
Packit Service f1aff6
	  N_("Swipe your left ring finger across %s") },
Packit Service f1aff6
	{ "left-little-finger",
Packit Service f1aff6
	  N_("Place your left little finger on the fingerprint reader"),
Packit Service f1aff6
	  N_("Place your left little finger on %s"),
Packit Service f1aff6
	  N_("Swipe your left little finger across the fingerprint reader"),
Packit Service f1aff6
	  N_("Swipe your left little finger across %s") },
Packit Service f1aff6
	{ "right-thumb",
Packit Service f1aff6
	  N_("Place your right thumb on the fingerprint reader"),
Packit Service f1aff6
	  N_("Place your right thumb on %s"),
Packit Service f1aff6
	  N_("Swipe your right thumb across the fingerprint reader"),
Packit Service f1aff6
	  N_("Swipe your right thumb across %s") },
Packit Service f1aff6
	{ "right-index-finger",
Packit Service f1aff6
	  N_("Place your right index finger on the fingerprint reader"),
Packit Service f1aff6
	  N_("Place your right index finger on %s"),
Packit Service f1aff6
	  N_("Swipe your right index finger across the fingerprint reader"),
Packit Service f1aff6
	  N_("Swipe your right index finger across %s") },
Packit Service f1aff6
	{ "right-middle-finger",
Packit Service f1aff6
	  N_("Place your right middle finger on the fingerprint reader"),
Packit Service f1aff6
	  N_("Place your right middle finger on %s"),
Packit Service f1aff6
	  N_("Swipe your right middle finger across the fingerprint reader"),
Packit Service f1aff6
	  N_("Swipe your right middle finger across %s") },
Packit Service f1aff6
	{ "right-ring-finger",
Packit Service f1aff6
	  N_("Place your right ring finger on the fingerprint reader"),
Packit Service f1aff6
	  N_("Place your right ring finger on %s"),
Packit Service f1aff6
	  N_("Swipe your right ring finger across the fingerprint reader"),
Packit Service f1aff6
	  N_("Swipe your right ring finger across %s") },
Packit Service f1aff6
	{ "right-little-finger",
Packit Service f1aff6
	  N_("Place your right little finger on the fingerprint reader"),
Packit Service f1aff6
	  N_("Place your right little finger on %s"),
Packit Service f1aff6
	  N_("Swipe your right little finger across the fingerprint reader"),
Packit Service f1aff6
	  N_("Swipe your right little finger across %s") },
Packit Service f1aff6
	{ NULL, NULL, NULL, NULL, NULL }
Packit Service f1aff6
};
Packit Service f1aff6
Packit Service f1aff6
#pragma GCC diagnostic push
Packit Service f1aff6
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
Packit Service f1aff6
Packit Service f1aff6
G_GNUC_UNUSED static char *finger_str_to_msg(const char *finger_name, const char *driver_name, gboolean is_swipe)
Packit Service f1aff6
{
Packit Service f1aff6
	int i;
Packit Service f1aff6
Packit Service f1aff6
	if (finger_name == NULL)
Packit Service f1aff6
		return NULL;
Packit Service f1aff6
Packit Service f1aff6
	for (i = 0; fingers[i].dbus_name != NULL; i++) {
Packit Service f1aff6
		if (g_str_equal (fingers[i].dbus_name, finger_name)) {
Packit Service f1aff6
			if (is_swipe == FALSE) {
Packit Service f1aff6
				if (driver_name)
Packit Service f1aff6
					return g_strdup_printf (TR (fingers[i].place_str_specific), driver_name);
Packit Service f1aff6
				else
Packit Service f1aff6
					return g_strdup (TR (fingers[i].place_str_generic));
Packit Service f1aff6
			} else {
Packit Service f1aff6
				if (driver_name)
Packit Service f1aff6
					return g_strdup_printf (TR (fingers[i].swipe_str_specific), driver_name);
Packit Service f1aff6
				else
Packit Service f1aff6
					return g_strdup (TR (fingers[i].swipe_str_generic));
Packit Service f1aff6
			}
Packit Service f1aff6
		}
Packit Service f1aff6
	}
Packit Service f1aff6
Packit Service f1aff6
	return NULL;
Packit Service f1aff6
}
Packit Service f1aff6
Packit Service f1aff6
#pragma GCC diagnostic pop
Packit Service f1aff6
Packit Service f1aff6
/* Cases not handled:
Packit Service f1aff6
 * verify-no-match
Packit Service f1aff6
 * verify-match
Packit Service f1aff6
 * verify-unknown-error
Packit Service f1aff6
 */
Packit Service f1aff6
G_GNUC_UNUSED static const char *verify_result_str_to_msg(const char *result, gboolean is_swipe)
Packit Service f1aff6
{
Packit Service f1aff6
	if (result == NULL)
Packit Service f1aff6
		return NULL;
Packit Service f1aff6
Packit Service f1aff6
	if (strcmp (result, "verify-retry-scan") == 0) {
Packit Service f1aff6
		if (is_swipe == FALSE)
Packit Service f1aff6
			return N_("Place your finger on the reader again");
Packit Service f1aff6
		else
Packit Service f1aff6
			return N_("Swipe your finger again");
Packit Service f1aff6
	}
Packit Service f1aff6
	if (strcmp (result, "verify-swipe-too-short") == 0)
Packit Service f1aff6
		return N_("Swipe was too short, try again");
Packit Service f1aff6
	if (strcmp (result, "verify-finger-not-centered") == 0)
Packit Service f1aff6
		return N_("Your finger was not centered, try swiping your finger again");
Packit Service f1aff6
	if (strcmp (result, "verify-remove-and-retry") == 0)
Packit Service f1aff6
		return N_("Remove your finger, and try swiping your finger again");
Packit Service f1aff6
Packit Service f1aff6
	return NULL;
Packit Service f1aff6
}
Packit Service f1aff6
Packit Service f1aff6
/* Cases not handled:
Packit Service f1aff6
 * enroll-completed
Packit Service f1aff6
 * enroll-failed
Packit Service f1aff6
 * enroll-unknown-error
Packit Service f1aff6
 */
Packit Service f1aff6
G_GNUC_UNUSED static const char *enroll_result_str_to_msg(const char *result, gboolean is_swipe)
Packit Service f1aff6
{
Packit Service f1aff6
	if (result == NULL)
Packit Service f1aff6
		return NULL;
Packit Service f1aff6
Packit Service f1aff6
	if (strcmp (result, "enroll-retry-scan") == 0 || strcmp (result, "enroll-stage-passed") == 0) {
Packit Service f1aff6
		if (is_swipe == FALSE)
Packit Service f1aff6
			return N_("Place your finger on the reader again");
Packit Service f1aff6
		else
Packit Service f1aff6
			return N_("Swipe your finger again");
Packit Service f1aff6
	}
Packit Service f1aff6
	if (strcmp (result, "enroll-swipe-too-short") == 0)
Packit Service f1aff6
		return N_("Swipe was too short, try again");
Packit Service f1aff6
	if (strcmp (result, "enroll-finger-not-centered") == 0)
Packit Service f1aff6
		return N_("Your finger was not centered, try swiping your finger again");
Packit Service f1aff6
	if (strcmp (result, "enroll-remove-and-retry") == 0)
Packit Service f1aff6
		return N_("Remove your finger, and try swiping your finger again");
Packit Service f1aff6
Packit Service f1aff6
	return NULL;
Packit Service f1aff6
}
Packit Service f1aff6