Back to index

lightning-sunbird  0.9+nobinonly
Classes | Enumerations | Functions | Variables
prefapi_private_data.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pref_saveArgs

Enumerations

enum  pref_SaveTypes { SAVE_NONSHARED, SAVE_SHARED, SAVE_ALL }

Functions

PLDHashOperator pref_savePref (PLDHashTable *table, PLDHashEntryHdr *heh, PRUint32 i, void *arg)
int PR_CALLBACK pref_CompareStrings (const void *v1, const void *v2, void *unused)

Variables

PLDHashTable gHashTable
PRBool gDirty

Class Documentation

struct pref_saveArgs

Definition at line 46 of file prefapi_private_data.h.

Class Members
char ** prefArray
pref_SaveTypes saveTypes

Enumeration Type Documentation

Enumerator:
SAVE_NONSHARED 
SAVE_SHARED 
SAVE_ALL 

Definition at line 43 of file prefapi_private_data.h.


Function Documentation

int PR_CALLBACK pref_CompareStrings ( const void v1,
const void v2,
void unused 
)

Definition at line 379 of file prefapi.cpp.

{
    char *s1 = *(char**) v1;
    char *s2 = *(char**) v2;

    if (!s1)
    {
        if (!s2)
            return 0;
        else
            return -1;
    }
    else if (!s2)
        return 1;
    else
        return strcmp(s1, s2);
}

Here is the caller graph for this function:

PLDHashOperator pref_savePref ( PLDHashTable table,
PLDHashEntryHdr heh,
PRUint32  i,
void arg 
)

Definition at line 321 of file prefapi.cpp.

{
    pref_saveArgs *argData = NS_STATIC_CAST(pref_saveArgs *, arg);
    PrefHashEntry *pref = NS_STATIC_CAST(PrefHashEntry *, heh);

    PR_ASSERT(pref);
    if (!pref)
        return PL_DHASH_NEXT;

    nsCAutoString prefValue;

    // where we're getting our pref from
    PrefValue* sourcePref;

    if (PREF_HAS_USER_VALUE(pref) &&
        pref_ValueChanged(pref->defaultPref,
                          pref->userPref,
                          (PrefType) PREF_TYPE(pref)))
        sourcePref = &pref->userPref;
    else if (PREF_IS_LOCKED(pref))
        sourcePref = &pref->defaultPref;
    else
        // do not save default prefs that haven't changed
        return PL_DHASH_NEXT;

#if MOZ_PROFILESHARING
  if ((argData->saveTypes == SAVE_SHARED &&
      !gSharedPrefHandler->IsPrefShared(pref->key)) ||
      (argData->saveTypes == SAVE_NONSHARED &&
      gSharedPrefHandler->IsPrefShared(pref->key)))
    return PL_DHASH_NEXT;
#endif

    // strings are in quotes!
    if (pref->flags & PREF_STRING) {
        prefValue = '\"';
        str_escape(sourcePref->stringVal, prefValue);
        prefValue += '\"';
    }

    else if (pref->flags & PREF_INT)
        prefValue.AppendInt(sourcePref->intVal);

    else if (pref->flags & PREF_BOOL)
        prefValue = (sourcePref->boolVal) ? "true" : "false";

    nsCAutoString prefName;
    str_escape(pref->key, prefName);

    argData->prefArray[i] = ToNewCString(NS_LITERAL_CSTRING("user_pref(\"") +
                                prefName +
                                NS_LITERAL_CSTRING("\", ") +
                                prefValue +
                                NS_LITERAL_CSTRING(");"));
    return PL_DHASH_NEXT;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 120 of file prefapi.cpp.

Definition at line 118 of file prefapi.cpp.