[gnome-control-center] user-accounts: Simplify the fingerprint manager fetching
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] user-accounts: Simplify the fingerprint manager fetching
- Date: Mon, 17 Oct 2016 09:45:57 +0000 (UTC)
commit a396e0578a073b8620343385a9c7321713b2a33b
Author: Bastien Nocera <hadess hadess net>
Date: Thu Oct 13 16:10:32 2016 +0200
user-accounts: Simplify the fingerprint manager fetching
Code styling fix.
panels/user-accounts/um-fingerprint-dialog.c | 35 ++++++++++---------------
1 files changed, 14 insertions(+), 21 deletions(-)
---
diff --git a/panels/user-accounts/um-fingerprint-dialog.c b/panels/user-accounts/um-fingerprint-dialog.c
index 3aa78bb..66c4700 100644
--- a/panels/user-accounts/um-fingerprint-dialog.c
+++ b/panels/user-accounts/um-fingerprint-dialog.c
@@ -62,10 +62,14 @@ typedef struct {
gint state;
} EnrollData;
-static void create_manager (void)
+static void
+ensure_manager (void)
{
GError *error = NULL;
+ if (manager != NULL)
+ return;
+
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (connection == NULL) {
g_warning ("Failed to connect to session bus: %s", error->message);
@@ -183,12 +187,9 @@ set_fingerprint_label (GtkWidget *button)
GVariantIter *fingers;
GError *error = NULL;
- if (manager == NULL) {
- create_manager ();
- if (manager == NULL) {
- return FALSE;
- }
- }
+ ensure_manager ();
+ if (manager == NULL)
+ return FALSE;
device = get_first_device ();
if (device == NULL)
@@ -232,11 +233,9 @@ delete_fingerprints (void)
GDBusProxy *device;
GVariant *result;
- if (manager == NULL) {
- create_manager ();
- if (manager == NULL)
- return;
- }
+ ensure_manager ();
+ if (manager == NULL)
+ return;
device = get_first_device ();
if (device == NULL)
@@ -614,7 +613,7 @@ enroll_fingerprints (GtkWindow *parent,
GtkWidget *editable_button,
ActUser *user)
{
- GDBusProxy *device;
+ GDBusProxy *device = NULL;
GtkBuilder *dialog;
EnrollData *data;
GtkWidget *ass;
@@ -622,15 +621,9 @@ enroll_fingerprints (GtkWindow *parent,
GVariant *result;
GError *error = NULL;
- device = NULL;
-
- if (manager == NULL) {
- create_manager ();
- if (manager != NULL)
- device = get_first_device ();
- } else {
+ ensure_manager ();
+ if (manager != NULL)
device = get_first_device ();
- }
if (manager == NULL || device == NULL) {
GtkWidget *d;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]