Optionally check for PolicyKit
2008-11-27 Bastien Nocera <hadess@hadess.net> * configure.in: Optionally check for PolicyKit 2008-11-27 Bastien Nocera <hadess@hadess.net> * Makefile.am: * fingerprint-strings.h: * fprintd-marshal.list: * gnome-about-me-fingerprint.c: * gnome-about-me-fingerprint.glade: * gnome-about-me-fingerprint.h: * gnome-about-me.c (create_fingerprint_button), (about_me_load_info), (about_me_fingerprint_button_clicked_cb), (about_me_setup_dialog), (main): * gnome-about-me.glade: Add support for enrolling fingerprints using the fprintd D-Bus service (Closes: #561881) 2008-11-27 Bastien Nocera <hadess@hadess.net> * POTFILES.in: Add new files from the fingerprint enrollment support svn path=/trunk/; revision=9153
This commit is contained in:
parent
3b04b8642c
commit
b83b10d8b1
13 changed files with 1206 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
|||
2008-11-27 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* configure.in: Optionally check for PolicyKit
|
||||
|
||||
2008-11-23 Jens Granseuer <jensgr@gmx.net>
|
||||
|
||||
Patch by: <dmacks@netspace.org>
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
2008-11-27 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* Makefile.am:
|
||||
* fingerprint-strings.h:
|
||||
* fprintd-marshal.list:
|
||||
* gnome-about-me-fingerprint.c:
|
||||
* gnome-about-me-fingerprint.glade:
|
||||
* gnome-about-me-fingerprint.h:
|
||||
* gnome-about-me.c (create_fingerprint_button),
|
||||
(about_me_load_info), (about_me_fingerprint_button_clicked_cb),
|
||||
(about_me_setup_dialog), (main):
|
||||
* gnome-about-me.glade: Add support for enrolling fingerprints
|
||||
using the fprintd D-Bus service (Closes: #561881)
|
||||
|
||||
==================== 2.25.1 ====================
|
||||
|
||||
Fri Oct 24 19:33:12 2008 Søren Sandmann <sandmann@redhat.com>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This is used in GNOMECC_CAPPLETS_CFLAGS
|
||||
cappletname = about-me
|
||||
|
||||
glade_files = gnome-about-me.glade
|
||||
glade_files = gnome-about-me.glade gnome-about-me-fingerprint.glade
|
||||
Desktop_in_files = gnome-about-me.desktop.in
|
||||
|
||||
pixmap_files = \
|
||||
|
@ -16,6 +16,10 @@ gnome_about_me_SOURCES = \
|
|||
gnome-about-me-password.h \
|
||||
e-image-chooser.c \
|
||||
e-image-chooser.h \
|
||||
gnome-about-me-fingerprint.c \
|
||||
gnome-about-me-fingerprint.h \
|
||||
$(MARSHALFILES) \
|
||||
fingerprint-strings.h \
|
||||
gnome-about-me.c
|
||||
|
||||
if BUILD_ABOUTME
|
||||
|
@ -24,7 +28,7 @@ bin_PROGRAMS = gnome-about-me
|
|||
pixmapdir = $(pkgdatadir)/pixmaps
|
||||
pixmap_DATA = $(pixmap_files)
|
||||
|
||||
gnome_about_me_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(LIBEBOOK_LIBS)
|
||||
gnome_about_me_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(LIBEBOOK_LIBS) $(POLKIT_GNOME_LIBS)
|
||||
gnome_about_me_LDFLAGS = -export-dynamic
|
||||
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
@ -38,13 +42,23 @@ glade_DATA = $(glade_files)
|
|||
INCLUDES = \
|
||||
$(GNOMECC_CAPPLETS_CFLAGS) \
|
||||
$(LIBEBOOK_CFLAGS) \
|
||||
$(POLKIT_GNOME_CFLAGS) \
|
||||
-DDATADIR="\"$(datadir)\"" \
|
||||
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
|
||||
-DGNOMECC_GLADE_DIR="\"$(gladedir)\"" \
|
||||
-DGNOMECC_PIXMAP_DIR="\"$(pixmapdir)\"" \
|
||||
-DGNOMELOCALEDIR="\"$(datadir)/locale\""
|
||||
|
||||
MARSHALFILES = marshal.c marshal.h
|
||||
BUILT_SOURCES = $(MARSHALFILES)
|
||||
|
||||
marshal.h: $(srcdir)/fprintd-marshal.list
|
||||
( $(GLIB_GENMARSHAL) --prefix=fprintd_marshal $(srcdir)/fprintd-marshal.list --header > marshal.h )
|
||||
marshal.c: marshal.h
|
||||
( $(GLIB_GENMARSHAL) --prefix=fprintd_marshal $(srcdir)/fprintd-marshal.list --body --header > marshal.c )
|
||||
|
||||
|
||||
endif # BUILD_ABOUTME
|
||||
|
||||
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(desktop_DATA)
|
||||
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(desktop_DATA) $(MARSHALFILES)
|
||||
EXTRA_DIST = $(glade_files) $(pixmap_files)
|
||||
|
|
111
capplets/about-me/fingerprint-strings.h
Normal file
111
capplets/about-me/fingerprint-strings.h
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* Helper functions to translate statuses and actions to strings
|
||||
* Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
|
||||
*
|
||||
* Experimental code. This will be moved out of fprintd into it's own
|
||||
* package once the system has matured.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
struct {
|
||||
const char *dbus_name;
|
||||
const char *place_str;
|
||||
const char *swipe_str;
|
||||
} fingers[11] = {
|
||||
{ "left-thumb", N_("Place your left thumb on %s"), N_("Swipe your left thumb on %s") },
|
||||
{ "left-index-finger", N_("Place your left index finger on %s"), N_("Swipe your left index finger on %s") },
|
||||
{ "left-middle-finger", N_("Place your left middle finger on %s"), N_("Swipe your left middle finger on %s") },
|
||||
{ "left-ring-finger", N_("Place your left ring finger on %s"), N_("Swipe your left ring finger on %s") },
|
||||
{ "left-little-finger", N_("Place your left little finger on %s"), N_("Swipe your left little finger on %s") },
|
||||
{ "right-thumb", N_("Place your right thumb on %s"), N_("Swipe your right thumb on %s") },
|
||||
{ "right-index-finger", N_("Place your right index finger on %s"), N_("Swipe your right index finger on %s") },
|
||||
{ "right-middle-finger", N_("Place your right middle finger on %s"), N_("Swipe your right middle finger on %s") },
|
||||
{ "right-ring-finger", N_("Place your right ring finger on %s"), N_("Swipe your right ring finger on %s") },
|
||||
{ "right-little-finger", N_("Place your right little finger on %s"), N_("Swipe your right little finger on %s") },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static const char *finger_str_to_msg(const char *finger_name, gboolean is_swipe)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (finger_name == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; fingers[i].dbus_name != NULL; i++) {
|
||||
if (g_str_equal (fingers[i].dbus_name, finger_name)) {
|
||||
if (is_swipe == FALSE)
|
||||
return fingers[i].place_str;
|
||||
else
|
||||
return fingers[i].swipe_str;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Cases not handled:
|
||||
* verify-no-match
|
||||
* verify-match
|
||||
* verify-unknown-error
|
||||
*/
|
||||
static const char *verify_result_str_to_msg(const char *result, gboolean is_swipe)
|
||||
{
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
|
||||
if (strcmp (result, "verify-retry-scan") == 0) {
|
||||
if (is_swipe == FALSE)
|
||||
return N_("Place your finger on the reader again");
|
||||
else
|
||||
return N_("Swipe your finger again");
|
||||
}
|
||||
if (strcmp (result, "verify-swipe-too-short") == 0)
|
||||
return N_("Swipe was too short, try again");
|
||||
if (strcmp (result, "verify-finger-not-centered") == 0)
|
||||
return N_("Your finger was not centered, try swiping your finger again");
|
||||
if (strcmp (result, "verify-remove-and-retry") == 0)
|
||||
return N_("Remove your finger, and try swiping your finger again");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Cases not handled:
|
||||
* enroll-completed
|
||||
* enroll-failed
|
||||
* enroll-unknown-error
|
||||
*/
|
||||
static const char *enroll_result_str_to_msg(const char *result, gboolean is_swipe)
|
||||
{
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
|
||||
if (strcmp (result, "enroll-retry-scan") == 0 || strcmp (result, "enroll-stage-passed") == 0) {
|
||||
if (is_swipe == FALSE)
|
||||
return N_("Place your finger on the reader again");
|
||||
else
|
||||
return N_("Swipe your finger again");
|
||||
}
|
||||
if (strcmp (result, "enroll-swipe-too-short") == 0)
|
||||
return N_("Swipe was too short, try again");
|
||||
if (strcmp (result, "enroll-finger-not-centered") == 0)
|
||||
return N_("Your finger was not centered, try swiping your finger again");
|
||||
if (strcmp (result, "enroll-remove-and-retry") == 0)
|
||||
return N_("Remove your finger, and try swiping your finger again");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
1
capplets/about-me/fprintd-marshal.list
Normal file
1
capplets/about-me/fprintd-marshal.list
Normal file
|
@ -0,0 +1 @@
|
|||
VOID:STRING,BOOLEAN
|
579
capplets/about-me/gnome-about-me-fingerprint.c
Normal file
579
capplets/about-me/gnome-about-me-fingerprint.c
Normal file
|
@ -0,0 +1,579 @@
|
|||
/* gnome-about-me-fingerprint.h
|
||||
* Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glade/glade.h>
|
||||
#include <dbus/dbus-glib-bindings.h>
|
||||
|
||||
#include "fingerprint-strings.h"
|
||||
#include "capplet-util.h"
|
||||
|
||||
static DBusGProxy *manager = NULL;
|
||||
static DBusGConnection *connection = NULL;
|
||||
static gboolean is_disable = FALSE;
|
||||
|
||||
enum {
|
||||
STATE_NONE,
|
||||
STATE_CLAIMED,
|
||||
STATE_ENROLLING
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GtkWidget *enable;
|
||||
GtkWidget *disable;
|
||||
|
||||
GtkWidget *ass;
|
||||
GladeXML *dialog_page1;
|
||||
GladeXML *dialog_page2;
|
||||
|
||||
DBusGProxy *device;
|
||||
gboolean is_swipe;
|
||||
char *name;
|
||||
const char *finger;
|
||||
gint state;
|
||||
} EnrollData;
|
||||
|
||||
static void create_manager (void)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
|
||||
if (connection == NULL) {
|
||||
g_warning ("Failed to connect to session bus: %s", error->message);
|
||||
return;
|
||||
}
|
||||
|
||||
manager = dbus_g_proxy_new_for_name (connection,
|
||||
"net.reactivated.Fprint",
|
||||
"/net/reactivated/Fprint/Manager",
|
||||
"net.reactivated.Fprint.Manager");
|
||||
}
|
||||
|
||||
static DBusGProxy *
|
||||
get_first_device (void)
|
||||
{
|
||||
DBusGProxy *device;
|
||||
char *device_str;
|
||||
|
||||
if (!dbus_g_proxy_call (manager, "GetDefaultDevice", NULL, G_TYPE_INVALID,
|
||||
DBUS_TYPE_G_OBJECT_PATH, &device_str, G_TYPE_INVALID)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
device = dbus_g_proxy_new_for_name(connection,
|
||||
"net.reactivated.Fprint",
|
||||
device_str,
|
||||
"net.reactivated.Fprint.Device");
|
||||
|
||||
g_free (device_str);
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_reason_for_error (const char *dbus_error)
|
||||
{
|
||||
if (g_str_equal (dbus_error, "net.reactivated.Fprint.Error.PermissionDenied"))
|
||||
return N_("You are not allowed to access the device. Contact your system administrator.");
|
||||
if (g_str_equal (dbus_error, "net.reactivated.Fprint.Error.AlreadyInUse"))
|
||||
return N_("The device is already in use.");
|
||||
if (g_str_equal (dbus_error, "net.reactivated.Fprint.Error.Internal"))
|
||||
return N_("An internal error occured");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
get_error_dialog (const char *title,
|
||||
const char *dbus_error,
|
||||
GtkWindow *parent)
|
||||
{
|
||||
GtkWidget *error_dialog;
|
||||
const char *reason;
|
||||
|
||||
if (dbus_error == NULL)
|
||||
g_warning ("get_error_dialog called with reason == NULL");
|
||||
|
||||
error_dialog =
|
||||
gtk_message_dialog_new (parent,
|
||||
GTK_DIALOG_MODAL,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
"%s", title);
|
||||
reason = get_reason_for_error (dbus_error);
|
||||
gtk_message_dialog_format_secondary_text
|
||||
(GTK_MESSAGE_DIALOG (error_dialog), "%s", reason ? _(reason) : _(dbus_error));
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
|
||||
GTK_RESPONSE_OK);
|
||||
gtk_window_set_modal (GTK_WINDOW (error_dialog), TRUE);
|
||||
gtk_window_set_position (GTK_WINDOW (error_dialog), GTK_WIN_POS_CENTER_ON_PARENT);
|
||||
|
||||
return error_dialog;
|
||||
}
|
||||
|
||||
void
|
||||
set_fingerprint_label (GtkWidget *enable, GtkWidget *disable)
|
||||
{
|
||||
char **fingers;
|
||||
DBusGProxy *device;
|
||||
GError *error = NULL;
|
||||
|
||||
gtk_widget_set_no_show_all (enable, TRUE);
|
||||
gtk_widget_set_no_show_all (disable, TRUE);
|
||||
|
||||
if (manager == NULL) {
|
||||
create_manager ();
|
||||
if (manager == NULL) {
|
||||
gtk_widget_hide (enable);
|
||||
gtk_widget_hide (disable);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
device = get_first_device ();
|
||||
if (device == NULL) {
|
||||
gtk_widget_hide (enable);
|
||||
gtk_widget_hide (disable);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dbus_g_proxy_call (device, "ListEnrolledFingers", &error, G_TYPE_STRING, "", G_TYPE_INVALID,
|
||||
G_TYPE_STRV, &fingers, G_TYPE_INVALID)) {
|
||||
if (dbus_g_error_has_name (error, "net.reactivated.Fprint.Error.NoEnrolledPrints") == FALSE) {
|
||||
gtk_widget_hide (enable);
|
||||
gtk_widget_hide (disable);
|
||||
g_object_unref (device);
|
||||
return;
|
||||
}
|
||||
fingers = NULL;
|
||||
}
|
||||
|
||||
if (fingers == NULL || g_strv_length (fingers) == 0) {
|
||||
gtk_widget_hide (disable);
|
||||
gtk_widget_show (enable);
|
||||
is_disable = FALSE;
|
||||
} else {
|
||||
gtk_widget_hide (enable);
|
||||
gtk_widget_show (disable);
|
||||
is_disable = TRUE;
|
||||
}
|
||||
|
||||
g_strfreev (fingers);
|
||||
g_object_unref (device);
|
||||
}
|
||||
|
||||
static void
|
||||
delete_fingerprints (void)
|
||||
{
|
||||
DBusGProxy *device;
|
||||
|
||||
if (manager == NULL) {
|
||||
create_manager ();
|
||||
if (manager == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
device = get_first_device ();
|
||||
if (device == NULL)
|
||||
return;
|
||||
|
||||
dbus_g_proxy_call (device, "DeleteEnrolledFingers", NULL, G_TYPE_STRING, "", G_TYPE_INVALID, G_TYPE_INVALID);
|
||||
|
||||
g_object_unref (device);
|
||||
}
|
||||
|
||||
static void
|
||||
delete_fingerprints_question (GladeXML *dialog, GtkWidget *enable, GtkWidget *disable)
|
||||
{
|
||||
GtkWidget *question;
|
||||
GtkWidget *button;
|
||||
|
||||
question = gtk_message_dialog_new (GTK_WINDOW (WID ("about-me-dialog")),
|
||||
GTK_DIALOG_MODAL,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_NONE,
|
||||
_("Delete registered fingerprints?"));
|
||||
gtk_dialog_add_button (GTK_DIALOG (question), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
||||
|
||||
button = gtk_button_new_with_mnemonic (_("_Delete Fingerprints"));
|
||||
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show (button);
|
||||
gtk_dialog_add_action_widget (GTK_DIALOG (question), button, GTK_RESPONSE_OK);
|
||||
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (question),
|
||||
_("Do you want to delete your registered fingerprints so fingerprint login is disabled?"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (question), 5);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (question), GTK_RESPONSE_OK);
|
||||
gtk_window_set_position (GTK_WINDOW (question), GTK_WIN_POS_CENTER_ON_PARENT);
|
||||
gtk_window_set_modal (GTK_WINDOW (question), TRUE);
|
||||
|
||||
if (gtk_dialog_run (GTK_DIALOG (question)) == GTK_RESPONSE_OK) {
|
||||
delete_fingerprints ();
|
||||
set_fingerprint_label (enable, disable);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (question);
|
||||
}
|
||||
|
||||
static void
|
||||
enroll_data_destroy (EnrollData *data)
|
||||
{
|
||||
switch (data->state) {
|
||||
case STATE_ENROLLING:
|
||||
dbus_g_proxy_call(data->device, "EnrollStop", NULL, G_TYPE_INVALID, G_TYPE_INVALID);
|
||||
/* fall-through */
|
||||
case STATE_CLAIMED:
|
||||
dbus_g_proxy_call(data->device, "Release", NULL, G_TYPE_INVALID, G_TYPE_INVALID);
|
||||
/* fall-through */
|
||||
case STATE_NONE:
|
||||
g_free (data->name);
|
||||
g_object_unref (data->device);
|
||||
g_object_unref (data->dialog_page1);
|
||||
g_object_unref (data->dialog_page2);
|
||||
gtk_widget_destroy (data->ass);
|
||||
|
||||
g_free (data);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
selected_finger (GladeXML *dialog)
|
||||
{
|
||||
int index;
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("radiobutton1")))) {
|
||||
gtk_widget_set_sensitive (WID ("finger_combobox"), FALSE);
|
||||
return "right-index-finger";
|
||||
}
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("radiobutton2")))) {
|
||||
gtk_widget_set_sensitive (WID ("finger_combobox"), FALSE);
|
||||
return "left-index-finger";
|
||||
}
|
||||
gtk_widget_set_sensitive (WID ("finger_combobox"), TRUE);
|
||||
index = gtk_combo_box_get_active (GTK_COMBO_BOX (WID ("finger_combobox")));
|
||||
switch (index) {
|
||||
case 0:
|
||||
return "left-thumb";
|
||||
case 1:
|
||||
return "left-middle-finger";
|
||||
case 2:
|
||||
return "left-ring-finger";
|
||||
case 3:
|
||||
return "left-little-finger";
|
||||
case 4:
|
||||
return "right-thumb";
|
||||
case 5:
|
||||
return "right-middle-finger";
|
||||
case 6:
|
||||
return "right-ring-finger";
|
||||
case 7:
|
||||
return "right-little-finger";
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
finger_radio_button_toggled (GtkToggleButton *button, EnrollData *data)
|
||||
{
|
||||
data->finger = selected_finger (data->dialog_page1);
|
||||
}
|
||||
|
||||
static void
|
||||
finger_combobox_changed (GtkComboBox *combobox, EnrollData *data)
|
||||
{
|
||||
data->finger = selected_finger (data->dialog_page2);
|
||||
}
|
||||
|
||||
static void
|
||||
assistant_cancelled (GtkAssistant *ass, EnrollData *data)
|
||||
{
|
||||
GtkWidget *enable, *disable;
|
||||
|
||||
enable = data->enable;
|
||||
disable = data->disable;
|
||||
|
||||
enroll_data_destroy (data);
|
||||
set_fingerprint_label (enable, disable);
|
||||
}
|
||||
|
||||
static void
|
||||
enroll_result (GObject *object, const char *result, gboolean done, EnrollData *data)
|
||||
{
|
||||
GladeXML *dialog = data->dialog_page2;
|
||||
char *msg;
|
||||
|
||||
if (done != FALSE) {
|
||||
if (g_str_equal (result, "enroll-completed")) {
|
||||
gtk_image_set_from_stock (GTK_IMAGE (WID ("image1")), GTK_STOCK_YES, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (data->ass), WID ("page2"), TRUE);
|
||||
}
|
||||
dbus_g_proxy_call(data->device, "EnrollStop", NULL, G_TYPE_INVALID, G_TYPE_INVALID);
|
||||
data->state = STATE_CLAIMED;
|
||||
if (g_str_equal (result, "enroll-completed") == FALSE) {
|
||||
/* The enrollment failed, restart it */
|
||||
dbus_g_proxy_call(data->device, "EnrollStart", NULL, G_TYPE_STRING, data->finger, G_TYPE_INVALID, G_TYPE_INVALID);
|
||||
data->state = STATE_ENROLLING;
|
||||
result = "enroll-retry-scan";
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
msg = g_strdup_printf (enroll_result_str_to_msg (result, data->is_swipe), data->name);
|
||||
gtk_label_set_text (GTK_LABEL (WID ("status-label")), msg);
|
||||
g_free (msg);
|
||||
}
|
||||
|
||||
static void
|
||||
assistant_prepare (GtkAssistant *ass, GtkWidget *page, EnrollData *data)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
name = g_object_get_data (G_OBJECT (page), "name");
|
||||
if (name == NULL)
|
||||
return;
|
||||
|
||||
if (g_str_equal (name, "enroll")) {
|
||||
DBusGProxy *p;
|
||||
GError *error = NULL;
|
||||
int num_enroll_stages;
|
||||
GValue value = { 0, };
|
||||
|
||||
if (!dbus_g_proxy_call (data->device, "Claim", &error, G_TYPE_STRING, "", G_TYPE_INVALID, G_TYPE_INVALID)) {
|
||||
GtkWidget *d;
|
||||
char *msg;
|
||||
|
||||
/* translators:
|
||||
* The variable is the name of the device, for example:
|
||||
* "Could you not access "Digital Persona U.are.U 4000/4000B" device */
|
||||
msg = g_strdup_printf (_("Could not access '%s' device"), data->name);
|
||||
d = get_error_dialog (msg, dbus_g_error_get_name (error), GTK_WINDOW (data->ass));
|
||||
g_error_free (error);
|
||||
gtk_dialog_run (GTK_DIALOG (d));
|
||||
gtk_widget_destroy (d);
|
||||
g_free (msg);
|
||||
|
||||
enroll_data_destroy (data);
|
||||
|
||||
return;
|
||||
}
|
||||
data->state = STATE_CLAIMED;
|
||||
|
||||
p = dbus_g_proxy_new_from_proxy (data->device, "org.freedesktop.DBus.Properties", NULL);
|
||||
if (!dbus_g_proxy_call (p, "Get", NULL, G_TYPE_STRING, "net.reactivated.Fprint.Device", G_TYPE_STRING, "num-enroll-stages", G_TYPE_INVALID,
|
||||
G_TYPE_VALUE, &value, G_TYPE_INVALID) || g_value_get_int (&value) < 1) {
|
||||
GtkWidget *d;
|
||||
char *msg;
|
||||
|
||||
/* translators:
|
||||
* The variable is the name of the device, for example:
|
||||
* "Could you not access "Digital Persona U.are.U 4000/4000B" device */
|
||||
msg = g_strdup_printf (_("Could not access '%s' device"), data->name);
|
||||
d = get_error_dialog (msg, "net.reactivated.Fprint.Error.Internal", GTK_WINDOW (data->ass));
|
||||
gtk_dialog_run (GTK_DIALOG (d));
|
||||
gtk_widget_destroy (d);
|
||||
g_free (msg);
|
||||
|
||||
enroll_data_destroy (data);
|
||||
|
||||
g_object_unref (p);
|
||||
return;
|
||||
}
|
||||
g_object_unref (p);
|
||||
num_enroll_stages = g_value_get_int (&value);
|
||||
|
||||
/* FIXME handle num_enroll_stages != 1 */
|
||||
|
||||
dbus_g_proxy_add_signal(data->device, "EnrollStatus", G_TYPE_STRING, G_TYPE_BOOLEAN, NULL);
|
||||
dbus_g_proxy_connect_signal(data->device, "EnrollStatus", G_CALLBACK(enroll_result), data, NULL);
|
||||
|
||||
if (!dbus_g_proxy_call(data->device, "EnrollStart", &error, G_TYPE_STRING, data->finger, G_TYPE_INVALID, G_TYPE_INVALID)) {
|
||||
GtkWidget *d;
|
||||
char *msg;
|
||||
|
||||
/* translators:
|
||||
* The variable is the name of the device, for example:
|
||||
* "Could you not access "Digital Persona U.are.U 4000/4000B" device */
|
||||
msg = g_strdup_printf (_("Could not start finger capture on '%s' device"), data->name);
|
||||
d = get_error_dialog (msg, dbus_g_error_get_name (error), GTK_WINDOW (data->ass));
|
||||
g_error_free (error);
|
||||
gtk_dialog_run (GTK_DIALOG (d));
|
||||
gtk_widget_destroy (d);
|
||||
g_free (msg);
|
||||
|
||||
enroll_data_destroy (data);
|
||||
|
||||
return;
|
||||
}
|
||||
data->state = STATE_ENROLLING;;
|
||||
} else {
|
||||
if (data->state == STATE_ENROLLING) {
|
||||
dbus_g_proxy_call(data->device, "EnrollStop", NULL, G_TYPE_INVALID, G_TYPE_INVALID);
|
||||
data->state = STATE_CLAIMED;
|
||||
}
|
||||
if (data->state == STATE_CLAIMED) {
|
||||
dbus_g_proxy_call(data->device, "Release", NULL, G_TYPE_INVALID, G_TYPE_INVALID);
|
||||
data->state = STATE_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
enroll_fingerprints (GtkWindow *parent, GtkWidget *enable, GtkWidget *disable)
|
||||
{
|
||||
DBusGProxy *device, *p;
|
||||
GHashTable *props;
|
||||
GladeXML *dialog;
|
||||
EnrollData *data;
|
||||
GtkWidget *ass;
|
||||
char *msg;
|
||||
|
||||
device = NULL;
|
||||
|
||||
if (manager == NULL) {
|
||||
create_manager ();
|
||||
if (manager != NULL)
|
||||
device = get_first_device ();
|
||||
} else {
|
||||
device = get_first_device ();
|
||||
}
|
||||
|
||||
if (manager == NULL || device == NULL) {
|
||||
GtkWidget *d;
|
||||
|
||||
d = get_error_dialog (_("Could not access any fingerprint readers"),
|
||||
_("Please contact your system administrator for help."),
|
||||
parent);
|
||||
gtk_dialog_run (GTK_DIALOG (d));
|
||||
gtk_widget_destroy (d);
|
||||
return;
|
||||
}
|
||||
|
||||
data = g_new0 (EnrollData, 1);
|
||||
data->device = device;
|
||||
data->enable = enable;
|
||||
data->disable = disable;
|
||||
|
||||
/* Get some details about the device */
|
||||
p = dbus_g_proxy_new_from_proxy (device, "org.freedesktop.DBus.Properties", NULL);
|
||||
if (dbus_g_proxy_call (p, "GetAll", NULL, G_TYPE_STRING, "net.reactivated.Fprint.Device", G_TYPE_INVALID,
|
||||
dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &props, G_TYPE_INVALID)) {
|
||||
const char *scan_type;
|
||||
data->name = g_value_dup_string (g_hash_table_lookup (props, "name"));
|
||||
scan_type = g_value_dup_string (g_hash_table_lookup (props, "scan-type"));
|
||||
if (g_str_equal (scan_type, "swipe"))
|
||||
data->is_swipe = TRUE;
|
||||
g_hash_table_destroy (props);
|
||||
}
|
||||
g_object_unref (p);
|
||||
|
||||
ass = gtk_assistant_new ();
|
||||
gtk_window_set_transient_for (GTK_WINDOW (ass), parent);
|
||||
gtk_window_set_position (GTK_WINDOW (ass), GTK_WIN_POS_CENTER_ON_PARENT);
|
||||
g_signal_connect (G_OBJECT (ass), "cancel",
|
||||
G_CALLBACK (assistant_cancelled), data);
|
||||
g_signal_connect (G_OBJECT (ass), "close",
|
||||
G_CALLBACK (assistant_cancelled), data);
|
||||
g_signal_connect (G_OBJECT (ass), "prepare",
|
||||
G_CALLBACK (assistant_prepare), data);
|
||||
|
||||
/* Page 1 */
|
||||
dialog = glade_xml_new (GNOMECC_GLADE_DIR "/gnome-about-me-fingerprint.glade",
|
||||
"page1", NULL);
|
||||
data->dialog_page1 = dialog;
|
||||
|
||||
gtk_assistant_append_page (GTK_ASSISTANT (ass), WID("page1"));
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT (ass), WID("page1"), _("Select finger"));
|
||||
gtk_assistant_set_page_type (GTK_ASSISTANT (ass), WID("page1"), GTK_ASSISTANT_PAGE_CONTENT);
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (WID ("finger_combobox")), 0);
|
||||
|
||||
g_signal_connect (G_OBJECT (WID ("radiobutton1")), "toggled",
|
||||
G_CALLBACK (finger_radio_button_toggled), data);
|
||||
g_signal_connect (G_OBJECT (WID ("radiobutton2")), "toggled",
|
||||
G_CALLBACK (finger_radio_button_toggled), data);
|
||||
g_signal_connect (G_OBJECT (WID ("radiobutton3")), "toggled",
|
||||
G_CALLBACK (finger_radio_button_toggled), data);
|
||||
g_signal_connect (G_OBJECT (WID ("finger_combobox")), "changed",
|
||||
G_CALLBACK (finger_combobox_changed), data);
|
||||
|
||||
data->finger = selected_finger (dialog);
|
||||
|
||||
g_object_set_data (G_OBJECT (WID("page1")), "name", "intro");
|
||||
|
||||
/* translators:
|
||||
* The variable is the name of the device, for example:
|
||||
* "To enable fingerprint login, you need to save one of your fingerprints, using the
|
||||
* 'Digital Persona U.are.U 4000/4000B' device." */
|
||||
msg = g_strdup_printf (_("To enable fingerprint login, you need to save one of your fingerprints, using the '%s' device."),
|
||||
data->name);
|
||||
gtk_label_set_text (GTK_LABEL (WID("intro-label")), msg);
|
||||
g_free (msg);
|
||||
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (ass), WID("page1"), TRUE);
|
||||
|
||||
/* Page 2 */
|
||||
dialog = glade_xml_new (GNOMECC_GLADE_DIR "/gnome-about-me-fingerprint.glade",
|
||||
"page2", NULL);
|
||||
data->dialog_page2 = dialog;
|
||||
gtk_assistant_append_page (GTK_ASSISTANT (ass), WID("page2"));
|
||||
if (data->is_swipe != FALSE)
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT (ass), WID("page2"), _("Swipe finger on reader"));
|
||||
else
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT (ass), WID("page2"), _("Place finger on reader"));
|
||||
gtk_assistant_set_page_type (GTK_ASSISTANT (ass), WID("page2"), GTK_ASSISTANT_PAGE_CONTENT);
|
||||
|
||||
g_object_set_data (G_OBJECT (WID("page2")), "name", "enroll");
|
||||
|
||||
msg = g_strdup_printf (finger_str_to_msg (data->finger, data->is_swipe), data->name);
|
||||
gtk_label_set_text (GTK_LABEL (WID("enroll-label")), msg);
|
||||
g_free (msg);
|
||||
|
||||
/* Page 3 */
|
||||
dialog = glade_xml_new (GNOMECC_GLADE_DIR "/gnome-about-me-fingerprint.glade",
|
||||
"page3", NULL);
|
||||
gtk_assistant_append_page (GTK_ASSISTANT (ass), WID("page3"));
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT (ass), WID("page3"), _("Done!"));
|
||||
gtk_assistant_set_page_type (GTK_ASSISTANT (ass), WID("page3"), GTK_ASSISTANT_PAGE_SUMMARY);
|
||||
|
||||
g_object_set_data (G_OBJECT (WID("page3")), "name", "summary");
|
||||
|
||||
data->ass = ass;
|
||||
gtk_widget_show_all (ass);
|
||||
}
|
||||
|
||||
void
|
||||
fingerprint_button_clicked (GladeXML *dialog,
|
||||
GtkWidget *enable,
|
||||
GtkWidget *disable)
|
||||
{
|
||||
if (is_disable != FALSE) {
|
||||
delete_fingerprints_question (dialog, enable, disable);
|
||||
} else {
|
||||
enroll_fingerprints (GTK_WINDOW (WID ("about-me-dialog")), enable, disable);
|
||||
}
|
||||
}
|
||||
|
344
capplets/about-me/gnome-about-me-fingerprint.glade
Normal file
344
capplets/about-me/gnome-about-me-fingerprint.glade
Normal file
|
@ -0,0 +1,344 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkWindow" id="window1">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">window1</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="page1">
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">12</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox74">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-info</property>
|
||||
<property name="icon_size">6</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="intro-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">To enable fingerprint login, you need to save one of your fingerprints, using the Acme Foobar 5000.</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox70">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radiobutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Right index finger</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radiobutton2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Left index finger</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox77">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radiobutton3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Other finger: </property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="finger_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="items" translatable="yes">Left thumb
|
||||
Left middle finger
|
||||
Left ring finger
|
||||
Left little finger
|
||||
Right thumb
|
||||
Right middle finger
|
||||
Right ring finger
|
||||
Right little finger</property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkWindow" id="window2">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">window2</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="page2">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="enroll-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="no">In order to save your fingerprints, you need to swipe your thumb on the "Acme foobar" device.</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="enroll_hbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-no</property>
|
||||
<property name="icon_size">6</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="status-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkWindow" id="window3">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">window3</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="page3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Your fingerprint was successfully saved. You should now be able to log in using your fingerprint reader.</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
27
capplets/about-me/gnome-about-me-fingerprint.h
Normal file
27
capplets/about-me/gnome-about-me-fingerprint.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/* gnome-about-me-fingerprint.h
|
||||
* Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <glade/glade.h>
|
||||
|
||||
void set_fingerprint_label (GtkWidget *enable,
|
||||
GtkWidget *disable);
|
||||
void fingerprint_button_clicked (GladeXML *dialog,
|
||||
GtkWidget *enable,
|
||||
GtkWidget *disable);
|
||||
|
|
@ -32,9 +32,16 @@
|
|||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
#include <libebook/e-book.h>
|
||||
#include <dbus/dbus-glib-bindings.h>
|
||||
|
||||
#ifdef HAVE_POLKIT
|
||||
#include <polkit-gnome/polkit-gnome.h>
|
||||
#endif
|
||||
|
||||
#include "e-image-chooser.h"
|
||||
#include "gnome-about-me-password.h"
|
||||
#include "gnome-about-me-fingerprint.h"
|
||||
#include "marshal.h"
|
||||
|
||||
#include "capplet-util.h"
|
||||
|
||||
|
@ -48,6 +55,8 @@ typedef struct {
|
|||
EBook *book;
|
||||
|
||||
GladeXML *dialog;
|
||||
GtkWidget *enable_fingerprint_button;
|
||||
GtkWidget *disable_fingerprint_button;
|
||||
|
||||
GdkScreen *screen;
|
||||
GtkIconTheme *theme;
|
||||
|
@ -156,6 +165,28 @@ about_me_error (GtkWindow *parent, gchar *str)
|
|||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
#ifdef HAVE_POLKIT
|
||||
static GtkWidget *
|
||||
create_fingerprint_button (const char *msg, const char *name)
|
||||
{
|
||||
GtkWidget *button;
|
||||
PolKitAction *action;
|
||||
PolKitGnomeAction *gaction;
|
||||
|
||||
action = polkit_action_new_from_string_representation ("net.reactivated.fprint.device.enroll");
|
||||
polkit_action_set_action_id (action, name);
|
||||
gaction = polkit_gnome_action_new_default (name,
|
||||
action,
|
||||
msg,
|
||||
NULL);
|
||||
polkit_action_unref (action);
|
||||
|
||||
button = polkit_gnome_action_create_button (gaction);
|
||||
g_object_unref (gaction);
|
||||
|
||||
return button;
|
||||
}
|
||||
#endif /* HAVE_POLKIT */
|
||||
|
||||
/********************/
|
||||
static void
|
||||
|
@ -650,6 +681,9 @@ about_me_load_info (GnomeAboutMe *me)
|
|||
for (i = 0; ids[i].wid != NULL; i++) {
|
||||
about_me_load_string_field (me, ids[i].wid, ids[i].cid, i);
|
||||
}
|
||||
|
||||
set_fingerprint_label (me->enable_fingerprint_button,
|
||||
me->disable_fingerprint_button);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -856,6 +890,14 @@ about_me_passwd_clicked_cb (GtkWidget *button, GnomeAboutMe *me)
|
|||
gnome_about_me_password (GTK_WINDOW (WID ("about-me-dialog")));
|
||||
}
|
||||
|
||||
static void
|
||||
about_me_fingerprint_button_clicked_cb (GtkWidget *button, GnomeAboutMe *me)
|
||||
{
|
||||
fingerprint_button_clicked (me->dialog,
|
||||
me->enable_fingerprint_button,
|
||||
me->disable_fingerprint_button);
|
||||
}
|
||||
|
||||
static gint
|
||||
about_me_setup_dialog (void)
|
||||
{
|
||||
|
@ -989,6 +1031,25 @@ about_me_setup_dialog (void)
|
|||
g_signal_connect (widget, "clicked",
|
||||
G_CALLBACK (about_me_image_clicked_cb), me);
|
||||
|
||||
#ifdef HAVE_POLKIT
|
||||
gtk_widget_destroy (WID ("enable_fingerprint_button"));
|
||||
gtk_widget_destroy (WID ("disable_fingerprint_button"));
|
||||
|
||||
me->enable_fingerprint_button = create_fingerprint_button (_("Enable _Fingerprint Login..."), "enable-action");
|
||||
gtk_container_add (GTK_CONTAINER (WID("buttons_vbox")), me->enable_fingerprint_button);
|
||||
|
||||
me->disable_fingerprint_button = create_fingerprint_button (_("Disable _Fingerprint Login..."), "disable-action");
|
||||
gtk_container_add (GTK_CONTAINER (WID("buttons_vbox")), me->disable_fingerprint_button);
|
||||
#else
|
||||
me->enable_fingerprint_button = WID ("enable_fingerprint_button");
|
||||
me->disable_fingerprint_button = WID ("disable_fingerprint_button");
|
||||
#endif /* HAVE_POLKIT */
|
||||
|
||||
g_signal_connect (me->enable_fingerprint_button, "clicked",
|
||||
G_CALLBACK (about_me_fingerprint_button_clicked_cb), me);
|
||||
g_signal_connect (me->disable_fingerprint_button, "clicked",
|
||||
G_CALLBACK (about_me_fingerprint_button_clicked_cb), me);
|
||||
|
||||
widget = WID ("image-chooser");
|
||||
g_signal_connect (widget, "changed",
|
||||
G_CALLBACK (about_me_image_changed_cb), me);
|
||||
|
@ -1027,6 +1088,8 @@ main (int argc, char **argv)
|
|||
int rc = 0;
|
||||
|
||||
capplet_init (NULL, &argc, &argv);
|
||||
dbus_g_object_register_marshaller (fprintd_marshal_VOID__STRING_BOOLEAN,
|
||||
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
|
||||
|
||||
rc = about_me_setup_dialog ();
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox56">
|
||||
<widget class="GtkVBox" id="buttons_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
@ -216,6 +216,38 @@
|
|||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="enable_fingerprint_button">
|
||||
<property name="visible">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Enable _Fingerprint Login...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="disable_fingerprint_button">
|
||||
<property name="visible">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Disable _Fingerprint Login...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
|
@ -198,6 +198,11 @@ if test "x$enable_aboutme" = "xyes"; then
|
|||
PKG_CHECK_MODULES(LIBEBOOK, [libebook-1.2 >= 1.7.90],
|
||||
[AC_DEFINE([HAVE_LIBEBOOK], 1,
|
||||
[Define if evolution-data-server libebook-1.2 is available])])
|
||||
dnl PolicyKit-gnome is optional
|
||||
PKG_CHECK_MODULES(POLKIT_GNOME, [polkit-gnome],
|
||||
[AC_DEFINE([HAVE_POLKIT], 1,
|
||||
[Define if PolicyKit-gnome is available])],
|
||||
has_polkit=false)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(BUILD_ABOUTME, test "x$enable_aboutme" = "xyes")
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2008-11-27 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* POTFILES.in: Add new files from the fingerprint
|
||||
enrollment support
|
||||
|
||||
2008-11-09 Luca Ferretti <elle.uca@libero.it>
|
||||
|
||||
* it.po: Updated Italian translation from stable branch.
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
[encoding: UTF-8]
|
||||
capplets/about-me/eel-alert-dialog.c
|
||||
capplets/about-me/e-image-chooser.c
|
||||
capplets/about-me/fingerprint-strings.h
|
||||
capplets/about-me/gnome-about-me.c
|
||||
capplets/about-me/gnome-about-me.desktop.in.in
|
||||
capplets/about-me/gnome-about-me-fingerprint.c
|
||||
capplets/about-me/gnome-about-me-fingerprint.glade
|
||||
capplets/about-me/gnome-about-me.glade
|
||||
capplets/about-me/gnome-about-me-password.c
|
||||
capplets/accessibility/at-properties/at-enable-dialog.glade
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue