prepare better solution of Glib's << operator
authorRobin Gareus <robin@gareus.org>
Thu, 15 Oct 2015 09:22:25 +0000 (11:22 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 15 Oct 2015 09:22:35 +0000 (11:22 +0200)
libs/gtkmm2ext/gtkmm2ext/utils.h
libs/gtkmm2ext/utils.cc

index 62ffba3b9cd8591455e8c7c7924ec6bba43bd5ad..688f4431c67b36f7fbbd6167f8edee66785977a1 100644 (file)
@@ -161,6 +161,15 @@ namespace Gtkmm2ext {
 
        LIBGTKMM2EXT_API void convert_bgra_to_rgba (guint8 const *, guint8 * dst, int, int);
        LIBGTKMM2EXT_API const char* event_type_string (int event_type);
+
+       /* glibmm ustring workaround
+        *
+        * Glib::operator<<(std::ostream&, Glib::ustring const&) internally calls
+        * g_locale_from_utf8() which uses loadlocale which is not thread-safe on OSX
+        *
+        * use a std::string
+        */
+       LIBGTKMM2EXT_API std::string markup_escape_text (std::string const& s);
 };
 
 #endif /*  __gtkmm2ext_utils_h__ */
index 4cfc0b26a02a5537c59cf76a62418878280417ed..3762f88dd664e01459148a02dd1072161a21c371 100644 (file)
@@ -967,3 +967,9 @@ Gtkmm2ext::event_type_string (int event_type)
 
        return "unknown";
 }
+
+std::string
+Gtkmm2ext::markup_escape_text (std::string const& s)
+{
+       return Glib::Markup::escape_text (s);
+}