Hook up preferences to load URLs from GetURL in new tabs or windows, and make UI for the 'load new tabs in background' pref (bug 150242). Also clarified the wording of the 'command-click opens new tab' pref.

This commit is contained in:
sfraser%netscape.com 2002-07-01 18:23:21 +00:00
Родитель e17057d531
Коммит b877548b33
20 изменённых файлов: 232 добавлений и 106 удалений

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

@ -37,17 +37,22 @@
// get the pref that specifies if we want to re-use the existing window or
// open a new one. There's really no point caching this pref.
PRBool reuseWindow = PR_FALSE;
PRBool loadInBackground = PR_FALSE;
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) );
if ( prefService )
if ( prefService ) {
prefService->GetBoolPref("browser.always_reuse_window", &reuseWindow);
prefService->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
}
// reuse the main window if there is one. The user may have closed all of
// them or we may get this event at startup before we've had time to load
// our window.
BrowserWindowController* controller = nsnull;
BrowserWindowController* controller = NULL;
if ( reuseWindow && [NSApp mainWindow] ) {
controller = [[NSApp mainWindow] windowController];
[controller loadURLString:[self directParameter]];
[controller openNewTabWithURL:[self directParameter] loadInBackground:loadInBackground];
}
else
controller = [[NSApp delegate] openBrowserWindowWithURL: [self directParameter]];

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

