#define SQLITEDB_FOLDER_ID "folder_id"
#define SQLITEDB_FOLDER_NAME "folder"
-
#define EDB_ERROR(_code) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, NULL)
#define EDB_ERROR_EX(_code, _msg) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, _msg)
#define EDB_NOT_OPENED_ERROR EDB_ERROR(NOT_OPENED)
g_propagate_error (error, EDB_ERROR (PERMISSION_DENIED));
} else {
g_propagate_error (error, e_data_book_create_error_fmt
- (E_DATA_BOOK_STATUS_OTHER_ERROR,
+ (E_DATA_BOOK_STATUS_OTHER_ERROR,
"Failed to remove file '%s': %s",
filename, g_strerror (errno)));
}
if (errno == EACCES || errno == EPERM)
g_propagate_error (error, EDB_ERROR (PERMISSION_DENIED));
else
- g_propagate_error (error,
+ g_propagate_error (error,
e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR,
"Failed to make directory %s: %s",
dirname, g_strerror (errno)));
string_to_dbt (uid, &id_dbt);
memset (&vcard_dbt, 0, sizeof (vcard_dbt));
vcard_dbt.flags = DB_DBT_MALLOC;
-
+
db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0);
if (db_error == 0) {
return FALSE;
}
- g_slist_foreach (contacts, (GFunc)g_object_unref, NULL);
+ g_slist_foreach (contacts, (GFunc) g_object_unref, NULL);
g_slist_free (contacts);
if (!e_book_backend_sqlitedb_set_is_populated (bfpriv->sqlitedb, SQLITEDB_FOLDER_ID, TRUE, &error)) {
}
}
- g_slist_foreach (summary_list, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (summary_list, (GFunc) e_book_backend_sqlitedb_search_data_free, NULL);
g_slist_free (summary_list);
} else {
summary_list = e_book_backend_sqlitedb_search (bf->priv->sqlitedb,
SQLITEDB_FOLDER_ID,
- query, fields_of_interest,
+ query, fields_of_interest,
&searched, &with_all_required_fields, NULL);
if (searched) {
notify_update_vcard (book_view, TRUE, data->uid, vcard);
}
- g_slist_foreach (summary_list, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+ g_slist_foreach (summary_list, (GFunc) e_book_backend_sqlitedb_search_data_free, NULL);
g_slist_free (summary_list);
} else {
/* iterate over the db and do the query there */
/* don't include the version in the list of cards */
if (strcmp (id_dbt.data, E_BOOK_BACKEND_FILE_VERSION_NAME)) {
- notify_update_vcard (book_view, allcontacts,
+ notify_update_vcard (book_view, allcontacts,
id_dbt.data, vcard_dbt.data);
} else {
g_free (vcard_dbt.data);
} else if (!build_sqlitedb (bf->priv)) {
g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR,
"Failed to build summary for an address book %s",
- bf->priv->filename));
+ bf->priv->filename));
}
}
static void
e_book_backend_file_notify_update (EBookBackend *backend, const EContact *contact)
{
- NotifyData data = { (EContact *)contact, E_BOOK_BACKEND_FILE (backend) };
+ NotifyData data = { (EContact *) contact, E_BOOK_BACKEND_FILE (backend) };
e_book_backend_foreach_view (backend, view_notify_update, &data);
}
(old_photo_etag != NULL && new_photo_etag != NULL && strcmp (old_photo_etag, new_photo_etag) != 0)) {
/* Download the photo. */
gdata_contacts_contact_get_photo_async (GDATA_CONTACTS_CONTACT (entry),
- GDATA_CONTACTS_SERVICE (E_BOOK_BACKEND_GOOGLE (backend)->priv->service), NULL,
- (GAsyncReadyCallback) process_contact_photo_cb, backend);
+ GDATA_CONTACTS_SERVICE (E_BOOK_BACKEND_GOOGLE (backend)->priv->service), NULL,
+ (GAsyncReadyCallback) process_contact_photo_cb, backend);
g_free (old_photo_etag);
return;
/* We now have to re-query for the contact, since setting its photo changes the contact's ETag. */
gdata_service_query_single_entry_async (E_BOOK_BACKEND_GOOGLE (data->backend)->priv->service,
- gdata_contacts_service_get_primary_authorization_domain (),
- gdata_entry_get_id (GDATA_ENTRY (contact)), NULL, GDATA_TYPE_CONTACTS_CONTACT,
- data->cancellable, (GAsyncReadyCallback) create_contact_photo_query_cb, data);
+ gdata_contacts_service_get_primary_authorization_domain (),
+ gdata_entry_get_id (GDATA_ENTRY (contact)), NULL, GDATA_TYPE_CONTACTS_CONTACT,
+ data->cancellable, (GAsyncReadyCallback) create_contact_photo_query_cb, data);
return;
} else {
/* Error. */
* we can update the EContact with the photo data and ETag. */
if (data->photo != NULL) {
gdata_contacts_contact_set_photo_async (GDATA_CONTACTS_CONTACT (new_contact), GDATA_CONTACTS_SERVICE (service),
- (const guint8 *) data->photo->data.inlined.data, data->photo->data.inlined.length,
- data->photo->data.inlined.mime_type, data->cancellable,
- (GAsyncReadyCallback) create_contact_photo_cb, data);
+ (const guint8 *) data->photo->data.inlined.data, data->photo->data.inlined.length,
+ data->photo->data.inlined.mime_type, data->cancellable,
+ (GAsyncReadyCallback) create_contact_photo_cb, data);
return;
}
#endif /* HAVE_LIBGDATA_0_9 */
/* We now have to re-query for the contact, since setting its photo changes the contact's ETag. */
gdata_service_query_single_entry_async (E_BOOK_BACKEND_GOOGLE (data->backend)->priv->service,
- gdata_contacts_service_get_primary_authorization_domain (),
- gdata_entry_get_id (GDATA_ENTRY (contact)), NULL, GDATA_TYPE_CONTACTS_CONTACT,
- data->cancellable, (GAsyncReadyCallback) modify_contact_photo_query_cb, data);
+ gdata_contacts_service_get_primary_authorization_domain (),
+ gdata_entry_get_id (GDATA_ENTRY (contact)), NULL, GDATA_TYPE_CONTACTS_CONTACT,
+ data->cancellable, (GAsyncReadyCallback) modify_contact_photo_query_cb, data);
return;
} else {
/* Error. */
/* Set the photo. */
g_return_if_fail (data->photo != NULL);
gdata_contacts_contact_set_photo_async (GDATA_CONTACTS_CONTACT (new_contact), GDATA_CONTACTS_SERVICE (service),
- (const guint8 *) data->photo->data.inlined.data, data->photo->data.inlined.length,
- data->photo->data.inlined.mime_type, data->cancellable,
- (GAsyncReadyCallback) modify_contact_photo_cb, data);
+ (const guint8 *) data->photo->data.inlined.data, data->photo->data.inlined.length,
+ data->photo->data.inlined.mime_type, data->cancellable,
+ (GAsyncReadyCallback) modify_contact_photo_cb, data);
return;
case REMOVE_PHOTO:
/* Unset the photo. */
g_return_if_fail (data->photo == NULL);
gdata_contacts_contact_set_photo_async (GDATA_CONTACTS_CONTACT (new_contact), GDATA_CONTACTS_SERVICE (service),
- NULL, 0, NULL, data->cancellable, (GAsyncReadyCallback) modify_contact_photo_cb, data);
+ NULL, 0, NULL, data->cancellable, (GAsyncReadyCallback) modify_contact_photo_cb, data);
return;
default:
g_assert_not_reached ();
/* Removing a photo */
data->photo_operation = REMOVE_PHOTO;
} else if (old_photo->data.inlined.length != new_photo->data.inlined.length ||
- memcmp (old_photo->data.inlined.data, new_photo->data.inlined.data, old_photo->data.inlined.length) != 0) {
+ memcmp (old_photo->data.inlined.data, new_photo->data.inlined.data, old_photo->data.inlined.length) != 0) {
/* Modifying the photo */
data->photo_operation = UPDATE_PHOTO;
} else {
typedef struct {
EContactField field; /* The EContact field */
- GType fundamental_type; /* The fundamental type (string or int) */
+ GType fundamental_type; /* The fundamental type (string or gint) */
const gchar *dbname; /* The key for this field in the sqlite3 table */
} SummeryField;
{
GError *err = NULL;
EContact *contact = NULL;
- gchar *vcard = e_book_backend_sqlitedb_get_vcard_string (ebsdb, folderid, uid,
+ gchar *vcard = e_book_backend_sqlitedb_get_vcard_string (ebsdb, folderid, uid,
fields_of_interest, with_all_required_fields, &err);
if (!err) {
contact = e_contact_new_from_vcard (vcard);
return contact;
}
-
static void
accumulate_fields_select_stmt (const gchar *field_name,
gpointer is_present,
if (!fields_of_interest)
return FALSE;
- g_hash_table_foreach (fields_of_interest, (GHFunc)check_field_foreach, &summary_fields);
+ g_hash_table_foreach (fields_of_interest, (GHFunc) check_field_foreach, &summary_fields);
return summary_fields;
}
*
*/
if (fields_of_interest && e_book_backend_sqlitedb_is_summary_fields (fields_of_interest)) {
- g_hash_table_foreach (fields_of_interest, (GHFunc)accumulate_fields_select_stmt, string);
+ g_hash_table_foreach (fields_of_interest, (GHFunc) accumulate_fields_select_stmt, string);
/* The query should return all the required information */
if (with_all_required_fields)
return g_string_free (string, FALSE);
}
-
/**
* e_book_backend_sqlitedb_get_vcard_string:
* @ebsdb: An #EBookBackendSqliteDB
book_backend_sql_exec (ebsdb->priv->db, stmt, store_data_to_vcard, &vcard_data, &err);
sqlite3_free (stmt);
} else
- book_backend_sql_exec (ebsdb->priv->db, select_stmt,
+ book_backend_sql_exec (ebsdb->priv->db, select_stmt,
store_data_to_vcard, &vcard_data, &err);
g_free (select_stmt);
gchar *sql_query;
sql_query = sexp ? sexp_to_sql_query (sexp) : NULL;
- search_contacts = book_backend_sqlitedb_search_query (ebsdb, sql_query, folderid,
- fields_of_interest,
+ search_contacts = book_backend_sqlitedb_search_query (ebsdb, sql_query, folderid,
+ fields_of_interest,
&local_with_all_required_fields, error);
g_free (sql_query);
g_object_unref (backend);
}
-
/**
* e_book_backend_notify_update:
* @backend: an #EBookBackend
/* we presume we'll need to get additional data only if we're not authenticated yet */
g_object_ref (ob);
camel_stream_write_string (
- (CamelStream *)ic->mem,
+ (CamelStream *) ic->mem,
camel_sasl_get_mechanism (CAMEL_SASL (ob)),
NULL, NULL);
if (!camel_sasl_get_authenticated ((CamelSasl *) ob))
string = g_strdup_printf ("{%u}", ob_size);
}
- camel_stream_write_string ((CamelStream *)ic->mem, string, NULL, NULL);
+ camel_stream_write_string ((CamelStream *) ic->mem, string, NULL, NULL);
g_free (string);
}
#define N_TEST_CONTACTS 4
-
static gboolean loading_view = FALSE;
/****************************************************************
if (e_contact_get_const (contact, E_CONTACT_FULL_NAME) != NULL)
g_error ("received contact name `%s' when only the uid and revision was requested",
- (gchar *)e_contact_get_const (contact, E_CONTACT_FULL_NAME));
+ (gchar *) e_contact_get_const (contact, E_CONTACT_FULL_NAME));
}
if (!loading_view)
g_signal_connect (view, "objects-removed", G_CALLBACK (objects_removed), NULL);
g_signal_connect (view, "complete", G_CALLBACK (complete), NULL);
-
- field_list = g_slist_prepend (NULL, (gpointer)e_contact_field_name (E_CONTACT_UID));
- field_list = g_slist_prepend (field_list, (gpointer)e_contact_field_name (E_CONTACT_REV));
+ field_list = g_slist_prepend (NULL, (gpointer) e_contact_field_name (E_CONTACT_UID));
+ field_list = g_slist_prepend (field_list, (gpointer) e_contact_field_name (E_CONTACT_REV));
e_book_client_view_set_fields_of_interest (view, field_list, &error);
g_slist_free (field_list);
setup_and_start_view (view);
}
-
static gpointer
call_get_view (gpointer user_data)
{
#define COMPARE_PERFORMANCE 0
#define BEEFY_VCARDS 1
-
#if COMPARE_PERFORMANCE
# define SETUP_TIMER(timer) GTimer *timer = g_timer_new ();
# define START_TIMER(timer) g_timer_start (timer);
for (e = emails; e; e = e->next) {
g_print ("\t%s\n", (gchar *)e->data);
}
- g_list_foreach (emails, (GFunc)g_free, NULL);
+ g_list_foreach (emails, (GFunc) g_free, NULL);
g_list_free (emails);
g_print ("\n");
if (uids_only && e_contact_get_const (contact, E_CONTACT_FULL_NAME) != NULL)
g_error ("received contact name `%s' when only the uid was requested",
- (gchar *)e_contact_get_const (contact, E_CONTACT_FULL_NAME));
+ (gchar *) e_contact_get_const (contact, E_CONTACT_FULL_NAME));
else if (!uids_only && e_contact_get_const (contact, E_CONTACT_FULL_NAME) == NULL)
g_error ("expected contact name missing");
}
g_signal_connect (view, "objects-removed", G_CALLBACK (objects_removed), NULL);
g_signal_connect (view, "complete", G_CALLBACK (complete), NULL);
- uid_field_list.data = (gpointer)e_contact_field_name (E_CONTACT_UID);
+ uid_field_list.data = (gpointer) e_contact_field_name (E_CONTACT_UID);
if (uids_only)
e_book_client_view_set_fields_of_interest (view, &uid_field_list, &error);
setup_and_start_view (view);
}
-
static gpointer
call_get_view (gpointer user_data)
{
}
g_object_unref (book_client);
-
/*
* Sync version uids only
*/
}
g_object_unref (book_client);
-
/*
* Async version all data
*/
if (!setup_book (&book_client))
return 1;
-
START_TIMER (timer);
start_in_idle_with_main_loop (call_get_view, book_client);
STOP_TIMER (timer);
g_object_unref (book_client);
-
/*
* Async version uids only
*/