comparison console/libgnt/gnttree.c @ 13936:669898e6aa11

[gaim-migrate @ 16467] Minor enhancements for the combobox. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 09 Jul 2006 00:54:31 +0000
parents cd2da4b079cf
children af23525bcb31
comparison
equal deleted inserted replaced
13935:cd2da4b079cf 13936:669898e6aa11
199 else if (row->choice) 199 else if (row->choice)
200 { 200 {
201 g_snprintf(format, sizeof(format) - 1, "[%c] ", row->isselected ? 'X' : ' '); 201 g_snprintf(format, sizeof(format) - 1, "[%c] ", row->isselected ? 'X' : ' ');
202 } 202 }
203 203
204 /* XXX: Need a utf8 version of snprintf */ 204 g_snprintf(str, sizeof(str) - 1, "%s%s", format, row->text);
205 if ((wr = g_snprintf(str, widget->priv.width, "%s%s", format, row->text)) >= widget->priv.width) 205
206 if ((wr = g_utf8_strlen(str, -1)) >= widget->priv.width - 1 - pos)
206 { 207 {
207 /* XXX: ellipsize */ 208 /* XXX: ellipsize */
208 str[widget->priv.width - 1 - pos] = 0; 209 char *s = g_utf8_offset_to_pointer(str, widget->priv.width - 1 - pos);
210 *s = '\0';
209 } 211 }
210 else 212 else
211 { 213 {
212 while (wr < widget->priv.width - 1 - pos) 214 while (wr < widget->priv.width - 1 - pos)
213 str[wr++] = ' '; 215 str[wr++] = ' ';