/** * _rb_source_set_import_status: * @source: an #RBSource * @job: a #RhythmDBImportJob * @progress_text: used to return progress text * @progress: used to return progress fraction * * Used in implementations of the get_status method to provide source * status information based on a #RhythmDBImportJob. */ void _rb_source_set_import_status (RBSource *source, RhythmDBImportJob *job, char **progress_text, float *progress) { int total; int imported; total = rhythmdb_import_job_get_total (job); imported = rhythmdb_import_job_get_imported (job); g_free (*progress_text); *progress_text = g_strdup_printf (_("Importing (%d/%d)"), imported, total); *progress = ((float)imported / (float)total); }
static void impl_get_status (RBSource *source, char **text, char **progress_text, float *progress) { RBGenericPlayerSourcePrivate *priv = GENERIC_PLAYER_SOURCE_GET_PRIVATE (source); /* get default status text first */ RB_SOURCE_CLASS (rb_generic_player_source_parent_class)->impl_get_status (source, text, progress_text, progress); /* override with bits of import status */ if (priv->import_job != NULL) { int total; int imported; total = rhythmdb_import_job_get_total (priv->import_job); imported = rhythmdb_import_job_get_imported (priv->import_job); g_free (*progress_text); *progress_text = g_strdup_printf (_("Importing (%d/%d)"), imported, total); *progress = ((float)imported / (float)total); } }