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,61 +131,64 @@ nsInstallDlg::Next(GtkWidget *aWidget, gpointer aData)
else else
bDownload = TRUE; bDownload = TRUE;
gtk_progress_set_activity_mode(GTK_PROGRESS(sMajorProgBar), FALSE); if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT) {
gtk_progress_bar_update(GTK_PROGRESS_BAR(sMajorProgBar), (gfloat) 0); gtk_progress_set_activity_mode(GTK_PROGRESS(sMajorProgBar), FALSE);
gtk_label_set_text(GTK_LABEL(sMajorLabel), ""); gtk_progress_bar_update(GTK_PROGRESS_BAR(sMajorProgBar), (gfloat) 0);
gtk_label_set_text(GTK_LABEL(sMajorLabel), "");
if (bDownload) if (bDownload)
{ {
InitDLProgress( TRUE ); InitDLProgress( TRUE );
pauseLabel = gtk_label_new(gCtx->Res("PAUSE")); pauseLabel = gtk_label_new(gCtx->Res("PAUSE"));
resumeLabel = gtk_label_new(gCtx->Res("RESUME")); resumeLabel = gtk_label_new(gCtx->Res("RESUME"));
gtk_container_remove(GTK_CONTAINER(gCtx->back), gCtx->backLabel); gtk_container_remove(GTK_CONTAINER(gCtx->back), gCtx->backLabel);
gtk_container_remove(GTK_CONTAINER(gCtx->next), gCtx->installLabel); gtk_container_remove(GTK_CONTAINER(gCtx->next), gCtx->installLabel);
gtk_container_add(GTK_CONTAINER(gCtx->back), pauseLabel); gtk_container_add(GTK_CONTAINER(gCtx->back), pauseLabel);
gtk_container_add(GTK_CONTAINER(gCtx->next), resumeLabel); gtk_container_add(GTK_CONTAINER(gCtx->next), resumeLabel);
gtk_widget_show(pauseLabel); gtk_widget_show(pauseLabel);
gtk_widget_show(resumeLabel); gtk_widget_show(resumeLabel);
gtk_signal_disconnect(GTK_OBJECT(gCtx->back), gCtx->backID); gtk_signal_disconnect(GTK_OBJECT(gCtx->back), gCtx->backID);
gtk_signal_disconnect(GTK_OBJECT(gCtx->next), gCtx->nextID); gtk_signal_disconnect(GTK_OBJECT(gCtx->next), gCtx->nextID);
gtk_signal_disconnect(GTK_OBJECT(gCtx->cancel), gCtx->cancelID); gtk_signal_disconnect(GTK_OBJECT(gCtx->cancel), gCtx->cancelID);
// disable resume button // disable resume button
gtk_widget_set_sensitive(gCtx->next, FALSE); gtk_widget_set_sensitive(gCtx->next, FALSE);
XI_GTK_UPDATE_UI();
// hook up buttons with callbacks
gCtx->backID = gtk_signal_connect(GTK_OBJECT(gCtx->back), "clicked",
GTK_SIGNAL_FUNC(DLPause), NULL);
gCtx->nextID = gtk_signal_connect(GTK_OBJECT(gCtx->next), "clicked",
GTK_SIGNAL_FUNC(DLResume), NULL);
gCtx->cancelID = gtk_signal_connect(GTK_OBJECT(gCtx->cancel), "clicked",
GTK_SIGNAL_FUNC(DLCancel), NULL);
}
else
{
gtk_widget_show(sMajorLabel);
gtk_widget_show(sMajorProgBar);
gtk_widget_hide(gCtx->back);
gtk_widget_hide(gCtx->next);
gtk_widget_hide(gCtx->cancel);
}
gtk_widget_hide(sMsg0Label);
if (bDownload && sDLTable)
gtk_widget_hide(sDLTable);
XI_GTK_UPDATE_UI(); XI_GTK_UPDATE_UI();
// hook up buttons with callbacks bInstallClicked = TRUE;
gCtx->backID = gtk_signal_connect(GTK_OBJECT(gCtx->back), "clicked",
GTK_SIGNAL_FUNC(DLPause), NULL);
gCtx->nextID = gtk_signal_connect(GTK_OBJECT(gCtx->next), "clicked",
GTK_SIGNAL_FUNC(DLResume), NULL);
gCtx->cancelID = gtk_signal_connect(GTK_OBJECT(gCtx->cancel), "clicked",
GTK_SIGNAL_FUNC(DLCancel), NULL);
}
else
{
gtk_widget_show(sMajorLabel);
gtk_widget_show(sMajorProgBar);
gtk_widget_hide(gCtx->back);
gtk_widget_hide(gCtx->next);
gtk_widget_hide(gCtx->cancel);
} }
gtk_widget_hide(sMsg0Label);
if (bDownload && sDLTable)
gtk_widget_hide(sDLTable);
XI_GTK_UPDATE_UI();
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,7 +562,8 @@ nsInstallDlg::PerformInstall()
err = engine->Download(bCus, comps); err = engine->Download(bCus, comps);
if (err == E_DL_DROP_CXN) if (err == E_DL_DROP_CXN)
{ {
DLPause(NULL, NULL); if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
DLPause(NULL, NULL);
ShowCxnDroppedDlg(); ShowCxnDroppedDlg();
return err; return err;
} }
@ -581,8 +585,11 @@ nsInstallDlg::PerformInstall()
} }
// prepare install UI // prepare install UI
InitInstallProgress(); if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
HideNavButtons(); {
InitInstallProgress();
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);
} }
ShowCompleteDlg(); if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
{
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)
@ -681,7 +693,7 @@ nsInstallDlg::MajorProgressCB(char *aName, int aNum, int aTotal, int aActivity)
char msg[256]; char msg[256];
if (!aName) if (!aName)
return; return;
#ifdef DEBUG #ifdef DEBUG
printf("%s %d: Name = %s\tNum = %d\tTotal = %d\tAct = %d\n", printf("%s %d: Name = %s\tNum = %d\tTotal = %d\tAct = %d\n",
@ -745,7 +757,7 @@ nsInstallDlg::SetDownloadComp(nsComponent *aComp, int aURLIndex,
char localPath[MAXPATHLEN]; char localPath[MAXPATHLEN];
if (!aComp) if (!aComp)
return; return;
if (!bHaveXPIDir) if (!bHaveXPIDir)
{ {
@ -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,8 +156,9 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
currURL = currComp->GetURL(i); currURL = currComp->GetURL(i);
if (!currURL) break; if (!currURL) break;
nsInstallDlg::SetDownloadComp(currComp, i, if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
currCompNum, numToDL); nsInstallDlg::SetDownloadComp(currComp, i,
currCompNum, numToDL);
// restore resume position // restore resume position
resPos = currComp->GetResumePos(); resPos = currComp->GetResumePos();
@ -202,8 +203,11 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
{ {
sprintf(localPath, "%s/%s", XPI_DIR, sprintf(localPath, "%s/%s", XPI_DIR,
currComp->GetArchive()); currComp->GetArchive());
err = conn->Get(nsInstallDlg::DownloadCB, localPath, if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT)
resPos); err = conn->Get(NULL, localPath, resPos);
else
err = conn->Get(nsInstallDlg::DownloadCB, localPath,
resPos);
conn->Close(); conn->Close();
} }
@ -237,8 +241,11 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
{ {
sprintf(localPath, "%s/%s", XPI_DIR, sprintf(localPath, "%s/%s", XPI_DIR,
currComp->GetArchive()); currComp->GetArchive());
err = conn->Get(nsInstallDlg::DownloadCB, localPath, if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT)
resPos); err = conn->Get(NULL, localPath, resPos);
else
err = conn->Get(nsInstallDlg::DownloadCB, localPath,
resPos);
conn->Close(); conn->Close();
} }
@ -291,8 +298,12 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
{ {
sprintf(localPath, "%s/%s", XPI_DIR, sprintf(localPath, "%s/%s", XPI_DIR,
currComp->GetArchive()); currComp->GetArchive());
err = conn->Get(srvPath, localPath, nsFTPConn::BINARY, if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT)
resPos, 1, nsInstallDlg::DownloadCB); err = conn->Get(srvPath, localPath, nsFTPConn::BINARY,
resPos, 1, NULL);
else
err = conn->Get(srvPath, localPath, nsFTPConn::BINARY,
resPos, 1, nsInstallDlg::DownloadCB);
passCount++; passCount++;
} }
@ -339,7 +350,8 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
} }
} }
nsInstallDlg::ClearRateLabel(); // clean after ourselves if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
nsInstallDlg::ClearRateLabel(); // clean after ourselves
if (err == OK) if (err == OK)
{ {
@ -368,7 +380,8 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
currCompNum = 1; currCompNum = 1;
} }
currCompSave = currComp; currCompSave = currComp;
gCtx->idlg->ReInitUI(); if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
gCtx->idlg->ReInitUI();
gCtx->idlg->ShowCRCDlg(); gCtx->idlg->ShowCRCDlg();
numToDL = TotalToDownload(aCustom, aComps); numToDL = TotalToDownload(aCustom, aComps);
} }
@ -515,8 +528,9 @@ nsXIEngine::Install(int aCustom, nsComponentList *aComps, char *aDestination)
#endif #endif
if (!currComp->IsDownloadOnly()) if (!currComp->IsDownloadOnly())
{ {
nsInstallDlg::MajorProgressCB(currComp->GetDescShort(), if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
compNum, mTotalComps, nsInstallDlg::ACT_INSTALL); nsInstallDlg::MajorProgressCB(currComp->GetDescShort(),
compNum, mTotalComps, nsInstallDlg::ACT_INSTALL);
err = InstallXPI(currComp, &stub); err = InstallXPI(currComp, &stub);
if (err != OK) if (err != OK)
if (err == E_INSTALL) if (err == E_INSTALL)
@ -1032,7 +1046,8 @@ nsXIEngine::CRCCheckDownloadedArchives(char *dlPath, short dlPathlen,
buf[ dlPathlen ] = '\0'; buf[ dlPathlen ] = '\0';
strcat( buf, "/" ); strcat( buf, "/" );
strcat( buf, currComp->GetArchive() ); strcat( buf, currComp->GetArchive() );
nsInstallDlg::MajorProgressCB(buf, i, count, nsInstallDlg::ACT_INSTALL); if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
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 &&
VerifyArchive( buf ) != ZIP_OK) { VerifyArchive( buf ) != ZIP_OK) {

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

@ -150,46 +150,42 @@ nsXInstaller::RunWizard(int argc, char **argv)
XI_VERIFY(gCtx); XI_VERIFY(gCtx);
// create the dialog window // create the dialog window
gtk_set_locale(); if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT) {
gtk_init(&argc, &argv); gtk_set_locale();
gdk_rgb_init(); gtk_init(&argc, &argv);
gdk_rgb_init();
gCtx->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gCtx->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
XI_VERIFY(gCtx->window); XI_VERIFY(gCtx->window);
gtk_window_set_position(GTK_WINDOW(gCtx->window), GTK_WIN_POS_CENTER); gtk_window_set_position(GTK_WINDOW(gCtx->window), GTK_WIN_POS_CENTER);
gtk_signal_connect(GTK_OBJECT(gCtx->window), "delete_event", gtk_signal_connect(GTK_OBJECT(gCtx->window), "delete_event",
GTK_SIGNAL_FUNC(Kill), NULL); GTK_SIGNAL_FUNC(Kill), NULL);
gtk_widget_set_usize(gCtx->window, XI_WIN_WIDTH, XI_WIN_HEIGHT); gtk_widget_set_usize(gCtx->window, XI_WIN_WIDTH, XI_WIN_HEIGHT);
gtk_container_set_border_width(GTK_CONTAINER(gCtx->window), 5); gtk_container_set_border_width(GTK_CONTAINER(gCtx->window), 5);
gtk_window_set_title(GTK_WINDOW(gCtx->window), gCtx->opt->mTitle); gtk_window_set_title(GTK_WINDOW(gCtx->window), gCtx->opt->mTitle);
gtk_widget_show(gCtx->window); gtk_widget_show(gCtx->window);
// create and display the logo and cancel button // create and display the logo and cancel button
logovbox = DrawLogo(); logovbox = DrawLogo();
if (logovbox) if (logovbox)
DrawCancelButton(logovbox); DrawCancelButton(logovbox);
// create and display the nav buttons // create and display the nav buttons
XI_ERR_BAIL(DrawNavButtons()); XI_ERR_BAIL(DrawNavButtons());
// create the notebook whose pages are dlgs // create the notebook whose pages are dlgs
gCtx->notebook = gtk_notebook_new(); gCtx->notebook = gtk_notebook_new();
XI_VERIFY(gCtx->notebook); XI_VERIFY(gCtx->notebook);
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gCtx->notebook), FALSE); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gCtx->notebook), FALSE);
gtk_notebook_set_show_border(GTK_NOTEBOOK(gCtx->notebook), FALSE); gtk_notebook_set_show_border(GTK_NOTEBOOK(gCtx->notebook), FALSE);
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,8 +110,9 @@ nsZipExtractor::Extract(nsComponent *aXPIEngine, int aTotal)
/* update UI /* update UI
*/ */
nsInstallDlg::MajorProgressCB(leaf, i, if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
aTotal, nsInstallDlg::ACT_EXTRACT); nsInstallDlg::MajorProgressCB(leaf, i,
aTotal, nsInstallDlg::ACT_EXTRACT);
sprintf(epath, "%s/%s", mDest, zpath); sprintf(epath, "%s/%s", mDest, zpath);
err = DirCreateRecursive(epath); err = DirCreateRecursive(epath);