[Spice-devel] [PATCH GTK 2/4] don't return a value from spice_smartcard_reader_init_libcacard

Christophe Fergeau cfergeau at redhat.com
Tue Jul 5 01:37:52 PDT 2011


The goal is to make initialization of libcacard async, so we
can't return a meaningful value from this function.
---
 gtk/smartcard-manager-priv.h |    2 +-
 gtk/smartcard-manager.c      |   13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/gtk/smartcard-manager-priv.h b/gtk/smartcard-manager-priv.h
index d40064c..89c3919 100644
--- a/gtk/smartcard-manager-priv.h
+++ b/gtk/smartcard-manager-priv.h
@@ -24,7 +24,7 @@
 
 G_BEGIN_DECLS
 
-gboolean spice_smartcard_manager_init_libcacard(SpiceSession *session);
+void spice_smartcard_manager_init_libcacard(SpiceSession *session);
 
 G_END_DECLS
 
diff --git a/gtk/smartcard-manager.c b/gtk/smartcard-manager.c
index 0aeb4f1..6d73e15 100644
--- a/gtk/smartcard-manager.c
+++ b/gtk/smartcard-manager.c
@@ -390,14 +390,15 @@ gboolean spice_smartcard_reader_is_software(SpiceSmartCardReader *reader)
 }
 
 G_GNUC_INTERNAL
-gboolean spice_smartcard_manager_init_libcacard(SpiceSession *session)
+void spice_smartcard_manager_init_libcacard(SpiceSession *session)
 {
     gchar *emul_args = NULL;
     VCardEmulOptions *options = NULL;
     gchar *dbname = NULL;
     GStrv certificates;
+    VCardEmulError error;
 
-    g_return_val_if_fail(session != NULL, VCARD_EMUL_FAIL);
+    g_return_if_fail(session != NULL);
     g_object_get(G_OBJECT(session),
                  "smartcard-db", &dbname,
                  "smartcard-certificates", &certificates,
@@ -425,12 +426,16 @@ gboolean spice_smartcard_manager_init_libcacard(SpiceSession *session)
     g_free(emul_args);
     if (options == NULL) {
         g_critical("vcard_emul_options() failed!");
-        return FALSE;
+        return;
     }
 
 init:
     /* FIXME: sometime this hangs a long time..., cant we make it async? */
-    return vcard_emul_init(options) == VCARD_EMUL_OK;
+    error = vcard_emul_init(options);
+
+    if (error != VCARD_EMUL_OK) {
+        g_critical("vcard_emul_init() failed: %d", error);
+    }
 }
 
 gboolean spice_smartcard_manager_insert_card(SpiceSmartCardManager *manager)
-- 
1.7.5.4



More information about the Spice-devel mailing list