157672 patch by ajschult@eos.ncsu.edu r=sgehani sr=dveditz unix install wizard "silent" mode not implemented

This commit is contained in:
cbiesinger%web.de 2003-02-22 16:56:57 +00:00
Родитель b70b9318ee
Коммит 052e7088d7
5 изменённых файлов: 150 добавлений и 96 удалений

Просмотреть файл

@ -82,4 +82,7 @@ UNKNOWN=Unknown
-623=Destination directory doesn't exist -623=Destination directory doesn't exist
-624=Can't make destination directory. Please try another directory. -624=Can't make destination directory. Please try another directory.
-625=A previous installation exists. -625=A previous installation exists.
-626=Insufficient permission
-627=Insufficient disk space
-628=Multiple CRC Failure

Просмотреть файл

@ -131,6 +131,7 @@ nsInstallDlg::Next(GtkWidget *aWidget, gpointer aData)
else else
bDownload = TRUE; bDownload = TRUE;
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT) {
gtk_progress_set_activity_mode(GTK_PROGRESS(sMajorProgBar), FALSE); gtk_progress_set_activity_mode(GTK_PROGRESS(sMajorProgBar), FALSE);
gtk_progress_bar_update(GTK_PROGRESS_BAR(sMajorProgBar), (gfloat) 0); gtk_progress_bar_update(GTK_PROGRESS_BAR(sMajorProgBar), (gfloat) 0);
gtk_label_set_text(GTK_LABEL(sMajorLabel), ""); gtk_label_set_text(GTK_LABEL(sMajorLabel), "");
@ -181,11 +182,13 @@ nsInstallDlg::Next(GtkWidget *aWidget, gpointer aData)
XI_GTK_UPDATE_UI(); XI_GTK_UPDATE_UI();
bInstallClicked = TRUE; bInstallClicked = TRUE;
}
PerformInstall(); PerformInstall();
if (bDLCancel) // set only when download was cancelled if (bDLCancel) // set only when download was cancelled
{ {
// mode auto has no call to gtk_main() // mode auto has no call to gtk_main()
if (gCtx->opt->mMode != nsXIOptions::MODE_AUTO) if (gCtx->opt->mMode == nsXIOptions::MODE_DEFAULT)
gtk_main_quit(); gtk_main_quit();
} }
@ -559,6 +562,7 @@ nsInstallDlg::PerformInstall()
err = engine->Download(bCus, comps); err = engine->Download(bCus, comps);
if (err == E_DL_DROP_CXN) if (err == E_DL_DROP_CXN)
{ {
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
DLPause(NULL, NULL); DLPause(NULL, NULL);
ShowCxnDroppedDlg(); ShowCxnDroppedDlg();
return err; return err;
@ -581,8 +585,11 @@ nsInstallDlg::PerformInstall()
} }
// prepare install UI // prepare install UI
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
{
InitInstallProgress(); InitInstallProgress();
HideNavButtons(); HideNavButtons();
}
// 2> extract engine // 2> extract engine
XI_ERR_BAIL(engine->Extract(xpiengine)); XI_ERR_BAIL(engine->Extract(xpiengine));
@ -596,7 +603,10 @@ nsInstallDlg::PerformInstall()
engine->DeleteXPIs(bCus, comps); engine->DeleteXPIs(bCus, comps);
} }
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
{
ShowCompleteDlg(); ShowCompleteDlg();
}
// run all specified applications after installation // run all specified applications after installation
if (sRunAppList) if (sRunAppList)
@ -615,6 +625,8 @@ BAIL:
void void
nsInstallDlg::XPIProgressCB(const char *aMsg, int aVal, int aMax) nsInstallDlg::XPIProgressCB(const char *aMsg, int aVal, int aMax)
{ {
if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT)
return;
// DUMP("XPIProgressCB"); // DUMP("XPIProgressCB");
if (!aMsg) if (!aMsg)
@ -1153,6 +1165,11 @@ nsInstallDlg::ShowCRCDlg()
{ {
GtkWidget *label, *okButton, *packer; GtkWidget *label, *okButton, *packer;
if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT) {
ErrorHandler(E_CRC_FAILED);
return;
}
if ( crcDlg == (GtkWidget *) NULL ) { if ( crcDlg == (GtkWidget *) NULL ) {
// throw up dialog informing user to press resume // throw up dialog informing user to press resume
// or to cancel out // or to cancel out
@ -1187,6 +1204,11 @@ nsInstallDlg::ShowCRCFailedDlg()
// throw up dialog informing user to press resume // throw up dialog informing user to press resume
// or to cancel out // or to cancel out
if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT) {
ErrorHandler(E_CRC_FAILED);
return OK;
}
crcFailedDlg = gtk_dialog_new(); crcFailedDlg = gtk_dialog_new();
label = gtk_label_new(gCtx->Res("CRC_FAILED")); label = gtk_label_new(gCtx->Res("CRC_FAILED"));
okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL")); okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL"));
@ -1220,6 +1242,11 @@ nsInstallDlg::ShowCxnDroppedDlg()
// throw up dialog informing user to press resume // throw up dialog informing user to press resume
// or to cancel out // or to cancel out
if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT) {
ErrorHandler(E_NO_DOWNLOAD);
return OK;
}
cxnDroppedDlg = gtk_dialog_new(); cxnDroppedDlg = gtk_dialog_new();
label = gtk_label_new(gCtx->Res("CXN_DROPPED")); label = gtk_label_new(gCtx->Res("CXN_DROPPED"));
okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL")); okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL"));

