[gcr] gcr: Fixes for glib deprecations in the mock prompter
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr] gcr: Fixes for glib deprecations in the mock prompter
- Date: Mon, 9 Jan 2012 14:47:14 +0000 (UTC)
commit b04a620fd29bb55d77f15fb6be0efbe23981f467
Author: Stef Walter <stefw collabora co uk>
Date: Mon Jan 9 15:46:43 2012 +0100
gcr: Fixes for glib deprecations in the mock prompter
gcr/gcr-mock-prompter.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/gcr/gcr-mock-prompter.c b/gcr/gcr-mock-prompter.c
index 9dbe780..55aadcf 100644
--- a/gcr/gcr-mock-prompter.c
+++ b/gcr/gcr-mock-prompter.c
@@ -916,12 +916,23 @@ gcr_mock_prompter_start (void)
g_assert (running == NULL);
running = g_new0 (ThreadData, 1);
+#if GLIB_CHECK_VERSION(2,31,3)
+ running->mutex = g_new0 (GMutex, 1);
+ g_mutex_init (running->mutex);
+ running->start_cond = g_new0 (GCond, 1);
+ g_cond_init (running->start_cond);
+#else
running->mutex = g_mutex_new ();
running->start_cond = g_cond_new ();
+#endif
g_queue_init (&running->responses);
-
g_mutex_lock (running->mutex);
+
+#if GLIB_CHECK_VERSION(2,31,3)
+ running->thread = g_thread_new ("mock-prompter", mock_prompter_thread, running);
+#else
running->thread = g_thread_create (mock_prompter_thread, running, TRUE, &error);
+#endif
if (error != NULL)
g_error ("mock prompter couldn't start thread: %s", error->message);
@@ -958,8 +969,16 @@ gcr_mock_prompter_stop (void)
g_queue_foreach (&running->responses, (GFunc)mock_response_free, NULL);
g_queue_clear (&running->responses);
+#if GLIB_CHECK_VERSION(2,31,3)
+ g_cond_clear (running->start_cond);
+ g_free (running->start_cond);
+ g_mutex_clear (running->mutex);
+ g_free (running->mutex);
+#else
g_cond_free (running->start_cond);
g_mutex_free (running->mutex);
+#endif
+
g_free (running);
running = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]