Remove unnecessary locale/UTF-8 encoding conversions
This commit is contained in:
@@ -170,31 +170,13 @@ void IntRadioExport(GtkRadioButton& widget, const IntImportCallback& importCallb
|
||||
}
|
||||
typedef ImportExport<GtkRadioButton, int, IntRadioImport, IntRadioExport> IntRadioImportExport;
|
||||
|
||||
template<typename Type, typename Formatter>
|
||||
class StringFromType
|
||||
{
|
||||
StringOutputStream value;
|
||||
public:
|
||||
StringFromType(const Type& type)
|
||||
{
|
||||
value << Formatter(type);
|
||||
}
|
||||
operator const char*() const
|
||||
{
|
||||
return value.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
typedef StringFromType<const char*, ConvertLocaleToUTF8> LocaleToUTF8;
|
||||
typedef StringFromType<const char*, ConvertUTF8ToLocale> UTF8ToLocale;
|
||||
|
||||
void TextEntryImport(GtkEntry& widget, const char* text)
|
||||
{
|
||||
gtk_entry_set_text(&widget, LocaleToUTF8(text));
|
||||
gtk_entry_set_text(&widget, text);
|
||||
}
|
||||
void TextEntryExport(GtkEntry& widget, const StringImportCallback& importCallback)
|
||||
{
|
||||
importCallback(UTF8ToLocale(gtk_entry_get_text(&widget)));
|
||||
importCallback(gtk_entry_get_text(&widget));
|
||||
}
|
||||
typedef ImportExport<GtkEntry, const char*, TextEntryImport, TextEntryExport> TextEntryImportExport;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user