// // Read values from the user's preferences. // This is done once at startup, but since the user's preferences // haven't actually been read yet at that time, we also have to // set a callback to inform us of changes to each pref. // void nsXPLookAndFeel::Init() { // Say we're already initialized, and take the chance that it might fail; // protects against some other process writing to our static variables. sInitialized = PR_TRUE; nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); if (!prefs) return; nsCOMPtr<nsIPrefBranch2> prefBranchInternal(do_QueryInterface(prefs)); if (!prefBranchInternal) return; unsigned int i; for (i = 0; i < NS_ARRAY_LENGTH(sIntPrefs); ++i) { InitFromPref(&sIntPrefs[i], prefs); prefBranchInternal->AddObserver(sIntPrefs[i].name, this, PR_FALSE); } for (i = 0; i < NS_ARRAY_LENGTH(sFloatPrefs); ++i) { InitFromPref(&sFloatPrefs[i], prefs); prefBranchInternal->AddObserver(sFloatPrefs[i].name, this, PR_FALSE); } for (i = 0; i < NS_ARRAY_LENGTH(sColorPrefs); ++i) { InitColorFromPref(i, prefs); prefBranchInternal->AddObserver(sColorPrefs[i], this, PR_FALSE); } }
nsMsgAccountManagerDataSource::nsMsgAccountManagerDataSource() { #ifdef DEBUG_amds printf("nsMsgAccountManagerDataSource() being created\n"); #endif // do per-class initialization here if (gAccountManagerResourceRefCnt++ == 0) { getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_CHILD), &kNC_Child); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_NAME), &kNC_Name); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREENAME), &kNC_FolderTreeName); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREESIMPLENAME), &kNC_FolderTreeSimpleName); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_NAME_SORT), &kNC_NameSort); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREENAME_SORT), &kNC_FolderTreeNameSort); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETAG), &kNC_PageTag); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_ISDEFAULTSERVER), &kNC_IsDefaultServer); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_SUPPORTSFILTERS), &kNC_SupportsFilters); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANGETMESSAGES), &kNC_CanGetMessages); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANGETINCOMINGMESSAGES), &kNC_CanGetIncomingMessages); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_ACCOUNT), &kNC_Account); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_SERVER), &kNC_Server); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_IDENTITY), &kNC_Identity); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_JUNK), &kNC_Junk); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_MAIN), &kNC_PageTitleMain); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_SERVER), &kNC_PageTitleServer); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_COPIES), &kNC_PageTitleCopies); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_OFFLINEANDDISKSPACE), &kNC_PageTitleOfflineAndDiskSpace); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_DISKSPACE), &kNC_PageTitleDiskSpace); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_ADDRESSING), &kNC_PageTitleAddressing); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_SMTP), &kNC_PageTitleSMTP); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_JUNK), &kNC_PageTitleJunk); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_FAKEACCOUNT), &kNC_PageTitleFakeAccount); getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_ACCOUNTROOT), &kNC_AccountRoot); getRDFService()->GetLiteral(NS_LITERAL_STRING("true").get(), &kTrueLiteral); // eventually these need to exist in some kind of array // that's easily extensible getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_SETTINGS), &kNC_Settings); kDefaultServerAtom = NS_NewAtom("DefaultServer"); } nsCOMPtr<nsIPrefBranch2> prefBranchInternal(do_GetService(NS_PREFSERVICE_CONTRACTID)); if (prefBranchInternal) prefBranchInternal->AddObserver(PREF_SHOW_FAKE_ACCOUNT, this, PR_FALSE); }