# HG changeset patch # User Sadrul Habib Chowdhury # Date 1157239410 0 # Node ID c374f45f4c948f4fab5daa212144689f2ac3b4e9 # Parent cfd5bcc06a7e104f825fdf4dfe036a9bbaf55b82 [gaim-migrate @ 17132] Do the same for the texts in buttons, and minor adjustments. committer: Tailor Script diff -r cfd5bcc06a7e -r c374f45f4c94 console/libgnt/gntbutton.c --- a/console/libgnt/gntbutton.c Sat Sep 02 23:06:25 2006 +0000 +++ b/console/libgnt/gntbutton.c Sat Sep 02 23:23:30 2006 +0000 @@ -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; diff -r cfd5bcc06a7e -r c374f45f4c94 console/libgnt/gntutils.c --- a/console/libgnt/gntutils.c Sat Sep 02 23:06:25 2006 +0000 +++ b/console/libgnt/gntutils.c Sat Sep 02 23:23:30 2006 +0000 @@ -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); }