Followed Jeromes suggestion and moved the desktop directory lookup to the
BackgroundImage::SetDesktopImage() method - if you need more control, you can still easily make _SetImage() public. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16274 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -38,6 +38,7 @@ All rights reserved.
|
|||||||
#include <Background.h>
|
#include <Background.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
@@ -248,9 +249,20 @@ BackgroundImage::SetImage(BDirectory& directory, const char* path, Mode mode,
|
|||||||
|
|
||||||
/*static*/
|
/*static*/
|
||||||
status_t
|
status_t
|
||||||
BackgroundImage::SetDesktopImage(BDirectory& directory, uint32 workspaces, const char* path,
|
BackgroundImage::SetDesktopImage(uint32 workspaces, const char* image,
|
||||||
Mode mode, BPoint offset, bool eraseIconBackground)
|
Mode mode, BPoint offset, bool eraseIconBackground)
|
||||||
{
|
{
|
||||||
return _SetImage(directory, true, workspaces, path, mode, offset, eraseIconBackground);
|
BPath path;
|
||||||
|
status_t status = find_directory(B_DESKTOP_DIRECTORY, &path);
|
||||||
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
BDirectory directory;
|
||||||
|
status = directory.SetTo(path.Path());
|
||||||
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
return _SetImage(directory, true, workspaces, image, mode, offset,
|
||||||
|
eraseIconBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ class BackgroundImage {
|
|||||||
|
|
||||||
static status_t SetImage(BDirectory& directory, const char* path, Mode mode,
|
static status_t SetImage(BDirectory& directory, const char* path, Mode mode,
|
||||||
BPoint offset, bool eraseIconBackground = false);
|
BPoint offset, bool eraseIconBackground = false);
|
||||||
static status_t SetDesktopImage(BDirectory& directory, uint32 workspaces,
|
static status_t SetDesktopImage(uint32 workspaces, const char* path,
|
||||||
const char* path, Mode mode, BPoint offset,
|
Mode mode, BPoint offset,
|
||||||
bool eraseIconBackground = false);
|
bool eraseIconBackground = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include <Clipboard.h>
|
#include <Clipboard.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <FindDirectory.h>
|
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
@@ -801,15 +800,10 @@ ShowImageWindow::MessageReceived(BMessage *message)
|
|||||||
case MSG_DESKTOP_BACKGROUND:
|
case MSG_DESKTOP_BACKGROUND:
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_DESKTOP_DIRECTORY, &path) == B_OK) {
|
if (path.SetTo(fImageView->Image()) == B_OK) {
|
||||||
BDirectory directory(path.Path());
|
BackgroundImage::SetDesktopImage(B_CURRENT_WORKSPACE,
|
||||||
if (directory.InitCheck() == B_OK) {
|
path.Path(), BackgroundImage::kScaledToFit,
|
||||||
if (path.SetTo(fImageView->Image()) == B_OK) {
|
BPoint(0, 0), false);
|
||||||
BackgroundImage::SetDesktopImage(directory, B_CURRENT_WORKSPACE,
|
|
||||||
path.Path(), BackgroundImage::kScaledToFit, BPoint(0, 0),
|
|
||||||
false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user