@ -24,9 +24,11 @@
CLASS = OrgMozillaChimeraPreferenceNavigation;
LANGUAGE = ObjC;
OUTLETS = {
checkboxLoadTabsInBackground = NSButton;
checkboxNewTabBlank = NSButton;
checkboxNewWindowBlank = NSButton;
checkboxOpenTabs = NSButton;
checkboxOpenTabsForAEs = NSButton;
checkboxUseSystemHomePage = NSButton;
sliderHistoryDays = NSSlider;
textFieldHistoryDays = NSTextField;

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

@ -3,7 +3,7 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>36 50 356 240 0 0 1152 746 </string>
<string>34 65 407 279 0 0 1152 746 </string>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBGroupedObjects</key>

Двоичные данные
camino/PreferencePanes/Navigation/English.lproj/Navigation.nib/objects.nib сгенерированный

Двоичный файл не отображается.

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

@ -30,10 +30,15 @@ class nsIPref;
{
// IBOutlet NSButton *buttonSystemPreferences;
IBOutlet NSTextField *textFieldHomePage;
IBOutlet NSButton *checkboxUseSystemHomePage;
IBOutlet NSButton *checkboxNewTabBlank;
IBOutlet NSButton *checkboxNewWindowBlank;
IBOutlet NSButton *checkboxOpenTabs;
IBOutlet NSButton *checkboxOpenTabsForAEs;
IBOutlet NSButton *checkboxLoadTabsInBackground;
IBOutlet NSSlider *sliderHistoryDays;
IBOutlet NSTextField *textFieldHistoryDays;
@ -50,6 +55,12 @@ class nsIPref;
- (NSString*)getSystemHomePage;
- (NSString*)getCurrentHomePage;
- (NSString*)getPrefString: (const char*)prefName;
- (NSString*)getStringPref: (const char*)prefName withSuccess:(BOOL*)outSuccess;
- (BOOL)getBooleanPref: (const char*)prefName withSuccess:(BOOL*)outSuccess;
- (int)getIntPref: (const char*)prefName withSuccess:(BOOL*)outSuccess;
- (void)setPref: (const char*)prefName toString:(NSString*)value;
- (void)setPref: (const char*)prefName toBoolean:(BOOL)value;
- (void)setPref: (const char*)prefName toInt:(int)value;
@end

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

@ -56,33 +56,27 @@ const int kDefaultExpireDays = 9;
if (!mPrefService)
return;
PRBool boolPref;
PRInt32 intPref;
nsresult rv = mPrefService->GetIntPref("browser.startup.page", &intPref);
// Check for NS_FAILED because we don't want to falsely interpret
// a failure as a preference set to 0.
if (NS_SUCCEEDED(rv) && intPref == 0)
BOOL gotPref;
if (([self getIntPref:"browser.startup.page" withSuccess:&gotPref] == 0) && gotPref)
[checkboxNewWindowBlank setState:YES];
rv = mPrefService->GetIntPref("browser.tabs.startPage", &intPref);
if (NS_SUCCEEDED(rv) && intPref == 0)
if (([self getIntPref:"browser.tabs.startPage" withSuccess:&gotPref] == 0) && gotPref)
[checkboxNewTabBlank setState:YES];
rv = mPrefService->GetIntPref("browser.history_expire_days", &intPref);
if (NS_FAILED(rv))
intPref = kDefaultExpireDays;
[textFieldHistoryDays setIntValue:intPref];
[sliderHistoryDays setIntValue:intPref];
rv = mPrefService->GetBoolPref("browser.tabs.opentabfor.middleclick", &boolPref);
if (NS_SUCCEEDED(rv) && boolPref == PR_TRUE)
[checkboxOpenTabs setState:YES];
int expireDays = [self getIntPref:"browser.history_expire_days" withSuccess:&gotPref];
if (!gotPref)
expireDays = kDefaultExpireDays;
BOOL useSystemHomePage = NO;
rv = mPrefService->GetBoolPref("chimera.use_system_home_page", &boolPref);
if (NS_SUCCEEDED(rv) && boolPref == PR_TRUE)
useSystemHomePage = YES;
[textFieldHistoryDays setIntValue:expireDays];
[sliderHistoryDays setIntValue:expireDays];
[checkboxOpenTabs setState:[self getBooleanPref:"browser.tabs.opentabfor.middleclick" withSuccess:&gotPref]];
[checkboxOpenTabsForAEs setState:[self getBooleanPref:"browser.always_reuse_window" withSuccess:&gotPref]];
[checkboxLoadTabsInBackground setState:[self getBooleanPref:"browser.tabs.loadInBackground" withSuccess:&gotPref]];
BOOL useSystemHomePage = [self getBooleanPref:"chimera.use_system_home_page" withSuccess:&gotPref] && gotPref;
if (useSystemHomePage)
[textFieldHomePage setEnabled:NO];
@ -111,10 +105,18 @@ const int kDefaultExpireDays = 9;
- (IBAction)checkboxClicked:(id)sender
{
if (!mPrefService || sender != checkboxOpenTabs)
if (!mPrefService)
return;
mPrefService->SetBoolPref("browser.tabs.opentabfor.middleclick", [sender state] ? PR_TRUE : PR_FALSE);
if (sender == checkboxOpenTabs) {
[self setPref:"browser.tabs.opentabfor.middleclick" toBoolean:[sender state]];
}
else if (sender == checkboxOpenTabsForAEs) {
[self setPref:"browser.always_reuse_window" toBoolean:[sender state]];
}
else if (sender == checkboxLoadTabsInBackground) {
[self setPref:"browser.tabs.loadInBackground" toBoolean:[sender state]];
}
}
- (IBAction)checkboxUseSystemHomePageClicked:(id)sender
@ -128,8 +130,7 @@ const int kDefaultExpireDays = 9;
if (useSystemHomePage)
[self setPref: "browser.startup.homepage" toString: [textFieldHomePage stringValue]];
mPrefService->SetBoolPref("chimera.use_system_home_page", useSystemHomePage ? PR_TRUE : PR_FALSE);
[self setPref:"chimera.use_system_home_page" toBoolean: useSystemHomePage];
[textFieldHomePage setStringValue: [self getCurrentHomePage]];
[textFieldHomePage setEnabled:!useSystemHomePage];
}
@ -144,11 +145,9 @@ const int kDefaultExpireDays = 9;
prefName = "browser.tabs.page";
else if (sender == checkboxNewWindowBlank)
prefName = "browser.startup.page";
else
return;
if (prefName)
mPrefService->SetIntPref(prefName, [sender state] ? 0 : 1);
[self setPref:prefName toInt: [sender state] ? 0 : 1];
}
- (IBAction)historyDaysModified:(id)sender
@ -161,16 +160,19 @@ const int kDefaultExpireDays = 9;
else if (sender == textFieldHistoryDays) {
// If any non-numeric characters were entered make some noise and spit it out.
if (([[textFieldHistoryDays stringValue] rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]).length) {
PRInt32 intPref = kDefaultExpireDays;
mPrefService->GetIntPref("browser.history_expire_days", &intPref);
[textFieldHistoryDays setIntValue:intPref];
BOOL gotPref;
int prefValue = [self getIntPref:"browser.history_expire_days" withSuccess:&gotPref];
if (!gotPref)
prefValue = kDefaultExpireDays;
[textFieldHistoryDays setIntValue:prefValue];
[sliderHistoryDays setIntValue:prefValue];
NSBeep ();
return;
} else
[sliderHistoryDays setIntValue:[textFieldHistoryDays intValue]];
}
mPrefService->SetIntPref("browser.history_expire_days", [sender intValue]);
[self setPref:"browser.history_expire_days" toInt:[sender intValue]];
}
@ -217,17 +219,16 @@ const int kDefaultExpireDays = 9;
- (NSString*) getCurrentHomePage
{
BOOL useSystemHomePage = NO;
PRBool boolPref;
nsresult rv = mPrefService->GetBoolPref("chimera.use_system_home_page", &boolPref);
if (NS_SUCCEEDED(rv) && boolPref == PR_TRUE)
BOOL gotPref;
if ([self getBooleanPref:"chimera.use_system_home_page" withSuccess:&gotPref] && gotPref)
return [self getSystemHomePage];
return [self getPrefString: "browser.startup.homepage"];
return [self getStringPref: "browser.startup.homepage" withSuccess:&gotPref];
}
// convenience routines for mozilla prefs
- (NSString*)getPrefString: (const char*)prefName
- (NSString*)getStringPref: (const char*)prefName withSuccess:(BOOL*)outSuccess
{
NSMutableString *prefValue = [[[NSMutableString alloc] init] autorelease];
@ -236,11 +237,34 @@ const int kDefaultExpireDays = 9;
if (NS_SUCCEEDED(rv) && buf) {
[prefValue setString:[NSString stringWithCString:buf]];
free(buf);
if (outSuccess) *outSuccess = YES;
} else {
if (outSuccess) *outSuccess = NO;
}
return prefValue;
}
// convenience routines for mozilla prefs
- (BOOL)getBooleanPref: (const char*)prefName withSuccess:(BOOL*)outSuccess
{
PRBool boolPref = PR_FALSE;
nsresult rv = mPrefService->GetBoolPref(prefName, &boolPref);
if (outSuccess)
*outSuccess = NS_SUCCEEDED(rv);
return boolPref ? YES : NO;
}
- (int)getIntPref: (const char*)prefName withSuccess:(BOOL*)outSuccess
{
PRInt32 intPref = 0;
nsresult rv = mPrefService->GetBoolPref(prefName, &intPref);
if (outSuccess)
*outSuccess = NS_SUCCEEDED(rv);
return intPref;
}
- (void)setPref: (const char*)prefName toString:(NSString*)value
{
if (mPrefService) {
@ -248,5 +272,19 @@ const int kDefaultExpireDays = 9;
}
}
- (void)setPref: (const char*)prefName toBoolean:(BOOL)value
{
if (mPrefService) {
mPrefService->SetBoolPref(prefName, value ? PR_TRUE : PR_FALSE);
}
}
- (void)setPref: (const char*)prefName toInt:(int)value
{
if (mPrefService) {
PRInt32 prefValue = value;
mPrefService->SetIntPref(prefName, prefValue);
}
}
@end

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

