Port XPInstall to GTK2. Bug 183389, patch by Andrew Schultz

<ajschult@verizon.net>, r=dveditz, sr=bryner
This commit is contained in:
bzbarsky%mit.edu 2005-02-24 04:13:17 +00:00
Родитель 839e767a4e
Коммит cfbff03fae
7 изменённых файлов: 102 добавлений и 45 удалений

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

@ -58,6 +58,9 @@ DIRS += wizard/libxpnet
ifdef MOZ_ENABLE_GTK
DIRS += wizard/unix/src2
endif
ifdef MOZ_ENABLE_GTK2
DIRS += wizard/unix/src2
endif
ifeq ($(OS_ARCH),WINNT)
DIRS += wizard/windows
endif

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

@ -74,9 +74,9 @@ CPPSRCS = \
$(NULL)
LIBS = \
`$(GTK_CONFIG) --libs` \
-ljar$(VERSION_NUMBER)_s \
-lxpnet_s \
$(TK_LIBS) \
$(DIST)/lib/$(LIB_PREFIX)jar$(VERSION_NUMBER)_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)xpnet_s.$(LIB_SUFFIX) \
-lpthread \
$(NULL)
@ -89,4 +89,4 @@ EXTRA_DEPS = \
include $(topsrcdir)/config/rules.mk
CXXFLAGS += `$(GTK_CONFIG) --cflags`
CXXFLAGS += $(TK_CFLAGS)

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

