Solve #4336 as suggested by Fredrik Modèen, using shared private code as suggested by Ryan Leavengood. Removed ProcessRefs code path.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32844 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
#include "BackgroundsView.h"
|
#include "BackgroundsView.h"
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <TrackerAddOn.h>
|
#include <TrackerAddOnAppLaunch.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -28,8 +28,6 @@ class BackgroundsWindow : public BWindow {
|
|||||||
public:
|
public:
|
||||||
BackgroundsWindow(BRect frame, bool standalone = true);
|
BackgroundsWindow(BRect frame, bool standalone = true);
|
||||||
|
|
||||||
void ProcessRefs(entry_ref dir, BMessage* refs);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
virtual void WorkspaceActivated(int32 oldWorkspaces, bool active);
|
virtual void WorkspaceActivated(int32 oldWorkspaces, bool active);
|
||||||
@@ -92,32 +90,9 @@ BackgroundsWindow::WorkspaceActivated(int32 oldWorkspaces, bool active)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BackgroundsWindow::ProcessRefs(entry_ref dir, BMessage* refs)
|
|
||||||
{
|
|
||||||
fBackgroundsView->ProcessRefs(dir, refs);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Tracker add-on entry
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/)
|
|
||||||
{
|
|
||||||
BackgroundsWindow* window = new BackgroundsWindow(BRect(100, 100, 570, 325), false);
|
|
||||||
window->ProcessRefs(dir, refs);
|
|
||||||
snooze(500);
|
|
||||||
window->Show();
|
|
||||||
|
|
||||||
status_t status;
|
|
||||||
wait_for_thread(window->Thread(), &status);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
@@ -130,4 +105,3 @@ main(int argc, char** argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -990,6 +990,12 @@ BackgroundsView::UpdateButtons()
|
|||||||
void
|
void
|
||||||
BackgroundsView::RefsReceived(BMessage *msg)
|
BackgroundsView::RefsReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
|
if (!msg->HasRef("refs") && msg->HasRef("dir_ref")) {
|
||||||
|
entry_ref dirRef;
|
||||||
|
if (msg->FindRef("dir_ref", &dirRef) == B_OK)
|
||||||
|
msg->AddRef("refs", &dirRef);
|
||||||
|
}
|
||||||
|
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
BMimeType imageType("image");
|
BMimeType imageType("image");
|
||||||
@@ -1095,23 +1101,6 @@ BackgroundsView::AddImage(BPath path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BackgroundsView::ProcessRefs(entry_ref dir, BMessage* refs)
|
|
||||||
{
|
|
||||||
fWorkspaceMenu->FindItem(kMsgDefaultFolder)->SetMarked(true);
|
|
||||||
BMessenger messenger(this);
|
|
||||||
messenger.SendMessage(kMsgDefaultFolder);
|
|
||||||
|
|
||||||
if (refs->CountNames(B_REF_TYPE) > 0) {
|
|
||||||
messenger.SendMessage(refs);
|
|
||||||
} else {
|
|
||||||
BMessage message(B_REFS_RECEIVED);
|
|
||||||
message.AddRef("refs", &dir);
|
|
||||||
messenger.SendMessage(&message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Image*
|
Image*
|
||||||
BackgroundsView::GetImage(int32 imageIndex)
|
BackgroundsView::GetImage(int32 imageIndex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ class BackgroundsView : public BBox {
|
|||||||
void WorkspaceActivated(uint32 oldWorkspaces, bool active);
|
void WorkspaceActivated(uint32 oldWorkspaces, bool active);
|
||||||
int32 AddImage(BPath path);
|
int32 AddImage(BPath path);
|
||||||
Image* GetImage(int32 imageIndex);
|
Image* GetImage(int32 imageIndex);
|
||||||
void ProcessRefs(entry_ref dir_ref, BMessage* msg);
|
|
||||||
|
|
||||||
void GetPreferredSize(float* _width, float* _height);
|
void GetPreferredSize(float* _width, float* _height);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user