[haiku-commits] r40986 - haiku/trunk/src/preferences/datatranslations

  • From: jonas@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 17 Mar 2011 03:28:45 +0100 (CET)

Author: kirilla
Date: 2011-03-17 03:28:45 +0100 (Thu, 17 Mar 2011)
New Revision: 40986
Changeset: https://dev.haiku-os.org/changeset/40986

Modified:
   haiku/trunk/src/preferences/datatranslations/DataTranslations.cpp
   haiku/trunk/src/preferences/datatranslations/DataTranslations.h
   haiku/trunk/src/preferences/datatranslations/DataTranslationsSettings.cpp
   haiku/trunk/src/preferences/datatranslations/DataTranslationsSettings.h
   haiku/trunk/src/preferences/datatranslations/DataTranslationsWindow.cpp
Log:
Build fix. CID 3165 FORWARD_NULL, avoid casting be_app.

Modified: haiku/trunk/src/preferences/datatranslations/DataTranslations.cpp
===================================================================
--- haiku/trunk/src/preferences/datatranslations/DataTranslations.cpp   
2011-03-17 01:15:04 UTC (rev 40985)
+++ haiku/trunk/src/preferences/datatranslations/DataTranslations.cpp   
2011-03-17 02:28:45 UTC (rev 40986)
@@ -14,13 +14,13 @@
 
 #include <Alert.h>
 #include <Catalog.h>
+#include <Entry.h>
 #include <Directory.h>
 #include <FindDirectory.h>
 #include <String.h>
 #include <TranslatorRoster.h>
 #include <TextView.h>
 
-#include "DataTranslationsSettings.h"
 #include "DataTranslationsWindow.h"
 
 
@@ -44,13 +44,6 @@
 
 
 void
-DataTranslationsApplication::SetWindowCorner(const BPoint& leftTop)
-{
-       fSettings.SetWindowCorner(leftTop);
-}
-
-
-void
 DataTranslationsApplication::AboutRequested()
 {
        BAlert* alert = new BAlert(B_TRANSLATE("About"),

Modified: haiku/trunk/src/preferences/datatranslations/DataTranslations.h
===================================================================
--- haiku/trunk/src/preferences/datatranslations/DataTranslations.h     
2011-03-17 01:15:04 UTC (rev 40985)
+++ haiku/trunk/src/preferences/datatranslations/DataTranslations.h     
2011-03-17 02:28:45 UTC (rev 40986)
@@ -13,9 +13,7 @@
 
 #include <Application.h>
 
-#include "DataTranslationsSettings.h"
 
-
 class BDirectory;
 class BEntry;
 
@@ -28,18 +26,10 @@
        virtual void                            RefsReceived(BMessage* message);
        virtual void                            AboutRequested();
 
-                       BPoint                          WindowCorner() const {
-                                                                       return 
fSettings.WindowCorner();
-                                                               }
-                       void                            SetWindowCorner(const 
BPoint& leftTop);
-
 private:
                        void                            _InstallError(const 
char* name, status_t status);
                        status_t                        _Install(BDirectory& 
target, BEntry& entry);
                        void                            
_NoTranslatorError(const char* name);
-
-private:
-                       DataTranslationsSettings        fSettings;
 };
 
 

Modified: 
haiku/trunk/src/preferences/datatranslations/DataTranslationsSettings.cpp
===================================================================
--- haiku/trunk/src/preferences/datatranslations/DataTranslationsSettings.cpp   
2011-03-17 01:15:04 UTC (rev 40985)
+++ haiku/trunk/src/preferences/datatranslations/DataTranslationsSettings.cpp   
2011-03-17 02:28:45 UTC (rev 40986)
@@ -19,6 +19,9 @@
 #include <Path.h>
 
 
+static DataTranslationsSettings sDataTranslationsSettings;
+
+
 DataTranslationsSettings::DataTranslationsSettings()
 {
        BPath path;
@@ -61,3 +64,10 @@
 {
        fCorner = corner;
 }
+
+
+DataTranslationsSettings*
+DataTranslationsSettings::Instance()
+{
+       return &sDataTranslationsSettings;
+}

Modified: 
haiku/trunk/src/preferences/datatranslations/DataTranslationsSettings.h
===================================================================
--- haiku/trunk/src/preferences/datatranslations/DataTranslationsSettings.h     
2011-03-17 01:15:04 UTC (rev 40985)
+++ haiku/trunk/src/preferences/datatranslations/DataTranslationsSettings.h     
2011-03-17 02:28:45 UTC (rev 40986)
@@ -20,6 +20,8 @@
                        BPoint                  WindowCorner() const { return 
fCorner; }
                        void                    SetWindowCorner(BPoint corner);
 
+       static DataTranslationsSettings*        Instance();
+
 private:
                        BPoint                  fCorner;
 };

Modified: 
haiku/trunk/src/preferences/datatranslations/DataTranslationsWindow.cpp
===================================================================
--- haiku/trunk/src/preferences/datatranslations/DataTranslationsWindow.cpp     
2011-03-17 01:15:04 UTC (rev 40985)
+++ haiku/trunk/src/preferences/datatranslations/DataTranslationsWindow.cpp     
2011-03-17 02:28:45 UTC (rev 40986)
@@ -34,6 +34,7 @@
 #include <TranslatorRoster.h>
 
 #include "DataTranslations.h"
+#include "DataTranslationsSettings.h"
 #include "IconView.h"
 #include "TranslatorListView.h"
 
@@ -52,7 +53,7 @@
                B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
                | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS)
 {
-       
MoveTo(static_cast<DataTranslationsApplication*>(be_app)->WindowCorner());
+       MoveTo(DataTranslationsSettings::Instance()->WindowCorner());
 
        _SetupViews();
 
@@ -210,9 +211,8 @@
 DataTranslationsWindow::QuitRequested()
 {
        BPoint pt(Frame().LeftTop());
-       dynamic_cast<DataTranslationsApplication*>(be_app)->SetWindowCorner(pt);
+       DataTranslationsSettings::Instance()->SetWindowCorner(pt);
        be_app->PostMessage(B_QUIT_REQUESTED);
-
        return true;
 }
 


Other related posts: