[gnome-settings-daemon] smartcard: fix driver activation notification
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] smartcard: fix driver activation notification
- Date: Mon, 29 Jul 2013 04:09:13 +0000 (UTC)
commit eb6f9706c145544b8f70222e42aab9554a260ec5
Author: Ray Strode <rstrode redhat com>
Date: Sun Jul 28 23:54:59 2013 -0400
smartcard: fix driver activation notification
g-s-d fails to notice when it's finished loading all
the smartcard drivers. This is because the code was
waiting for the driver worker threads to finish instead
of to start (and also a fault >= instead > 0 check for
pending drivers)
The commit fixes that.
plugins/smartcard/gsd-smartcard-manager.c | 40 ++--------------------------
1 files changed, 3 insertions(+), 37 deletions(-)
---
diff --git a/plugins/smartcard/gsd-smartcard-manager.c b/plugins/smartcard/gsd-smartcard-manager.c
index 05f77f8..14c2f71 100644
--- a/plugins/smartcard/gsd-smartcard-manager.c
+++ b/plugins/smartcard/gsd-smartcard-manager.c
@@ -321,28 +321,6 @@ watch_smartcards_from_driver_async (GsdSmartcardManager *self,
g_object_unref (task);
}
-typedef struct
-{
- guint driver_registered : 1;
- guint smartcards_watched : 1;
-} ActivateDriverOperation;
-
-static void
-try_to_complete_driver_activation (GTask *task)
-{
- ActivateDriverOperation *operation;
-
- operation = g_task_get_task_data (task);
-
- if (!operation->driver_registered)
- return;
-
- if (!operation->smartcards_watched)
- return;
-
- g_task_return_boolean (task, TRUE);
-}
-
static gboolean
register_driver_finish (GsdSmartcardManager *self,
GAsyncResult *result,
@@ -356,7 +334,6 @@ on_driver_registered (GsdSmartcardManager *self,
GAsyncResult *result,
GTask *task)
{
- ActivateDriverOperation *operation;
GError *error = NULL;
if (!register_driver_finish (self, result, &error)) {
@@ -365,10 +342,7 @@ on_driver_registered (GsdSmartcardManager *self,
return;
}
- operation = g_task_get_task_data (task);
- operation->driver_registered = TRUE;
-
- try_to_complete_driver_activation (task);
+ g_task_return_boolean (task, TRUE);
}
static void
@@ -376,12 +350,7 @@ on_smartcards_from_driver_watched (GsdSmartcardManager *self,
GAsyncResult *result,
GTask *task)
{
- ActivateDriverOperation *operation;
-
- operation = g_task_get_task_data (task);
- operation->smartcards_watched = TRUE;
-
- try_to_complete_driver_activation (task);
+ g_debug ("Done watching smartcards from driver");
}
typedef struct {
@@ -462,14 +431,11 @@ activate_driver (GsdSmartcardManager *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- ActivateDriverOperation *operation;
GTask *task;
g_debug ("Activating driver '%s'", driver->commonName);
task = g_task_new (self, cancellable, callback, user_data);
- operation = g_new0 (ActivateDriverOperation, 1);
- g_task_set_task_data (task, operation, (GDestroyNotify) g_free);
register_driver (self,
driver,
@@ -504,7 +470,7 @@ try_to_complete_all_drivers_activation (GTask *task)
operation = g_task_get_task_data (task);
- if (operation->pending_drivers_count >= 0)
+ if (operation->pending_drivers_count > 0)
return;
if (operation->activated_drivers_count > 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]