[gdm/remotes/origin/wip/multi-stack: 8/9] greeter: Add fingerprint plugin



commit 20a67a6a18fd2fcffed58568b6476db9a05b7913
Author: Ray Strode <rstrode redhat com>
Date:   Fri Feb 6 16:25:47 2009 -0500

    greeter: Add fingerprint plugin
    
    This commit adds a plugin to initiate a conversation for
    fingerprint scans.

 configure.ac                                       |    4 +
 gui/simple-greeter/plugins/Makefile.am             |    2 +-
 gui/simple-greeter/plugins/fingerprint/Makefile.am |   58 +++
 .../plugins/fingerprint/gdm-fingerprint            |   17 +
 .../fingerprint/gdm-fingerprint-extension.c        |  485 ++++++++++++++++++++
 .../fingerprint/gdm-fingerprint-extension.h        |   56 +++
 .../plugins/fingerprint/gdm-fingerprint.pam        |   17 +
 .../plugins/fingerprint/icons/16x16/Makefile.am    |    5 +
 .../fingerprint/icons/16x16/gdm-fingerprint.png    |  Bin 0 -> 461 bytes
 .../plugins/fingerprint/icons/48x48/Makefile.am    |    5 +
 .../fingerprint/icons/48x48/gdm-fingerprint.png    |  Bin 0 -> 1638 bytes
 .../plugins/fingerprint/icons/Makefile.am          |    1 +
 ...play-manager.plugins.fingerprint.gschema.xml.in |    9 +
 gui/simple-greeter/plugins/fingerprint/page.ui     |   57 +++
 po/POTFILES.in                                     |    1 +
 15 files changed, 716 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 958a5b6..4dade85 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1430,6 +1430,10 @@ gui/simple-greeter/libgdmsimplegreeter/Makefile
 gui/simple-greeter/libgdmsimplegreeter/gdmsimplegreeter.pc
 gui/simple-greeter/plugins/Makefile
 gui/simple-greeter/plugins/password/Makefile
+gui/simple-greeter/plugins/fingerprint/Makefile
+gui/simple-greeter/plugins/fingerprint/icons/Makefile
+gui/simple-greeter/plugins/fingerprint/icons/16x16/Makefile
+gui/simple-greeter/plugins/fingerprint/icons/48x48/Makefile
 gui/simple-chooser/Makefile
 utils/Makefile
 data/gdm.conf
