Hi Guillaume,

I just want to say that your patch doesn't quite work as expected. Instead of just using system default colour unless custom colour is set, Pgadmin actually stores that default colour in server configuration, and always sets it explicitly. This isn't a problem until you change the theme you use, but once you do (like I switched from light to dark theme), all your servers are suddently using a colour that is no longer the default.

I think the correct behavior would be not to store colour in the configuration unless the user sets it explicitly. This way, even if PgAdmin stores the default upon initial creation, the user could clear that setting manually and it would then always be treated as empty instead of being reset to the default colour on first run. Ideally, it would even be possible to disable custom colour via a checkbox or something like that.

I made a small patch, which prevents storing the empty setting. However, it is incomplete due to the server dialog now erring upon load, because it actually expects a colour value. I believe this should be easy to fix for someone familiar with the code though.

I'm attaching this half-baked patch. Feel free to apply it if PgAdmin is still to be supported for some time.

Cheers,
Rimas Kudelis

--- pgadmin3-1.22.0.orig/pgadmin/include/schema/pgServer.h
+++ pgadmin3-1.22.0/pgadmin/include/schema/pgServer.h
@@ -47,7 +47,7 @@ public:
 	pgServer(const wxString &newServer = wxT(""), const wxString &newHostAddr = wxT(""), const wxString &newDescription = wxT(""),
 	         const wxString &newService = wxT(""), const wxString &newDatabase = wxT(""), const wxString &newUsername = wxT(""), int newPort = 5432,
 	         bool storePwd = false, const wxString &newRolename = wxT(""), bool restore = true, int sslMode = 0,
-	         const wxString &colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).GetAsString(wxC2S_HTML_SYNTAX), const wxString &group = wxEmptyString,
+	         const wxString &colour = wxEmptyString, const wxString &group = wxEmptyString,
 	         bool sshTunnel = false, const wxString &newTunnelHost = wxEmptyString, const wxString &newTunnelUserName = wxEmptyString, bool authModePwd = true,
 	         const wxString &newTunnelPassword = wxEmptyString, const wxString &newPublicKey = wxEmptyString, const wxString &newIdentityFile = wxEmptyString,
 	         const int &sshPort = DEFAULT_SSH_PORT);
--- pgadmin3-1.22.0.orig/pgadmin/schema/pgServer.cpp
+++ pgadmin3-1.22.0/pgadmin/schema/pgServer.cpp
@@ -1556,12 +1556,5 @@ pgObject *pgServerFactory::CreateObjects
 				colour = wxEmptyString;
 		}

-		if (colour.IsEmpty())
-		{
-			wxColour cColour;
-			cColour.Set(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).GetAsString(wxC2S_HTML_SYNTAX));
-			colour = cColour.GetAsString(wxC2S_HTML_SYNTAX);
-		}
-
 		// SSL mode
 #ifdef PG_SSL

Reply via email to