@ -24,9 +24,11 @@
CLASS = OrgMozillaChimeraPreferenceNavigation;
LANGUAGE = ObjC;
OUTLETS = {
checkboxLoadTabsInBackground = NSButton;
checkboxNewTabBlank = NSButton;
checkboxNewWindowBlank = NSButton;
checkboxOpenTabs = NSButton;
checkboxOpenTabsForAEs = NSButton;
checkboxUseSystemHomePage = NSButton;
sliderHistoryDays = NSSlider;
textFieldHistoryDays = NSTextField;

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

@ -3,7 +3,7 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>36 50 356 240 0 0 1152 746 </string>
<string>34 65 407 279 0 0 1152 746 </string>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBGroupedObjects</key>

Двоичные данные
camino/PreferencePanes/Navigation/Navigation.nib/objects.nib сгенерированный

Двоичный файл не отображается.

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

@ -37,17 +37,22 @@
// get the pref that specifies if we want to re-use the existing window or
// open a new one. There's really no point caching this pref.
PRBool reuseWindow = PR_FALSE;
PRBool loadInBackground = PR_FALSE;
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) );
if ( prefService )
if ( prefService ) {
prefService->GetBoolPref("browser.always_reuse_window", &reuseWindow);
prefService->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
}
// reuse the main window if there is one. The user may have closed all of
// them or we may get this event at startup before we've had time to load
// our window.
BrowserWindowController* controller = nsnull;
BrowserWindowController* controller = NULL;
if ( reuseWindow && [NSApp mainWindow] ) {
controller = [[NSApp mainWindow] windowController];
[controller loadURLString:[self directParameter]];
[controller openNewTabWithURL:[self directParameter] loadInBackground:loadInBackground];
}
else
controller = [[NSApp delegate] openBrowserWindowWithURL: [self directParameter]];

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

@ -37,17 +37,22 @@
// get the pref that specifies if we want to re-use the existing window or
// open a new one. There's really no point caching this pref.
PRBool reuseWindow = PR_FALSE;
PRBool loadInBackground = PR_FALSE;
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) );
if ( prefService )
if ( prefService ) {
prefService->GetBoolPref("browser.always_reuse_window", &reuseWindow);
prefService->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
}
// reuse the main window if there is one. The user may have closed all of
// them or we may get this event at startup before we've had time to load
// our window.
BrowserWindowController* controller = nsnull;
BrowserWindowController* controller = NULL;
if ( reuseWindow && [NSApp mainWindow] ) {
controller = [[NSApp mainWindow] windowController];
[controller loadURLString:[self directParameter]];
[controller openNewTabWithURL:[self directParameter] loadInBackground:loadInBackground];
}
else
controller = [[NSApp delegate] openBrowserWindowWithURL: [self directParameter]];

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

@ -24,9 +24,11 @@
CLASS = OrgMozillaChimeraPreferenceNavigation;
LANGUAGE = ObjC;
OUTLETS = {
checkboxLoadTabsInBackground = NSButton;
checkboxNewTabBlank = NSButton;
checkboxNewWindowBlank = NSButton;
checkboxOpenTabs = NSButton;
checkboxOpenTabsForAEs = NSButton;
checkboxUseSystemHomePage = NSButton;
sliderHistoryDays = NSSlider;
textFieldHistoryDays = NSTextField;

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

@ -3,7 +3,7 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>36 50 356 240 0 0 1152 746 </string>
<string>34 65 407 279 0 0 1152 746 </string>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBGroupedObjects</key>

Двоичные данные
chimera/PreferencePanes/Navigation/English.lproj/Navigation.nib/objects.nib сгенерированный

Двоичный файл не отображается.

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

@ -30,10 +30,15 @@ class nsIPref;
{
// IBOutlet NSButton *buttonSystemPreferences;
IBOutlet NSTextField *textFieldHomePage;
IBOutlet NSButton *checkboxUseSystemHomePage;
IBOutlet NSButton *checkboxNewTabBlank;
IBOutlet NSButton *checkboxNewWindowBlank;
IBOutlet NSButton *checkboxOpenTabs;
IBOutlet NSButton *checkboxOpenTabsForAEs;
IBOutlet NSButton *checkboxLoadTabsInBackground;
IBOutlet NSSlider *sliderHistoryDays;
IBOutlet NSTextField *textFieldHistoryDays;
@ -50,6 +55,12 @@ class nsIPref;
- (NSString*)getSystemHomePage;
- (NSString*)getCurrentHomePage;
- (NSString*)getPrefString: (const char*)prefName;
- (NSString*)getStringPref: (const char*)prefName withSuccess:(BOOL*)outSuccess;
- (BOOL)getBooleanPref: (const char*)prefName withSuccess:(BOOL*)outSuccess;
- (int)getIntPref: (const char*)prefName withSuccess:(BOOL*)outSuccess;
- (void)setPref: (const char*)prefName toString:(NSString*)value;
- (void)setPref: (const char*)prefName toBoolean:(BOOL)value;
- (void)setPref: (const char*)prefName toInt:(int)value;
@end

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

@ -56,33 +56,27 @@ const int kDefaultExpireDays = 9;
if (!mPrefService)
return;
PRBool boolPref;
PRInt32 intPref;
nsresult rv = mPrefService->GetIntPref("browser.startup.page", &intPref);
// Check for NS_FAILED because we don't want to falsely interpret
// a failure as a preference set to 0.
if (NS_SUCCEEDED(rv) && intPref == 0)
BOOL gotPref;
if (([self getIntPref:"browser.startup.page" withSuccess:&gotPref] == 0) && gotPref)
[checkboxNewWindowBlank setState:YES];
rv = mPrefService->GetIntPref("browser.tabs.startPage", &intPref);
if (NS_SUCCEEDED(rv) && intPref == 0)
if (([self getIntPref:"browser.tabs.startPage" withSuccess:&gotPref] == 0) && gotPref)
[checkboxNewTabBlank setState:YES];
rv = mPrefService->GetIntPref("browser.history_expire_days", &intPref);
if (NS_FAILED(rv))
intPref = kDefaultExpireDays;
[textFieldHistoryDays setIntValue:intPref];
[sliderHistoryDays setIntValue:intPref];
rv = mPrefService->GetBoolPref("browser.tabs.opentabfor.middleclick", &boolPref);
if (NS_SUCCEEDED(rv) && boolPref == PR_TRUE)
[checkboxOpenTabs setState:YES];
int expireDays = [self getIntPref:"browser.history_expire_days" withSuccess:&gotPref];
if (!gotPref)
expireDays = kDefaultExpireDays;
BOOL useSystemHomePage = NO;
rv = mPrefService->GetBoolPref("chimera.use_system_home_page", &boolPref);
if (NS_SUCCEEDED(rv) && boolPref == PR_TRUE)
useSystemHomePage = YES;
[textFieldHistoryDays setIntValue:expireDays];
[sliderHistoryDays setIntValue:expireDays];
[checkboxOpenTabs setState:[self getBooleanPref:"browser.tabs.opentabfor.middleclick" withSuccess:&gotPref]];
[checkboxOpenTabsForAEs setState:[self getBooleanPref:"browser.always_reuse_window" withSuccess:&gotPref]];
[checkboxLoadTabsInBackground setState:[self getBooleanPref:"browser.tabs.loadInBackground" withSuccess:&gotPref]];
BOOL useSystemHomePage = [self getBooleanPref:"chimera.use_system_home_page" withSuccess:&gotPref] && gotPref;
if (useSystemHomePage)
[textFieldHomePage setEnabled:NO];
@ -111,10 +105,18 @@ const int kDefaultExpireDays = 9;
- (IBAction)checkboxClicked:(id)sender
{
if (!mPrefService || sender != checkboxOpenTabs)
if (!mPrefService)
return;
mPrefService->SetBoolPref("browser.tabs.opentabfor.middleclick", [sender state] ? PR_TRUE : PR_FALSE);
if (sender == checkboxOpenTabs) {
[self setPref:"browser.tabs.opentabfor.middleclick" toBoolean:[sender state]];
}
else if (sender == checkboxOpenTabsForAEs) {
[self setPref:"browser.always_reuse_window" toBoolean:[sender state]];
}
else if (sender == checkboxLoadTabsInBackground) {
[self setPref:"browser.tabs.loadInBackground" toBoolean:[sender state]];
}
}
- (IBAction)checkboxUseSystemHomePageClicked:(id)sender
@ -128,8 +130,7 @@ const int kDefaultExpireDays = 9;
if (useSystemHomePage)
[self setPref: "browser.startup.homepage" toString: [textFieldHomePage stringValue]];
mPrefService->SetBoolPref("chimera.use_system_home_page", useSystemHomePage ? PR_TRUE : PR_FALSE);
[self setPref:"chimera.use_system_home_page" toBoolean: useSystemHomePage];
[textFieldHomePage setStringValue: [self getCurrentHomePage]];
[textFieldHomePage setEnabled:!useSystemHomePage];
}
@ -144,11 +145,9 @@ const int kDefaultExpireDays = 9;
prefName = "browser.tabs.page";
else if (sender == checkboxNewWindowBlank)
prefName = "browser.startup.page";
else
return;
if (prefName)
mPrefService->SetIntPref(prefName, [sender state] ? 0 : 1);
[self setPref:prefName toInt: [sender state] ? 0 : 1];
}
- (IBAction)historyDaysModified:(id)sender
@ -161,16 +160,19 @@ const int kDefaultExpireDays = 9;
else if (sender == textFieldHistoryDays) {
// If any non-numeric characters were entered make some noise and spit it out.
if (([[textFieldHistoryDays stringValue] rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]).length) {
PRInt32 intPref = kDefaultExpireDays;
mPrefService->GetIntPref("browser.history_expire_days", &intPref);
[textFieldHistoryDays setIntValue:intPref];
BOOL gotPref;
int prefValue = [self getIntPref:"browser.history_expire_days" withSuccess:&gotPref];
if (!gotPref)
prefValue = kDefaultExpireDays;
[textFieldHistoryDays setIntValue:prefValue];
[sliderHistoryDays setIntValue:prefValue];
NSBeep ();
return;
} else
[sliderHistoryDays setIntValue:[textFieldHistoryDays intValue]];
}
mPrefService->SetIntPref("browser.history_expire_days", [sender intValue]);
[self setPref:"browser.history_expire_days" toInt:[sender intValue]];
}
@ -217,17 +219,16 @@ const int kDefaultExpireDays = 9;
- (NSString*) getCurrentHomePage
{
BOOL useSystemHomePage = NO;
PRBool boolPref;
nsresult rv = mPrefService->GetBoolPref("chimera.use_system_home_page", &boolPref);
if (NS_SUCCEEDED(rv) && boolPref == PR_TRUE)
BOOL gotPref;
if ([self getBooleanPref:"chimera.use_system_home_page" withSuccess:&gotPref] && gotPref)
return [self getSystemHomePage];
return [self getPrefString: "browser.startup.homepage"];
return [self getStringPref: "browser.startup.homepage" withSuccess:&gotPref];
}
// convenience routines for mozilla prefs
- (NSString*)getPrefString: (const char*)prefName
- (NSString*)getStringPref: (const char*)prefName withSuccess:(BOOL*)outSuccess
{
NSMutableString *prefValue = [[[NSMutableString alloc] init] autorelease];
@ -236,11 +237,34 @@ const int kDefaultExpireDays = 9;
if (NS_SUCCEEDED(rv) && buf) {
[prefValue setString:[NSString stringWithCString:buf]];
free(buf);
if (outSuccess) *outSuccess = YES;
} else {
if (outSuccess) *outSuccess = NO;
}
return prefValue;
}
// convenience routines for mozilla prefs
- (BOOL)getBooleanPref: (const char*)prefName withSuccess:(BOOL*)outSuccess
{
PRBool boolPref = PR_FALSE;
nsresult rv = mPrefService->GetBoolPref(prefName, &boolPref);
if (outSuccess)
*outSuccess = NS_SUCCEEDED(rv);
return boolPref ? YES : NO;
}
- (int)getIntPref: (const char*)prefName withSuccess:(BOOL*)outSuccess
{
PRInt32 intPref = 0;
nsresult rv = mPrefService->GetBoolPref(prefName, &intPref);
if (outSuccess)
*outSuccess = NS_SUCCEEDED(rv);
return intPref;
}
- (void)setPref: (const char*)prefName toString:(NSString*)value
{
if (mPrefService) {
@ -248,5 +272,19 @@ const int kDefaultExpireDays = 9;
}
}
- (void)setPref: (const char*)prefName toBoolean:(BOOL)value
{
if (mPrefService) {
mPrefService->SetBoolPref(prefName, value ? PR_TRUE : PR_FALSE);
}
}
- (void)setPref: (const char*)prefName toInt:(int)value
{
if (mPrefService) {
PRInt32 prefValue = value;
mPrefService->SetIntPref(prefName, prefValue);
}
}
@end

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

