usb_ecm: Use the current configuration instead of a fixed one.
[haiku.git] / src / preferences / datatranslations / DataTranslationsSettings.cpp
blob0db5e9c6c20a2d546365c49cfad7e91cf5e0c5d6
1 /*
2 * Copyright 2002-2010, Haiku, Inc.
3 * Distributed under the terms of the MIT license.
5 * Authors:
6 * Oliver Siebenmarck
7 * Axel Dörfler
8 */
11 #include "DataTranslationsSettings.h"
13 #include <stdio.h>
15 #include <Application.h>
16 #include <File.h>
17 #include <FindDirectory.h>
18 #include <Message.h>
19 #include <Path.h>
22 static DataTranslationsSettings sDataTranslationsSettings;
25 DataTranslationsSettings::DataTranslationsSettings()
27 BPath path;
28 if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
29 return;
31 fCorner = BPoint(-1, -1);
33 path.Append("system/DataTranslations settings");
34 BFile file(path.Path(), B_READ_ONLY);
35 BMessage settings;
37 if (file.InitCheck() == B_OK
38 && settings.Unflatten(&file) == B_OK) {
39 BPoint corner;
40 if (settings.FindPoint("window corner", &corner) == B_OK)
41 fCorner = corner;
46 DataTranslationsSettings::~DataTranslationsSettings()
48 BPath path;
49 if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) < B_OK)
50 return;
52 BMessage settings;
53 settings.AddPoint("window corner", fCorner);
55 path.Append("system/DataTranslations settings");
56 BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
57 if (file.InitCheck() == B_OK)
58 settings.Flatten(&file);
62 void
63 DataTranslationsSettings::SetWindowCorner(BPoint corner)
65 fCorner = corner;
69 DataTranslationsSettings*
70 DataTranslationsSettings::Instance()
72 return &sDataTranslationsSettings;