Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
nsXInstaller.cpp File Reference
#include "nscore.h"
#include "nsXInstaller.h"
#include "logo.xpm"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 The Xalan testcases app.
int ErrorHandler (int aErr, const char *aErrMsg)
void ErrDlgOK (GtkWidget *aWidget, gpointer aData)
int IsErrFatal (int aErr)

Variables

nsXIContextgCtx = NULL
static GtkWidget * sErrDlg = NULL

Function Documentation

void ErrDlgOK ( GtkWidget *  aWidget,
gpointer  aData 
)

Definition at line 473 of file nsXInstaller.cpp.

{
    gtk_widget_destroy(sErrDlg);
    sErrDlg = NULL;

    gtk_main_quit();
}

Here is the call graph for this function:

int ErrorHandler ( int  aErr,
const char *  aErrMsg 
)

Definition at line 417 of file nsXInstaller.cpp.

{
    GtkWidget *okButton, *label;
    char msg[256];
    char newmsg[256];
    char errStr[16];
    
    sprintf(errStr, "%d", aErr); 
    if (aErrMsg != NULL)
       sprintf(newmsg, gCtx->Res(errStr), aErrMsg);
    else
       strcpy(newmsg, gCtx->Res(errStr));

    if (!IsErrFatal(aErr))
        sprintf(msg, gCtx->Res("ERROR"), aErr, newmsg);
    else
        sprintf(msg, gCtx->Res("FATAL_ERROR"), aErr, newmsg);
    
    // lack of gCtx->window indicates we have not yet run RunWizard 
    // and gtk_init
    if (gCtx->opt->mMode == nsXIOptions::MODE_SILENT || !gCtx->window)
    {
        fprintf (stderr, "%s\n", msg);
        if (IsErrFatal(aErr))
            exit(aErr);
        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);

    gtk_window_set_position(GTK_WINDOW(sErrDlg), GTK_WIN_POS_CENTER);
    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(sErrDlg)->action_area), 
                      okButton);
    gtk_signal_connect(GTK_OBJECT(okButton), "clicked",
                       GTK_SIGNAL_FUNC(ErrDlgOK), NULL);
    gtk_signal_connect(GTK_OBJECT(sErrDlg), "delete_event",
                       GTK_SIGNAL_FUNC(ErrDlgOK), NULL);

    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(sErrDlg)->vbox), label);
    
    GTK_WIDGET_SET_FLAGS(okButton, GTK_CAN_DEFAULT);
    gtk_widget_grab_default(okButton);
    gtk_widget_show_all(sErrDlg);

    gtk_main();

    if (IsErrFatal(aErr))
        exit(aErr);

    return aErr;
}

Here is the call graph for this function:

int IsErrFatal ( int  aErr)

Definition at line 482 of file nsXInstaller.cpp.

{
    int bFatal = TRUE;

    /* non-fatal errors */
    switch (aErr)
    {
        case E_XPI_FAIL:
        case E_INSTALL:
        case E_MKDIR_FAIL:
        case E_OLD_INST:
        case E_DIR_NOT_EMPTY:
        case E_INVALID_PROXY:
            bFatal = FALSE;
        default:
            break; 
    }

    return bFatal;
}
int main ( int  argc,
char **  argv 
)

The Xalan testcases app.

Definition at line 392 of file nsXInstaller.cpp.

{
    nsXInstaller *installer = new nsXInstaller();
    int err = OK;

    if (installer)
    {
        if ( (err = installer->ParseConfig()) == OK)
        {
            if (installer->ParseArgs(argc, argv) == OK)
                err = installer->RunWizard(argc, argv);
        }
    }
    else
        err = E_MEM;

    XI_IF_DELETE(installer);

    exit(err);
}

Here is the call graph for this function:


Variable Documentation

Definition at line 44 of file nsXInstaller.cpp.

GtkWidget* sErrDlg = NULL [static]

Definition at line 45 of file nsXInstaller.cpp.