Esempio n. 1
0
static gboolean
update_status_idle (RBImportDialog *dialog)
{
	int count;
	const char *fmt;
	char *text;

	if (rb_entry_view_have_selection (dialog->priv->entry_view)) {
		GList *sel;

		sel = rb_entry_view_get_selected_entries (dialog->priv->entry_view);
		count = g_list_length (sel);
		g_list_free_full (sel, (GDestroyNotify) rhythmdb_entry_unref);

		fmt = ngettext ("Import %d selected track", "Import %d selected tracks", count);
	} else {
		count = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (dialog->priv->query_model), NULL);
		fmt = ngettext ("Import %d listed track", "Import %d listed tracks", count);
	}
	text = g_strdup_printf (fmt, count);
	gtk_button_set_label (GTK_BUTTON (dialog->priv->import_button), text);
	g_free (text);

	/* hack to get these strings marked for translation */
	if (0) {
		ngettext ("%d song", "%d songs", 0);
	}
	text = rhythmdb_query_model_compute_status_normal (dialog->priv->query_model, "%d song", "%d songs");
	rb_entry_view_set_status (dialog->priv->entry_view, text, FALSE);
	g_free (text);

	dialog->priv->update_status_id = 0;
	return FALSE;
}
Esempio n. 2
0
static void
default_get_status (RBDisplayPage *page,
		    char **text,
		    char **progress_text,
		    float *progress)
{
	RBSource *source = RB_SOURCE (page);
	/* hack to get these strings marked for translation */
	if (0) {
		ngettext ("%d song", "%d songs", 0);
	}

	if (source->priv->query_model) {
		*text = rhythmdb_query_model_compute_status_normal (source->priv->query_model,
								    "%d song",
								    "%d songs");
		if (rhythmdb_query_model_has_pending_changes (source->priv->query_model)) {
			*progress = -1.0f;
		}
	} else {
		*text = g_strdup ("");
	}
}