show the error returned by SmcOpenConnection(); don't call it more than once -- the desktop environment is not going to change while the program is running

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-05-03 13:41:36 +00:00
parent 8bd37efca7
commit dee28fdd4d

View File

@ -332,15 +332,19 @@ static wxString GetSM()
if ( !dpy ) if ( !dpy )
return wxEmptyString; return wxEmptyString;
char smerr[256];
char *client_id; char *client_id;
SmcConn smc_conn = SmcOpenConnection(NULL, NULL, SmcConn smc_conn = SmcOpenConnection(NULL, NULL,
999, 999, 999, 999,
0 /* mask */, NULL /* callbacks */, 0 /* mask */, NULL /* callbacks */,
NULL, &client_id, NULL, &client_id,
0, NULL); WXSIZEOF(smerr), smerr);
if ( !smc_conn ) if ( !smc_conn )
{
wxLogWarning(_("Failed to connect to session manager: %s"), smerr);
return wxEmptyString; return wxEmptyString;
}
char *vendor = SmcVendor(smc_conn); char *vendor = SmcVendor(smc_conn);
wxString ret = wxString::FromAscii( vendor ); wxString ret = wxString::FromAscii( vendor );
@ -471,7 +475,7 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg)
wxString wxGUIAppTraits::GetDesktopEnvironment() const wxString wxGUIAppTraits::GetDesktopEnvironment() const
{ {
#if wxUSE_DETECT_SM #if wxUSE_DETECT_SM
const wxString SM = GetSM(); static const wxString SM = GetSM();
if (SM == wxT("GnomeSM")) if (SM == wxT("GnomeSM"))
return wxT("GNOME"); return wxT("GNOME");