Skip to content

Commit

Permalink
Merge pull request HaikuArchives#8 from atalax/master
Browse files Browse the repository at this point in the history
Use find_directory to find the location of settings and backgrounds
  • Loading branch information
scottmc committed Dec 24, 2014
2 parents ebffae4 + e8c7c4e commit 5991814
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
Binary file added backgrounds/Fire.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backgrounds/Sky.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backgrounds/Steel.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions image-sources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Steel.jpg
http://commons.wikimedia.org/wiki/File:Diamond_Plate.jpg

Sky.jpg
http://commons.wikimedia.org/wiki/File:Sky-2.jpg

Fire.jpg
http://commons.wikimedia.org/wiki/File:FIRE_01.JPG
19 changes: 9 additions & 10 deletions source/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <Directory.h>
#include <LayoutBuilder.h>
#include <Box.h>
#include <FindDirectory.h>
#include "AboutWindow.h"
#include "Preferences.h"
#include "TileView.h"
Expand Down Expand Up @@ -46,16 +47,14 @@ MainWindow::MainWindow(void)
fGrid(NULL),
fWorkGrid(NULL)
{
app_info ai;
be_app->GetAppInfo(&ai);
BPath path(&ai.ref);
path.GetParent(&path);
path.Append("backgrounds");
fBackPath = path.Path();
fBackPath << "/";

BPath path;
find_directory(B_USER_SETTINGS_DIRECTORY, &path);
path.Append("BeVexed");
fBackPath = BString(path.Path()) << "/backgrounds/";
fPrefPath = BString(path.Path()) << "/settings";

static const rgb_color beos_blue = {51,102,152,255};
LoadPreferences(PREFERENCES_PATH);
LoadPreferences(fPrefPath);

if(gPreferences.FindInt8("gridsize",(int8*)&fGridSize)!=B_OK)
{
Expand Down Expand Up @@ -202,7 +201,7 @@ MainWindow::MainWindow(void)
bool MainWindow::QuitRequested(void)
{
gPreferences.ReplacePoint("corner",Frame().LeftTop());
SavePreferences(PREFERENCES_PATH);
SavePreferences(fPrefPath);
be_app->PostMessage(B_QUIT_REQUESTED);
return true;
}
Expand Down
1 change: 1 addition & 0 deletions source/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class MainWindow : public BWindow
uint8 fTileSize;

BString fBackPath;
BString fPrefPath;
BString fBackName;
};

Expand Down
2 changes: 0 additions & 2 deletions source/Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ extern BLocker prefsLock;
extern BMessage gPreferences;
extern BString gAppPath;

#define PREFERENCES_PATH "/boot/home/config/settings/BeVexed"

status_t SavePreferences(const char *path);
status_t LoadPreferences(const char *path);

Expand Down

0 comments on commit 5991814

Please sign in to comment.