ESourceRegistry: Do not mandate builtin sources.
[platform/upstream/evolution-data-server.git] / tests / libebook / client / client-test-utils.c
index e66c018..bb41e82 100644 (file)
@@ -1,4 +1,26 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2011, 2012 Red Hat, Inc. (www.redhat.com)
+ * Copyright (C) 2012 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Milan Crha <mcrha@redhat.com>
+ *          Matthew Barnes <mbarnes@redhat.com>
+ *          Tristan Van Berkom <tristanvb@openismus.com>
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -49,6 +71,7 @@ open_system_book (ESourceRegistry *registry,
        main_initialize ();
 
        source = e_source_registry_ref_builtin_address_book (registry);
+       g_return_val_if_fail (source != NULL, NULL);
        book_client = e_book_client_new (source, &error);
        g_object_unref (source);
 
@@ -95,14 +118,10 @@ idle_cb (gpointer data)
        g_return_val_if_fail (idle->func != NULL, FALSE);
 
        if (idle->run_in_thread) {
-               GError *error = NULL;
-
-               g_thread_create (idle->func, idle->data, FALSE, &error);
+               GThread *thread;
 
-               if (error) {
-                       report_error ("create thread", &error);
-                       stop_main_loop (1);
-               }
+               thread = g_thread_new (NULL, idle->func, idle->data);
+               g_thread_unref (thread);
        } else {
                idle->func (idle->data);
        }