Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Attributes
nsXIContext Class Reference

#include <nsXIContext.h>

Collaboration diagram for nsXIContext:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsXIContext ()
 ~nsXIContext ()
char * itoa (int n)
int LoadResources ()
int ReleaseResources ()
char * Res (char *aKey)
 nsXIContext ()
 ~nsXIContext ()
int LoadResources ()
int ReleaseResources ()
char * Res (char *aKey)

Public Attributes

nsXInstallerme
nsLicenseDlgldlg
nsWelcomeDlgwdlg
nsSetupTypeDlgsdlg
nsComponentsDlgcdlg
nsInstallDlgidlg
nsXIOptionsopt
GtkWidget * window
GtkWidget * back
GtkWidget * next
GtkWidget * cancel
GtkWidget * nextLabel
GtkWidget * backLabel
GtkWidget * acceptLabel
GtkWidget * declineLabel
GtkWidget * installLabel
GtkWidget * logo
GtkWidget * mainbox
GtkWidget * notebook
GtkWidget * header
GtkWidget * header_title
GtkWidget * header_subtitle
int backID
int nextID
int cancelID
int bDone
GtkWidget * canvas
int bMoving

Private Attributes

kvpairreslist

Detailed Description

Definition at line 64 of file nsXIContext.h.


Constructor & Destructor Documentation

Definition at line 77 of file nsXIContext.cpp.

{
    // NOTE: don't try to delete "me" cause I control thee

    ReleaseResources();

    XI_IF_DELETE(ldlg);
    XI_IF_DELETE(wdlg);
    XI_IF_DELETE(sdlg);
    XI_IF_DELETE(cdlg);
    XI_IF_DELETE(idlg);

    XI_IF_DELETE(opt);
}

Here is the call graph for this function:


Member Function Documentation

char * nsXIContext::itoa ( int  n)

Definition at line 93 of file nsXIContext.cpp.

{
       char *s;
       int i, j, sign, tmp;
       
       /* check sign and convert to positive to stringify numbers */
       if ( (sign = n) < 0)
              n = -n;
       i = 0;
       s = (char*) malloc(sizeof(char));
       
       /* grow string as needed to add numbers from powers of 10 
     * down till none left 
     */
       do
       {
              s = (char*) realloc(s, (i+1)*sizeof(char));
              s[i++] = n % 10 + '0';  /* '0' or 30 is where ASCII numbers start */
              s[i] = '\0';
       }
       while( (n /= 10) > 0);      
       
       /* tack on minus sign if we found earlier that this was negative */
       if (sign < 0)
       {
              s = (char*) realloc(s, (i+1)*sizeof(char));
              s[i++] = '-';
       }
       s[i] = '\0';
       
       /* pop numbers (and sign) off of string to push back into right direction */
       for (i = 0, j = strlen(s) - 1; i < j; i++, j--)
       {
              tmp = s[i];
              s[i] = s[j];
              s[j] = tmp;
       }
       
       return s;
}

Here is the call graph for this function:

Definition at line 138 of file nsXIContext.cpp.

