Le 28/12/2009 20:10, Dave Page a écrit :
> On Mon, Dec 28, 2009 at 12:47 PM, Guillaume Lelarge
> <[email protected]> wrote:
>> Hi,
>>
>> You'll find attached a patch that makes use of this new 8.5 feature. The
>> frmStatus window handles a new column on the activity report to show the
>> application name. Each pgAdmin's window who owns a connection has a
>> specific name (for example "browser (pgAdmin)", "config editor
>> (pgAdmin)", "edit grid (pgAdmin)", ...). I don't think we need to add
>> pgAdmin's release because there are probably already too much details.
>>
>> Comments?
> 
> Much prefer "pgAdmin - xxx", eg:
> 
> pgAdmin - Browser
> pgAdmin - Query Tool
> 

Done. I suppose Magnus will agree on this, the word pgAdmin is still
first in the application name.

New patch attached. I'll apply it tomorrow night if no one objects.


-- 
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com
diff --git a/pgadmin/db/pgConn.cpp b/pgadmin/db/pgConn.cpp
index d1352d8..303f0fa 100644
--- a/pgadmin/db/pgConn.cpp
+++ b/pgadmin/db/pgConn.cpp
@@ -162,6 +162,7 @@ pgConn::pgConn(const wxString& server, const wxString& database, const wxString&
             case 2: connstr.Append(wxT(" requiressl=0"));   break;
         }
     }
+
     connstr.Trim(false);
 	
     dbHost = server;
@@ -205,6 +206,9 @@ bool pgConn::DoConnect()
         connStatus = PGCONN_OK;
         PQsetNoticeProcessor(conn, pgNoticeProcessor, this);
 
+        // tell the backend who we really are
+        if (BackendMinimumVersion(8, 5))
+            ExecuteVoid(wxT("SET application_name='pgAdmin - Browser'"),false);
 
         wxString sql=wxT("SET DateStyle=ISO;SELECT oid, pg_encoding_to_char(encoding) AS encoding, datlastsysoid\n")
                       wxT("  FROM pg_database WHERE ");
diff --git a/pgadmin/frm/frmConfig.cpp b/pgadmin/frm/frmConfig.cpp
index aae2227..3e21a6a 100644
--- a/pgadmin/frm/frmConfig.cpp
+++ b/pgadmin/frm/frmConfig.cpp
@@ -62,6 +62,11 @@ frmConfig::frmConfig(frmMain *parent, const wxString& title, pgConn *_conn)
     mainForm = parent;
     conn=_conn;
     SetStatusBarPane(-1);
+
+    // tell the backend who we really are
+    if (conn->BackendMinimumVersion(8, 5))
+        conn->ExecuteVoid(wxT("SET application_name='pgAdmin - Config Editor'"),false);
+
 }
 
 
diff --git a/pgadmin/frm/frmEditGrid.cpp b/pgadmin/frm/frmEditGrid.cpp
index 5fe642b..4927f27 100644
--- a/pgadmin/frm/frmEditGrid.cpp
+++ b/pgadmin/frm/frmEditGrid.cpp
@@ -107,6 +107,10 @@ frmEditGrid::frmEditGrid(frmMain *form, const wxString& _title, pgConn *_conn, p
     relid=(Oid)obj->GetOid();
     editorCell = new sqlCell();
 
+    // tell the backend who we really are
+    if (connection->BackendMinimumVersion(8, 5))
+        connection->ExecuteVoid(wxT("SET application_name='pgAdmin - Edit Grid'"),false);
+
     // notify wxAUI which frame to use
     manager.SetManagedWindow(this);
     manager.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_TRANSPARENT_DRAG);
diff --git a/pgadmin/frm/frmHbaConfig.cpp b/pgadmin/frm/frmHbaConfig.cpp
index bd81926..511ff9f 100644
--- a/pgadmin/frm/frmHbaConfig.cpp
+++ b/pgadmin/frm/frmHbaConfig.cpp
@@ -54,6 +54,10 @@ frmHbaConfig::frmHbaConfig(frmMain *parent, pgServer *server)
 
     if (conn)
     {
+        // tell the backend who we really are
+        if (conn->BackendMinimumVersion(8, 5))
+            conn->ExecuteVoid(wxT("SET application_name='pgAdmin - Config Editor'"),false);
+
         serverFileName = conn->ExecuteScalar(wxT("SHOW hba_file"));
         if (serverFileName == wxT("unset") || serverFileName.IsEmpty())
             serverFileName = wxT("pg_hba.conf");
diff --git a/pgadmin/frm/frmMainConfig.cpp b/pgadmin/frm/frmMainConfig.cpp
index 9bb5875..1b21f0d 100644
--- a/pgadmin/frm/frmMainConfig.cpp
+++ b/pgadmin/frm/frmMainConfig.cpp
@@ -55,6 +55,9 @@ frmMainConfig::frmMainConfig(frmMain *parent, pgServer *server)
 
     if (conn)
     {
+        // tell the backend who we really are
+        if (conn->BackendMinimumVersion(8, 5))
+            conn->ExecuteVoid(wxT("SET application_name='pgAdmin - Config Editor'"),false);
 
         if (serverFileName.IsEmpty())
             serverFileName = wxT("postgresql.conf");
diff --git a/pgadmin/frm/frmQuery.cpp b/pgadmin/frm/frmQuery.cpp
index e9f4d64..ecfca27 100644
--- a/pgadmin/frm/frmQuery.cpp
+++ b/pgadmin/frm/frmQuery.cpp
@@ -212,6 +212,10 @@ pgsTimer(new pgScriptTimer(this))
     recentKey = wxT("RecentFiles");
     RestorePosition(100, 100, 600, 500, 450, 300);
 
+    // tell the backend who we really are
+    if (conn->BackendMinimumVersion(8, 5))
+        conn->ExecuteVoid(wxT("SET application_name='pgAdmin - Query Tool'"),false);
+
     // notify wxAUI which frame to use
     manager.SetManagedWindow(this);
     manager.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_TRANSPARENT_DRAG);
diff --git a/pgadmin/frm/frmStatus.cpp b/pgadmin/frm/frmStatus.cpp
index 87778be..1678d09 100644
--- a/pgadmin/frm/frmStatus.cpp
+++ b/pgadmin/frm/frmStatus.cpp
@@ -176,6 +176,10 @@ frmStatus::frmStatus(frmMain *form, const wxString& _title, pgConn *conn) : pgFr
     logHasTimestamp = false;
     logFormatKnown = false;
 
+    // tell the backend who we really are
+    if (conn->BackendMinimumVersion(8, 5))
+        conn->ExecuteVoid(wxT("SET application_name='pgAdmin - Server Status'"),false);
+
     // Notify wxAUI which frame to use
     manager.SetManagedWindow(this);
     manager.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_TRANSPARENT_DRAG | wxAUI_MGR_ALLOW_ACTIVE_PANE);
@@ -470,6 +474,8 @@ void frmStatus::AddStatusPane()
     // Add each column to the list control
     statusList = (ctlListView*)lstStatus;
     statusList->AddColumn(wxT("PID"), 35);
+    if (connection->BackendMinimumVersion(8, 5))
+        statusList->AddColumn(_("Application name"), 70);
     statusList->AddColumn(_("Database"), 70);
     statusList->AddColumn(_("User"), 70);
     if (connection->BackendMinimumVersion(8, 1))
@@ -1117,6 +1123,8 @@ void frmStatus::OnRefreshStatusTimer(wxTimerEvent &event)
                 wxString qry=dataSet1->GetVal(wxT("current_query"));
 
                 int colpos=1;
+                if (connection->BackendMinimumVersion(8, 5))
+                    statusList->SetItem(row, colpos++, dataSet1->GetVal(wxT("application_name")));
                 statusList->SetItem(row, colpos++, dataSet1->GetVal(wxT("datname")));
                 statusList->SetItem(row, colpos++, dataSet1->GetVal(wxT("usename")));
 
-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to