Mercurial > pidgin
annotate src/protocols/msn/utils.c @ 7751:d691cb95ee67
[gaim-migrate @ 8396]
Changes for the conversation "Find" dialog:
-Makes the window manager "X" work correctly when closing the dialog
-Added an "s" mnemonic for the search box
-Hitting enter now performs the default action (Find)
-The Find button grays and un-grays (aka sensitizes and desensitizes)
itself based on the presence or absence of text in the search box.
For this I moved a function from dialogs.c to util.[c|h]:
gaim_gtk_set_sensitive_if_input()
-HIGification suggestions from Steven Garrity:
1. Give the window a title ("Find") as is recommended by the HIG
(http://developer.gnome.org/projects/gup/hig/1.0/windows.html#window-properties).
2. Drop the phrase "Enter a search phrase" altogether. Since the text
box is already labeled (and if the window was labeled too), this phrase
is redundant. Removing it simplifies the visual appearance of the
window, and is one less thing to translate.
3.Change text box label from "Search term:" to "Search for:". This isn't
a big deal, but the Search window in GEdit uses "Search for:" (I
couldn't find much consistency anywhere else).
4.Move "Close" and "Find" buttons to be 12 pixels from the bottom and
right edges of the window, as recommended by the HIG
(http://developer.gnome.org/projects/gup/hig/1.0/layout.html#window-layout-spacing).
Also thanks to Nathan Fredrickson for writing a patch for Steven's
suggestions.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Thu, 04 Dec 2003 22:09:58 +0000 |
| parents | 67f9b43c402a |
| children | 06f57183e29f |
| rev | line source |
|---|---|
| 5309 | 1 /** |
|
5312
89948fedf782
[gaim-migrate @ 5684]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
2 * @file utils.c Utility functions |
| 5309 | 3 * |
| 4 * gaim | |
| 5 * | |
| 6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
|
6701
b7e113a59b51
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
6359
diff
changeset
|
7 * |
| 5309 | 8 * This program is free software; you can redistribute it and/or modify |
| 9 * it under the terms of the GNU General Public License as published by | |
| 10 * the Free Software Foundation; either version 2 of the License, or | |
| 11 * (at your option) any later version. | |
| 12 * | |
| 13 * This program is distributed in the hope that it will be useful, | |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 * GNU General Public License for more details. | |
| 17 * | |
| 18 * You should have received a copy of the GNU General Public License | |
| 19 * along with this program; if not, write to the Free Software | |
| 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 */ | |
| 22 #include "msn.h" | |
| 23 | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
24 void |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
25 msn_parse_format(const char *mime, char **pre_ret, char **post_ret) |
| 5309 | 26 { |
| 27 char *cur; | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
28 GString *pre = g_string_new(NULL); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
29 GString *post = g_string_new(NULL); |
|
6093
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
30 unsigned int colors[3]; |
| 5309 | 31 |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
32 if (pre_ret != NULL) *pre_ret = NULL; |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
33 if (post_ret != NULL) *post_ret = NULL; |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
34 |
| 5309 | 35 cur = strstr(mime, "FN="); |
| 36 | |
| 37 if (cur && (*(cur = cur + 3) != ';')) { | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
38 pre = g_string_append(pre, "<FONT FACE=\""); |
| 5309 | 39 |
| 40 while (*cur && *cur != ';') { | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
41 pre = g_string_append_c(pre, *cur); |
| 5309 | 42 cur++; |
| 43 } | |
| 44 | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
45 pre = g_string_append(pre, "\">"); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
46 post = g_string_prepend(post, "</FONT>"); |
| 5309 | 47 } |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
48 |
| 5309 | 49 cur = strstr(mime, "EF="); |
| 50 | |
| 51 if (cur && (*(cur = cur + 3) != ';')) { | |
| 52 while (*cur && *cur != ';') { | |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
53 pre = g_string_append_c(pre, '<'); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
54 pre = g_string_append_c(pre, *cur); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
55 pre = g_string_append_c(pre, '>'); |
| 5309 | 56 cur++; |
| 57 } | |
| 58 } | |
| 59 | |
| 60 cur = strstr(mime, "CO="); | |
| 61 | |
| 62 if (cur && (*(cur = cur + 3) != ';')) { | |
|
6093
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
63 int i; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
64 |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
65 i = sscanf(cur, "%02x%02x%02x;", &colors[0], &colors[1], &colors[2]); |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
66 |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
67 if (i > 0) { |
| 5309 | 68 char tag[64]; |
|
6093
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
69 |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
70 if (i == 1) { |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
71 colors[2] = colors[0]; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
72 colors[1] = 0; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
73 colors[0] = 0; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
74 } |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
75 else if (i == 2) { |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
76 colors[2] = colors[1]; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
77 colors[1] = colors[0]; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
78 colors[0] = 0; |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
79 } |
|
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
80 |
| 5309 | 81 g_snprintf(tag, sizeof(tag), |
| 82 "<FONT COLOR=\"#%02hhx%02hhx%02hhx\">", | |
|
6093
13a37cacd10b
[gaim-migrate @ 6552]
Christian Hammond <chipx86@chipx86.com>
parents:
5964
diff
changeset
|
83 colors[2], colors[1], colors[0]); |
| 5309 | 84 |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
85 pre = g_string_append(pre, tag); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
86 post = g_string_prepend(post, "</FONT>"); |
| 5309 | 87 } |
| 88 } | |
| 89 | |
| 7134 | 90 cur = g_strdup(gaim_url_decode(pre->str)); |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
91 g_string_free(pre, TRUE); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
92 |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
93 if (pre_ret != NULL) |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
94 *pre_ret = cur; |
|
6359
dfde69e105ae
[gaim-migrate @ 6863]
Christian Hammond <chipx86@chipx86.com>
parents:
6358
diff
changeset
|
95 else |
|
dfde69e105ae
[gaim-migrate @ 6863]
Christian Hammond <chipx86@chipx86.com>
parents:
6358
diff
changeset
|
96 g_free(cur); |
| 5309 | 97 |
| 7134 | 98 cur = g_strdup(gaim_url_decode(post->str)); |
|
6358
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
99 g_string_free(post, TRUE); |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
100 |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
101 if (post_ret != NULL) |
|
8ba58b296cc1
[gaim-migrate @ 6862]
Christian Hammond <chipx86@chipx86.com>
parents:
6093
diff
changeset
|
102 *post_ret = cur; |
|
6359
dfde69e105ae
[gaim-migrate @ 6863]
Christian Hammond <chipx86@chipx86.com>
parents:
6358
diff
changeset
|
103 else |
|
dfde69e105ae
[gaim-migrate @ 6863]
Christian Hammond <chipx86@chipx86.com>
parents:
6358
diff
changeset
|
104 g_free(cur); |
| 5309 | 105 } |
