From 0ea56367c51422329ed761e04f314451d6777a48 Mon Sep 17 00:00:00 2001
From: Adam C Scott <adam.c.scott@gmail.com>
Date: Mon, 14 Sep 2015 13:16:46 -0600
Subject: [PATCH] Display Connection and Database in Statusbar: Add another
 field in frmMain's statusbar to get the current object's connection and
 database and display in the field in the status bar.

---
 pgadmin/frm/frmMain.cpp | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/pgadmin/frm/frmMain.cpp b/pgadmin/frm/frmMain.cpp
index 8629dda..570701b 100644
--- a/pgadmin/frm/frmMain.cpp
+++ b/pgadmin/frm/frmMain.cpp
@@ -516,13 +516,13 @@ void frmMain::CreateMenus()
 	treeContextMenu = 0;
 
 	// Status bar
-	statusBar = CreateStatusBar(3);
-	int iWidths[3] = {0, -1, 100};
-	SetStatusWidths(3, iWidths);
+	statusBar = CreateStatusBar(4);
+	int iWidths[4] = {0, -1, 400, 100};
+	SetStatusWidths(4, iWidths);
 	SetStatusBarPane(-1);
 	statusBar->SetStatusText(wxT(""), 0);
 	statusBar->SetStatusText(_("Ready."), 1);
-	statusBar->SetStatusText(_("0 Secs"), 2);
+	statusBar->SetStatusText(_("0 Secs"), 3);
 
 	wxAcceleratorEntry entries[4];
 	entries[0].Set(wxACCEL_NORMAL, WXK_F5, refFact->GetId());
@@ -1354,7 +1354,18 @@ void frmMain::EndMsg(bool done)
 		float timeval = stopwatch.Time();
 		wxString time;
 		time.Printf(_("%.2f secs"), (timeval / 1000));
-		statusBar->SetStatusText(time, 2);
+		statusBar->SetStatusText(time, 3);
+
+		// Display the name of the connection for currently selected object
+		wxString connection;
+		if (currentObject)
+		{
+			pgConn *conn = currentObject->GetConnection();
+	   
+			if (conn)
+				connection = conn->GetName();
+		}
+		statusBar->SetStatusText(connection,2);
 
 		// Display the 'Done' message
 		if (done)
-- 
2.5.2.windows.1

