Fix BAboutWindow lifecycle

BAboutWindow returned false in QuitRequested in order to hide instead of closing.
Not only this keeps a BLooper running for a rarely used window, but it also
prevents quitting an application in the window was not destroyed first.

 * Remove aforementioned QuitRequested method,
 * Add a static GetWindow method that returns the existing about window, if there
is one, or creates one if there is not. A boolean can be set to tell the caller
what happened,
 * Adjust all callers to use that new method, instead of managing the window themselves.
This commit is contained in:
Adrien Destugues
2013-04-30 21:50:24 +02:00
parent 3a12979db2
commit fd19c7366d
16 changed files with 135 additions and 155 deletions
+4 -3
View File
@@ -18,7 +18,6 @@
class AboutView;
class BBitmap;
class BPoint;
class BHandler;
class BAboutWindow : public BWindow {
public:
@@ -26,7 +25,6 @@ class BAboutWindow : public BWindow {
const char* signature);
virtual ~BAboutWindow();
virtual bool QuitRequested();
virtual void Show();
BPoint AboutPosition(float width, float height);
@@ -48,9 +46,12 @@ class BAboutWindow : public BWindow {
const char* Version();
void SetVersion(const char* version);
static BAboutWindow* GetWindow(const char* appName,
const char* signature, bool* needsInit = NULL);
private:
AboutView* fAboutView;
BHandler* fCaller;
static BAboutWindow* sAboutWindow;
};
#endif // B_ABOUT_WINDOW_H