telepathy-logger: log-manager: factor out start_async_op_in_thread()

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Fri Sep 27 04:44:20 PDT 2013


Module: telepathy-logger
Branch: master
Commit: 9acc98e7c25b1b9bb7f779c595e05a9d88035c48
URL:    http://cgit.freedesktop.org/telepathy/telepathy-logger/commit/?id=9acc98e7c25b1b9bb7f779c595e05a9d88035c48

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Fri Sep 27 12:17:07 2013 +0200

log-manager: factor out start_async_op_in_thread()

https://bugs.freedesktop.org/show_bug.cgi?id=69814

---

 telepathy-logger/log-manager.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/telepathy-logger/log-manager.c b/telepathy-logger/log-manager.c
index 62d0f74..944b741 100644
--- a/telepathy-logger/log-manager.c
+++ b/telepathy-logger/log-manager.c
@@ -871,6 +871,14 @@ _get_dates_async_thread (GSimpleAsyncResult *simple,
 }
 
 
+static void
+start_async_op_in_thread (TpAccount *account,
+    GSimpleAsyncResult *result,
+    GSimpleAsyncThreadFunc func)
+{
+  g_simple_async_result_run_in_thread (result, func, 0, NULL);
+}
+
 /**
  * tpl_log_manager_get_dates_async:
  * @manager: a #TplLogManager
@@ -917,8 +925,7 @@ tpl_log_manager_get_dates_async (TplLogManager *manager,
       _tpl_log_manager_async_operation_cb, async_data,
       tpl_log_manager_get_dates_async);
 
-  g_simple_async_result_run_in_thread (simple, _get_dates_async_thread, 0,
-      NULL);
+  start_async_op_in_thread (account, simple, _get_dates_async_thread);
 
   g_object_unref (simple);
 }
@@ -1028,8 +1035,7 @@ tpl_log_manager_get_events_for_date_async (TplLogManager *manager,
       _tpl_log_manager_async_operation_cb, async_data,
       tpl_log_manager_get_events_for_date_async);
 
-  g_simple_async_result_run_in_thread (simple,
-      _get_events_for_date_async_thread, 0, NULL);
+  start_async_op_in_thread (account, simple, _get_events_for_date_async_thread);
 
   g_object_unref (simple);
 }
@@ -1145,8 +1151,7 @@ tpl_log_manager_get_filtered_events_async (TplLogManager *manager,
       _tpl_log_manager_async_operation_cb, async_data,
       tpl_log_manager_get_filtered_events_async);
 
-  g_simple_async_result_run_in_thread (simple,
-      _get_filtered_events_async_thread, 0, NULL);
+  start_async_op_in_thread (account, simple, _get_filtered_events_async_thread);
 
   g_object_unref (simple);
 }
@@ -1286,8 +1291,7 @@ tpl_log_manager_get_entities_async (TplLogManager *self,
       _tpl_log_manager_async_operation_cb, async_data,
       tpl_log_manager_get_entities_async);
 
-  g_simple_async_result_run_in_thread (simple, _get_entities_async_thread, 0,
-      NULL);
+  start_async_op_in_thread (account, simple, _get_entities_async_thread);
 
   g_object_unref (simple);
 }
@@ -1386,8 +1390,7 @@ tpl_log_manager_search_async (TplLogManager *manager,
       _tpl_log_manager_async_operation_cb, async_data,
       tpl_log_manager_search_async);
 
-  g_simple_async_result_run_in_thread (simple, _search_async_thread, 0,
-      NULL);
+  start_async_op_in_thread (NULL, simple, _search_async_thread);
 
   g_object_unref (simple);
 }



More information about the telepathy-commits mailing list