{
    int err = OK;
    nsINIParser *parser = NULL;
    char *resfile = NULL;
    kvpair *currkv = NULL;
    char currkey[MAX_KEY_SIZE];
    int len, i;

    resfile = nsINIParser::ResolveName(RES_FILE);
    if (!resfile)
        return E_INVALID_PTR;

    parser = new nsINIParser(resfile);
    if (!parser)
    {
        XI_IF_FREE(resfile);
        return E_MEM;
    }

    char *strkeys[] = 
    {
        "NEXT",
        "BACK",
        "CANCEL",
        "ACCEPT",
        "DECLINE",
        "INSTALL",
        "PAUSE",
        "RESUME",
        "DEFAULT_TITLE",
        "DEST_DIR",
        "BROWSE",
        "SELECT_DIR",
        "DOESNT_EXIST",
        "YES_LABEL",
        "NO_LABEL",
        "OK_LABEL",
        "DELETE_LABEL",
        "CANCEL_LABEL",
        "ERROR",
        "FATAL_ERROR",
        "DESCRIPTION",
        "WILL_INSTALL",
        "TO_LOCATION",
        "PREPARING",
        "EXTRACTING",
        "INSTALLING_XPI",
        "PROCESSING_FILE",
        "NO_PERMS",
        "DL_SETTINGS",
        "SAVE_MODULES",
        "PROXY_SETTINGS",
        "PS_LABEL0",
        "PS_LABEL1",
        "PS_LABEL2",
        "PS_LABEL3",
        "ERROR_TITLE",
        "DS_AVAIL",
        "DS_REQD",
        "NO_DISK_SPACE",
        "CXN_DROPPED",
        "DOWNLOADING",
        "FROM",
        "TO",
        "STATUS",
        "DL_STATUS_STR",
        "CRC_FAILED",
        "CRC_CHECK",
        "USAGE_MSG",
        "UNKNOWN",

        __EOT__
    };

    /* read in UI strings */
    currkv = (kvpair *) malloc(sizeof(kvpair));
    reslist = currkv;
    for (i = 0; strcmp(strkeys[i], __EOT__) != 0; i++)
    {
        err = parser->GetStringAlloc(RES_SECT, strkeys[i], 
                                    &(currkv->val), &len);
        if (err != OK)
            goto BAIL;

        currkv->key = strdup(strkeys[i]);
        currkv->next = (kvpair *) malloc(sizeof(kvpair));
        currkv = currkv->next;

        if (i > 1024) /* inf loop prevention paranoia */
            break;
    }
    currkv->next = NULL; /* seal off list */

    /* read in err strings */
    for (i = FIRST_ERR; i >= LAST_ERR; i--)
    {
        sprintf(currkey, "%d", i);
        err = parser->GetStringAlloc(RES_SECT, currkey, &(currkv->val), &len);
        if (err != OK)
            goto BAIL;
        
        currkv->key = strdup(currkey);
        if (i == LAST_ERR)
            break;
        currkv->next = (kvpair *) malloc(sizeof(kvpair));
        currkv = currkv->next;
    }
    currkv->next = NULL; /* seal off list */

BAIL:
    if (err != OK)
    {
        fprintf(stderr, "FATAL ERROR: Failed to load resources!\n");
    }
    XI_IF_FREE(resfile);
    XI_IF_DELETE(parser);
    return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 259 of file nsXIContext.cpp.

{
    int err = OK;
    kvpair *currkv = NULL, *delkv = NULL;
    
    /* empty list -- should never really happen */
    if (!reslist) 
        return E_PARAM;
    
    currkv = reslist;
    while (currkv)
    {
        XI_IF_FREE(currkv->key);
        XI_IF_FREE(currkv->val);
        delkv = currkv;
        currkv = currkv->next;
        XI_IF_FREE(delkv);
    }

    return err;
}

Here is the caller graph for this function:

char* nsXIContext::Res ( char *  aKey)
char * nsXIContext::Res ( char *  aKey)

Definition at line 282 of file nsXIContext.cpp.

{
    char *val = NULL;
    kvpair *currkv = NULL;

    /* param check */
    if (!aKey || !reslist)
        return NULL;

    /* search through linked list */
    currkv = reslist;
    while (currkv)
    {
        if (strcmp(aKey, currkv->key) == 0)
        {
            val = currkv->val;
            break;
        }
        currkv = currkv->next;
    } 

    return val;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 92 of file nsXIContext.h.

GtkWidget * nsXIContext::back

Definition at line 87 of file nsXIContext.h.

Definition at line 102 of file nsXIContext.h.

Definition at line 91 of file nsXIContext.h.

Definition at line 105 of file nsXIContext.h.

Definition at line 103 of file nsXIContext.h.

GtkWidget * nsXIContext::cancel

Definition at line 89 of file nsXIContext.h.

Definition at line 104 of file nsXIContext.h.

GtkWidget* nsXIContext::canvas

Definition at line 97 of file nsXIContext.h.

Definition at line 78 of file nsXIContext.h.

Definition at line 93 of file nsXIContext.h.

GtkWidget* nsXIContext::header

Definition at line 98 of file nsXIContext.h.

Definition at line 100 of file nsXIContext.h.

Definition at line 99 of file nsXIContext.h.

Definition at line 79 of file nsXIContext.h.

Definition at line 94 of file nsXIContext.h.

Definition at line 75 of file nsXIContext.h.

GtkWidget * nsXIContext::logo

Definition at line 95 of file nsXIContext.h.

GtkWidget * nsXIContext::mainbox

Definition at line 96 of file nsXIContext.h.

Definition at line 70 of file nsXIContext.h.

GtkWidget * nsXIContext::next

Definition at line 88 of file nsXIContext.h.

Definition at line 103 of file nsXIContext.h.

Definition at line 90 of file nsXIContext.h.

GtkWidget * nsXIContext::notebook

Definition at line 97 of file nsXIContext.h.

Definition at line 81 of file nsXIContext.h.

Definition at line 117 of file nsXIContext.h.

Definition at line 77 of file nsXIContext.h.

Definition at line 76 of file nsXIContext.h.

GtkWidget * nsXIContext::window

Definition at line 86 of file nsXIContext.h.


The documentation for this class was generated from the following files: