diff --git a/pgadmin/frm/frmOptions.cpp b/pgadmin/frm/frmOptions.cpp
index 958e373..0d0d08e 100644
--- a/pgadmin/frm/frmOptions.cpp
+++ b/pgadmin/frm/frmOptions.cpp
@@ -73,6 +73,8 @@
 #define pickerActiveProcessColour   CTRL_COLOURPICKER("pickerActiveProcessColour")
 #define pickerSlowProcessColour     CTRL_COLOURPICKER("pickerSlowProcessColour")
 #define pickerBlockedProcessColour  CTRL_COLOURPICKER("pickerBlockedProcessColour")
+#define txtFavouritesFile           CTRL_TEXT("txtFavouritesFile")
+#define txtMacrosFile               CTRL_TEXT("txtMacrosFile")
 
 BEGIN_EVENT_TABLE(frmOptions, pgDialog)
     EVT_MENU(MNU_HELP,                                            frmOptions::OnHelp)
@@ -90,6 +92,8 @@ BEGIN_EVENT_TABLE(frmOptions, pgDialog)
     EVT_BUTTON (wxID_HELP,                                        frmOptions::OnHelp)
     EVT_BUTTON (wxID_CANCEL,                                      frmOptions::OnCancel)
     EVT_COMBOBOX(XRCID("cbCopyQuote"),		                      frmOptions::OnChangeCopyQuote)
+    EVT_BUTTON (XRCID("btnFavoritesPath"),                        frmOptions::OnFavouritesFileSelect)
+    EVT_BUTTON (XRCID("btnMacrosFile"),                           frmOptions::OnMacrosFileSelect)
 END_EVENT_TABLE()
 
 
@@ -227,6 +231,9 @@ frmOptions::frmOptions(frmMain *parent)
     pickerSlowProcessColour->SetColour(settings->GetSlowProcessColour());
     pickerBlockedProcessColour->SetColour(settings->GetBlockedProcessColour());
 
+    txtFavouritesFile->SetValue(settings->GetFavouritesFile());
+    txtMacrosFile->SetValue(settings->GetMacrosFile());
+
     cbLanguage->Append(_("Default"));
     int sel=0;
     wxLanguage langId=settings->GetCanonicalLanguage();
@@ -594,6 +601,9 @@ void frmOptions::OnOK(wxCommandEvent &ev)
         changed = true;
     settings->SetBlockedProcessColour(sColour);
 
+    settings->SetFavouritesFile(txtFavouritesFile->GetValue());
+    settings->SetMacrosFile(txtMacrosFile->GetValue());
+
     // Change the language last, as it will affect our tests for changes
     // in the display object types.
     int langNo=cbLanguage->GetCurrentSelection();
@@ -714,3 +724,19 @@ wxString frmOptions::CheckColour(wxString oldColour)
     return newColour;
 }
 
+
+void frmOptions::OnFavouritesFileSelect(wxCommandEvent &ev)
+{
+    wxFileDialog dlg(this, _("Select file to store favourites queries"), txtFavouritesFile->GetValue());
+    if (dlg.ShowModal() == wxID_OK)
+        txtFavouritesFile->SetValue(dlg.GetPath());
+}
+
+
+void frmOptions::OnMacrosFileSelect(wxCommandEvent &ev)
+{
+    wxFileDialog dlg(this, _("Select file to store macros"), txtMacrosFile->GetValue());
+    if (dlg.ShowModal() == wxID_OK)
+        txtMacrosFile->SetValue(dlg.GetPath());
+}
+
diff --git a/pgadmin/include/frm/frmOptions.h b/pgadmin/include/frm/frmOptions.h
index 2ff9db6..8d657d1 100644
--- a/pgadmin/include/frm/frmOptions.h
+++ b/pgadmin/include/frm/frmOptions.h
@@ -48,6 +48,8 @@ private:
     void OnSuppressHints(wxCommandEvent &ev);
     void OnResetHints(wxCommandEvent &ev);
 	void OnChangeCopyQuote(wxCommandEvent &ev);
