Mercurial > pidgin
annotate console/libgnt/gntutils.c @ 15690:444b7ee76492
small leak/fix
author | Richard Nelson <wabz@pidgin.im> |
---|---|
date | Fri, 23 Feb 2007 21:46:52 +0000 |
parents | 7a52dce840b4 |
children | e354528c4163 |
rev | line source |
---|---|
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include "gntutils.h" |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 |
14311
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
3 #include <stdlib.h> |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
4 #include <string.h> |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
5 |
14417
64e28f46c695
[gaim-migrate @ 17125]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14366
diff
changeset
|
6 #include "config.h" |
64e28f46c695
[gaim-migrate @ 17125]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14366
diff
changeset
|
7 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 void gnt_util_get_text_bound(const char *text, int *width, int *height) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 const char *s = text, *last; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 int count = 1, max = 0; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 int len; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 /* XXX: ew ... everyone look away */ |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 last = s; |
14060
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
16 if (s) |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 { |
14060
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
18 while (*s) |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 { |
14060
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
20 if (*s == '\n' || *s == '\r') |
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
21 { |
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
22 count++; |
14420
c4a32405af68
[gaim-migrate @ 17128]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14419
diff
changeset
|
23 len = gnt_util_onscreen_width(last, s); |
14060
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
24 if (max < len) |
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
25 max = len; |
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
26 last = s + 1; |
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
27 } |
14420
c4a32405af68
[gaim-migrate @ 17128]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14419
diff
changeset
|
28 s = g_utf8_next_char(s); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 } |
14060
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
30 |
14420
c4a32405af68
[gaim-migrate @ 17128]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14419
diff
changeset
|
31 len = gnt_util_onscreen_width(last, s); |
14060
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
32 if (max < len) |
81648c6aa918
[gaim-migrate @ 16678]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
33 max = len; |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 if (height) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 *height = count; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 if (width) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 *width = max + (count > 1); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 |
14311
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
42 int gnt_util_onscreen_width(const char *start, const char *end) |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
43 { |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
44 int width = 0; |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
45 |
14477
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14424
diff
changeset
|
46 if (end == NULL) |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14424
diff
changeset
|
47 end = start + strlen(start); |
ca36763497d9
[gaim-migrate @ 17195]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14424
diff
changeset
|
48 |
14311
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
49 while (start < end) { |
14419 | 50 width += g_unichar_iswide(g_utf8_get_char(start)) ? 2 : 1; |
51 start = g_utf8_next_char(start); | |
14311
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
52 } |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
53 return width; |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
54 } |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
55 |
14420
c4a32405af68
[gaim-migrate @ 17128]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14419
diff
changeset
|
56 const char *gnt_util_onscreen_width_to_pointer(const char *string, int len, int *w) |
14311
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
57 { |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
58 int size; |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
59 int width = 0; |
14420
c4a32405af68
[gaim-migrate @ 17128]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14419
diff
changeset
|
60 const char *str = string; |
14311
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
61 |
14714
1d084d1ee6fa
[gaim-migrate @ 17468]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14477
diff
changeset
|
62 if (len <= 0) { |
14824
6ec7e963d186
[gaim-migrate @ 17591]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14793
diff
changeset
|
63 len = gnt_util_onscreen_width(string, NULL); |
14714
1d084d1ee6fa
[gaim-migrate @ 17468]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14477
diff
changeset
|
64 } |
1d084d1ee6fa
[gaim-migrate @ 17468]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14477
diff
changeset
|
65 |
14311
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
66 while (width < len && *str) { |
14419 | 67 size = g_unichar_iswide(g_utf8_get_char(str)) ? 2 : 1; |
68 if (width + size > len) | |
69 break; | |
70 str = g_utf8_next_char(str); | |
71 width += size; | |
14311
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
72 } |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
73 if (w) |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
74 *w = width; |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
75 return str; |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
76 } |
fda9dc44807d
[gaim-migrate @ 17001]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14060
diff
changeset
|
77 |
14423
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
78 char *gnt_util_onscreen_fit_string(const char *string, int maxw) |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
79 { |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
80 const char *start, *end; |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
81 GString *str; |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
82 |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
83 if (maxw <= 0) |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
84 maxw = getmaxx(stdscr) - 4; |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
85 |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
86 start = string; |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
87 str = g_string_new(NULL); |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
88 |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
89 while (*start) { |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
90 if ((end = strchr(start, '\n')) != NULL || |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
91 (end = strchr(start, '\r')) != NULL) { |
14424
c374f45f4c94
[gaim-migrate @ 17132]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14423
diff
changeset
|
92 if (gnt_util_onscreen_width(start, end) > maxw) |
14423
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
93 end = NULL; |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
94 } |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
95 if (end == NULL) |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
96 end = gnt_util_onscreen_width_to_pointer(start, maxw, NULL); |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
97 str = g_string_append_len(str, start, end - start); |
14424
c374f45f4c94
[gaim-migrate @ 17132]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14423
diff
changeset
|
98 if (*end) { |
c374f45f4c94
[gaim-migrate @ 17132]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14423
diff
changeset
|
99 str = g_string_append_c(str, '\n'); |
c374f45f4c94
[gaim-migrate @ 17132]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14423
diff
changeset
|
100 if (*end == '\n' || *end == '\r') |
c374f45f4c94
[gaim-migrate @ 17132]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14423
diff
changeset
|
101 end++; |
c374f45f4c94
[gaim-migrate @ 17132]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14423
diff
changeset
|
102 } |
14423
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
103 start = end; |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
104 } |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
105 return g_string_free(str, FALSE); |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
106 } |
cfd5bcc06a7e
[gaim-migrate @ 17131]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
107 |
15303
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
108 struct duplicate_fns |
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
109 { |
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
110 GDupFunc key_dup; |
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
111 GDupFunc value_dup; |
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
112 GHashTable *table; |
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
113 }; |
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
114 |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14714
diff
changeset
|
115 static void |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14714
diff
changeset
|
116 duplicate_values(gpointer key, gpointer value, gpointer data) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14714
diff
changeset
|
117 { |
15303
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
118 struct duplicate_fns *fns = data; |
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
119 g_hash_table_insert(fns->table, fns->key_dup ? fns->key_dup(key) : key, |
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
120 fns->value_dup ? fns->value_dup(value) : value); |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14714
diff
changeset
|
121 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14714
diff
changeset
|
122 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14714
diff
changeset
|
123 GHashTable *g_hash_table_duplicate(GHashTable *src, GHashFunc hash, |
15303
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
124 GEqualFunc equal, GDestroyNotify key_d, GDestroyNotify value_d, |
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
125 GDupFunc key_dup, GDupFunc value_dup) |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14714
diff
changeset
|
126 { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14714
diff
changeset
|
127 GHashTable *dest = g_hash_table_new_full(hash, equal, key_d, value_d); |
15303
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
128 struct duplicate_fns fns = {key_dup, value_dup, dest}; |
7a52dce840b4
[gaim-migrate @ 18094]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15158
diff
changeset
|
129 g_hash_table_foreach(src, duplicate_values, &fns); |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14714
diff
changeset
|
130 return dest; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14714
diff
changeset
|
131 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14714
diff
changeset
|
132 |
15158
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
133 gboolean gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint, |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
134 GValue *return_accu, |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
135 const GValue *handler_return, |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
136 gpointer dummy) |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
137 { |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
138 gboolean continue_emission; |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
139 gboolean signal_handled; |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
140 |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
141 signal_handled = g_value_get_boolean (handler_return); |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
142 g_value_set_boolean (return_accu, signal_handled); |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
143 continue_emission = !signal_handled; |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
144 |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
145 return continue_emission; |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
146 } |
68385f5bbd61
[gaim-migrate @ 17944]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14824
diff
changeset
|
147 |