]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/utilsgtk.cpp
implemented wxMBConv::IsUTF8() helper for more classes so that all uses of UTF-8...
[wxWidgets.git] / src / gtk / utilsgtk.cpp
index c0d0309f9532ad008870bb0e8b970137c1ba3f7b..445a5f3bb707c8fada1c01c63238b1e0fd0c8fd0 100644 (file)
 #include "wx/apptrait.h"
 
 #include "wx/process.h"
+#include "wx/sysopt.h"
 
 #include "wx/unix/execute.h"
 
 #include "wx/gtk/private/timer.h"
+#include "wx/evtloop.h"
 
 #ifdef __WXDEBUG__
     #include "wx/gtk/assertdlg_gtk.h"
@@ -332,15 +334,19 @@ static wxString GetSM()
     if ( !dpy )
         return wxEmptyString;
 
+    char smerr[256];
     char *client_id;
     SmcConn smc_conn = SmcOpenConnection(NULL, NULL,
                                          999, 999,
                                          0 /* mask */, NULL /* callbacks */,
                                          NULL, &client_id,
-                                         0, NULL);
+                                         WXSIZEOF(smerr), smerr);
 
     if ( !smc_conn )
+    {
+        wxLogWarning(_("Failed to connect to session manager: %s"), smerr);
         return wxEmptyString;
+    }
 
     char *vendor = SmcVendor(smc_conn);
     wxString ret = wxString::FromAscii( vendor );
@@ -358,10 +364,17 @@ static wxString GetSM()
 // wxGUIAppTraits
 //-----------------------------------------------------------------------------
 
+wxEventLoopBase *wxGUIAppTraits::CreateEventLoop()
+{
+    return new wxEventLoop();
+}
+
+
 #if wxUSE_INTL
 void wxGUIAppTraits::SetLocale()
 {
     gtk_set_locale();
+    wxUpdateLocaleIsUtf8();
 }
 #endif
 
@@ -469,17 +482,20 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg)
 
 wxString wxGUIAppTraits::GetDesktopEnvironment() const
 {
+    wxString de = wxSystemOptions::GetOption(_T("gtk.desktop"));
+    if ( de.empty() )
+    {
 #if wxUSE_DETECT_SM
-    const wxString SM = GetSM();
+        static const wxString s_SM = GetSM();
 
-    if (SM == wxT("GnomeSM"))
-        return wxT("GNOME");
-
-    if (SM == wxT("KDE"))
-        return wxT("KDE");
+        if (s_SM == wxT("GnomeSM"))
+            de = wxT("GNOME");
+        else if (s_SM == wxT("KDE"))
+            de = wxT("KDE");
+    }
 #endif // wxUSE_DETECT_SM
 
-    return wxEmptyString;
+    return de;
 }
 
 #ifdef __WXGTK26__