Bug 357616 Remove remaining traces of nsIPref from widget/

r+sr=roc
This commit is contained in:
cbiesinger%web.de 2006-10-23 15:29:09 +00:00
Родитель c0603518e5
Коммит cfd35e7c04
12 изменённых файлов: 57 добавлений и 63 удалений

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

@ -39,7 +39,8 @@
#include "nsIWidget.h"
#include "nsDeviceContextSpecB.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "prenv.h" /* for PR_GetEnv */
#include "nsIServiceManager.h"
#include "nsReadableUtils.h"
@ -158,7 +159,7 @@ NS_IMETHODIMP nsDeviceContextSpecBeOS::Init(nsIPrintSettings* aPS)
if (aPS != nsnull) {
PRBool isOn;
aPS->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &isOn);
nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);
nsCOMPtr<nsIPrefBranch> pPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
(void) pPrefs->SetBoolPref("print.selection_radio_enabled", isOn);
}
@ -508,9 +509,10 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
if (!printerList) {
nsresult rv;
nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);
nsCOMPtr<nsIPrefBranch> pPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID,
&rv);
if (NS_SUCCEEDED(rv)) {
(void) pPrefs->CopyCharPref("print.printer_list", &printerList);
(void) pPrefs->GetCharPref("print.printer_list", &printerList);
}
}
@ -533,7 +535,7 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
mGlobalNumPrinters++;
}
free(printerList);
NS_Free(printerList);
}
#endif /* USE_POSTSCRIPT */

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

@ -45,7 +45,6 @@
#include "nsIFileURL.h"
#include "nsSound.h"
#include "nsNetUtil.h"
#include "nsIPref.h"
#include "nsDirectoryServiceDefs.h"

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

@ -57,8 +57,6 @@
#include "nsGtkUtils.h" // for nsGtkUtils::gdk_keyboard_get_modifiers()
#include "nsIPref.h"
static void
ConvertKeyEventToContextMenuEvent(const nsKeyEvent* inKeyEvent,
nsMouseEvent* outCMEvent);

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

@ -52,7 +52,8 @@
#include "nsDeviceContextSpecG.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "prenv.h" /* for PR_GetEnv */
#include "nsPrintfCString.h"
@ -185,8 +186,8 @@ private:
void SetIntValue( const char *tagname, PRInt32 value );
void SetCharValue( const char *tagname, const char *value );
nsXPIDLCString mPrinterName;
nsCOMPtr<nsIPref> mPrefs;
nsXPIDLCString mPrinterName;
nsCOMPtr<nsIPrefBranch> mPrefs;
};
void nsPrinterFeatures::SetBoolValue( const char *tagname, PRBool value )
@ -208,7 +209,7 @@ nsPrinterFeatures::nsPrinterFeatures( const char *printername )
{
DO_PR_DEBUG_LOG(("nsPrinterFeatures::nsPrinterFeatures('%s')\n", printername));
mPrinterName.Assign(printername);
mPrefs = do_GetService(NS_PREF_CONTRACTID);
mPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
SetBoolValue("has_special_printerfeatures", PR_TRUE);
}
@ -720,7 +721,7 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::ClosePrintManager()
* - Get prefs
*/
static
nsresult CopyPrinterCharPref(nsIPref *pref, const char *modulename, const char *printername, const char *prefname, char **return_buf)
nsresult CopyPrinterCharPref(nsIPrefBranch *pref, const char *modulename, const char *printername, const char *prefname, char **return_buf)
{
DO_PR_DEBUG_LOG(("CopyPrinterCharPref('%s', '%s', '%s')\n", modulename, printername, prefname));
@ -733,7 +734,7 @@ nsresult CopyPrinterCharPref(nsIPref *pref, const char *modulename, const char *
/* Get prefs per printer name and module name */
name = nsPrintfCString(512, "print.%s.printer_%s.%s", modulename, printername, prefname);
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
rv = pref->CopyCharPref(name, return_buf);
rv = pref->GetCharPref(name, return_buf);
}
if (NS_FAILED(rv)) {
@ -741,7 +742,7 @@ nsresult CopyPrinterCharPref(nsIPref *pref, const char *modulename, const char *
/* Get prefs per printer name */
name = nsPrintfCString(512, "print.printer_%s.%s", printername, prefname);
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
rv = pref->CopyCharPref(name, return_buf);
rv = pref->GetCharPref(name, return_buf);
}
if (NS_FAILED(rv)) {
@ -749,14 +750,14 @@ nsresult CopyPrinterCharPref(nsIPref *pref, const char *modulename, const char *
/* Get prefs per module name */
name = nsPrintfCString(512, "print.%s.%s", modulename, prefname);
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
rv = pref->CopyCharPref(name, return_buf);
rv = pref->GetCharPref(name, return_buf);
}
if (NS_FAILED(rv)) {
/* Get prefs */
name = nsPrintfCString(512, "print.%s", prefname);
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
rv = pref->CopyCharPref(name, return_buf);
rv = pref->GetCharPref(name, return_buf);
}
}
}
@ -857,7 +858,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
NS_ENSURE_TRUE(*aPrinterName, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(aPrintSettings, NS_ERROR_FAILURE);
nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);
nsCOMPtr<nsIPrefBranch> pPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
@ -1339,7 +1340,7 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv;
nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);
nsCOMPtr<nsIPrefBranch> pPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;

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