@ -64,11 +64,13 @@ nsComponentsDlg::Back(GtkWidget *aWidget, gpointer aData)
{
DUMP("Back");
if (aData != gCtx->cdlg) return;
#ifdef MOZ_WIDGET_GTK
if (gCtx->bMoving)
{
gCtx->bMoving = FALSE;
return;
}
#endif
// hide this notebook page
gCtx->cdlg->Hide();
@ -83,11 +85,13 @@ nsComponentsDlg::Next(GtkWidget *aWidget, gpointer aData)
{
DUMP("Next");
if (aData != gCtx->cdlg) return;
#ifdef MOZ_WIDGET_GTK
if (gCtx->bMoving)
{
gCtx->bMoving = FALSE;
return;
}
#endif
if (OK != nsSetupTypeDlg::VerifyDiskSpace())
return;
@ -97,7 +101,9 @@ nsComponentsDlg::Next(GtkWidget *aWidget, gpointer aData)
// show the next dlg
gCtx->idlg->Show();
#ifdef MOZ_WIDGET_GTK
gCtx->bMoving = TRUE;
#endif
}
int

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

@ -99,11 +99,13 @@ nsInstallDlg::Back(GtkWidget *aWidget, gpointer aData)
{
DUMP("Back");
if (aData != gCtx->idlg) return;
#ifdef MOZ_WIDGET_GTK
if (gCtx->bMoving)
{
gCtx->bMoving = FALSE;
return;
}
#endif
// hide this notebook page
gCtx->idlg->Hide();
@ -113,7 +115,9 @@ nsInstallDlg::Back(GtkWidget *aWidget, gpointer aData)
{
gCtx->cdlg->Show();
// only set bMoving for component dlg since setuptype has no "back"
#ifdef MOZ_WIDGET_GTK
gCtx->bMoving = TRUE;
#endif
}
else
{
@ -130,12 +134,14 @@ nsInstallDlg::Next(GtkWidget *aWidget, gpointer aData)
GtkWidget *pauseLabel, *resumeLabel;
if (aData != gCtx->idlg) return;
#ifdef MOZ_WIDGET_GTK
if (gCtx->bMoving)
{
gCtx->bMoving = FALSE;
DUMP("Moving done!");
return;
}
#endif
bCus = (gCtx->opt->mSetupType == (gCtx->sdlg->GetNumSetupTypes() - 1));
comps = gCtx->sdlg->GetSelectedSetupType()->GetComponents();
@ -210,7 +216,9 @@ nsInstallDlg::Next(GtkWidget *aWidget, gpointer aData)
if (gCtx->opt->mMode == nsXIOptions::MODE_DEFAULT)
gtk_main_quit();
#ifdef MOZ_WIDGET_GTK
gCtx->bMoving = TRUE;
#endif
return;
}
@ -959,7 +967,7 @@ nsInstallDlg::SaveModulesToggled(GtkWidget *aWidget, gpointer aData)
void
nsInstallDlg::ShowProxySettings(GtkWidget *aWidget, gpointer aData)
{
GtkWidget *psDlg, *psTable, *packer;
GtkWidget *psDlg, *psTable;
GtkWidget *okButton, *cancelButton;
GtkWidget *psLabel[NUM_PS_ENTRIES];
int i;
@ -981,12 +989,9 @@ nsInstallDlg::ShowProxySettings(GtkWidget *aWidget, gpointer aData)
psLabel[i] = gtk_label_new(gCtx->Res(resName));
gtk_widget_show(psLabel[i]);
packer = gtk_packer_new();
gtk_packer_add_defaults(GTK_PACKER(packer), psLabel[i], GTK_SIDE_RIGHT,
GTK_ANCHOR_CENTER, GTK_FILL_X);
gtk_widget_show(packer);
gtk_misc_set_alignment(GTK_MISC(psLabel[i]), 1, 0.5);
gtk_table_attach(GTK_TABLE(psTable), packer, 0, 1, i, i + 1,
gtk_table_attach(GTK_TABLE(psTable), psLabel[i], 0, 1, i, i + 1,
static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND),
static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), 5, 5);
}
@ -1190,7 +1195,7 @@ static GtkWidget *crcDlg = (GtkWidget *) NULL;
void
nsInstallDlg::ShowCRCDlg()
{
GtkWidget *label, *okButton, *packer;
GtkWidget *label, *okButton;
if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT) {
ErrorHandler(E_CRC_FAILED);
@ -1204,17 +1209,14 @@ nsInstallDlg::ShowCRCDlg()
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();
if (crcDlg && label && okButton && packer)
if (crcDlg && label && okButton )
{
gtk_packer_set_default_border_width(GTK_PACKER(packer), 20);
gtk_packer_add_defaults(GTK_PACKER(packer), label, GTK_SIDE_BOTTOM,
GTK_ANCHOR_CENTER, GTK_FILL_X);
gtk_misc_set_padding(GTK_MISC(label), 20, 20);
gtk_misc_set_alignment(GTK_MISC(label), 0.5, 1);
gtk_window_set_title(GTK_WINDOW(crcDlg), gCtx->opt->mTitle);
gtk_window_set_position(GTK_WINDOW(crcDlg), GTK_WIN_POS_CENTER);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(crcDlg)->vbox),
packer);
label);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(crcDlg)->action_area),
okButton);
gtk_signal_connect(GTK_OBJECT(okButton), "clicked",
@ -1230,7 +1232,7 @@ nsInstallDlg::ShowCRCDlg()
int
nsInstallDlg::ShowCxnDroppedDlg()
{
GtkWidget *cxnDroppedDlg, *label, *okButton, *packer;
GtkWidget *cxnDroppedDlg, *label, *okButton;
// throw up dialog informing user to press resume
// or to cancel out
@ -1243,18 +1245,16 @@ nsInstallDlg::ShowCxnDroppedDlg()
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();
if (cxnDroppedDlg && label && okButton && packer)
if (cxnDroppedDlg && label && okButton )
{
gtk_packer_set_default_border_width(GTK_PACKER(packer), 20);
gtk_packer_add_defaults(GTK_PACKER(packer), label, GTK_SIDE_BOTTOM,
GTK_ANCHOR_CENTER, GTK_FILL_X);
gtk_misc_set_padding(GTK_MISC(label), 20, 20);
gtk_misc_set_alignment(GTK_MISC(label), 0.5, 1);
gtk_window_set_modal(GTK_WINDOW(cxnDroppedDlg), TRUE);
gtk_window_set_title(GTK_WINDOW(cxnDroppedDlg), gCtx->opt->mTitle);
gtk_window_set_position(GTK_WINDOW(cxnDroppedDlg), GTK_WIN_POS_CENTER);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(cxnDroppedDlg)->vbox),
packer);
label);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(cxnDroppedDlg)->action_area),
okButton);
gtk_signal_connect(GTK_OBJECT(okButton), "clicked",

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

@ -56,11 +56,13 @@ nsLicenseDlg::Back(GtkWidget *aWidget, gpointer aData)
{
DUMP("Back");
if (aData != gCtx->ldlg) return;
#ifdef MOZ_WIDGET_GTK
if (gCtx->bMoving)
{
gCtx->bMoving = FALSE;
return;
}
#endif
gtk_main_quit();
return;
@ -71,18 +73,22 @@ nsLicenseDlg::Next(GtkWidget *aWidget, gpointer aData)
{
DUMP("Next");
if (aData != gCtx->ldlg) return;
#ifdef MOZ_WIDGET_GTK
if (gCtx->bMoving)
{
gCtx->bMoving = FALSE;
return;
}
#endif
// hide this notebook page
gCtx->ldlg->Hide();
// show the next dlg
gCtx->sdlg->Show();
#ifdef MOZ_WIDGET_GTK
gCtx->bMoving = TRUE;
#endif
}
int
@ -149,6 +155,7 @@ nsLicenseDlg::Show()
goto BAIL;
}
#if defined(MOZ_WIDGET_GTK)
// create a new scrollable textarea and add it to the table
GtkWidget *text = gtk_text_new(NULL, NULL);
GdkFont *font = gdk_font_load( LICENSE_FONT );
@ -172,6 +179,24 @@ nsLicenseDlg::Show()
static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_SHRINK | GTK_FILL),
0, 0);
gtk_widget_show(vscrollbar);
#elif defined(MOZ_WIDGET_GTK2)
GtkWidget *text = gtk_scrolled_window_new (NULL, NULL);
GtkWidget *textview = gtk_text_view_new();
GtkTextBuffer *textbuffer;
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
gtk_text_buffer_set_text (textbuffer, licenseContents, -1);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (text),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (text), textview);
gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW(textview), FALSE);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD);
gtk_table_attach(GTK_TABLE(mTable), text, 1, 2, 0, 1,
static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND ),
static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), 0, 0);
gtk_widget_show_all(text);
#endif
mWidgetsInit = TRUE;
}

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