diff --git a/gui/simple-greeter/plugins/Makefile.am b/gui/simple-greeter/plugins/Makefile.am
index c0390db..9811a68 100644
--- a/gui/simple-greeter/plugins/Makefile.am
+++ b/gui/simple-greeter/plugins/Makefile.am
@@ -1 +1 @@
-SUBDIRS = password
+SUBDIRS = password fingerprint
diff --git a/gui/simple-greeter/plugins/fingerprint/Makefile.am b/gui/simple-greeter/plugins/fingerprint/Makefile.am
new file mode 100644
index 0000000..1f057a5
--- /dev/null
+++ b/gui/simple-greeter/plugins/fingerprint/Makefile.am
@@ -0,0 +1,58 @@
+SUBDIRS = icons
+
+NULL =
+PAM_SERVICE_NAME = gdm-fingerprint
+
+gsettings_SCHEMAS =org.gnome.display-manager.plugins.fingerprint.gschema.xml
+ INTLTOOL_XML_NOMERGE_RULE@
+ GSETTINGS_RULES@
+
+extensiondir = $(extensionsdatadir)/fingerprint
+extension_DATA = page.ui
+
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/common				\
+	-I$(top_srcdir)/gui/simple-greeter/libgdmsimplegreeter	\
+	-DDMCONFDIR=\""$(dmconfdir)"\"			\
+	-DGDMCONFDIR=\"$(gdmconfdir)\"                  \
+	-DPLUGINDATADIR=\""$(extensiondir)"\"		\
+	-DGDM_FINGERPRINT_EXTENSION_SERVICE_NAME=\""$(PAM_SERVICE_NAME)"\"	\
+	-DSYSCONFDIR=\""$(sysconfdir)"\"		\
+	-DLIBLOCALEDIR=\""$(prefix)/lib/locale"\"	\
+	-DGNOMELOCALEDIR=\""$(datadir)/locale"\" 	\
+	-DLIBEXECDIR=\""$(libexecdir)"\" 		\
+	-DSBINDIR=\""$(sbindir)"\"		 	\
+	$(DISABLE_DEPRECATED_CFLAGS)	\
+	$(GTK_CFLAGS)					\
+	$(SIMPLE_GREETER_CFLAGS)			\
+	$(POLKIT_GNOME_CFLAGS)				\
+	$(NULL)
+
+
+plugindir = $(GDM_SIMPLE_GREETER_PLUGINS_DIR)
+plugin_LTLIBRARIES = libfingerprint.la
+
+libfingerprint_la_CFLAGS =			\
+	$(SIMPLE_GREETER_CFLAGS)	\
+	$(NULL)
+
+libfingerprint_la_LDFLAGS = -module -avoid-version -export-dynamic
+libfingerprint_la_LIBADD = ../../../../common/libgdmcommon.la \
+			../../libgdmsimplegreeter/libgdmsimplegreeter.la
+libfingerprint_la_SOURCES =				\
+			gdm-fingerprint-extension.h	\
+			gdm-fingerprint-extension.c
+
+$(PAM_SERVICE_NAME): $(PAM_SERVICE_NAME).pam
+	cp $(PAM_SERVICE_NAME).pam $(PAM_SERVICE_NAME)
+
+pamdir = $(PAM_PREFIX)/pam.d
+pam_DATA = $(PAM_SERVICE_NAME)
+
+EXTRA_DIST = $(extension_DATA) $(PAM_SERVICE_NAME).pam
+CLEANFILES = $(PAM_SERVICE_NAME)
+
+MAINTAINERCLEANFILES =                  \
+        *~                              \
+        $(PAM_SERVICE_NAME)             \
+        Makefile.in
diff --git a/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint
new file mode 100644
index 0000000..1a1c777
--- /dev/null
+++ b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint
@@ -0,0 +1,17 @@
+# Sample PAM file for doing fingerprint authentication.
+# Distros should replace this with what makes sense for them.
+auth        required      pam_env.so
+auth        required      pam_fprintd.so
+auth        sufficient    pam_succeed_if.so uid >= 500 quiet
+auth        required      pam_deny.so
+
+account     required      pam_unix.so
+account     sufficient    pam_localuser.so
+account     sufficient    pam_succeed_if.so uid < 500 quiet
+account     required      pam_permit.so
+
+password    required      pam_deny.so
+
+session     optional      pam_keyinit.so revoke
+session     required      pam_limits.so
+session     required      pam_unix.so
diff --git a/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c
new file mode 100644
index 0000000..c6ea706
--- /dev/null
+++ b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c
@@ -0,0 +1,485 @@
+/*
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Written By: Ray Strode <rstrode redhat com>
+ *
+ */
+
+#include <config.h>
+#include <stdlib.h>
+
+#include "gdm-fingerprint-extension.h"
+
+#include <glib/gi18n-lib.h>
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+struct _GdmFingerprintExtensionPrivate
+{
+        GIcon     *icon;
+        GtkWidget *page;
+        GtkActionGroup *actions;
+        GSettings *settings;
+
+        GtkWidget *message_label;
+        GtkWidget *prompt_label;
+        GtkWidget *prompt_entry;
+
+        GQueue    *message_queue;
+        guint      message_timeout_id;
+
+        GDBusConnection *bus_connection;
+
+        guint      answer_pending : 1;
+};
+
+typedef struct {
+        char                  *text;
+        GdmServiceMessageType  type;
+} QueuedMessage;
+
+static void gdm_fingerprint_extension_finalize (GObject *object);
+
+static void gdm_login_extension_iface_init (GdmLoginExtensionIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GdmFingerprintExtension,
+                         gdm_fingerprint_extension,
+                         G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (GDM_TYPE_LOGIN_EXTENSION,
+                                                gdm_login_extension_iface_init));
+
+static void
+set_message (GdmFingerprintExtension *extension,
+             const char           *message)
+{
+        gtk_widget_show (extension->priv->message_label);
+        gtk_label_set_text (GTK_LABEL (extension->priv->message_label), message);
+}
+
+static void
+free_queued_message (QueuedMessage *message)
+{
+        g_free (message->text);
+        g_slice_free (QueuedMessage, message);
+}
+
+static void
+purge_message_queue (GdmFingerprintExtension *extension)
+{
+        if (extension->priv->message_timeout_id) {
+                g_source_remove (extension->priv->message_timeout_id);
+                extension->priv->message_timeout_id = 0;
+        }
+        g_queue_foreach (extension->priv->message_queue,
+                         (GFunc) free_queued_message,
+                         NULL);
+        g_queue_clear (extension->priv->message_queue);
+}
+
+static gboolean
+dequeue_message (GdmFingerprintExtension *extension)
+{
+        if (!g_queue_is_empty (extension->priv->message_queue)) {
+                int duration;
+                gboolean needs_beep;
+
+                QueuedMessage *message;
+                message = (QueuedMessage *) g_queue_pop_head (extension->priv->message_queue);
+
+                switch (message->type) {
+                        case GDM_SERVICE_MESSAGE_TYPE_INFO:
+                                needs_beep = FALSE;
+                                break;
+                        case GDM_SERVICE_MESSAGE_TYPE_PROBLEM:
+                                needs_beep = TRUE;
+                                break;
+                        default:
+                                g_assert_not_reached ();
+                }
+
+                set_message (extension, message->text);
+
+                duration = (int) (g_utf8_strlen (message->text, -1) / 66.0) * 1000;
+                duration = CLAMP (duration, 400, 3000);
+
+                extension->priv->message_timeout_id = g_timeout_add (duration,
+                                                                     (GSourceFunc) dequeue_message,
+                                                                     extension);
+                if (needs_beep) {
+                        gdk_window_beep (gtk_widget_get_window (GTK_WIDGET (extension)));
+                }
+
+                free_queued_message (message);
+        } else {
+                extension->priv->message_timeout_id = 0;
+
+                _gdm_login_extension_emit_message_queue_empty (GDM_LOGIN_EXTENSION (extension));
+        }
+
+        return FALSE;
+}
+
+static void
+gdm_fingerprint_extension_queue_message (GdmLoginExtension *login_extension,
+                                         GdmServiceMessageType type,
+                                         const char      *text)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (login_extension);
+
+        QueuedMessage *message = g_slice_new (QueuedMessage);
+
+        message->text = g_strdup (text);
+        message->type = type;
+
+        g_queue_push_tail (extension->priv->message_queue, message);
+
+        if (extension->priv->message_timeout_id == 0) {
+                dequeue_message (extension);
+        }
+}
+
+static void
+gdm_fingerprint_extension_ask_question (GdmLoginExtension *login_extension,
+                                        const char      *message)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (login_extension);
+        gtk_widget_show (extension->priv->prompt_label);
+        gtk_label_set_text (GTK_LABEL (extension->priv->prompt_label), message);
+        gtk_entry_set_text (GTK_ENTRY (extension->priv->prompt_entry), "");
+        gtk_entry_set_visibility (GTK_ENTRY (extension->priv->prompt_entry), TRUE);
+        gtk_widget_show (extension->priv->prompt_entry);
+        gtk_widget_grab_focus (extension->priv->prompt_entry);
+        extension->priv->answer_pending = TRUE;
+}
+
+static void
+gdm_fingerprint_extension_ask_secret (GdmLoginExtension *login_extension,
+                                      const char      *message)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (login_extension);
+        gtk_widget_show (extension->priv->prompt_label);
+        gtk_label_set_text (GTK_LABEL (extension->priv->prompt_label), message);
+        gtk_entry_set_visibility (GTK_ENTRY (extension->priv->prompt_entry), FALSE);
+        gtk_entry_set_text (GTK_ENTRY (extension->priv->prompt_entry), "");
+        gtk_widget_show (extension->priv->prompt_entry);
+        gtk_widget_grab_focus (extension->priv->prompt_entry);
+        extension->priv->answer_pending = TRUE;
+}
+
+static void
+gdm_fingerprint_extension_reset (GdmLoginExtension *login_extension)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (login_extension);
+        gtk_widget_hide (extension->priv->prompt_label);
+        gtk_label_set_text (GTK_LABEL (extension->priv->prompt_label), "");
+
+        gtk_widget_hide (extension->priv->prompt_entry);
+        gtk_entry_set_text (GTK_ENTRY (extension->priv->prompt_entry), "");
+        gtk_entry_set_visibility (GTK_ENTRY (extension->priv->prompt_entry), TRUE);
+        extension->priv->answer_pending = FALSE;
+
+        set_message (extension, "");
+        purge_message_queue (extension);
+
+        gdm_login_extension_set_enabled (login_extension, FALSE);
+}
+
+static void
+gdm_fingerprint_extension_set_ready (GdmLoginExtension *login_extension)
+{
+        gdm_login_extension_set_enabled (login_extension, TRUE);
+}
+
+static char *
+gdm_fingerprint_extension_get_service_name (GdmLoginExtension *login_extension)
+{
+        return g_strdup (GDM_FINGERPRINT_EXTENSION_SERVICE_NAME);
+}
+
+static GtkWidget *
+gdm_fingerprint_extension_get_page (GdmLoginExtension *login_extension)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (login_extension);
+        return extension->priv->page;
+}
+
+static GtkActionGroup *
+gdm_fingerprint_extension_get_actions (GdmLoginExtension *login_extension)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (login_extension);
+
+        return g_object_ref (extension->priv->actions);
+}
+
+static void
+gdm_fingerprint_extension_request_answer (GdmLoginExtension *login_extension)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (login_extension);
+        const char *text;
+
+        if (!extension->priv->answer_pending) {
+                _gdm_login_extension_emit_answer (login_extension, NULL);
+                return;
+        }
+
+        extension->priv->answer_pending = FALSE;
+        text = gtk_entry_get_text (GTK_ENTRY (extension->priv->prompt_entry));
+        _gdm_login_extension_emit_answer (login_extension, text);
+
+        gtk_widget_hide (extension->priv->prompt_entry);
+        gtk_label_set_text (GTK_LABEL (extension->priv->prompt_label), "");
+        gtk_entry_set_text (GTK_ENTRY (extension->priv->prompt_entry), "");
+}
+
+static gboolean
+gdm_fingerprint_extension_focus (GdmLoginExtension *login_extension)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (login_extension);
+
+        if (!extension->priv->answer_pending) {
+                return FALSE;
+        }
+
+        gtk_widget_grab_focus (extension->priv->prompt_entry);
+        return TRUE;
+}
+
+static gboolean
+gdm_fingerprint_extension_has_queued_messages (GdmLoginExtension *login_extension)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (login_extension);
+
+        if (extension->priv->message_timeout_id != 0) {
+                return TRUE;
+        }
+
+        if (!g_queue_is_empty (extension->priv->message_queue)) {
+                return TRUE;
+        }
+
+        return FALSE;
+}
+
+static GIcon *
+gdm_fingerprint_extension_get_icon (GdmLoginExtension *login_extension)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (login_extension);
+        return g_object_ref (extension->priv->icon);
+}
+
+static char *
+gdm_fingerprint_extension_get_name (GdmLoginExtension *extension)
+{
+        return g_strdup (_("Fingerprint Authentication"));
+}
+
+static char *
+gdm_fingerprint_extension_get_description (GdmLoginExtension *extension)
+{
+        return g_strdup (_("Log into session with fingerprint"));
+}
+
+static gboolean
+gdm_fingerprint_extension_is_choosable (GdmLoginExtension *extension)
+{
+        return FALSE;
+}
+
+static gboolean
+gdm_fingerprint_extension_is_visible (GdmLoginExtension *login_extension)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (login_extension);
+        GVariant *device_variant;
+        char *contents, **lines;
+        int i;
+        gboolean ret;
+
+        if (!g_settings_get_boolean (extension->priv->settings, "active")) {
+                return FALSE;
+        }
+
+        if (extension->priv->bus_connection == NULL) {
+                return FALSE;
+        }
+
+        device_variant =
+            g_dbus_connection_call_sync (extension->priv->bus_connection,
+                                         "net.reactivated.Fprint",
+                                         "/net/reactivated/Fprint/Manager",
+                                         "net.reactivated.Fprint.Manager",
+                                         "GetDefaultDevice",
+                                         NULL, G_VARIANT_TYPE_OBJECT_PATH,
+                                         G_DBUS_CALL_FLAGS_NONE,
+                                         -1,
+                                         NULL,
+                                         NULL);
+        if (device_variant == NULL) {
+                return FALSE;
+        }
+
+        g_variant_unref (device_variant);
+
+        if (!g_file_get_contents ("/etc/sysconfig/authconfig",
+                                  &contents, NULL, NULL)) {
+                return TRUE;
+        }
+
+        lines = g_strsplit (contents, "\n", -1);
+        g_free (contents);
+
+        ret = TRUE;
+        for (i = 0; lines[i] ; i++) {
+                if (g_str_has_prefix (lines[i], "USEFPRINTD=") != FALSE) {
+                        char *value;
+
+                        value = lines[i] + strlen ("USEFPRINTD=");
+                        ret = rpmatch (value);
+                }
+        }
+
+        g_strfreev (lines);
+
+        return ret;
+}
+
+static void
+gdm_login_extension_iface_init (GdmLoginExtensionIface *iface)
+{
+        iface->get_icon = gdm_fingerprint_extension_get_icon;
+        iface->get_description = gdm_fingerprint_extension_get_description;
+        iface->get_name = gdm_fingerprint_extension_get_name;
+        iface->is_choosable = gdm_fingerprint_extension_is_choosable;
+        iface->is_visible = gdm_fingerprint_extension_is_visible;
+        iface->queue_message = gdm_fingerprint_extension_queue_message;
+        iface->ask_question = gdm_fingerprint_extension_ask_question;
+        iface->ask_secret = gdm_fingerprint_extension_ask_secret;
+        iface->reset = gdm_fingerprint_extension_reset;
+        iface->set_ready = gdm_fingerprint_extension_set_ready;
+        iface->get_service_name = gdm_fingerprint_extension_get_service_name;
+        iface->get_page = gdm_fingerprint_extension_get_page;
+        iface->get_actions = gdm_fingerprint_extension_get_actions;
+        iface->request_answer = gdm_fingerprint_extension_request_answer;
+        iface->focus = gdm_fingerprint_extension_focus;
+        iface->has_queued_messages = gdm_fingerprint_extension_has_queued_messages;
+}
+
+static void
+gdm_fingerprint_extension_class_init (GdmFingerprintExtensionClass *extension_class)
+{
+        GObjectClass *object_class;
+
+        object_class = G_OBJECT_CLASS (extension_class);
+
+        object_class->finalize = gdm_fingerprint_extension_finalize;
+
+        g_type_class_add_private (extension_class,
+                                  sizeof (GdmFingerprintExtensionPrivate));
+}
+
+static void
+gdm_fingerprint_extension_finalize (GObject *object)
+{
+        GdmFingerprintExtension *extension = GDM_FINGERPRINT_EXTENSION (object);
+
+        purge_message_queue (extension);
+
+        if (extension->priv->bus_connection != NULL) {
+                g_object_unref (extension->priv->bus_connection);
+        }
+}
+
+static void
+create_page (GdmFingerprintExtension *extension)
+{
+        GtkBuilder *builder;
+        GObject *object;
+        GError *error;
+
+        builder = gtk_builder_new ();
+
+        error = NULL;
+        gtk_builder_add_from_file (builder,
+                                   PLUGINDATADIR "/page.ui",
+                                   &error);
+
+        if (error != NULL) {
+                g_warning ("Could not load UI file: %s", error->message);
+                g_error_free (error);
+                return;
+        }
+
+        object = gtk_builder_get_object (builder, "page");
+        g_object_ref (object);
+
+        extension->priv->page = GTK_WIDGET (object);
+
+        object = gtk_builder_get_object (builder, "auth-prompt-label");
+        g_object_ref (object);
+        extension->priv->prompt_label = GTK_WIDGET (object);
+        gtk_widget_hide (extension->priv->prompt_label);
+
+        object = gtk_builder_get_object (builder, "auth-prompt-entry");
+        g_object_ref (object);
+        extension->priv->prompt_entry = GTK_WIDGET (object);
+        gtk_widget_hide (extension->priv->prompt_entry);
+
+        object = gtk_builder_get_object (builder, "auth-message-label");
+        g_object_ref (object);
+        extension->priv->message_label = GTK_WIDGET (object);
+        gtk_widget_show (extension->priv->message_label);
+
+        g_object_unref (builder);
+}
+
+static void
+create_actions (GdmFingerprintExtension *extension)
+{
+        extension->priv->actions = gtk_action_group_new (GDM_FINGERPRINT_EXTENSION_NAME);
+}
+
+static void
+gdm_fingerprint_extension_init (GdmFingerprintExtension *extension)
+{
+        extension->priv = G_TYPE_INSTANCE_GET_PRIVATE (extension,
+                                                       GDM_TYPE_FINGERPRINT_EXTENSION,
+                                                       GdmFingerprintExtensionPrivate);
+
+        extension->priv->icon = g_themed_icon_new ("gdm-fingerprint");
+        create_page (extension);
+        create_actions (extension);
+
+        extension->priv->message_queue = g_queue_new ();
+
+        extension->priv->settings = g_settings_new ("org.gnome.display-manager.plugins.fingerprint");
+        extension->priv->bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
+
+        gdm_fingerprint_extension_reset (GDM_LOGIN_EXTENSION (extension));
+}
+
+void
+g_io_module_load (GIOModule *module)
+{
+        g_io_extension_point_implement (GDM_LOGIN_EXTENSION_POINT_NAME,
+                                        GDM_TYPE_FINGERPRINT_EXTENSION,
+                                        GDM_FINGERPRINT_EXTENSION_NAME,
+                                        0);
+}
+
+void
+g_io_module_unload (GIOModule *module)
+{
+}
diff --git a/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.h b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.h
new file mode 100644
index 0000000..ec0436c
--- /dev/null
+++ b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * 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.
+ *
+ * Written By: Ray Strode <rstrode redhat com>
+ */
+
+#ifndef __GDM_FINGERPRINT_EXTENSION_H
+#define __GDM_FINGERPRINT_EXTENSION_H
+
+#include <glib-object.h>
+#include "gdm-login-extension.h"
+
+G_BEGIN_DECLS
+
+#define GDM_TYPE_FINGERPRINT_EXTENSION (gdm_fingerprint_extension_get_type ())
+#define GDM_FINGERPRINT_EXTENSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDM_TYPE_FINGERPRINT_EXTENSION, GdmFingerprintExtension))
+#define GDM_FINGERPRINT_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDM_TYPE_FINGERPRINT_EXTENSION, GdmFingerprintExtensionClass))
+#define GDM_IS_FINGERPRINT_EXTENSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDM_TYPE_FINGERPRINT_EXTENSION))
+#define GDM_IS_FINGERPRINT_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDM_TYPE_FINGERPRINT_EXTENSION))
+#define GDM_FINGERPRINT_EXTENSION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GDM_TYPE_FINGERPRINT_EXTENSION, GdmFingerprintExtensionClass))
+
+#define GDM_FINGERPRINT_EXTENSION_NAME "gdm-fingerprint-extension"
+
+typedef struct _GdmFingerprintExtensionPrivate GdmFingerprintExtensionPrivate;
+
+typedef struct
+{
+        GObject                  parent;
+        GdmFingerprintExtensionPrivate *priv;
+} GdmFingerprintExtension;
+
+typedef struct
+{
+        GObjectClass parent_class;
+} GdmFingerprintExtensionClass;
+
+GType                 gdm_fingerprint_extension_get_type      (void);
+
+G_END_DECLS
+
+#endif /* GDM_FINGERPRINT_EXTENSION_H */
diff --git a/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint.pam b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint.pam
new file mode 100644
index 0000000..1a1c777
--- /dev/null
+++ b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint.pam
@@ -0,0 +1,17 @@
+# Sample PAM file for doing fingerprint authentication.
+# Distros should replace this with what makes sense for them.
+auth        required      pam_env.so
+auth        required      pam_fprintd.so
+auth        sufficient    pam_succeed_if.so uid >= 500 quiet
+auth        required      pam_deny.so
+
+account     required      pam_unix.so
+account     sufficient    pam_localuser.so
+account     sufficient    pam_succeed_if.so uid < 500 quiet
+account     required      pam_permit.so
+
+password    required      pam_deny.so
+
+session     optional      pam_keyinit.so revoke
+session     required      pam_limits.so
+session     required      pam_unix.so
diff --git a/gui/simple-greeter/plugins/fingerprint/icons/16x16/Makefile.am b/gui/simple-greeter/plugins/fingerprint/icons/16x16/Makefile.am
new file mode 100644
index 0000000..f42e317
--- /dev/null
+++ b/gui/simple-greeter/plugins/fingerprint/icons/16x16/Makefile.am
@@ -0,0 +1,5 @@
+iconsdir = $(datadir)/icons/hicolor/16x16/apps
+
+icons_DATA = gdm-fingerprint.png
+
+EXTRA_DIST = $(icons_DATA)
diff --git a/gui/simple-greeter/plugins/fingerprint/icons/16x16/gdm-fingerprint.png b/gui/simple-greeter/plugins/fingerprint/icons/16x16/gdm-fingerprint.png
new file mode 100644
index 0000000..4438cee
Binary files /dev/null and b/gui/simple-greeter/plugins/fingerprint/icons/16x16/gdm-fingerprint.png differ
diff --git a/gui/simple-greeter/plugins/fingerprint/icons/48x48/Makefile.am b/gui/simple-greeter/plugins/fingerprint/icons/48x48/Makefile.am
new file mode 100644
index 0000000..f4ab2a0
--- /dev/null
+++ b/gui/simple-greeter/plugins/fingerprint/icons/48x48/Makefile.am
@@ -0,0 +1,5 @@
+iconsdir = $(datadir)/icons/hicolor/48x48/apps
+
+icons_DATA = gdm-fingerprint.png
+
+EXTRA_DIST = $(icons_DATA)
diff --git a/gui/simple-greeter/plugins/fingerprint/icons/48x48/gdm-fingerprint.png b/gui/simple-greeter/plugins/fingerprint/icons/48x48/gdm-fingerprint.png
new file mode 100644
index 0000000..fd6f546
Binary files /dev/null and b/gui/simple-greeter/plugins/fingerprint/icons/48x48/gdm-fingerprint.png differ
diff --git a/gui/simple-greeter/plugins/fingerprint/icons/Makefile.am b/gui/simple-greeter/plugins/fingerprint/icons/Makefile.am
new file mode 100644
index 0000000..c20f10d
--- /dev/null
+++ b/gui/simple-greeter/plugins/fingerprint/icons/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = 16x16 48x48
diff --git a/gui/simple-greeter/plugins/fingerprint/org.gnome.display-manager.plugins.fingerprint.gschema.xml.in b/gui/simple-greeter/plugins/fingerprint/org.gnome.display-manager.plugins.fingerprint.gschema.xml.in
new file mode 100644
index 0000000..542ccbb
--- /dev/null
+++ b/gui/simple-greeter/plugins/fingerprint/org.gnome.display-manager.plugins.fingerprint.gschema.xml.in
@@ -0,0 +1,9 @@
+<schemalist>
+  <schema id="org.gnome.display-manager.plugins.fingerprint" path="/org/gnome/display-manager/plugins/fingerprint/">
+    <key name="active" type="b">
+      <default>true</default>
+      <_summary>Activation of this plugin</_summary>
+      <_description>Whether this plugin would be activated or not</_description>
+    </key>
+  </schema>
+</schemalist>
diff --git a/gui/simple-greeter/plugins/fingerprint/page.ui b/gui/simple-greeter/plugins/fingerprint/page.ui
new file mode 100644
index 0000000..8fa5c7b
--- /dev/null
+++ b/gui/simple-greeter/plugins/fingerprint/page.ui
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.14"/>
+    <object class="GtkVBox" id="page">
+      <property name="visible">True</property>
+      <property name="orientation">vertical</property>
+      <child>
+        <object class="GtkHBox" id="auth-input-box">
+          <property name="visible">True</property>
+          <property name="spacing">6</property>
+          <child>
+            <object class="GtkLabel" id="auth-prompt-label">
+              <property name="visible">True</property>
+            </object>
+            <packing>
+              <property name="expand">False</property>
+              <property name="fill">False</property>
+              <property name="position">0</property>
+            </packing>
+          </child>
+          <child>
+            <object class="GtkEntry" id="auth-prompt-entry">
+              <property name="visible">True</property>
+              <property name="can_focus">True</property>
+              <property name="activates_default">True</property>
+            </object>
+            <packing>
+              <property name="position">1</property>
+            </packing>
+          </child>
+        </object>
+        <packing>
+          <property name="expand">True</property>
+          <property name="fill">True</property>
+          <property name="position">0</property>
+        </packing>
+      </child>
+      <child>
+        <object class="GtkHBox" id="auth-message-box">
+          <property name="visible">True</property>
+          <child>
+            <object class="GtkLabel" id="auth-message-label">
+              <property name="visible">True</property>
+            </object>
+            <packing>
+              <property name="position">0</property>
+            </packing>
+          </child>
+        </object>
+        <packing>
+          <property name="expand">True</property>
+          <property name="fill">True</property>
+          <property name="position">1</property>
+        </packing>
+      </child>
+    </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d4d5a51..77fe17d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -82,6 +82,7 @@ gui/simple-greeter/gdm-timer.c
 gui/simple-greeter/gdm-user-chooser-widget.c
 gui/simple-greeter/greeter-main.c
 gui/simple-greeter/plugins/password/gdm-password-extension.c
+gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c
 utils/gdmflexiserver.c
 utils/gdm-screenshot.c
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]