From 0cc39805634404d9662d63793010e55c75d52778 Mon Sep 17 00:00:00 2001 From: "timeless%mozdev.org" Date: Tue, 27 Apr 2004 04:59:34 +0000 Subject: [PATCH] Bug 240929 make dialogs modal patch by ajschult@mindspring.com r=dveditz sr=bryner --- xpinstall/wizard/unix/src2/nsInstallDlg.cpp | 3 +++ xpinstall/wizard/unix/src2/nsSetupTypeDlg.cpp | 25 ++++--------------- xpinstall/wizard/unix/src2/nsXInstaller.cpp | 1 + 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/xpinstall/wizard/unix/src2/nsInstallDlg.cpp b/xpinstall/wizard/unix/src2/nsInstallDlg.cpp index 2ecd366366e..e2262eba6a3 100644 --- a/xpinstall/wizard/unix/src2/nsInstallDlg.cpp +++ b/xpinstall/wizard/unix/src2/nsInstallDlg.cpp @@ -939,6 +939,7 @@ nsInstallDlg::ShowProxySettings(GtkWidget *aWidget, gpointer aData) char resName[16], *text = nsnull; psDlg = gtk_dialog_new(); + gtk_window_set_modal(GTK_WINDOW(psDlg), TRUE); gtk_window_set_title(GTK_WINDOW(psDlg), gCtx->opt->mTitle); gtk_window_set_position(GTK_WINDOW(psDlg), GTK_WIN_POS_CENTER); @@ -1173,6 +1174,7 @@ nsInstallDlg::ShowCRCDlg() // throw up dialog informing user to press resume // or to cancel out crcDlg = gtk_dialog_new(); + gtk_window_set_modal(GTK_WINDOW(crcDlg), TRUE); label = gtk_label_new(gCtx->Res("CRC_CHECK")); okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL")); packer = gtk_packer_new(); @@ -1251,6 +1253,7 @@ nsInstallDlg::ShowCxnDroppedDlg() } cxnDroppedDlg = gtk_dialog_new(); + gtk_window_set_modal(GTK_WINDOW(cxnDroppedDlg), TRUE); label = gtk_label_new(gCtx->Res("CXN_DROPPED")); okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL")); packer = gtk_packer_new(); diff --git a/xpinstall/wizard/unix/src2/nsSetupTypeDlg.cpp b/xpinstall/wizard/unix/src2/nsSetupTypeDlg.cpp index 8f2e31cbec0..22b35d21f20 100644 --- a/xpinstall/wizard/unix/src2/nsSetupTypeDlg.cpp +++ b/xpinstall/wizard/unix/src2/nsSetupTypeDlg.cpp @@ -69,9 +69,6 @@ static GtkWidget *sFolder; static GSList *sGroup; static GtkWidget *sCreateDestDlg; static GtkWidget *sDelInstDlg; -static int sFilePickerUp = FALSE; -static int sConfirmCreateUp = FALSE; -static int sDelInstUp = FALSE; static nsLegacyCheck *sLegacyChecks = NULL; static nsObjectIgnore *sObjectsToIgnore = NULL; @@ -124,10 +121,6 @@ nsSetupTypeDlg::Next(GtkWidget *aWidget, gpointer aData) return; } - // creation confirmation dlg still up - if (sConfirmCreateUp || sDelInstUp) - return; - // verify selected destination directory exists if (OK != nsSetupTypeDlg::VerifyDestination()) return; @@ -693,13 +686,11 @@ nsSetupTypeDlg::SelectFolder(GtkWidget *aWidget, gpointer aData) { DUMP("SelectFolder"); - if (sFilePickerUp) - return; - GtkWidget *fileSel = NULL; char *selDir = gCtx->opt->mDestination; fileSel = gtk_file_selection_new(gCtx->Res("SELECT_DIR")); + gtk_window_set_modal(GTK_WINDOW(fileSel), TRUE); gtk_file_selection_set_filename(GTK_FILE_SELECTION(fileSel), selDir); gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fileSel)->ok_button), "clicked", (GtkSignalFunc) SelectFolderOK, fileSel); @@ -708,7 +699,6 @@ nsSetupTypeDlg::SelectFolder(GtkWidget *aWidget, gpointer aData) "clicked", (GtkSignalFunc) SelectFolderCancel, GTK_OBJECT(fileSel)); gtk_widget_show(fileSel); - sFilePickerUp = TRUE; } void @@ -734,7 +724,6 @@ nsSetupTypeDlg::SelectFolderOK(GtkWidget *aWidget, GtkFileSelection *aFileSel) // tear down file sel dlg gtk_object_destroy(GTK_OBJECT(aFileSel)); - sFilePickerUp = FALSE; } void @@ -744,7 +733,6 @@ nsSetupTypeDlg::SelectFolderCancel(GtkWidget *aWidget, // tear down file sel dlg gtk_object_destroy(GTK_OBJECT(aWidget)); gtk_object_destroy(GTK_OBJECT(aFileSel)); - sFilePickerUp = FALSE; } void @@ -773,6 +761,7 @@ nsSetupTypeDlg::VerifyDestination() sprintf(message, gCtx->Res("NO_PERMS"), gCtx->opt->mDestination); noPermsDlg = gtk_dialog_new(); + gtk_window_set_modal(GTK_WINDOW(noPermsDlg), TRUE); label = gtk_label_new(message); okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL")); @@ -808,6 +797,7 @@ nsSetupTypeDlg::VerifyDestination() sprintf(message, gCtx->Res("DOESNT_EXIST"), gCtx->opt->mDestination); sCreateDestDlg = gtk_dialog_new(); + gtk_window_set_modal(GTK_WINDOW(sCreateDestDlg), TRUE); label = gtk_label_new(message); yesButton = gtk_button_new_with_label(gCtx->Res("YES_LABEL")); noButton = gtk_button_new_with_label(gCtx->Res("NO_LABEL")); @@ -829,7 +819,6 @@ nsSetupTypeDlg::VerifyDestination() gtk_container_add(GTK_CONTAINER(GTK_DIALOG(sCreateDestDlg)->vbox), label); gtk_widget_show_all(sCreateDestDlg); - sConfirmCreateUp = TRUE; return err; } @@ -877,7 +866,6 @@ nsSetupTypeDlg::CreateDestYes(GtkWidget *aWidget, gpointer aData) umask(oldPerms); // restore original umask gtk_widget_destroy(sCreateDestDlg); - sConfirmCreateUp = FALSE; if (err != 0) { @@ -906,7 +894,6 @@ nsSetupTypeDlg::CreateDestNo(GtkWidget *aWidget, gpointer aData) DUMP("CreateDestNo"); gtk_widget_destroy(sCreateDestDlg); - sConfirmCreateUp = FALSE; } int @@ -939,6 +926,7 @@ nsSetupTypeDlg::DeleteOldInst() { // throw up delete dialog sDelInstDlg = gtk_dialog_new(); + gtk_window_set_modal(GTK_WINDOW(sDelInstDlg), TRUE); gtk_window_set_title(GTK_WINDOW(sDelInstDlg), gCtx->opt->mTitle); gtk_window_set_position(GTK_WINDOW(sDelInstDlg), GTK_WIN_POS_CENTER); @@ -984,7 +972,6 @@ nsSetupTypeDlg::DeleteOldInst() FALSE, FALSE, 0); } gtk_widget_show_all(sDelInstDlg); - sDelInstUp = TRUE; err = E_OLD_INST; break; @@ -1000,8 +987,6 @@ nsSetupTypeDlg::DeleteInstDelete(GtkWidget *aWidget, gpointer aData) { DUMP("DeleteInstDelete"); - sDelInstUp = FALSE; - if (!fork()) { execlp("rm", "rm", "-rf", gCtx->opt->mDestination, NULL); @@ -1032,7 +1017,6 @@ nsSetupTypeDlg::DeleteInstCancel(GtkWidget *aWidget, gpointer aData) { DUMP("DeleteInstCancel"); - sDelInstUp = FALSE; gtk_widget_destroy(sDelInstDlg); } @@ -1124,6 +1108,7 @@ nsSetupTypeDlg::VerifyDiskSpace(void) gCtx->Res("NO_DISK_SPACE")); noDSDlg = gtk_dialog_new(); + gtk_window_set_modal(GTK_WINDOW(noDSDlg), TRUE); label = gtk_label_new(message); okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL")); packer = gtk_packer_new(); diff --git a/xpinstall/wizard/unix/src2/nsXInstaller.cpp b/xpinstall/wizard/unix/src2/nsXInstaller.cpp index 937c511526e..8d54d0e36b9 100644 --- a/xpinstall/wizard/unix/src2/nsXInstaller.cpp +++ b/xpinstall/wizard/unix/src2/nsXInstaller.cpp @@ -453,6 +453,7 @@ ErrorHandler(int aErr, const char* aErrMsg) return aErr; } sErrDlg = gtk_dialog_new(); + gtk_window_set_modal(GTK_WINDOW(sErrDlg), TRUE); gtk_window_set_title(GTK_WINDOW(sErrDlg), gCtx->Res("ERROR_TITLE")); okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL")); label = gtk_label_new(msg);