+    void OnFavouritesFileSelect(wxCommandEvent &ev);
+    void OnMacrosFileSelect(wxCommandEvent &ev);
     wxString CheckColour(wxString colour);
     DECLARE_EVENT_TABLE()
 };
diff --git a/pgadmin/include/utils/sysSettings.h b/pgadmin/include/utils/sysSettings.h
index 984f287..84f7115 100644
--- a/pgadmin/include/utils/sysSettings.h
+++ b/pgadmin/include/utils/sysSettings.h
@@ -120,6 +120,10 @@ public:
     void SetSQLFont(const wxFont &font);
     int GetLineEndingType() const { int i; Read(wxT("LineEndingType"), &i, 2); return i; }
 	void SetLineEndingType(const int newval) { Write(wxT("LineEndingType"), newval); }
+	wxString GetFavouritesFile();
+	void SetFavouritesFile(const wxString &newval) { Write(wxT("FavouritesFile"), newval); }
+	wxString GetMacrosFile();
+	void SetMacrosFile(const wxString &newval) { Write(wxT("MacrosFile"), newval); }
 
     // Status Colours options
     wxString GetIdleProcessColour() const { wxString s; Read(wxT("IdleProcessColour"), &s, wxT("#5fa4d9")); return s; }
@@ -177,9 +181,7 @@ public:
 
 	enum configFileName
 	{
-		PGPASS,
-		PGAFAVOURITES,
-		PGAMACROS
+		PGPASS
 	};
 	static wxString GetConfigFile(configFileName cfgname);
 
diff --git a/pgadmin/ui/frmOptions.xrc b/pgadmin/ui/frmOptions.xrc
index 317f6f0..3f47ba4 100644
--- a/pgadmin/ui/frmOptions.xrc
+++ b/pgadmin/ui/frmOptions.xrc
@@ -3,7 +3,7 @@
   <object class="wxDialog" name="frmOptions">
     <title>Options</title>
     <pos>0,0d</pos>
-    <size>246,235d</size>
+    <size>246,280d</size>
     <style>wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxCAPTION|wxSYSTEM_MENU</style>
     <object class="wxNotebook" name="nbOptions">
       <object class="notebookpage">
@@ -185,7 +185,7 @@
         </object>
       </object>
       <object class="notebookpage">
-        <label>Query</label>
+        <label>Query Tool</label>
         <object class="wxPanel" name="pnlQuery">
           <object class="wxStaticText" name="stSqlFont">
             <label>Font</label>
@@ -318,6 +318,45 @@
             <pos>175,172d</pos>
             <size>226,12d</size>
           </object>
+          <object class="wxStaticText" name="stFavouritesFile">
+            <label>Favourites file path</label>
+            <pos>5,187d</pos>
+          </object>
+          <object class="wxTextCtrl" name="txtFavouritesFile">
+            <pos>70,185d</pos>
+            <size>140,-1d</size>
+          </object>
+          <object class="wxButton" name="btnFavouritesFile">
+            <label>...</label>
+            <pos>215,185d</pos>
+            <size>15,-1d</size>
+          </object>
+          <object class="wxStaticText" name="stMacrosFile">
+            <label>Macros file path</label>
+            <pos>5,203d</pos>
+          </object>
+          <object class="wxTextCtrl" name="txtMacrosFile">
+            <pos>70,201d</pos>
+            <size>140,-1d</size>
+          </object>
+          <object class="wxButton" name="btnMacrosFile">
+            <label>...</label>
+            <pos>215,201d</pos>
+            <size>15,-1d</size>
+          </object>
+          <object class="wxStaticText" name="stHistoryPath">
+            <label>History file path</label>
+            <pos>5,218d</pos>
+          </object>
+          <object class="wxTextCtrl" name="txtHistoryPath">
+            <pos>70,216d</pos>
+            <size>140,-1d</size>
+          </object>
+          <object class="wxButton" name="btnHistoryPath">
+            <label>...</label>
+            <pos>215,216d</pos>
+            <size>15,-1d</size>
+          </object>
         </object>
       </object>
       <object class="notebookpage">
