tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / preferences / time / TimeSettings.cpp
blobf50b8a264b8516fb5b926687f5721f95e1318fa7
1 /*
2 * Copyright 2002-2007, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Andrew McCall, mccall@digitalparadise.co.uk
7 * Mike Berg <mike@berg-net.us>
8 * Julun <host.haiku@gmx.de>
12 #include "TimeSettings.h"
13 #include "TimeMessages.h"
16 #include <File.h>
17 #include <FindDirectory.h>
18 #include <Path.h>
21 TimeSettings::TimeSettings()
23 fSettingsFile("Time_preflet_window")
28 TimeSettings::~TimeSettings()
33 BPoint
34 TimeSettings::LeftTop() const
36 BPath path;
37 BPoint leftTop(-1000.0, -1000.0);
39 if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
40 path.Append(fSettingsFile.String());
42 BFile file(path.Path(), B_READ_ONLY);
43 if (file.InitCheck() == B_OK) {
44 BPoint tmp;
45 if (file.Read(&tmp, sizeof(BPoint)) == sizeof(BPoint))
46 leftTop = tmp;
50 return leftTop;
54 void
55 TimeSettings::SetLeftTop(const BPoint leftTop)
57 BPath path;
58 if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
59 return;
61 path.Append(fSettingsFile.String());
63 BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE);
64 if (file.InitCheck() == B_OK)
65 file.Write(&leftTop, sizeof(BPoint));