Author: pulkomandy Date: 2010-06-29 15:53:20 +0200 (Tue, 29 Jun 2010) New Revision: 37301 Changeset: http://dev.haiku-os.org/changeset/37301/haiku Modified: haiku/trunk/src/apps/deskbar/TimeView.cpp haiku/trunk/src/apps/deskbar/TimeView.h Log: Some refactoring of the deskar localization code to be more effective. There is a memory leak somewhere in deskbar, but it appears to be unrelated to the time localization change (stays even if clock is disabled), so I have no idea where it comes from. Modified: haiku/trunk/src/apps/deskbar/TimeView.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/TimeView.cpp 2010-06-29 10:52:16 UTC (rev 37300) +++ haiku/trunk/src/apps/deskbar/TimeView.cpp 2010-06-29 13:53:20 UTC (rev 37301) @@ -96,6 +96,8 @@ fLastTimeStr[0] = 0; fLastDateStr[0] = 0; fNeedToUpdate = true; + + be_locale_roster->GetDefaultCountry(&fHere); } @@ -109,6 +111,8 @@ data->FindBool("eurodate", &fEuroDate); data->FindBool("interval", &fInterval); fShowingDate = false; + + be_locale_roster->GetDefaultCountry(&fHere); } #endif @@ -317,11 +321,7 @@ fMinute = time.tm_min; fHour = time.tm_hour; - - BCountry* here; - be_locale_roster->GetDefaultCountry(&here); - - here->FormatTime(fTimeStr, 64, fTime, fShowSeconds); + fHere->FormatTime(fTimeStr, 64, fTime, fShowSeconds); } Modified: haiku/trunk/src/apps/deskbar/TimeView.h =================================================================== --- haiku/trunk/src/apps/deskbar/TimeView.h 2010-06-29 10:52:16 UTC (rev 37300) +++ haiku/trunk/src/apps/deskbar/TimeView.h 2010-06-29 13:53:20 UTC (rev 37301) @@ -44,12 +44,14 @@ const uint32 kFullDate = 'FDat'; const uint32 kEuroDate = 'EDat'; +class BCountry; class BMessageRunner; #ifdef AS_REPLICANT class _EXPORT TTimeView; #endif + class TTimeView : public BView { public: TTimeView(float maxWidth, float height, bool showSeconds = false, @@ -130,6 +132,8 @@ BMessenger fCalendarWindow; BMessageRunner* fLongClickMessageRunner; + + BCountry* fHere; // For date and time localizing purposes };