Adium

Changeset 23581

Show
Ignore:
Timestamp:
05/22/2008 11:04:46 PM (6 months ago)
Author:
zacw
Message:

Add an advanced status preference option to "Count unread conversations instead of unread messages". Fixes #8599.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Frameworks/Adium Framework/Source/AIChatControllerProtocol.h

    r23232 r23581  
    4040- (AIChat *)mostRecentUnviewedChat; 
    4141- (int)unviewedContentCount; 
     42- (int)unviewedConversationCount; 
    4243- (void)switchChat:(AIChat *)chat toAccount:(AIAccount *)newAccount; 
    4344- (void)switchChat:(AIChat *)chat toListContact:(AIListContact *)inContact usingContactAccount:(BOOL)useContactAccount; 
  • trunk/Frameworks/Adium Framework/Source/AIStatusControllerProtocol.h

    r23523 r23581  
    3131 
    3232#define PREF_GROUP_STATUS_PREFERENCES                   @"Status Preferences" 
     33#define KEY_STATUS_CONVERSATION_COUNT                   @"Unread Conversations" 
    3334#define KEY_STATUS_REPORT_IDLE                                  @"Report Idle" 
    3435#define KEY_STATUS_REPORT_IDLE_INTERVAL                 @"Report Idle Interval" 
  • trunk/Plugins/Dock Icon Badging/AIDockBadger.h

    r20090 r23581  
    2626         
    2727        BOOL                                            shouldBadge; 
     28        BOOL                                            showConversationCount; 
    2829} 
    2930 
  • trunk/Plugins/Dock Icon Badging/AIDockBadger.m

    r17742 r23581  
    1919#import <Adium/AIContactControllerProtocol.h> 
    2020#import <Adium/AIContentControllerProtocol.h> 
     21#import <Adium/AIStatusControllerProtocol.h> 
    2122#import "AIDockController.h" 
    2223#import <Adium/AIInterfaceControllerProtocol.h> 
     
    5657        //Observe pref changes 
    5758        [[adium preferenceController] registerPreferenceObserver:self forGroup:PREF_GROUP_APPEARANCE]; 
     59         
     60        // Register as an observer of the status preferences for unread conversation count 
     61        [[adium preferenceController] registerPreferenceObserver:self 
     62                                                                                                        forGroup:PREF_GROUP_STATUS_PREFERENCES]; 
    5863} 
    5964 
     
    98103                                                        object:(AIListObject *)object preferenceDict:(NSDictionary *)prefDict firstTime:(BOOL)firstTime 
    99104{ 
    100         if (!key || [key isEqualToString:KEY_BADGE_DOCK_ICON]) { 
     105        if ([group isEqualToString:PREF_GROUP_APPEARANCE] && (!key || [key isEqualToString:KEY_BADGE_DOCK_ICON])) { 
    101106                BOOL    newShouldBadge = [[prefDict objectForKey:KEY_BADGE_DOCK_ICON] boolValue]; 
    102107                if (newShouldBadge != shouldBadge) { 
     
    121126                } 
    122127        } 
     128         
     129        if ([group isEqualToString:PREF_GROUP_STATUS_PREFERENCES]) { 
     130                showConversationCount = [[prefDict objectForKey:KEY_STATUS_CONVERSATION_COUNT] boolValue]; 
     131        } 
    123132}        
    124133 
     
    186195- (void)_setOverlay 
    187196{ 
    188         int contentCount = [[adium chatController] unviewedContentCount]; 
     197        int contentCount = (showConversationCount ? 
     198                                           [[adium chatController] unviewedConversationCount] : [[adium chatController] unviewedContentCount]); 
    189199 
    190200        if (contentCount != lastUnviewedContentCount) { 
  • trunk/Plugins/Status Menu Item/CBStatusMenuItemController.h

    r23580 r23581  
    4646        NSTimer                                 *unviewedContentFlash; 
    4747         
     48        BOOL                                    showConversationCount; 
     49         
    4850        BOOL                                    showBadge; 
    4951        BOOL                                    showUnreadCount; 
  • trunk/Plugins/Status Menu Item/CBStatusMenuItemController.m

    r23580 r23581  
    136136            [[adium contactController] registerListObjectObserver:self]; 
    137137                 
    138                 // Register as an observer of the preference group so we can update our "show offline contacts" option 
     138                // Register as an observer of the preference group so we can update our "show groups contacts" option 
    139139                [[adium preferenceController] registerPreferenceObserver:self 
    140140                                                                                                                forGroup:PREF_GROUP_CONTACT_LIST_DISPLAY]; 
    141141                 
     142                // Register as an observer of the status preferences for unread conversation count 
     143                [[adium preferenceController] registerPreferenceObserver:self 
     144                                                                                                                forGroup:PREF_GROUP_STATUS_PREFERENCES];                 
     145                 
    142146                // Register as an observer of our own preference group 
    143147                [[adium preferenceController] registerPreferenceObserver:self 
    144                                                                                                                 forGroup:PREF_GROUP_STATUS_MENU_ITEM];          
     148                                                                                                                forGroup:PREF_GROUP_STATUS_MENU_ITEM]; 
    145149                 
    146150                //Register to recieve active state changed notifications 
     
    250254- (void)updateUnreadCount 
    251255{ 
    252         int unreadCount = [[adium chatController] unviewedContentCount]; 
     256        int unreadCount = (showConversationCount ? 
     257                                           [[adium chatController] unviewedConversationCount] : [[adium chatController] unviewedContentCount]); 
    253258 
    254259        // Only show if enabled and greater-than zero; otherwise, set to nil. 
     
    843848                [self updateStatusItemLength]; 
    844849        } 
     850         
     851        if ([group isEqualToString:PREF_GROUP_STATUS_PREFERENCES]) { 
     852                showConversationCount = [[prefDict objectForKey:KEY_STATUS_CONVERSATION_COUNT] boolValue]; 
     853        } 
    845854} 
    846855 
  • trunk/Resources/StatusPreferencesAdvanced.nib/classes.nib

    r22227 r23581  
    1515                <dict> 
    1616                        <key>CLASS</key> 
     17                        <string>RBSplitView</string> 
     18                        <key>LANGUAGE</key> 
     19                        <string>ObjC</string> 
     20                        <key>OUTLETS</key> 
     21                        <dict> 
     22                                <key>delegate</key> 
     23                                <string>id</string> 
     24                        </dict> 
     25                        <key>SUPERCLASS</key> 
     26                        <string>RBSplitSubview</string> 
     27                </dict> 
     28                <dict> 
     29                        <key>CLASS</key> 
    1730                        <string>NSTextField</string> 
    1831                        <key>LANGUAGE</key> 
     
    3043                </dict> 
    3144                <dict> 
     45                        <key>CLASS</key> 
     46                        <string>RBSplitSubview</string> 
     47                        <key>LANGUAGE</key> 
     48                        <string>ObjC</string> 
     49                        <key>SUPERCLASS</key> 
     50                        <string>NSView</string> 
     51                </dict> 
     52                <dict> 
    3253                        <key>ACTIONS</key> 
    3354                        <dict> 
    3455                                <key>adiumPrint</key> 
    3556                                <string>id</string> 
     57                                <key>didAdjustSubviews</key> 
     58                                <string>RBSplitView</string> 
    3659                                <key>prefsWindowWillClose</key> 
    3760                                <string>SS_PrefsController</string> 
     61                                <key>toggleFindPanel</key> 
     62                                <string>id</string> 
     63                                <key>willAdjustSubviews</key> 
     64                                <string>RBSplitView</string> 
    3865                        </dict> 
    3966                        <key>CLASS</key> 
     
    127154                                <string>NSButton</string> 
    128155                                <key>checkBox_statusWindowHideInBackground</key> 
     156                                <string>NSButton</string> 
     157                                <key>checkBox_unreadConversations</key> 
    129158                                <string>NSButton</string> 
    130159                                <key>label_quitConfirmation</key> 
  • trunk/Resources/StatusPreferencesAdvanced.nib/info.nib

    r22227 r23581  
    1414        </array> 
    1515        <key>IBSystem Version</key> 
    16         <string>9B18</string> 
     16        <string>9C7010</string> 
    1717        <key>targetFramework</key> 
    1818        <string>IBCocoaFramework</string> 
  • trunk/Source/AIChatController.m

    r23557 r23581  
    720720 
    721721/*! 
     722 * @brief Gets the total number of conversations with unviewed messages 
     723 *  
     724 * @result The number of conversations with unviewed messages 
     725 */ 
     726- (int)unviewedConversationCount 
     727{ 
     728        int                             count = 0; 
     729        AIChat                  *chat; 
     730        NSEnumerator    *enumerator; 
     731         
     732        enumerator = [[self openChats] objectEnumerator]; 
     733        while ((chat = [enumerator nextObject])) { 
     734                if ([chat unviewedContentCount] > 0) 
     735                        count++; 
     736        } 
     737        return count; 
     738} 
     739 
     740/*! 
    722741 * @brief Is the passed contact in a group chat? 
    723742 * 
  • trunk/Source/ESStatusAdvancedPreferences.h

    r21551 r23581  
    99 
    1010@interface ESStatusAdvancedPreferences : AIAdvancedPreferencePane { 
     11        IBOutlet        NSButton        *checkBox_unreadConversations; 
     12         
    1113        IBOutlet        NSTextField     *label_statusWindow; 
    1214        IBOutlet        NSButton        *checkBox_statusWindowHideInBackground; 
  • trunk/Source/ESStatusAdvancedPreferences.m

    r21551 r23581  
    5151- (void)viewDidLoad 
    5252{ 
     53        [checkBox_unreadConversations setLocalizedString:AILocalizedString(@"Count unread conversations instead of unread messages", nil)]; 
     54         
    5355        [label_statusWindow setLocalizedString:AILocalizedString(@"Away Status Window", nil)]; 
    5456        [checkBox_statusWindowHideInBackground setLocalizedString:AILocalizedString(@"Hide the status window when Adium is not active", nil)];