From: <sa...@us...> - 2006-09-02 23:23:37
|
Revision: 17132 http://svn.sourceforge.net/gaim/?rev=17132&view=rev Author: sadrul Date: 2006-09-02 16:23:30 -0700 (Sat, 02 Sep 2006) Log Message: ----------- Do the same for the texts in buttons, and minor adjustments. Modified Paths: -------------- trunk/console/libgnt/gntbutton.c trunk/console/libgnt/gntutils.c Modified: trunk/console/libgnt/gntbutton.c =================================================================== --- trunk/console/libgnt/gntbutton.c 2006-09-02 23:06:25 UTC (rev 17131) +++ trunk/console/libgnt/gntbutton.c 2006-09-02 23:23:30 UTC (rev 17132) @@ -128,7 +128,7 @@ GntWidget *widget = g_object_new(GNT_TYPE_BUTTON, NULL); GntButton *button = GNT_BUTTON(widget); - button->priv->text = g_strdup(text); + button->priv->text = gnt_util_onscreen_fit_string(text, -1); gnt_widget_set_take_focus(widget, TRUE); return widget; Modified: trunk/console/libgnt/gntutils.c =================================================================== --- trunk/console/libgnt/gntutils.c 2006-09-02 23:06:25 UTC (rev 17131) +++ trunk/console/libgnt/gntutils.c 2006-09-02 23:23:30 UTC (rev 17132) @@ -82,17 +82,18 @@ while (*start) { if ((end = strchr(start, '\n')) != NULL || (end = strchr(start, '\r')) != NULL) { - if (gnt_util_onscreen_width(start, end) <= maxw) { - ++end; - } else + if (gnt_util_onscreen_width(start, end) > maxw) end = NULL; } if (end == NULL) end = gnt_util_onscreen_width_to_pointer(start, maxw, NULL); str = g_string_append_len(str, start, end - start); + if (*end) { + str = g_string_append_c(str, '\n'); + if (*end == '\n' || *end == '\r') + end++; + } start = end; - if (*end && *end != '\n' && *end != '\r') - str = g_string_append_c(str, '\n'); } return g_string_free(str, FALSE); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |