示例#1
0
void Installer::UpdateProgress()
{
	Job *j = this->CurrentJob();

	if (this->window == NULL)
		return;

	if (this->IsRunning() && j != NULL)
	{
		double progress = j->GetProgress();
		gtk_progress_bar_set_fraction(
			GTK_PROGRESS_BAR(this->bar),
			progress);

		std::ostringstream text;
		if (this->DownloadFinished())
			text << "Installing ";
		else
			text << "Downloading ";
		text << "package " << j->Index() << " of " << Job::total;

		gtk_label_set_text(GTK_LABEL(this->label), text.str().c_str());

	}
	else if (!this->IsRunning())
	{
		gtk_progress_bar_set_fraction(
			GTK_PROGRESS_BAR(this->bar),
			1.0);
	}
}
示例#2
0
void Installer::UpdateProgress()
{
    Job *j = this->CurrentJob();

    if (this->window == NULL)
        return;

    Stage s = this->GetStage();
    if (j != NULL && (s == DOWNLOADING || s == INSTALLING))
    {
        double progress = j->GetProgress();
        gtk_progress_bar_set_fraction(
            GTK_PROGRESS_BAR(this->progressBar),
            progress);

        std::ostringstream text;
        if (s == INSTALLING)
            text << "Installing ";
        else
            text << "Downloading ";
        text << "package " << j->Index() << " of " << Job::total;

        gtk_label_set_text(GTK_LABEL(this->downloadingLabel), text.str().c_str());

    }
    else if (s == PREINSTALL)
    {
        gtk_progress_bar_set_fraction(
            GTK_PROGRESS_BAR(this->progressBar),
            1.0);
    }
    
}