static gboolean account_miner_job_process_entry (GomAccountMinerJob *job, TrackerSparqlConnection *connection, GHashTable *previous_resources, const gchar *datasource_urn, ZpjSkydriveEntry *entry, GCancellable *cancellable, GError **error) { GDateTime *created_time, *updated_time; gchar *contact_resource; gchar *resource = NULL; gchar *date, *identifier; const gchar *class = NULL, *id, *name; gboolean resource_exists, mtime_changed; gint64 new_mtime; id = zpj_skydrive_entry_get_id (entry); identifier = g_strdup_printf ("%swindows-live:skydrive:%s", ZPJ_IS_SKYDRIVE_FOLDER (entry) ? "gd:collection:" : "", id); /* remove from the list of the previous resources */ g_hash_table_remove (previous_resources, identifier); name = zpj_skydrive_entry_get_name (entry); if (ZPJ_IS_SKYDRIVE_FILE (entry)) class = gom_filename_to_rdf_type (name); else if (ZPJ_IS_SKYDRIVE_FOLDER (entry))
static void zpj_download_stream_ready (GObject *source, GAsyncResult *res, gpointer user_data) { GError *error = NULL; PdfLoadJob *job = (PdfLoadJob *) user_data; const gchar *name; const gchar *extension; job->stream = zpj_skydrive_download_file_to_stream_finish (ZPJ_SKYDRIVE (source), res, &error); if (error != NULL) { pdf_load_job_complete_error (job, error); return; } name = zpj_skydrive_entry_get_name (job->zpj_entry); extension = gd_filename_get_extension_offset (name); /* If it is not a PDF, we need to convert it afterwards. * http://msdn.microsoft.com/en-us/library/live/hh826545#fileformats */ if (g_strcmp0 (extension, ".pdf") != 0) { GFileIOStream *iostream; job->download_file = g_file_new_tmp (NULL, &iostream, &error); if (error != NULL) { pdf_load_job_complete_error (job, error); return; } /* We don't need the iostream. */ g_io_stream_close (G_IO_STREAM (iostream), NULL, NULL); } else job->download_file = g_file_new_for_path (job->pdf_path); g_file_replace_async (job->download_file, NULL, FALSE, G_FILE_CREATE_PRIVATE, G_PRIORITY_DEFAULT, job->cancellable, file_replace_ready_cb, job); }