Просмотреть файл

@ -156,6 +156,7 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
currURL = currComp->GetURL(i); currURL = currComp->GetURL(i);
if (!currURL) break; if (!currURL) break;
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
nsInstallDlg::SetDownloadComp(currComp, i, nsInstallDlg::SetDownloadComp(currComp, i,
currCompNum, numToDL); currCompNum, numToDL);
@ -202,6 +203,9 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
{ {
sprintf(localPath, "%s/%s", XPI_DIR, sprintf(localPath, "%s/%s", XPI_DIR,
currComp->GetArchive()); currComp->GetArchive());
if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT)
err = conn->Get(NULL, localPath, resPos);
else
err = conn->Get(nsInstallDlg::DownloadCB, localPath, err = conn->Get(nsInstallDlg::DownloadCB, localPath,
resPos); resPos);
conn->Close(); conn->Close();
@ -237,6 +241,9 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
{ {
sprintf(localPath, "%s/%s", XPI_DIR, sprintf(localPath, "%s/%s", XPI_DIR,
currComp->GetArchive()); currComp->GetArchive());
if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT)
err = conn->Get(NULL, localPath, resPos);
else
err = conn->Get(nsInstallDlg::DownloadCB, localPath, err = conn->Get(nsInstallDlg::DownloadCB, localPath,
resPos); resPos);
conn->Close(); conn->Close();
@ -291,6 +298,10 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
{ {
sprintf(localPath, "%s/%s", XPI_DIR, sprintf(localPath, "%s/%s", XPI_DIR,
currComp->GetArchive()); currComp->GetArchive());
if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT)
err = conn->Get(srvPath, localPath, nsFTPConn::BINARY,
resPos, 1, NULL);
else
err = conn->Get(srvPath, localPath, nsFTPConn::BINARY, err = conn->Get(srvPath, localPath, nsFTPConn::BINARY,
resPos, 1, nsInstallDlg::DownloadCB); resPos, 1, nsInstallDlg::DownloadCB);
passCount++; passCount++;
@ -339,6 +350,7 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
} }
} }
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
nsInstallDlg::ClearRateLabel(); // clean after ourselves nsInstallDlg::ClearRateLabel(); // clean after ourselves
if (err == OK) if (err == OK)
@ -368,6 +380,7 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
currCompNum = 1; currCompNum = 1;
} }
currCompSave = currComp; currCompSave = currComp;
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
gCtx->idlg->ReInitUI(); gCtx->idlg->ReInitUI();
gCtx->idlg->ShowCRCDlg(); gCtx->idlg->ShowCRCDlg();
numToDL = TotalToDownload(aCustom, aComps); numToDL = TotalToDownload(aCustom, aComps);
@ -515,6 +528,7 @@ nsXIEngine::Install(int aCustom, nsComponentList *aComps, char *aDestination)
#endif #endif
if (!currComp->IsDownloadOnly()) if (!currComp->IsDownloadOnly())
{ {
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
nsInstallDlg::MajorProgressCB(currComp->GetDescShort(), nsInstallDlg::MajorProgressCB(currComp->GetDescShort(),
compNum, mTotalComps, nsInstallDlg::ACT_INSTALL); compNum, mTotalComps, nsInstallDlg::ACT_INSTALL);
err = InstallXPI(currComp, &stub); err = InstallXPI(currComp, &stub);
@ -1032,6 +1046,7 @@ nsXIEngine::CRCCheckDownloadedArchives(char *dlPath, short dlPathlen,
buf[ dlPathlen ] = '\0'; buf[ dlPathlen ] = '\0';
strcat( buf, "/" ); strcat( buf, "/" );
strcat( buf, currComp->GetArchive() ); strcat( buf, currComp->GetArchive() );
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
nsInstallDlg::MajorProgressCB(buf, i, count, nsInstallDlg::ACT_INSTALL); nsInstallDlg::MajorProgressCB(buf, i, count, nsInstallDlg::ACT_INSTALL);
if (((aCustom == TRUE && currComp->IsSelected()) || if (((aCustom == TRUE && currComp->IsSelected()) ||
(aCustom == FALSE)) && IsArchiveFile(buf) == PR_TRUE && (aCustom == FALSE)) && IsArchiveFile(buf) == PR_TRUE &&

Просмотреть файл

@ -150,6 +150,7 @@ nsXInstaller::RunWizard(int argc, char **argv)
XI_VERIFY(gCtx); XI_VERIFY(gCtx);
// create the dialog window // create the dialog window
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT) {
gtk_set_locale(); gtk_set_locale();
gtk_init(&argc, &argv); gtk_init(&argc, &argv);
gdk_rgb_init(); gdk_rgb_init();
@ -182,14 +183,9 @@ nsXInstaller::RunWizard(int argc, char **argv)
gtk_notebook_set_scrollable(GTK_NOTEBOOK(gCtx->notebook), FALSE); gtk_notebook_set_scrollable(GTK_NOTEBOOK(gCtx->notebook), FALSE);
gtk_widget_show(gCtx->notebook); gtk_widget_show(gCtx->notebook);
gtk_container_add(GTK_CONTAINER(gCtx->canvas), gCtx->notebook); gtk_container_add(GTK_CONTAINER(gCtx->canvas), gCtx->notebook);
if (gCtx->opt->mMode == nsXIOptions::MODE_AUTO)
{
// show install dlg
gCtx->idlg->Show(nsXInstallerDlg::FORWARD_MOVE);
gCtx->idlg->Next((GtkWidget *)NULL, (gpointer) gCtx->idlg);
} }
else
if (gCtx->opt->mMode == nsXIOptions::MODE_DEFAULT)
{ {
// show welcome dlg // show welcome dlg
gCtx->wdlg->Show(nsXInstallerDlg::FORWARD_MOVE); gCtx->wdlg->Show(nsXInstallerDlg::FORWARD_MOVE);
@ -198,6 +194,13 @@ nsXInstaller::RunWizard(int argc, char **argv)
gtk_main(); gtk_main();
} }
else
{
// show install dlg
if (gCtx->opt->mMode == nsXIOptions::MODE_AUTO)
gCtx->idlg->Show(nsXInstallerDlg::FORWARD_MOVE);
gCtx->idlg->Next((GtkWidget *)NULL, (gpointer) gCtx->idlg);
}
return OK; return OK;
@ -407,6 +410,11 @@ ErrorHandler(int aErr, const char* aErrMsg)
else else
sprintf(msg, gCtx->Res("FATAL_ERROR"), aErr, gCtx->Res(errStr)); sprintf(msg, gCtx->Res("FATAL_ERROR"), aErr, gCtx->Res(errStr));
if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT)
{
fprintf (stderr, "%s\n", msg);
return aErr;
}
sErrDlg = gtk_dialog_new(); sErrDlg = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(sErrDlg), gCtx->Res("ERROR_TITLE")); gtk_window_set_title(GTK_WINDOW(sErrDlg), gCtx->Res("ERROR_TITLE"));
okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL")); okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL"));

Просмотреть файл

@ -110,6 +110,7 @@ nsZipExtractor::Extract(nsComponent *aXPIEngine, int aTotal)
/* update UI /* update UI
*/ */
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
nsInstallDlg::MajorProgressCB(leaf, i, nsInstallDlg::MajorProgressCB(leaf, i,
aTotal, nsInstallDlg::ACT_EXTRACT); aTotal, nsInstallDlg::ACT_EXTRACT);