diff console/libgnt/gntlabel.c @ 14059:2d1b41e3cf0d

[gaim-migrate @ 16674] Add a way to change some preferences (the preferences for the conversations do not do anything yet). I used the request-api for this, which I think is cool. But too many preferences will make the dialog long, which may not fit in the screen. It looks alright for now though. You can pop the dialog up with "/prefs" command in a converastion. And some other minor fixes. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 09 Aug 2006 03:41:45 +0000
parents 0a0d2a1fd2bc
children cfd5bcc06a7e
line wrap: on
line diff
--- a/console/libgnt/gntlabel.c	Tue Aug 08 23:20:08 2006 +0000
+++ b/console/libgnt/gntlabel.c	Wed Aug 09 03:41:45 2006 +0000
@@ -1,4 +1,5 @@
 #include "gntlabel.h"
+#include "gntutils.h"
 
 #include <string.h>
 
@@ -33,27 +34,9 @@
 gnt_label_size_request(GntWidget *widget)
 {
 	GntLabel *label = GNT_LABEL(widget);
-	char *s = label->text, *last = s;
-	int count = 1;
-	int max = 0;
 
-	/* XXX: ew ... everyone look away */
-	while (*s)
-	{
-		if (*s == '\n' || *s == '\r')
-		{
-			count++;
-			if (max < s - last + 1)
-				max = s - last + 1;
-			last = s + 1;
-		}
-		s++;
-	}
-	if (max < s - last + 1)
-		max = s - last + 1;
-	widget->priv.height = count;
-
-	widget->priv.width = max;
+	gnt_util_get_text_bound(label->text,
+			&widget->priv.width, &widget->priv.height);
 }
 
 static void