Skip to content

Commit

Permalink
Start of codebase rewrite. Most likely will not build for anyone with…
Browse files Browse the repository at this point in the history
… this first commit, but it shows the direction we are heading. Trying to clean up resources to make Textual easier to expand.
  • Loading branch information
emsquared committed Jun 14, 2012
1 parent bc3754f commit 04dc1d1
Show file tree
Hide file tree
Showing 228 changed files with 5,993 additions and 7,523 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// You can redistribute it and/or modify it under the new BSD license.
// Converted to ARC Support on Thursday, June 08, 2012

#define CLICK_INTERVAL 2
#define _clickInterval 2

@implementation GrowlController
@implementation TLOGrowlController

@synthesize owner;
@synthesize lastClickedContext;
Expand All @@ -14,8 +14,8 @@ @implementation GrowlController
- (id)init
{
if ((self = [super init])) {
#ifdef _USES_NATIVE_NOTIFICATION_CENTER
if ([Preferences featureAvailableToOSXMountainLion]) {
#ifdef TXNativeNotificationCenterAvailable
if ([TPCPreferences featureAvailableToOSXMountainLion]) {
[_NSUserNotificationCenter() setDelegate:self];

return self;
Expand All @@ -29,89 +29,89 @@ - (id)init
}


- (void)notify:(NotificationType)type title:(NSString *)title
- (void)notify:(TXNotificationType)type title:(NSString *)title
desc:(NSString *)desc userInfo:(NSDictionary *)info
{
if ([Preferences growlEnabledForEvent:type] == NO) return;
if ([TPCPreferences growlEnabledForEvent:type] == NO) return;

NSString *kind = nil;

NSInteger priority = 0;

BOOL sticky = [Preferences growlStickyForEvent:type];
BOOL sticky = [TPCPreferences growlStickyForEvent:type];

switch (type) {
case NOTIFICATION_HIGHLIGHT:
case TXNotificationHighlightType:
{
priority = 1;
kind = TXTLS(@"NOTIFICATION_MSG_HIGHLIGHT");
title = TXTFLS(@"NOTIFICATION_MSG_HIGHLIGHT_TITLE", title);
kind = TXTLS(@"NotificationHighlightMessage");
title = TXTFLS(@"NotificationHighlightMessageTitle", title);
break;
}
case NOTIFICATION_NEW_TALK:
case TXNotificationNewQueryType:
{
priority = 1;
kind = TXTLS(@"NOTIFICATION_MSG_NEW_TALK");
title = TXTLS(@"NOTIFICATION_MSG_NEW_TALK_TITLE");
kind = TXTLS(@"NotificationNewPrivateQueryMessage");
title = TXTLS(@"NotificationNewPrivateQueryMessageTitle");
break;
}
case NOTIFICATION_CHANNEL_MSG:
case TXNotificationChannelMessageType:
{
kind = TXTLS(@"NOTIFICATION_MSG_CHANNEL_MSG");
kind = TXTLS(@"NotificationChannelTalkMessage");
break;
}
case NOTIFICATION_CHANNEL_NOTICE:
case TXNotificationChannelNoticeType:
{
kind = TXTLS(@"NOTIFICATION_MSG_CHANNEL_NOTICE");
title = TXTFLS(@"NOTIFICATION_MSG_CHANNEL_NOTICE_TITLE", title);
kind = TXTLS(@"NotificationChannelNoticeMessage");
title = TXTFLS(@"NotificationChannelNoticeMessageTitle", title);
break;
}
case NOTIFICATION_TALK_MSG:
case TXNotificationQueryMessageType:
{
kind = TXTLS(@"NOTIFICATION_MSG_TALK_MSG");
title = TXTLS(@"NOTIFICATION_MSG_TALK_MSG_TITLE");
kind = TXTLS(@"NotificationPrivateQueryMessage");
title = TXTLS(@"NotificationPrivateQueryMessageTitle");
break;
}
case NOTIFICATION_TALK_NOTICE:
case TXNotificationQueryNoticeType:
{
kind = TXTLS(@"NOTIFICATION_MSG_TALK_NOTICE");
title = TXTLS(@"NOTIFICATION_MSG_TALK_NOTICE_TITLE");
kind = TXTLS(@"NotificationPrivateNoticeMessage");
title = TXTLS(@"NotificationPrivateNoticeMessageTitle");
break;
}
case NOTIFICATION_KICKED:
case TXNotificationKickType:
{
kind = TXTLS(@"NOTIFICATION_MSG_KICKED");
title = TXTFLS(@"NOTIFICATION_MSG_KICKED_TITLE", title);
kind = TXTLS(@"NotificationKickedMessage");
title = TXTFLS(@"NotificationKickedMessageTitle", title);
break;
}
case NOTIFICATION_INVITED:
case TXNotificationInviteType:
{
kind = TXTLS(@"NOTIFICATION_MSG_INVITED");
title = TXTFLS(@"NOTIFICATION_MSG_INVITED_TITLE", title);
kind = TXTLS(@"NotificationInvitedMessage");
title = TXTFLS(@"NotificationInvitedMessageTitle", title);
break;
}
case NOTIFICATION_LOGIN:
case TXNotificationConnectType:
{
kind = TXTLS(@"NOTIFICATION_MSG_LOGIN");
title = TXTFLS(@"NOTIFICATION_MSG_LOGIN_TITLE", title);
kind = TXTLS(@"NotificationConnectedMessage");
title = TXTFLS(@"NotificationConnectedMessageTitle", title);
break;
}
case NOTIFICATION_DISCONNECT:
case TXNotificationDisconnectType:
{
kind = TXTLS(@"NOTIFICATION_MSG_DISCONNECT");
title = TXTFLS(@"NOTIFICATION_MSG_DISCONNECT_TITLE", title);
kind = TXTLS(@"NotificationDisconnectMessage");
title = TXTFLS(@"NotificationDisconnectMessageTitle", title);
break;
}
case NOTIFICATION_ADDRESS_BOOK_MATCH:
case TXNotificationAddressBookMatchType:
{
kind = TXTLS(@"NOTIFICATION_ADDRESS_BOOK_MATCH");
title = TXTLS(@"NOTIFICATION_MSG_ADDRESS_BOOK_MATCH_TITLE");
kind = TXTLS(@"TXNotificationAddressBookMatchType");
title = TXTLS(@"NotificationAddressBookMatchMessageTitle");
break;
}
}

#ifdef _USES_NATIVE_NOTIFICATION_CENTER
if ([Preferences featureAvailableToOSXMountainLion]) {
#ifdef TXNativeNotificationCenterAvailable
if ([TPCPreferences featureAvailableToOSXMountainLion]) {
NSUserNotification *notification = [[NSUserNotification alloc] init];

notification.title = title;
Expand All @@ -136,7 +136,7 @@ - (void)notify:(NotificationType)type title:(NSString *)title

/* NSUserNotificationCenter */

#ifdef _USES_NATIVE_NOTIFICATION_CENTER
#ifdef TXNativeNotificationCenterAvailable

- (void)userNotificationCenter:(NSUserNotificationCenter *)center
didActivateNotification:(NSUserNotification *)notification
Expand All @@ -152,18 +152,18 @@ - (void)userNotificationCenter:(NSUserNotificationCenter *)center

- (NSString *)applicationNameForGrowl
{
return [Preferences applicationName];
return [TPCPreferences applicationName];
}

- (NSDictionary *)registrationDictionaryForGrowl
{
NSArray *allNotifications = [NSArray arrayWithObjects:
TXTLS(@"NOTIFICATION_MSG_HIGHLIGHT"), TXTLS(@"NOTIFICATION_MSG_NEW_TALK"),
TXTLS(@"NOTIFICATION_MSG_CHANNEL_MSG"), TXTLS(@"NOTIFICATION_MSG_CHANNEL_NOTICE"),
TXTLS(@"NOTIFICATION_MSG_TALK_MSG"), TXTLS(@"NOTIFICATION_MSG_TALK_NOTICE"),
TXTLS(@"NOTIFICATION_MSG_KICKED"), TXTLS(@"NOTIFICATION_MSG_INVITED"),
TXTLS(@"NOTIFICATION_MSG_LOGIN"), TXTLS(@"NOTIFICATION_MSG_DISCONNECT"),
TXTLS(@"NOTIFICATION_ADDRESS_BOOK_MATCH"), nil];
TXTLS(@"NotificationHighlightMessage"), TXTLS(@"NotificationNewPrivateQueryMessage"),
TXTLS(@"NotificationChannelTalkMessage"), TXTLS(@"NotificationChannelNoticeMessage"),
TXTLS(@"NotificationPrivateQueryMessage"), TXTLS(@"NotificationPrivateNoticeMessage"),
TXTLS(@"NotificationKickedMessage"), TXTLS(@"NotificationInvitedMessage"),
TXTLS(@"NotificationConnectedMessage"), TXTLS(@"NotificationDisconnectMessage"),
TXTLS(@"TXNotificationAddressBookMatchType"), nil];

return [NSDictionary dictionaryWithObjectsAndKeys:allNotifications, GROWL_NOTIFICATIONS_ALL, allNotifications, GROWL_NOTIFICATIONS_DEFAULT, nil];
}
Expand All @@ -172,7 +172,7 @@ - (void)growlNotificationWasClicked:(NSDictionary *)context
{
CFAbsoluteTime now = CFAbsoluteTimeGetCurrent();

if ((now - self.lastClickedTime) < CLICK_INTERVAL) {
if ((now - self.lastClickedTime) < _clickInterval) {
if (self.lastClickedContext && [self.lastClickedContext isEqual:context]) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// You can redistribute it and/or modify it under the new BSD license.
// Converted to ARC Support on Thursday, June 08, 2012

@implementation NickCompletionStatus
@implementation TLONickCompletionStatus

@synthesize text;
@synthesize range;
Expand Down
Loading

0 comments on commit 04dc1d1

Please sign in to comment.