William Bowling is sharing code with you
Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.
Don't show this again1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | //
// ESDualWindowMessageWindowPreferences.m
// Adium
//
// Created by Evan Schoenberg on Thu Sep 18 2003.
//
#import "ESCLViewLabelsAdvancedPrefs.h"
#import "AISCLViewPlugin.h"
#import <AIUtilities/AIDictionaryAdditions.h>
@implementation ESCLViewLabelsAdvancedPrefs
//Preference pane properties
- (PREFERENCE_CATEGORY)category{
return AIPref_Advanced_ContactList;
}
- (NSString *)label{
return AILocalizedString(@"Labels","Contact list labels");
}
- (NSString *)nibName{
return @"CLViewLabelsAdvancedPrefs";
}
- (NSDictionary *)restorablePreferences
{
NSDictionary *defaultPrefs = [NSDictionary dictionaryNamed:SCL_DEFAULT_PREFS forClass:[self class]];
NSDictionary *defaultsTemp = [NSDictionary dictionaryWithObjectsAndKeys:
[defaultPrefs objectForKey:KEY_SCL_LABEL_AROUND_CONTACT],KEY_SCL_LABEL_AROUND_CONTACT,
[defaultPrefs objectForKey:KEY_SCL_OUTLINE_LABELS],KEY_SCL_OUTLINE_LABELS,
[defaultPrefs objectForKey:KEY_SCL_LABEL_OPACITY],KEY_SCL_LABEL_OPACITY,
[defaultPrefs objectForKey:KEY_SCL_LABEL_GROUPS],KEY_SCL_LABEL_GROUPS,
[defaultPrefs objectForKey:KEY_SCL_LABEL_GROUPS_COLOR],KEY_SCL_LABEL_GROUPS_COLOR,
[defaultPrefs objectForKey:KEY_SCL_USE_GRADIENT],KEY_SCL_USE_GRADIENT,
nil];
NSDictionary *defaultsDict = [NSDictionary dictionaryWithObject:defaultsTemp forKey:PREF_GROUP_CONTACT_LIST_DISPLAY];
return defaultsDict;
}
//Called in response to all preference controls, applies new settings
- (IBAction)changePreference:(id)sender
{
if(sender == checkbox_labelAroundContact){
[adium.preferenceController setPreference:[NSNumber numberWithBool:[sender state]]
forKey:KEY_SCL_LABEL_AROUND_CONTACT
group:PREF_GROUP_CONTACT_LIST_DISPLAY];
}else if(sender == checkbox_outlineLabels){
[adium.preferenceController setPreference:[NSNumber numberWithBool:[sender state]]
forKey:KEY_SCL_OUTLINE_LABELS
group:PREF_GROUP_CONTACT_LIST_DISPLAY];
}else if(sender == checkbox_useGradient){
[adium.preferenceController setPreference:[NSNumber numberWithBool:[sender state]]
forKey:KEY_SCL_USE_GRADIENT
group:PREF_GROUP_CONTACT_LIST_DISPLAY];
}else if(sender == slider_labelOpacity){
[adium.preferenceController setPreference:[NSNumber numberWithDouble:[sender doubleValue]]
forKey:KEY_SCL_LABEL_OPACITY
group:PREF_GROUP_CONTACT_LIST_DISPLAY];
}else if(sender == checkbox_labelGroups){
[adium.preferenceController setPreference:[NSNumber numberWithBool:[sender state]]
forKey:KEY_SCL_LABEL_GROUPS
group:PREF_GROUP_CONTACT_LIST_DISPLAY];
}else if(sender == colorWell_labelGroupsColor){
[adium.preferenceController setPreference:[[sender color] stringRepresentation]
forKey:KEY_SCL_LABEL_GROUPS_COLOR
group:PREF_GROUP_CONTACT_LIST_DISPLAY];
}
[self configureControlDimming];
}
//Configure the preference view
- (void)viewDidLoad
{
NSDictionary *preferenceDict = [adium.preferenceController preferencesForGroup:PREF_GROUP_CONTACT_LIST_DISPLAY];
[checkbox_labelAroundContact setState:[[preferenceDict objectForKey:KEY_SCL_LABEL_AROUND_CONTACT] boolValue]];
[checkbox_outlineLabels setState:[[preferenceDict objectForKey:KEY_SCL_OUTLINE_LABELS] boolValue]];
[slider_labelOpacity setDoubleValue:[[preferenceDict objectForKey:KEY_SCL_LABEL_OPACITY] doubleValue]];
[slider_labelOpacity setMinValue:0.05];
[slider_labelOpacity setMaxValue:1.00];
[checkbox_labelGroups setState:[[preferenceDict objectForKey:KEY_SCL_LABEL_GROUPS] boolValue]];
[colorWell_labelGroupsColor setColor:[[preferenceDict objectForKey:KEY_SCL_LABEL_GROUPS_COLOR] representedColor]];
[checkbox_useGradient setState:[[preferenceDict objectForKey:KEY_SCL_USE_GRADIENT] boolValue]];
[self configureControlDimming];
}
- (void)viewWillClose
{
if([colorWell_labelGroupsColor isActive]) [colorWell_labelGroupsColor deactivate];
}
//Enable/disable controls that are available/unavailable
- (void)configureControlDimming
{
NSDictionary *preferenceDict = [adium.preferenceController preferencesForGroup:PREF_GROUP_CONTACT_LIST_DISPLAY];
BOOL labelsAreEnabled = [[preferenceDict objectForKey:KEY_SCL_SHOW_LABELS] boolValue];
[checkbox_labelAroundContact setEnabled:labelsAreEnabled];
[checkbox_outlineLabels setEnabled:labelsAreEnabled];
[slider_labelOpacity setEnabled:labelsAreEnabled];
[checkbox_labelGroups setEnabled:labelsAreEnabled];
[checkbox_useGradient setEnabled:labelsAreEnabled];
[colorWell_labelGroupsColor setEnabled:(labelsAreEnabled ? [[preferenceDict objectForKey:KEY_SCL_LABEL_GROUPS] boolValue] : NO)];
}
@end
|