@@ -394,7 +433,7 @@
         </object>
       </object>
       <pos>2,3d</pos>
-      <size>240,210d</size>
+      <size>240,255d</size>
       <object class="notebookpage">
         <label>Display</label>
         <object class="wxPanel" name="pnlDisplay">
@@ -422,18 +461,18 @@
     </object>
     <object class="wxButton" name="wxID_HELP">
       <label>&amp;Help</label>
-      <pos>2,216d</pos>
+      <pos>2,261d</pos>
     </object>
     <object class="wxButton" name="wxID_OK">
       <label>&amp;OK</label>
       <default>1</default>
-      <pos>140,216d</pos>
+      <pos>140,261d</pos>
       <tooltip>Accept the current settings and close the dialogue.</tooltip>
     </object>
     <object class="wxButton" name="wxID_CANCEL">
       <label>&amp;Cancel</label>
       <default>0</default>
-      <pos>193,216d</pos>
+      <pos>193,261d</pos>
       <tooltip>Cancel any changes and close the dialogue.</tooltip>
     </object>
   </object>
diff --git a/pgadmin/utils/favourites.cpp b/pgadmin/utils/favourites.cpp
index 838f95b..6b2c644 100644
--- a/pgadmin/utils/favourites.cpp
+++ b/pgadmin/utils/favourites.cpp
@@ -284,10 +284,10 @@ queryFavouriteFolder *queryFavouriteFileProvider::LoadFavourites(bool emptyonfai
 	xmlTextReaderPtr reader;
 	int ret;
 
-	if (!wxFile::Access(sysSettings::GetConfigFile(sysSettings::PGAFAVOURITES), wxFile::read))
+	if (!wxFile::Access(settings->GetFavouritesFile(), wxFile::read))
 		return emptyonfailure?(new queryFavouriteFolder()):NULL;
 
-	reader = xmlReaderForFile((const char *)sysSettings::GetConfigFile(sysSettings::PGAFAVOURITES).mb_str(wxConvUTF8),NULL,0);
+	reader = xmlReaderForFile((const char *)settings->GetFavouritesFile().mb_str(wxConvUTF8),NULL,0);
 	if (!reader)
 	{
 		wxMessageBox(_("Failed to load favourites file!"));
@@ -314,7 +314,7 @@ void queryFavouriteFileProvider::SaveFavourites(queryFavouriteFolder *favourites
 {
 	xmlTextWriterPtr writer;
 
-	writer = xmlNewTextWriterFilename((const char *)sysSettings::GetConfigFile(sysSettings::PGAFAVOURITES).mb_str(wxConvUTF8),0);
+	writer = xmlNewTextWriterFilename((const char *)settings->GetFavouritesFile().mb_str(wxConvUTF8),0);
 	if (!writer)
 	{
 		wxMessageBox(_("Failed to write to favourites file!"));
diff --git a/pgadmin/utils/macros.cpp b/pgadmin/utils/macros.cpp
index f758843..a10756a 100644
--- a/pgadmin/utils/macros.cpp
+++ b/pgadmin/utils/macros.cpp
@@ -221,10 +221,10 @@ queryMacroList *queryMacroFileProvider::LoadMacros(bool emptyOnFailure)
 	xmlTextReaderPtr reader;
 	int ret;
 
-	if (!wxFile::Access(sysSettings::GetConfigFile(sysSettings::PGAMACROS), wxFile::read))
+	if (!wxFile::Access(settings->GetMacrosFile(), wxFile::read))
 		return emptyOnFailure ? (new queryMacroList()) : NULL;
 
-	reader = xmlReaderForFile((const char *)sysSettings::GetConfigFile(sysSettings::PGAMACROS).mb_str(wxConvUTF8),NULL,0);
+	reader = xmlReaderForFile((const char *)settings->GetMacrosFile().mb_str(wxConvUTF8),NULL,0);
 	if (!reader)
 	{
 		wxMessageBox(_("Failed to load macros file!"));
@@ -251,7 +251,7 @@ void queryMacroFileProvider::SaveMacros(queryMacroList *macros)
 {
 	xmlTextWriterPtr writer;
 
-	writer = xmlNewTextWriterFilename((const char *)sysSettings::GetConfigFile(sysSettings::PGAMACROS).mb_str(wxConvUTF8),0);
+	writer = xmlNewTextWriterFilename((const char *)settings->GetMacrosFile().mb_str(wxConvUTF8),0);
 	if (!writer)
 	{
 		wxMessageBox(_("Failed to open macros file!"));
diff --git a/pgadmin/utils/sysSettings.cpp b/pgadmin/utils/sysSettings.cpp
index faa8c16..3a3f261 100644
--- a/pgadmin/utils/sysSettings.cpp
+++ b/pgadmin/utils/sysSettings.cpp
@@ -683,7 +683,7 @@ void sysSettings::SetCanonicalLanguage(const wxLanguage &lang)
 //////////////////////////////////////////////////////////////////////////
 wxString sysSettings::GetConfigFile(configFileName cfgname)
 {
-    if (cfgname == PGPASS || cfgname == PGAFAVOURITES || cfgname == PGAMACROS)
+    if (cfgname == PGPASS)
     {
         wxStandardPaths stdp;
         wxString fname=stdp.GetUserConfigDir();
@@ -696,12 +696,6 @@ wxString sysSettings::GetConfigFile(configFileName cfgname)
         case PGPASS:
             fname += wxT("\\pgpass.conf");
             break;
-        case PGAFAVOURITES:
-            fname += wxT("\\pgadmin_favourites.xml");
-            break;
-        case PGAMACROS:
-            fname += wxT("\\pgadmin_macros.xml");
-            break;
         }
 #else
         switch(cfgname)
@@ -709,15 +703,51 @@ wxString sysSettings::GetConfigFile(configFileName cfgname)
         case PGPASS:
             fname += wxT("/.pgpass");
             break;
-        case PGAFAVOURITES:
-            fname += wxT("/.pgadminfavourites");
-            break;
-        case PGAMACROS:
-            fname += wxT("/.pgadminmacros");
-            break;
         }
 #endif
         return fname;
     }
     return wxT("");
 }
+
+
+wxString sysSettings::GetFavouritesFile()
+{
+    wxString s, tmp;
+    
+    wxStandardPaths stdp;
+    tmp = stdp.GetUserConfigDir();
+#ifdef WIN32
+    tmp += wxT("\\postgresql");
+    if (!wxDirExists(tmp))
+        wxMkdir(tmp);
+    tmp += wxT("\\pgadmin_favourites.xml");
+#else
+    tmp += wxT("/.pgadminfavourites");
+#endif
+
+    Read(wxT("FavouritesFile"), &s, tmp);
+    
+    return s;
+}
+
+
+wxString sysSettings::GetMacrosFile()
+{
+    wxString s, tmp;
+    
+    wxStandardPaths stdp;
+    tmp = stdp.GetUserConfigDir();
+#ifdef WIN32
+    tmp += wxT("\\postgresql");
+    if (!wxDirExists(tmp))
+        wxMkdir(tmp);
+    tmp += wxT("\\pgadmin_macros.xml");
+#else
+    tmp += wxT("/.pgadminmacros");
+#endif
+
+    Read(wxT("MacrosFile"), &s, tmp);
+    
+    return s;
+}
