Hook up button icon preferences, begin implementing the setting
This commit is contained in:
parent
a1e2dd5be2
commit
3f181a1a84
|
@ -66,6 +66,7 @@ static id newTabTarget;
|
||||||
-(Website*)currentWebsiteForTab: (id)tab;
|
-(Website*)currentWebsiteForTab: (id)tab;
|
||||||
-(void)updateTabsVisibility;
|
-(void)updateTabsVisibility;
|
||||||
-(void)onPreferencesUpdated: (id)sender;
|
-(void)onPreferencesUpdated: (id)sender;
|
||||||
|
-(void)reconfigureUrlBarButtons;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation BrowserWindowController
|
@implementation BrowserWindowController
|
||||||
|
@ -533,11 +534,28 @@ static id newTabTarget;
|
||||||
currentTabLocation = location;
|
currentTabLocation = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void)reconfigureUrlBarButtons {
|
||||||
|
NSLog(@"reconfigure url bar buttons");
|
||||||
|
UrlBarButtonType buttonType = [[Preferences defaultPreferences] urlBarButtonType];
|
||||||
|
NSLog(@"type: %d", buttonType);
|
||||||
|
switch (buttonType) {
|
||||||
|
case UrlBarButtonTypeImage:
|
||||||
|
[backButton setImage: [NSImage imageNamed: @"back"]];
|
||||||
|
break;
|
||||||
|
case UrlBarButtonTypeText:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-(void)onPreferencesUpdated: (id)sender {
|
-(void)onPreferencesUpdated: (id)sender {
|
||||||
id dict = [sender object];
|
id dict = [sender object];
|
||||||
PreferenceType type = (PreferenceType)[[dict objectForKey: @"type"] integerValue];
|
PreferenceType type = (PreferenceType)[[dict objectForKey: @"type"] integerValue];
|
||||||
if (type == PreferenceTypeAlwaysShowTabs || type == PreferenceTypeTabLocation) {
|
if (type == PreferenceTypeAlwaysShowTabs || type == PreferenceTypeTabLocation) {
|
||||||
[self updateTabsVisibility];
|
[self updateTabsVisibility];
|
||||||
|
} else if (type == PreferenceTypeUrlBarButtonType) {
|
||||||
|
[self reconfigureUrlBarButtons];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,10 @@ E_RESOURCES := \
|
||||||
internal.css \
|
internal.css \
|
||||||
quirks.css \
|
quirks.css \
|
||||||
SearchEngines \
|
SearchEngines \
|
||||||
|
forward.png \
|
||||||
|
back.png \
|
||||||
|
refresh.png \
|
||||||
|
search.png \
|
||||||
|
|
||||||
E_RESOURCES := $(addprefix resources/,$(E_RESOURCES))
|
E_RESOURCES := $(addprefix resources/,$(E_RESOURCES))
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,18 @@ typedef NS_ENUM(NSInteger, TabLocation) {
|
||||||
TabLocationNone
|
TabLocationNone
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSInteger, UrlBarButtonType) {
|
||||||
|
UrlBarButtonTypeText = 0,
|
||||||
|
UrlBarButtonTypeImage
|
||||||
|
};
|
||||||
|
|
||||||
// Certain preferences will notify that they have been updated using this key.
|
// Certain preferences will notify that they have been updated using this key.
|
||||||
#define PreferencesUpdatedNotificationName @"PreferencesUpdatedNotification"
|
#define PreferencesUpdatedNotificationName @"PreferencesUpdatedNotification"
|
||||||
typedef NS_ENUM(NSInteger, PreferenceType) {
|
typedef NS_ENUM(NSInteger, PreferenceType) {
|
||||||
PreferenceTypeAlwaysShowTabs = 0,
|
PreferenceTypeAlwaysShowTabs = 0,
|
||||||
PreferenceTypeTabLocation,
|
PreferenceTypeTabLocation,
|
||||||
PreferenceTypeShowUrlSuggestions
|
PreferenceTypeShowUrlSuggestions,
|
||||||
|
PreferenceTypeUrlBarButtonType
|
||||||
};
|
};
|
||||||
|
|
||||||
@interface Preferences: NSObject {
|
@interface Preferences: NSObject {
|
||||||
|
@ -63,5 +69,8 @@ typedef NS_ENUM(NSInteger, PreferenceType) {
|
||||||
-(BOOL)showUrlSuggestions;
|
-(BOOL)showUrlSuggestions;
|
||||||
-(void)setShowUrlSuggestions: (BOOL)value;
|
-(void)setShowUrlSuggestions: (BOOL)value;
|
||||||
|
|
||||||
|
-(UrlBarButtonType)urlBarButtonType;
|
||||||
|
-(void)setUrlBarButtonType: (UrlBarButtonType)buttonType;
|
||||||
|
|
||||||
+(Preferences*)defaultPreferences;
|
+(Preferences*)defaultPreferences;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#define KEY_TAB_LOCATION @"tab_location"
|
#define KEY_TAB_LOCATION @"tab_location"
|
||||||
#define KEY_DEVELOPER_VIEW_LOCATION @"developer_view_location"
|
#define KEY_DEVELOPER_VIEW_LOCATION @"developer_view_location"
|
||||||
#define KEY_SHOW_URL_SUGGESTIONS @"show_url_suggestions"
|
#define KEY_SHOW_URL_SUGGESTIONS @"show_url_suggestions"
|
||||||
|
#define KEY_URL_BAR_BUTTON_TYPE @"url_bar_button_type"
|
||||||
|
|
||||||
@interface Preferences (Private)
|
@interface Preferences (Private)
|
||||||
|
|
||||||
|
@ -186,6 +187,21 @@
|
||||||
[self notifyPreferenceUpdated: PreferenceTypeShowUrlSuggestions];
|
[self notifyPreferenceUpdated: PreferenceTypeShowUrlSuggestions];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(UrlBarButtonType)urlBarButtonType {
|
||||||
|
if ([defaults objectForKey: KEY_URL_BAR_BUTTON_TYPE] != nil) {
|
||||||
|
return (UrlBarButtonType)[defaults integerForKey:
|
||||||
|
KEY_URL_BAR_BUTTON_TYPE];
|
||||||
|
} else {
|
||||||
|
return UrlBarButtonTypeText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)setUrlBarButtonType: (UrlBarButtonType)buttonType {
|
||||||
|
[defaults setInteger: (NSInteger)buttonType forKey:
|
||||||
|
KEY_URL_BAR_BUTTON_TYPE];
|
||||||
|
[self notifyPreferenceUpdated: PreferenceTypeUrlBarButtonType];
|
||||||
|
}
|
||||||
|
|
||||||
+(Preferences*)defaultPreferences {
|
+(Preferences*)defaultPreferences {
|
||||||
static Preferences *prefs;
|
static Preferences *prefs;
|
||||||
if (prefs == nil) {
|
if (prefs == nil) {
|
||||||
|
|
|
@ -211,6 +211,8 @@
|
||||||
[developerViewsButton selectItemAtIndex: (NSInteger)viewLocation];
|
[developerViewsButton selectItemAtIndex: (NSInteger)viewLocation];
|
||||||
[urlSuggestionsButton setState: [[Preferences defaultPreferences] showUrlSuggestions]
|
[urlSuggestionsButton setState: [[Preferences defaultPreferences] showUrlSuggestions]
|
||||||
? NSOnState : NSOffState];
|
? NSOnState : NSOffState];
|
||||||
|
UrlBarButtonType buttonType = [[Preferences defaultPreferences] urlBarButtonType];
|
||||||
|
[urlBarButtonsTypeButton selectItemAtIndex: (NSInteger)buttonType];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)didPickDeveloperViews: (id)sender {
|
-(void)didPickDeveloperViews: (id)sender {
|
||||||
|
@ -251,6 +253,9 @@
|
||||||
|
|
||||||
-(void)didPickUrlButtonsType: (id)sender {
|
-(void)didPickUrlButtonsType: (id)sender {
|
||||||
NSLog(@"didPickUrlButtonsType");
|
NSLog(@"didPickUrlButtonsType");
|
||||||
|
UrlBarButtonType buttonType = (UrlBarButtonType)[sender indexOfItem: [sender
|
||||||
|
selectedItem]];
|
||||||
|
[[Preferences defaultPreferences] setUrlBarButtonType: buttonType];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 242 B |
Binary file not shown.
After Width: | Height: | Size: 252 B |
Binary file not shown.
After Width: | Height: | Size: 847 B |
Binary file not shown.
After Width: | Height: | Size: 755 B |
Loading…
Reference in New Issue