@ -52,7 +52,8 @@
#include <Resources.h>
#include <MacWindows.h>
#include <FixMath.h>
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIServiceManager.h"
#include "nsQuickSort.h"
#include "nsUnicodeMappingUtil.h"
@ -871,7 +872,7 @@ PRUint32 nsDeviceContextMac::GetScreenResolution()
initialized = PR_TRUE;
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv) && prefs) {
PRInt32 intVal;
if (NS_SUCCEEDED(prefs->GetIntPref("layout.css.dpi", &intVal)) && intVal > 0) {

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

@ -42,7 +42,8 @@
#include "nsReadableUtils.h"
#include "nsISupportsArray.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "prenv.h" /* for PR_GetEnv */
#include "nsPrintfCString.h"
@ -524,7 +525,7 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv;
nsCOMPtr<nsIPref> pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv);
nsCOMPtr<nsIPrefBranch> pPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
BOOL prefFailed = NS_FAILED(rv); // don't return on failure, optional feature
for (ULONG i = 0; i < mGlobalNumPrinters; i++) {

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

@ -51,7 +51,6 @@
#include "nsSound.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsIPref.h"
#include "nsDirectoryServiceDefs.h"

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

@ -46,7 +46,6 @@
#include <stdlib.h>
#include "nsIWidget.h"
#include "nsIPref.h"
#include "nsCRT.h"
#include <Pt.h>

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

@ -59,7 +59,6 @@
#endif
#include "nsReadableUtils.h"
#include "nsIPref.h"
#include "nsClipboard.h"
#include <errno.h>

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

@ -4251,7 +4251,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
if (didChange) {
// update device context font cache
// Dirty but easiest way:
// Changing nsIPref entry which triggers callbacks
// Changing nsIPrefBranch entry which triggers callbacks
// and flows into calling mDeviceContext->FlushFontCache()
// to update the font cache in all the instance of Browsers
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);

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

@ -50,7 +50,9 @@
#ifdef DEBUG
#include "nsIServiceManager.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsIObserver.h"
static void debug_RegisterPrefCallbacks();
@ -1025,7 +1027,7 @@ static PRUint32 debug_NumPrefValues =
//////////////////////////////////////////////////////////////
static PRBool debug_GetBoolPref(nsIPref * aPrefs,const char * aPrefName)
static PRBool debug_GetBoolPref(nsIPrefBranch * aPrefs,const char * aPrefName)
{
NS_ASSERTION(nsnull != aPrefName,"cmon, pref name is null.");
NS_ASSERTION(nsnull != aPrefs,"cmon, prefs are null.");
@ -1074,30 +1076,29 @@ static void debug_SetCachedBoolPref(const char * aPrefName,PRBool aValue)
}
//////////////////////////////////////////////////////////////
/* static */ int PR_CALLBACK
debug_PrefChangedCallback(const char * name,void * closure)
class Debug_PrefObserver : public nsIObserver {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
};
NS_IMPL_ISUPPORTS1(Debug_PrefObserver, nsIObserver)
NS_IMETHODIMP
Debug_PrefObserver::Observe(nsISupports* subject, const char* topic,
const PRUnichar* data)
{
nsCOMPtr<nsIPrefBranch> branch(do_QueryInterface(subject));
NS_ASSERTION(branch, "must implement nsIPrefBranch");
nsIPref * prefs = nsnull;
nsresult rv = CallGetService(NS_PREF_CONTRACTID, &prefs);
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not get prefs service.");
NS_ASSERTION(nsnull != prefs,"Prefs services is null.");
NS_ConvertUTF16toUTF8 prefName(data);
if (NS_SUCCEEDED(rv))
{
PRBool value = PR_FALSE;
prefs->GetBoolPref(name,&value);
debug_SetCachedBoolPref(name,value);
NS_RELEASE(prefs);
}
return 0;
PRBool value = PR_FALSE;
branch->GetBoolPref(prefName.get(), &value);
debug_SetCachedBoolPref(prefName.get(), value);
return NS_OK;
}
//////////////////////////////////////////////////////////////
/* static */ void
debug_RegisterPrefCallbacks()
@ -1108,28 +1109,24 @@ debug_RegisterPrefCallbacks()
{
once = PR_FALSE;
nsIPref * prefs = nsnull;
nsresult rv = CallGetService(NS_PREF_CONTRACTID, &prefs);
nsCOMPtr<nsIPrefBranch2> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not get prefs service.");
NS_ASSERTION(nsnull != prefs,"Prefs services is null.");
NS_ASSERTION(prefs, "Prefs services is null.");
if (NS_SUCCEEDED(rv))
if (prefs)
{
nsCOMPtr<nsIObserver> obs(new Debug_PrefObserver());
for (PRUint32 i = 0; i < debug_NumPrefValues; i++)
{
// Initialize the pref values
debug_PrefValues[i].value =
debug_GetBoolPref(prefs,debug_PrefValues[i].name);
// Register callbacks for when these change
prefs->RegisterCallback(debug_PrefValues[i].name,
debug_PrefChangedCallback,
NULL);
if (obs) {
// Register callbacks for when these change
prefs->AddObserver(debug_PrefValues[i].name, obs, PR_FALSE);
}
}
NS_RELEASE(prefs);
}
}
}

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

@ -43,8 +43,6 @@
#include "nsIObserver.h"
#include "nsIPrefBranch.h"
class nsIPref;
#ifdef NS_DEBUG
struct nsSize;
#endif