Mercurial > pidgin.yaz
diff console/libgnt/gntcombobox.c @ 14420:c4a32405af68
[gaim-migrate @ 17128]
Keep things neat and clean in gnt_util_onscreen_width_to_pointer.
The only use of this function currently is to truncate a string to
make sure it fits in the drawing area, eg, the title of a window,
or in the combobox. The function is called on a newly allocated
string, which is truncated (if necessary), printed, and freed.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 02 Sep 2006 18:55:27 +0000 |
parents | ed771d01239b |
children | 3ac156db9cb6 |
line wrap: on
line diff
--- a/console/libgnt/gntcombobox.c Sat Sep 02 16:55:32 2006 +0000 +++ b/console/libgnt/gntcombobox.c Sat Sep 02 18:55:27 2006 +0000 @@ -36,7 +36,7 @@ gnt_combo_box_draw(GntWidget *widget) { GntComboBox *box = GNT_COMBO_BOX(widget); - char *text = NULL; + char *text = NULL, *s; GntColorType type; int len; @@ -53,12 +53,8 @@ wbkgdset(widget->window, '\0' | COLOR_PAIR(type)); - if ((len = g_utf8_strlen(text, -1)) > widget->priv.width - 4) - { - char *s = gnt_util_onscreen_width_to_pointer(text, widget->priv.width - 4, NULL); - *s = '\0'; - len = widget->priv.width - 4; - } + s = (char*)gnt_util_onscreen_width_to_pointer(text, widget->priv.width - 4, &len); + *s = '\0'; mvwprintw(widget->window, 1, 1, text); whline(widget->window, ' ' | COLOR_PAIR(type), widget->priv.width - 4 - len);