comparison 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
comparison
equal deleted inserted replaced
14058:32a71e64ceae 14059:2d1b41e3cf0d
1 #include "gntlabel.h" 1 #include "gntlabel.h"
2 #include "gntutils.h"
2 3
3 #include <string.h> 4 #include <string.h>
4 5
5 enum 6 enum
6 { 7 {
31 32
32 static void 33 static void
33 gnt_label_size_request(GntWidget *widget) 34 gnt_label_size_request(GntWidget *widget)
34 { 35 {
35 GntLabel *label = GNT_LABEL(widget); 36 GntLabel *label = GNT_LABEL(widget);
36 char *s = label->text, *last = s;
37 int count = 1;
38 int max = 0;
39 37
40 /* XXX: ew ... everyone look away */ 38 gnt_util_get_text_bound(label->text,
41 while (*s) 39 &widget->priv.width, &widget->priv.height);
42 {
43 if (*s == '\n' || *s == '\r')
44 {
45 count++;
46 if (max < s - last + 1)
47 max = s - last + 1;
48 last = s + 1;
49 }
50 s++;
51 }
52 if (max < s - last + 1)
53 max = s - last + 1;
54 widget->priv.height = count;
55
56 widget->priv.width = max;
57 } 40 }
58 41
59 static void 42 static void
60 gnt_label_class_init(GntLabelClass *klass) 43 gnt_label_class_init(GntLabelClass *klass)
61 { 44 {