/* -*- 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>
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);
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);
}
return FALSE;
}
-
-
typedef struct {
GMainLoop *loop;
const gchar *uid;
if (!data->book)
g_error ("Unable to create the book: %s", error->message);
- g_idle_add ((GSourceFunc)quit_idle, data);
+ g_idle_add ((GSourceFunc) quit_idle, data);
return FALSE;
}
/* XXX e_source_registry_commit_source_sync isnt really sync... or else
* we could call e_source_registry_ref_source() immediately
*/
- g_timeout_add (20, (GSourceFunc)create_book_idle, data);
+ g_timeout_add (20, (GSourceFunc) create_book_idle, data);
return FALSE;
}
data.uid = uid;
data.loop = g_main_loop_new (NULL, FALSE);
- g_idle_add ((GSourceFunc)register_source_idle, &data);
+ g_idle_add ((GSourceFunc) register_source_idle, &data);
g_main_loop_run (data.loop);
g_main_loop_unref (data.loop);
filename = g_build_filename (SRCDIR, "..", "data", "vcards", case_filename, NULL);
file = g_file_new_for_path (filename);
if (!g_file_load_contents (file, NULL, &vcard, NULL, NULL, &error)) {
- g_warning ("failed to read test contact file '%s': %s",
+ g_warning (
+ "failed to read test contact file '%s': %s",
filename, error->message);
exit (1);
}