[Adium-devl] [Adium-svn] rev 16275 - trunk/Source

Colin Barrett timber at lava.net
Wed Jun 21 09:07:19 UTC 2006


Isn't there a way to get this from your locale?

-Colin

On Jun 18, 2006, at 2:20 PM, evands at adiumx.com wrote:

> Author: evands
> Date: 2006-06-18 20:20:08 -0400 (Sun, 18 Jun 2006)
> New Revision: 16275
>
> Modified:
>    trunk/Source/AIAbstractLogViewerWindowController.h
>    trunk/Source/AIAbstractLogViewerWindowController.m
> Log:
> The 'this week' date filter in the log viewer still defaults to  
> having Sunday be the start of the week.  If you set a different day  
> as the start of the week in iCal, however, we'll respect that  
> preference.  I think this is reasonable, as it is way too nitpicky  
> a preference to include within Adium itself but is something that,  
> if you cared about significantly, you would probably change in  
> iCal, as well. Fixes #4279
>
> Modified: trunk/Source/AIAbstractLogViewerWindowController.h
> ===================================================================
> --- trunk/Source/AIAbstractLogViewerWindowController.h	2006-06-19  
> 00:02:12 UTC (rev 16274)
> +++ trunk/Source/AIAbstractLogViewerWindowController.h	2006-06-19  
> 00:20:08 UTC (rev 16275)
> @@ -102,6 +102,8 @@
>  	
>  	AIDateType			filterDateType;
>  	NSCalendarDate		*filterDate;
> +	int					firstDayOfWeek;
> +	BOOL				iCalFirstDayOfWeekDetermined;
>
>  	NSMutableDictionary	*logToGroupDict;
>  	NSMutableDictionary	*logFromGroupDict;
>
> Modified: trunk/Source/AIAbstractLogViewerWindowController.m
> ===================================================================
> --- trunk/Source/AIAbstractLogViewerWindowController.m	2006-06-19  
> 00:02:12 UTC (rev 16274)
> +++ trunk/Source/AIAbstractLogViewerWindowController.m	2006-06-19  
> 00:20:08 UTC (rev 16275)
> @@ -148,7 +148,7 @@
>      displayedLogArray = nil;
>      aggregateLogIndexProgressTimer = nil;
>      windowIsClosing = NO;
> -	
> +
>      blankImage = [[NSImage alloc] initWithSize:NSMakeSize(16,16)];
>
>      sortDirection = YES;
> @@ -1883,6 +1883,29 @@
>  	return [dateTypeMenu autorelease];
>  }
>
> +- (int)daysSinceStartOfWeekGivenToday:(NSCalendarDate *)today
> +{
> +	int todayDayOfWeek = [today dayOfWeek];
> +
> +	//Try to look at the iCal preferences if possible
> +	if (!iCalFirstDayOfWeekDetermined) {
> +		CFPropertyListRef iCalFirstDayOfWeek = CFPreferencesCopyAppValue 
> (CFSTR("first day of week"),CFSTR("com.apple.iCal"));
> +		if (iCalFirstDayOfWeek) {
> +			//This should return a CFNumberRef... we're using another app's  
> prefs, so make sure.
> +			if (CFGetTypeID(iCalFirstDayOfWeek) == CFNumberGetTypeID()) {
> +				firstDayOfWeek = [(NSNumber *)iCalFirstDayOfWeek intValue];
> +			}
> +
> +			CFRelease(iCalFirstDayOfWeek);
> +		}
> +
> +		//Don't check again
> +		iCalFirstDayOfWeekDetermined = YES;
> +	}
> +
> +	return ((todayDayOfWeek > firstDayOfWeek) ? (todayDayOfWeek -  
> firstDayOfWeek) : ((todayDayOfWeek + 7) - firstDayOfWeek));
> +}
> +
>  /*
>   * @brief A new date type was selected
>   *
> @@ -1918,7 +1941,7 @@
>  			filterDateType = AIDateTypeAfter;
>  			filterDate = [[today dateByAddingYears:0
>  											months:0
> -											  days:-[today dayOfWeek]
> +											  days:-[self daysSinceStartOfWeekGivenToday:today]
>  											 hours:-[today hourOfDay]
>  										   minutes:-[today minuteOfHour]
>  										   seconds:-([today secondOfMinute] + 1)] retain];
> @@ -1970,6 +1993,9 @@
>
>  - (void)configureDateFilter
>  {
> +	firstDayOfWeek = 0; /* Sunday */
> +	iCalFirstDayOfWeekDetermined = NO;
> +
>  	[popUp_dateFilter setMenu:[self dateTypeMenu]];
>  	[popUp_dateFilter selectItemWithTag:AIDateTypeAnyDate];
>  	[self selectedDateType:AIDateTypeAnyDate];
>
>
> _______________________________________________
> Adium-svn mailing list
> Adium-svn at adiumx.com
> http://adiumx.com/mailman/listinfo/adium-svn_adiumx.com
>





More information about the devel mailing list