From 5b12845050b248e5398618d2f24f197117967e29 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 29 Jun 2010 13:53:20 +0000 Subject: [PATCH] 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37301 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/TimeView.cpp | 10 +++++----- src/apps/deskbar/TimeView.h | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp index 92a170dcfc..151a90a2b1 100644 --- a/src/apps/deskbar/TimeView.cpp +++ b/src/apps/deskbar/TimeView.cpp @@ -96,6 +96,8 @@ TTimeView::TTimeView(float maxWidth, float height, bool showSeconds, fLastTimeStr[0] = 0; fLastDateStr[0] = 0; fNeedToUpdate = true; + + be_locale_roster->GetDefaultCountry(&fHere); } @@ -109,6 +111,8 @@ TTimeView::TTimeView(BMessage* data) data->FindBool("eurodate", &fEuroDate); data->FindBool("interval", &fInterval); fShowingDate = false; + + be_locale_roster->GetDefaultCountry(&fHere); } #endif @@ -317,11 +321,7 @@ TTimeView::GetCurrentTime() 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); } diff --git a/src/apps/deskbar/TimeView.h b/src/apps/deskbar/TimeView.h index 9837665e39..333eba695a 100644 --- a/src/apps/deskbar/TimeView.h +++ b/src/apps/deskbar/TimeView.h @@ -44,12 +44,14 @@ const uint32 kShowSeconds = 'ShSc'; 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 @@ class TTimeView : public BView { BMessenger fCalendarWindow; BMessageRunner* fLongClickMessageRunner; + + BCountry* fHere; // For date and time localizing purposes };