@ -24,9 +24,11 @@
CLASS = OrgMozillaChimeraPreferenceNavigation;
LANGUAGE = ObjC;
OUTLETS = {
checkboxLoadTabsInBackground = NSButton;
checkboxNewTabBlank = NSButton;
checkboxNewWindowBlank = NSButton;
checkboxOpenTabs = NSButton;
checkboxOpenTabsForAEs = NSButton;
checkboxUseSystemHomePage = NSButton;
sliderHistoryDays = NSSlider;
textFieldHistoryDays = NSTextField;

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

@ -3,7 +3,7 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>36 50 356 240 0 0 1152 746 </string>
<string>34 65 407 279 0 0 1152 746 </string>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBGroupedObjects</key>

Двоичные данные
chimera/PreferencePanes/Navigation/Navigation.nib/objects.nib сгенерированный

Двоичный файл не отображается.

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

@ -37,17 +37,22 @@
// get the pref that specifies if we want to re-use the existing window or
// open a new one. There's really no point caching this pref.
PRBool reuseWindow = PR_FALSE;
PRBool loadInBackground = PR_FALSE;
nsCOMPtr<nsIPref> prefService ( do_GetService(NS_PREF_CONTRACTID) );
if ( prefService )
if ( prefService ) {
prefService->GetBoolPref("browser.always_reuse_window", &reuseWindow);
prefService->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground);
}
// reuse the main window if there is one. The user may have closed all of
// them or we may get this event at startup before we've had time to load
// our window.
BrowserWindowController* controller = nsnull;
BrowserWindowController* controller = NULL;
if ( reuseWindow && [NSApp mainWindow] ) {
controller = [[NSApp mainWindow] windowController];
[controller loadURLString:[self directParameter]];
[controller openNewTabWithURL:[self directParameter] loadInBackground:loadInBackground];
}
else
controller = [[NSApp delegate] openBrowserWindowWithURL: [self directParameter]];