diff -up capplets/about-me/gnome-about-me-fingerprint.c gnome-control-center-2.26.0/capplets/about-me/gnome-about-me-fingerprint.c --- capplets/about-me/gnome-about-me-fingerprint.c 2009-04-16 16:51:51.000000000 +0100 +++ capplets/about-me/gnome-about-me-fingerprint.c 2009-04-16 16:56:49.000000000 +0100 @@ -92,6 +92,40 @@ get_first_device (void) return device; } +static gboolean +pam_fprintd_available (void) +{ + char *contents, **lines; + gboolean ret; + guint i; + + if (g_file_test ("/etc/pam.d/gdm-fingerprint", G_FILE_TEST_IS_REGULAR) == FALSE) + return FALSE; + if (g_file_get_contents ("/etc/sysconfig/authconfig", &contents, NULL, NULL) == FALSE) + return FALSE; + + lines = g_strsplit (contents, "\n", -1); + g_free (contents); + + ret = FALSE; + + for (i = 0; lines[i] ; i++) { + if (g_str_has_prefix (lines[i], "USEFPRINTD=") != FALSE) { + char *value; + + value = lines[i] + strlen ("USEFPRINTD="); + if (g_strcmp0 (value, "yes") == 0) { + ret = TRUE; + break; + } + } + } + + g_strfreev (lines); + + return ret; +} + static const char * get_reason_for_error (const char *dbus_error) { @@ -146,29 +180,24 @@ set_fingerprint_label (GtkWidget *enable gtk_widget_set_no_show_all (enable, TRUE); gtk_widget_set_no_show_all (disable, TRUE); + if (pam_fprintd_available () == FALSE) + goto bail; + if (manager == NULL) { create_manager (); - if (manager == NULL) { - gtk_widget_hide (enable); - gtk_widget_hide (disable); - return; - } + if (manager == NULL) + goto bail; } device = get_first_device (); - if (device == NULL) { - gtk_widget_hide (enable); - gtk_widget_hide (disable); - return; - } + if (device == NULL) + goto bail; 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; + goto bail; } fingers = NULL; } @@ -185,6 +214,11 @@ set_fingerprint_label (GtkWidget *enable g_strfreev (fingers); g_object_unref (device); + + return; +bail: + gtk_widget_hide (enable); + gtk_widget_hide (disable); } static void