本文整理汇总了C++中UT_UTF8String::utf8_str方法的典型用法代码示例。如果您正苦于以下问题:C++ UT_UTF8String::utf8_str方法的具体用法?C++ UT_UTF8String::utf8_str怎么用?C++ UT_UTF8String::utf8_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UT_UTF8String
的用法示例。
在下文中一共展示了UT_UTF8String::utf8_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createPNGSnapshot
bool GR_MathManager::createPNGSnapshot(AD_Document * pDoc, UT_Rect & rec,
const char * szDataID)
{
if (isDefault())
{
return false;
}
if ((rec.width == 0) || (rec.height ==0))
{
return false;
}
GR_Painter painter(getGraphics());
GR_Image * pImage = painter.genImageFromRectangle(rec);
if(pImage == NULL)
{
return false;
}
UT_ByteBuf * pBuf = NULL;
pImage->convertToBuffer(&pBuf);
UT_UTF8String sID = "snapshot-png-";
sID += szDataID;
const std::string mimetypePNG = "image/png";
UT_DEBUGMSG(("Making data-item of name %s \n",sID.utf8_str()));
pDoc->createDataItem(sID.utf8_str(),false,reinterpret_cast< const UT_ByteBuf *>(pBuf),mimetypePNG,NULL);
DELETEP(pBuf);
DELETEP(pImage);
return true;
}
示例2: write
/**
* Write the <text:list-style> element.
*/
bool ODe_Style_List::write(GsfOutput* pODT,
const UT_UTF8String& rSpacesOffset) const {
UT_uint32 i, count;
UT_UTF8String subElementSpacesOffset;
UT_UTF8String output;
UT_GenericVector<ODe_ListLevelStyle*>* pVector;
bool ok;
UT_UTF8String_sprintf(output, "%s<text:list-style style:name=\"%s\">\n",
rSpacesOffset.utf8_str(), m_name.utf8_str());
ODe_writeUTF8String(pODT, output);
subElementSpacesOffset = rSpacesOffset;
subElementSpacesOffset += " ";
pVector = m_levelStyles.enumerate();
count = pVector->getItemCount();
for (i=0; i<count; i++) {
ok = (*pVector)[i]->write(pODT, subElementSpacesOffset);
if (!ok) {
return false;
}
}
UT_UTF8String_sprintf(output, "%s</text:list-style>\n",
rSpacesOffset.utf8_str());
ODe_writeUTF8String(pODT, output);
return true;
}
示例3: _handleMimetype
/**
* Handle the mimetype file
*/
UT_Error IE_Imp_OpenDocument::_handleMimetype ()
{
GsfInput* pInput = gsf_infile_child_by_name(m_pGsfInfile, "mimetype");
if (!pInput) {
UT_DEBUGMSG(("Error: didn't get a mimetype. Assuming that it's a"
" application/vnd.oasis.opendocument.text document\n"));
return UT_OK;
}
UT_UTF8String mimetype;
if (gsf_input_size (pInput) > 0) {
mimetype.append(
(const char *)gsf_input_read(pInput, gsf_input_size (pInput), NULL),
gsf_input_size (pInput));
}
UT_Error err = UT_OK;
if ((strcmp("application/vnd.oasis.opendocument.text", mimetype.utf8_str()) != 0) &&
(strcmp("application/vnd.oasis.opendocument.text-template", mimetype.utf8_str()) != 0) &&
(strcmp("application/vnd.oasis.opendocument.text-web", mimetype.utf8_str()) != 0))
{
UT_DEBUGMSG(("*** Unknown mimetype '%s'\n", mimetype.utf8_str()));
err = UT_IE_BOGUSDOCUMENT;
}
g_object_unref (G_OBJECT (pInput));
return err;
}
示例4: makeSnapShot
void GR_GOComponentManager::makeSnapShot(UT_sint32 uid, G_GNUC_UNUSED UT_Rect & rec)
{
GR_AbiGOComponentItems * pItem = m_vecItems.getNthItem(uid);
UT_return_if_fail(pItem);
GOComponentView * pGOComponentView = m_vecGOComponentView.getNthItem(uid);
const PP_AttrProp * pSpanAP = NULL;
PT_AttrPropIndex api = pItem->m_iAPI;
/* bool b = */ m_pDoc->getAttrProp(api, &pSpanAP);
const char * pszDataID = NULL;
pSpanAP->getAttribute("dataid", pszDataID);
UT_ConstByteBufPtr pBuf;
std::string mime_type;
if ((pBuf = pGOComponentView->getSnapShot (mime_type)))
{
UT_UTF8String sID = (mime_type == "image/svg")? "snapshot-svg-": "snapshot-png-";
sID += pszDataID;
if(pItem->m_bHasSnapshot)
{
m_pDoc->replaceDataItem(sID.utf8_str(), pBuf);
}
else
{
m_pDoc->createDataItem(sID.utf8_str(), false, pBuf, mime_type, NULL);
pItem->m_bHasSnapshot = true;
}
}
}
示例5: setStyleInGUI
void AP_UnixDialog_Stylist::setStyleInGUI(void)
{
UT_sint32 row,col;
UT_UTF8String sCurStyle = *getCurStyle();
if((getStyleTree() == NULL) || (sCurStyle.size() == 0))
updateDialog();
if(m_wStyleList == NULL)
return;
if(isStyleTreeChanged())
_fillTree();
getStyleTree()->findStyle(sCurStyle,row,col);
UT_DEBUGMSG(("After findStyle row %d col %d col \n",row,col));
UT_UTF8String sPathFull = UT_UTF8String_sprintf("%d:%d",row,col);
UT_UTF8String sPathRow = UT_UTF8String_sprintf("%d",row);
UT_DEBUGMSG(("Full Path string is %s \n",sPathFull.utf8_str()));
GtkTreePath * gPathRow = gtk_tree_path_new_from_string (sPathRow.utf8_str());
GtkTreePath * gPathFull = gtk_tree_path_new_from_string (sPathFull.utf8_str());
gtk_tree_view_expand_row( GTK_TREE_VIEW(m_wStyleList),gPathRow,TRUE);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(m_wStyleList),gPathFull,NULL,TRUE,0.5,0.5);
gtk_tree_view_set_cursor(GTK_TREE_VIEW(m_wStyleList),gPathFull,NULL,TRUE);
setStyleChanged(false);
gtk_tree_path_free(gPathRow);
gtk_tree_path_free(gPathFull);
}
示例6: new_styleName
/*!
* fill the properties vector with the values the given style.
*/
void AP_UnixDialog_Styles::new_styleName(void)
{
static char message[200];
const XAP_StringSet * pSS = m_pApp->getStringSet();
const gchar * psz = gtk_entry_get_text( GTK_ENTRY( m_wStyleNameEntry));
UT_UTF8String s;
UT_UTF8String s1;
pSS->getValueUTF8(AP_STRING_ID_DLG_Styles_DefNone,s);
if(psz && strcmp(psz,s.utf8_str())== 0)
{
// TODO: do a real error dialog
pSS->getValueUTF8(AP_STRING_ID_DLG_Styles_ErrNotTitle1,s);
pSS->getValueUTF8(AP_STRING_ID_DLG_Styles_ErrNotTitle2,s1);
sprintf(message,"%s%s%s",s.utf8_str(),psz,s1.utf8_str());
messageBoxOK(static_cast<const char *>(message));
return;
}
pSS->getValueUTF8(AP_STRING_ID_DLG_Styles_DefCurrent,s);
if(psz && strcmp(psz,s.utf8_str())== 0)
{
// TODO: do a real error dialog
pSS->getValueUTF8(AP_STRING_ID_DLG_Styles_ErrNotTitle1,s);
pSS->getValueUTF8(AP_STRING_ID_DLG_Styles_ErrNotTitle2,s1);
sprintf(message,"%s%s%s",s.utf8_str(),psz,s1.utf8_str());
messageBoxOK(static_cast<const char *>(message));
return;
}
g_snprintf(static_cast<gchar *>(m_newStyleName),40,"%s",psz);
addOrReplaceVecAttribs(PT_NAME_ATTRIBUTE_NAME,getNewStyleName());
}
示例7: applyStyles
/*!
* Append all styles from the Psion Word Styles Section.
*/
UT_Error IE_Imp_Psion::applyStyles(const psiconv_word_styles_section style_sec)
{
UT_UTF8String props;
int i;
gchar *stylename;
psiconv_word_style style;
UT_Error res;
// Iterate through all defined styles.
// Index -1 is misused to represent the default "Normal" style.
for (i = -1; i < (int) psiconv_list_length(style_sec->styles); i++) {
if (i == -1)
style = style_sec->normal;
else if (!(style = (psiconv_word_style)
psiconv_list_get(style_sec->styles,i)))
return UT_IE_IMPORTERROR;
// Get the style paragraph and character attributes.
props.clear();
if ((res = getParagraphAttributes(style->paragraph,props)))
return res;
if ((res = getCharacterAttributes(style->character,props)))
return res;
// Not yet implemented: hotkey
// Not yet implemented: built_in
// Not yet implemented: outline_level
// The three unimplemented features above are not yet available
// within AbiWord.
// Get the style name.
if (i == -1)
stylename = (gchar *) strdup("Normal");
else
stylename = prepare_style_name(style->name);
if (!stylename)
return UT_IE_NOMEMORY;
UT_DEBUGMSG(("PSION: Importing style %s\n",stylename));
UT_DEBUGMSG(("PSION: Style attributes: %s\n",props.utf8_str()));
const PP_PropertyVector propsArray = {
"props", props.utf8_str(),
"name", stylename,
// All Psion styles are based upon the Normal style
"basedon", "Normal"
};
if (!(getDoc()->appendStyle(propsArray))) {
UT_DEBUGMSG(("PSION: AppendStyle failed...\n"));
free(stylename);
return UT_IE_IMPORTERROR;
}
free(stylename);
}
return UT_OK;
}
示例8: _constructWindowContents
void AP_UnixDialog_ToggleCase::_constructWindowContents (GtkWidget *vbox1)
{
GSList *vbox1_group = NULL;
GtkWidget *sentenceCase;
GtkWidget *lowerCase;
GtkWidget *upperCase;
GtkWidget *firstUpperCase;
GtkWidget *toggleCase;
const XAP_StringSet * pSS = m_pApp->getStringSet();
UT_UTF8String s;
pSS->getValueUTF8(AP_STRING_ID_DLG_ToggleCase_SentenceCase,s);
sentenceCase = gtk_radio_button_new_with_label (vbox1_group,s.utf8_str());
vbox1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (sentenceCase));
gtk_widget_show (sentenceCase);
gtk_box_pack_start (GTK_BOX (vbox1), sentenceCase, FALSE, FALSE, 0);
pSS->getValueUTF8(AP_STRING_ID_DLG_ToggleCase_LowerCase,s);
lowerCase = gtk_radio_button_new_with_label (vbox1_group,s.utf8_str());
vbox1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (lowerCase));
gtk_widget_show (lowerCase);
gtk_box_pack_start (GTK_BOX (vbox1), lowerCase, FALSE, FALSE, 0);
pSS->getValueUTF8(AP_STRING_ID_DLG_ToggleCase_UpperCase,s);
upperCase = gtk_radio_button_new_with_label (vbox1_group,s.utf8_str());
vbox1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (upperCase));
gtk_widget_show (upperCase);
gtk_box_pack_start (GTK_BOX (vbox1), upperCase, FALSE, FALSE, 0);
pSS->getValueUTF8(AP_STRING_ID_DLG_ToggleCase_FirstUpperCase,s);
firstUpperCase = gtk_radio_button_new_with_label (vbox1_group,s.utf8_str());
vbox1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (firstUpperCase));
gtk_widget_show (firstUpperCase);
gtk_box_pack_start (GTK_BOX (vbox1), firstUpperCase, FALSE, FALSE, 0);
pSS->getValueUTF8(AP_STRING_ID_DLG_ToggleCase_ToggleCase,s);
toggleCase = gtk_radio_button_new_with_label (vbox1_group,s.utf8_str());
vbox1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggleCase));
gtk_widget_show (toggleCase);
gtk_box_pack_start (GTK_BOX (vbox1), toggleCase, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT(sentenceCase), "user_data", GINT_TO_POINTER(CASE_SENTENCE));
g_object_set_data (G_OBJECT(lowerCase), "user_data", GINT_TO_POINTER(CASE_LOWER));
g_object_set_data (G_OBJECT(upperCase), "user_data", GINT_TO_POINTER(CASE_UPPER));
g_object_set_data (G_OBJECT(firstUpperCase), "user_data", GINT_TO_POINTER(CASE_FIRST_CAPITAL));
g_object_set_data (G_OBJECT(toggleCase), "user_data", GINT_TO_POINTER(CASE_TOGGLE));
g_signal_connect (G_OBJECT(sentenceCase), "toggled",
G_CALLBACK(s_toggled), (gpointer)this);
g_signal_connect (G_OBJECT(lowerCase), "toggled",
G_CALLBACK(s_toggled), (gpointer)this);
g_signal_connect (G_OBJECT(upperCase), "toggled",
G_CALLBACK(s_toggled), (gpointer)this);
g_signal_connect (G_OBJECT(firstUpperCase), "toggled",
G_CALLBACK(s_toggled), (gpointer)this);
g_signal_connect (G_OBJECT(toggleCase), "toggled",
G_CALLBACK(s_toggled), (gpointer)this);
}
示例9: UT_UTF8String_addPropertyString
/*!
* Assuming a string of standard abiword properties eg. "fred:nerk; table-width:1.0in; table-height:10.in"
* Add aother propety string, updating previously defined properties with
* values in the new string.
*/
void UT_UTF8String_addPropertyString(UT_UTF8String & sPropertyString, const UT_UTF8String & sNewProp)
{
UT_sint32 iSize = static_cast<UT_sint32>(sNewProp.size());
UT_sint32 iBase =0;
UT_UTF8String sProp;
UT_UTF8String sVal;
UT_UTF8String sSubStr;
const char * szWork = NULL;
const char * szLoc = NULL;
while(iBase < iSize)
{
bool bBreakAtEnd = false;
sSubStr = sNewProp.substr(iBase, iSize-iBase);
szWork = sSubStr.utf8_str();
szLoc = strstr(szWork,":");
UT_sint32 iextra = 0;
if(szLoc)
{
UT_sint32 k = iBase;
while(*sNewProp.substr(k,k).utf8_str() == ' ')
{
k++;
iextra++;
}
sProp = sNewProp.substr(k,szLoc - szWork-iextra);
}
else
{
break;
}
iBase += szLoc-szWork+1;
sSubStr = sNewProp.substr(iBase, iSize-iBase);
szWork = sSubStr.utf8_str();
szLoc = strstr(szWork,";");
if(szLoc)
{
sVal = sNewProp.substr(iBase,szLoc - szWork);
iBase += szLoc-szWork+1;
}
else
{
sVal = sNewProp.substr(iBase,iSize-iBase);
bBreakAtEnd = true;
}
if((sProp.size()>0) && (sVal.size() >0))
{
UT_UTF8String_setProperty(sPropertyString,sProp,sVal);
}
else
{
break;
}
if(bBreakAtEnd)
{
break;
}
}
}
示例10: _handleDataItems
void s_XSL_FO_Listener::_handleDataItems(void)
{
const char * szName = NULL;
std::string mimeType;
const UT_ByteBuf * pByteBuf;
for (UT_uint32 k=0; (m_pDocument->enumDataItems(k, NULL, &szName, &pByteBuf, &mimeType)); k++)
{
UT_sint32 loc = -1;
for (UT_sint32 i = 0; i < m_utvDataIDs.getItemCount(); i++)
{
if(strcmp(reinterpret_cast<const char*>(m_utvDataIDs[i]), szName) == 0)
{
loc = i;
break;
}
}
if(loc > -1)
{
UT_UTF8String fname;
UT_UTF8String_sprintf(fname, "%s_data", m_pie->getFileName());
UT_go_directory_create(fname.utf8_str(), 0750, NULL);
if (mimeType == "image/svg+xml")
UT_UTF8String_sprintf(fname, "%s/%d.svg", fname.utf8_str(), loc);
else if (mimeType == "application/mathml+xml")
UT_UTF8String_sprintf(fname, "%s/%d.mathml", fname.utf8_str(), loc);
else // raster Image
{
const char * extension = "png";
if(mimeType == "image/jpeg") {
extension = "jpg";
}
char * temp = _stripSuffix(UT_go_basename(szName), '_');
char * fstripped = _stripSuffix(temp, '.');
UT_UTF8String_sprintf(fname, "%s/%s.%s", fname.utf8_str(), fstripped, extension);
FREEP(temp);
FREEP(fstripped);
}
GsfOutput *fp = UT_go_file_create (fname.utf8_str(), NULL);
if(!fp)
continue;
gsf_output_write(fp, pByteBuf->getLength(), (const guint8 *)pByteBuf->getPointer(0));
gsf_output_close(fp);
g_object_unref(fp);
}
}
return;
}
示例11: setValueString
/** set the widget value as string */
void XAP_UnixWidget::setValueString(const UT_UTF8String &val)
{
if (GTK_IS_ENTRY(m_widget)) {
gtk_entry_set_text(GTK_ENTRY(m_widget), val.utf8_str());
}
else if (GTK_IS_LABEL(m_widget)) {
gtk_label_set_text(GTK_LABEL(m_widget), val.utf8_str());
}
else {
UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
}
}
示例12: _setRadioButtonLabels
void AP_UnixDialog_Lists::_setRadioButtonLabels(void)
{
// char *tmp;
const XAP_StringSet * pSS = m_pApp->getStringSet();
UT_UTF8String s;
PopulateDialogData();
// Button 0 is Start New List, button 2 is resume list
pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Start_New,s);
gtk_label_set_text( GTK_LABEL(m_wStartNew_label), s.utf8_str());
pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Resume,s);
gtk_label_set_text( GTK_LABEL(m_wStartSub_label), s.utf8_str());
}
示例13: setLevelStyle
void ODe_Style_List::setLevelStyle(UT_uint8 level, const PP_AttrProp& rBlockAP) {
UT_UTF8String levelString;
ODe_ListLevelStyle* pLevelStyle;
const gchar* pValue = NULL;
bool ok;
UT_UTF8String_sprintf(levelString, "%u", level);
pLevelStyle = m_levelStyles.pick(levelString.utf8_str());
if (pLevelStyle != NULL) {
// This level style aws already set. There's nothing to be done.
return;
}
ok = rBlockAP.getProperty("list-style", pValue);
UT_return_if_fail(ok && pValue);
if (!strcmp(pValue, "Numbered List") ||
!strcmp(pValue, "Lower Case List") ||
!strcmp(pValue, "Upper Case List") ||
!strcmp(pValue, "Lower Roman List") ||
!strcmp(pValue, "Upper Roman List") ||
!strcmp(pValue, "Hebrew List") ||
!strcmp(pValue, "Arabic List")) {
pLevelStyle = new ODe_Numbered_ListLevelStyle();
} else if (!strcmp(pValue, "Bullet List") ||
!strcmp(pValue, "Dashed List") ||
!strcmp(pValue, "Square List") ||
!strcmp(pValue, "Triangle List") ||
!strcmp(pValue, "Diamond List") ||
!strcmp(pValue, "Star List") ||
!strcmp(pValue, "Tick List") ||
!strcmp(pValue, "Box List") ||
!strcmp(pValue, "Hand List") ||
!strcmp(pValue, "Heart List") ||
!strcmp(pValue, "Implies List")) {
pLevelStyle = new ODe_Bullet_ListLevelStyle();
} else {
UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
return;
}
m_levelStyles.insert(levelString.utf8_str(), pLevelStyle);
pLevelStyle->fetchAttributesFromAbiBlock(rBlockAP);
}
示例14: definePageSizeTag
/**
* Sets the <pagesize> tag.
*/
void ODi_Style_PageLayout::definePageSizeTag(PD_Document* pDocument) const {
UT_uint32 propCtr = 0;
static const int MAX_PAGE_ATTS = 13; // 2*(width height orientation pagetype units page-scale) 0
const gchar* pageAtts[MAX_PAGE_ATTS];
double pageWidthMmNumeric = 0.0;
double pageHeightMmNumeric = 0.0;
UT_UTF8String pageWidthMm;
UT_UTF8String pageHeightMm;
UT_LocaleTransactor lt(LC_NUMERIC, "C");
// width and height are rounded to full mm because that's how they are
// predefined in Abi and there seem to be rounding errors in oow's exporter
if (!m_pageWidth.empty()) {
pageAtts[propCtr++] = "width";
pageWidthMmNumeric = rint(UT_convertToDimension(m_pageWidth.utf8_str(),
DIM_MM));
UT_UTF8String_sprintf(pageWidthMm, "%f", pageWidthMmNumeric);
pageAtts[propCtr++] = pageWidthMm.utf8_str();
}
if (!m_pageHeight.empty()) {
pageAtts[propCtr++] = "height";
pageHeightMmNumeric = rint(UT_convertToDimension(m_pageHeight.utf8_str(),
DIM_MM));
UT_UTF8String_sprintf(pageHeightMm, "%f", pageHeightMmNumeric);
pageAtts[propCtr++] = pageHeightMm.utf8_str();
}
pageAtts[propCtr++] = "units";
pageAtts[propCtr++] = "mm";
if (!m_printOrientation.empty()) {
pageAtts[propCtr++] = "orientation";
pageAtts[propCtr++] = m_printOrientation.utf8_str();
}
pageAtts[propCtr++] = "page-scale";
pageAtts[propCtr++] = "1.0";
fp_PageSize ps(pageWidthMmNumeric, pageHeightMmNumeric, DIM_MM);
pageAtts[propCtr++] = "pagetype";
pageAtts[propCtr++] = ps.getPredefinedName();
pageAtts[propCtr] = 0; // To signal the end of the array
pDocument->setPageSizeFromFile(pageAtts);
}
示例15: _createLevelItems
void AP_UnixDialog_FormatTOC::_createLevelItems(void)
{
const XAP_StringSet * pSS = XAP_App::getApp()->getStringSet ();
UT_UTF8String s;
GtkComboBox *combo;
combo = GTK_COMBO_BOX(_getWidget("wLevelOption"));
XAP_makeGtkComboBoxText(combo, G_TYPE_INT);
pSS->getValueUTF8(AP_STRING_ID_DLG_FormatTOC_Level1,s);
XAP_appendComboBoxTextAndInt(combo, s.utf8_str(), 1);
pSS->getValueUTF8(AP_STRING_ID_DLG_FormatTOC_Level2,s);
XAP_appendComboBoxTextAndInt(combo, s.utf8_str(), 2);
pSS->getValueUTF8(AP_STRING_ID_DLG_FormatTOC_Level3,s);
XAP_appendComboBoxTextAndInt(combo, s.utf8_str(), 3);
pSS->getValueUTF8(AP_STRING_ID_DLG_FormatTOC_Level4,s);
XAP_appendComboBoxTextAndInt(combo, s.utf8_str(), 4);
gtk_combo_box_set_active(combo, 0);
//////////////////////////////////////////////////////////////////////////////
combo = GTK_COMBO_BOX(_getWidget("wDetailsLevel"));
XAP_makeGtkComboBoxText(combo, G_TYPE_INT);
pSS->getValueUTF8(AP_STRING_ID_DLG_FormatTOC_Level1,s);
XAP_appendComboBoxTextAndInt(combo, s.utf8_str(), 1);
pSS->getValueUTF8(AP_STRING_ID_DLG_FormatTOC_Level2,s);
XAP_appendComboBoxTextAndInt(combo, s.utf8_str(), 2);
pSS->getValueUTF8(AP_STRING_ID_DLG_FormatTOC_Level3,s);
XAP_appendComboBoxTextAndInt(combo, s.utf8_str(), 3);
pSS->getValueUTF8(AP_STRING_ID_DLG_FormatTOC_Level4,s);
XAP_appendComboBoxTextAndInt(combo, s.utf8_str(), 4);
gtk_combo_box_set_active(combo, 0);
}