@ -91,11 +91,13 @@ nsSetupTypeDlg::Next(GtkWidget *aWidget, gpointer aData)
{
DUMP("Next");
if (aData && aData != gCtx->sdlg) return;
#ifdef MOZ_WIDGET_GTK
if (gCtx->bMoving)
{
gCtx->bMoving = FALSE;
return;
}
#endif
// verify selected destination directory exists
if (OK != nsSetupTypeDlg::VerifyDestination())
@ -139,12 +141,14 @@ nsSetupTypeDlg::Next(GtkWidget *aWidget, gpointer aData)
}
}
#ifdef MOZ_WIDGET_GTK
// When Next() is not invoked from a signal handler, the caller passes
// aData as NULL so we know not to do the bMoving hack.
if (aData)
{
gCtx->bMoving = TRUE;
}
#endif
}
int
@ -668,7 +672,7 @@ nsSetupTypeDlg::SelectFolderOK(GtkWidget *aWidget, GtkFileSelection *aFileSel)
DUMP("SelectFolderOK");
struct stat destStat;
char *selDir = gtk_file_selection_get_filename(
const char *selDir = gtk_file_selection_get_filename(
GTK_FILE_SELECTION(aFileSel));
// put the candidate file name in the global variable, then verify it
@ -1011,7 +1015,7 @@ nsSetupTypeDlg::ConstructPath(char *aDest, char *aTrunk, char *aLeaf)
int
nsSetupTypeDlg::CheckDestEmpty()
{
DUMP("DeleteOldInst");
DUMP("CheckDestEmpty");
DIR *destDirD;
struct dirent *de;
@ -1052,7 +1056,7 @@ nsSetupTypeDlg::VerifyDiskSpace(void)
int dsAvail, dsReqd;
char dsAvailStr[128], dsReqdStr[128];
char message[512];
GtkWidget *noDSDlg, *label, *okButton, *packer;
GtkWidget *noDSDlg, *label, *okButton;
// find disk space available at destination
dsAvail = DSAvailable();
@ -1077,24 +1081,22 @@ nsSetupTypeDlg::VerifyDiskSpace(void)
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();
if (noDSDlg && label && okButton && packer)
if (noDSDlg && label && okButton)
{
gtk_window_set_title(GTK_WINDOW(noDSDlg), gCtx->opt->mTitle);
gtk_window_set_position(GTK_WINDOW(noDSDlg),
GTK_WIN_POS_CENTER);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_packer_set_default_border_width(GTK_PACKER(packer), 20);
gtk_packer_add_defaults(GTK_PACKER(packer), label,
GTK_SIDE_BOTTOM, GTK_ANCHOR_CENTER, GTK_FILL_X);
gtk_misc_set_padding(GTK_MISC(label), 20, 20);
gtk_misc_set_alignment(GTK_MISC(label), 0.5, 1);
gtk_box_pack_start(GTK_BOX(
GTK_DIALOG(noDSDlg)->action_area), okButton,
FALSE, FALSE, 10);
gtk_signal_connect(GTK_OBJECT(okButton), "clicked",
GTK_SIGNAL_FUNC(NoDiskSpaceOK), noDSDlg);
gtk_box_pack_start(GTK_BOX(
GTK_DIALOG(noDSDlg)->vbox), packer, FALSE, FALSE, 10);
GTK_DIALOG(noDSDlg)->vbox), label, FALSE, FALSE, 10);
GTK_WIDGET_SET_FLAGS(okButton, GTK_CAN_DEFAULT);
gtk_widget_grab_default(okButton);

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

@ -58,18 +58,22 @@ nsWelcomeDlg::Next(GtkWidget *aWidget, gpointer aData)
{
DUMP("Next");
if (aData != gCtx->wdlg) return;
#ifdef MOZ_WIDGET_GTK
if (gCtx->bMoving)
{
gCtx->bMoving = FALSE;
return;
}
#endif
// hide this notebook page
gCtx->wdlg->Hide();
// show the next dlg
gCtx->ldlg->Show();
#ifdef MOZ_WIDGET_GTK
gCtx->bMoving = TRUE;
#endif
}
int
@ -137,6 +141,7 @@ nsWelcomeDlg::Show()
}
// create a new scrollable textarea and add it to the table
#if defined(MOZ_WIDGET_GTK)
GtkWidget *text = gtk_text_new(NULL, NULL);
GdkFont *font = gdk_font_load( README_FONT );
gtk_text_set_editable(GTK_TEXT(text), FALSE);
@ -153,11 +158,27 @@ nsWelcomeDlg::Show()
// Add a vertical scrollbar to the GtkText widget
GtkWidget *vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
gtk_table_attach(GTK_TABLE(mTable), vscrollbar, 2, 3, 0, 1,
GTK_FILL,
gtk_table_attach(GTK_TABLE(mTable), vscrollbar, 2, 3, 0, 1, GTK_FILL,
static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_SHRINK | GTK_FILL),
0, 0);
gtk_widget_show(vscrollbar);
#elif defined(MOZ_WIDGET_GTK2)
GtkWidget *text = gtk_scrolled_window_new (NULL, NULL);
GtkWidget *textview = gtk_text_view_new();
GtkTextBuffer *textbuffer;
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
gtk_text_buffer_set_text (textbuffer, readmeContents, -1);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (text),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (text), textview);
gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW(textview), FALSE);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD);
gtk_table_attach_defaults(GTK_TABLE(mTable), text, 1, 2, 0, 1);
gtk_widget_show_all(text);
#endif
mWidgetsInit = TRUE;
}