Mercurial > pidgin
annotate src/conversation.c @ 401:7c74e2f579b5
[gaim-migrate @ 411]
Heh, whoops. you can send messages to offline people now.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 12 Jun 2000 22:02:50 +0000 |
parents | be408b41c172 |
children | a330017b3aa4 |
rev | line source |
---|---|
66 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
344
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
344
diff
changeset
|
23 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
344
diff
changeset
|
24 #endif |
66 | 25 #include <string.h> |
26 #include <sys/time.h> | |
27 #include <sys/types.h> | |
28 #include <sys/stat.h> | |
29 #include <unistd.h> | |
30 #include <stdio.h> | |
31 #include <stdlib.h> | |
210
ec0686b3b03f
[gaim-migrate @ 220]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
209
diff
changeset
|
32 #include <ctype.h> |
66 | 33 #include <gtk/gtk.h> |
34 #include "gaim.h" | |
35 #include "gtkhtml.h" | |
36 #include <gdk/gdkkeysyms.h> | |
37 #include "pixmaps/underline.xpm" | |
38 #include "pixmaps/bold.xpm" | |
39 #include "pixmaps/italic.xpm" | |
40 #include "pixmaps/small.xpm" | |
41 #include "pixmaps/normal.xpm" | |
42 #include "pixmaps/big.xpm" | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
43 #include "pixmaps/fontface.xpm" |
66 | 44 #include "pixmaps/speaker.xpm" |
210
ec0686b3b03f
[gaim-migrate @ 220]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
209
diff
changeset
|
45 /* #include "pixmaps/aimicon2.xpm" */ |
66 | 46 #include "pixmaps/wood.xpm" |
47 #include "pixmaps/palette.xpm" | |
48 #include "pixmaps/link.xpm" | |
49 #include "pixmaps/strike.xpm" | |
50 | |
337 | 51 #include "pixmaps/smile_happy.xpm" |
52 #include "pixmaps/smile_sad.xpm" | |
53 #include "pixmaps/smile_wink.xpm" | |
54 | |
66 | 55 int state_lock=0; |
56 | |
57 GdkPixmap *dark_icon_pm = NULL; | |
58 GdkBitmap *dark_icon_bm = NULL; | |
59 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
60 char *fontface; |
66 | 61 |
62 void check_everything(GtkWidget *entry); | |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
63 char *get_tag_by_prefix(GtkWidget *entry, const char *prefix); |
66 | 64 gboolean user_keypress_callback(GtkWidget *entry, GdkEventKey *event, struct conversation *c); |
65 | |
66 /*------------------------------------------------------------------------*/ | |
67 /* Helpers */ | |
68 /*------------------------------------------------------------------------*/ | |
69 | |
70 | |
71 void quiet_set(GtkWidget *tb, int state) | |
72 { | |
73 state_lock=1; | |
74 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(tb), state); | |
75 state_lock=0; | |
76 } | |
77 | |
78 | |
79 void set_state_lock(int i) | |
80 { | |
81 state_lock = i; | |
82 } | |
83 | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
84 void toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
85 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
86 gboolean sensitivity = GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(to_toggle)); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
87 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
88 if (sensitivity == TRUE) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
89 gtk_widget_set_sensitive(GTK_WIDGET(to_toggle), FALSE); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
90 else |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
91 gtk_widget_set_sensitive(GTK_WIDGET(to_toggle), TRUE); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
92 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
93 return; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
94 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
95 |
66 | 96 struct conversation *new_conversation(char *name) |
97 { | |
98 struct conversation *c; | |
99 | |
100 c = find_conversation(name); | |
101 | |
102 if (c != NULL) | |
103 return c; | |
104 | |
105 c = (struct conversation *)g_new0(struct conversation, 1); | |
106 g_snprintf(c->name, sizeof(c->name), "%s", name); | |
107 | |
108 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | |
109 FILE *fd; | |
70 | 110 |
373
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
363
diff
changeset
|
111 fd = open_log_file(c->name); |
66 | 112 if (!(general_options & OPT_GEN_STRIP_HTML)) |
70 | 113 fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", full_date()); |
66 | 114 else |
70 | 115 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date()); |
116 | |
66 | 117 fclose(fd); |
118 } | |
119 | |
120 show_conv(c); | |
121 conversations = g_list_append(conversations, c); | |
122 return c; | |
123 } | |
124 | |
125 | |
126 struct conversation *find_conversation(char *name) | |
127 { | |
128 char *cuser = g_malloc(64); | |
129 struct conversation *c; | |
130 GList *cnv = conversations; | |
131 | |
132 strcpy(cuser, normalize(name)); | |
133 | |
134 while(cnv) { | |
135 c = (struct conversation *)cnv->data; | |
136 if(!strcasecmp(cuser, normalize(c->name))) { | |
137 g_free(cuser); | |
138 return c; | |
139 } | |
140 cnv = cnv->next; | |
141 } | |
142 g_free(cuser); | |
143 return NULL; | |
144 } | |
145 | |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
146 /* given the first part of a tag, returns the length up to the final '>'; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
147 useful for 'remove_tags' calls on variable data, such as <font face> |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
148 tags */ |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
149 char *get_tag_by_prefix(GtkWidget *entry, const char *prefix) |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
150 { |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
151 char *s, *t; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
152 int i = 0; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
153 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
154 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
155 t = s; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
156 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
157 if (t = strstr(s, prefix)) |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
158 { |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
159 for (i = 1; t[i] != '\0'; i++) |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
160 { |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
161 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
162 if (t[i] == '>') |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
163 break; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
164 } |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
165 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
166 t = gtk_editable_get_chars(GTK_EDITABLE(entry), (t-s), (t-s) + i + 1); |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
167 } |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
168 return t; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
169 } |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
170 |
66 | 171 /* --------------------------------------------------- |
172 * Function to remove a log file entry | |
173 * --------------------------------------------------- | |
174 */ | |
175 | |
176 void rm_log(struct log_conversation *a) | |
177 { | |
178 struct conversation *cnv = find_conversation(a->name); | |
179 char buf[128]; | |
180 | |
181 log_conversations = g_list_remove(log_conversations, a); | |
182 | |
183 save_prefs(); | |
184 | |
185 if (cnv) { | |
186 if (!(general_options & OPT_GEN_LOG_ALL)) | |
187 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, cnv->name); | |
188 else | |
189 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, cnv->name); | |
190 gtk_window_set_title(GTK_WINDOW(cnv->window), buf); | |
191 } | |
192 } | |
193 | |
194 struct log_conversation *find_log_info(char *name) | |
195 { | |
196 char *pname = g_malloc(64); | |
197 GList *lc = log_conversations; | |
198 struct log_conversation *l; | |
199 | |
200 | |
201 strcpy(pname, normalize(name)); | |
202 | |
203 while(lc) { | |
204 l = (struct log_conversation *)lc->data; | |
205 if (!strcasecmp(pname, normalize(l->name))) { | |
206 g_free(pname); | |
207 return l; | |
208 } | |
209 lc = lc->next; | |
210 } | |
211 g_free(pname); | |
212 return NULL; | |
213 } | |
214 | |
215 void delete_conversation(struct conversation *cnv) | |
216 { | |
217 conversations = g_list_remove(conversations, cnv); | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
218 if (cnv->color_dialog) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
219 gtk_widget_destroy(cnv->color_dialog); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
220 if (cnv->font_dialog) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
221 gtk_widget_destroy(cnv->font_dialog); |
66 | 222 g_free(cnv); |
223 } | |
224 | |
225 void update_log_convs() | |
226 { | |
227 GList *cnv = conversations; | |
228 struct conversation *c; | |
229 | |
230 while(cnv) { | |
231 c = (struct conversation *)cnv->data; | |
232 | |
233 if (c->log_button) | |
234 gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE); | |
235 | |
236 cnv = cnv->next; | |
237 } | |
238 } | |
239 | |
240 void update_font_buttons() | |
241 { | |
242 GList *cnv = conversations; | |
243 struct conversation *c; | |
244 | |
245 while (cnv) { | |
246 c = (struct conversation *)cnv->data; | |
247 | |
248 if (c->bold) | |
249 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); | |
250 | |
251 if (c->italic) | |
252 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); | |
253 | |
254 if (c->underline) | |
255 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); | |
256 | |
257 if (c->strike) | |
258 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); | |
259 | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
260 /* if (c->font) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
261 gtk_widget_set_sensitive(c->font, ((font_options & OPT_FONT_FACE)) ? TRUE : FALSE);*/ |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
262 |
66 | 263 cnv = cnv->next; |
264 } | |
265 } | |
266 | |
267 /* | |
268 void update_transparency() | |
269 { | |
270 GList *cnv = conversations; | |
271 struct conversation *c; | |
272 | |
273 This func should be uncalled! | |
274 | |
275 while(cnv) { | |
276 c = (struct conversation *)cnv->data; | |
277 | |
278 if (c->text) | |
279 gtk_html_set_transparent(GTK_HTML(c->text), | |
280 (transparent) ? TRUE : FALSE); | |
281 | |
282 cnv = cnv->next; | |
283 } | |
284 } | |
285 */ | |
286 | |
287 | |
288 /*------------------------------------------------------------------------*/ | |
289 /* Callbacks */ | |
290 /*------------------------------------------------------------------------*/ | |
291 | |
292 void toggle_loggle(GtkWidget *w, struct conversation *p) | |
293 { | |
294 if (state_lock) | |
295 return; | |
296 | |
297 if (find_log_info(p->name)) | |
298 rm_log(find_log_info(p->name)); | |
299 else | |
300 show_log_dialog(p->name); | |
301 } | |
302 | |
303 static int close_callback(GtkWidget *widget, struct conversation *c) | |
304 { | |
305 gtk_widget_destroy(c->window); | |
306 delete_conversation(c); | |
307 return TRUE; | |
308 } | |
309 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
310 void set_font_face(GtkWidget *widget, struct conversation *c) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
311 { |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
312 char *pre_fontface, *old_font_face; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
313 int alloc = 0, length; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
314 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
315 if (!(font_options & OPT_FONT_FACE)) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
316 return; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
317 |
308
e5fa88351dc8
[gaim-migrate @ 318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
318 if (c->current_fontface[0] && strcmp(c->current_fontface, "(null)")) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
319 { |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
320 pre_fontface = g_strconcat("<FONT FACE=\"", c->current_fontface, "\">", '\0'); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
321 alloc++; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
322 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
323 else |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
324 pre_fontface = "<FONT FACE=\"Helvetica\">"; |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
325 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
326 if (!strcmp(pre_fontface, "<FONT FACE=\"\">")) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
327 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
328 g_free(pre_fontface); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
329 alloc--; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
330 pre_fontface = "<FONT FACE=\"Helvetica\">"; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
331 } |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
332 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
333 if (old_font_face = get_tag_by_prefix(c->entry, "<FONT FACE")) |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
334 { |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
335 remove_tags(c->entry, old_font_face); |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
336 remove_tags(c->entry, "</FONT>"); |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
337 } |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
338 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
339 surround(c->entry, pre_fontface, "</FONT>"); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
340 gtk_widget_grab_focus(c->entry); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
341 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
342 if (alloc) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
343 g_free(pre_fontface); |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
344 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
345 g_free(old_font_face); /* mem allocated in get_tag_by_prefix() */ |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
346 return; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
347 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
348 |
66 | 349 static gint delete_event_convo(GtkWidget *w, GdkEventAny *e, struct conversation *c) |
350 { | |
351 delete_conversation(c); | |
352 return FALSE; | |
353 } | |
354 | |
355 static void color_callback(GtkWidget *widget, struct conversation *c) | |
356 { | |
357 /* show_color_dialog(c); */ | |
358 gtk_widget_grab_focus(c->entry); | |
359 } | |
360 | |
361 static void add_callback(GtkWidget *widget, struct conversation *c) | |
362 { | |
363 if (find_buddy(c->name) != NULL) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
364 sprintf(debug_buff,_("Removing '%s' from buddylist.\n"), c->name); |
66 | 365 debug_print(debug_buff); |
366 remove_buddy(find_group_by_buddy(c->name), find_buddy(c->name)); | |
367 build_edit_tree(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
368 gtk_label_set_text(GTK_LABEL(GTK_BIN(c->add_button)->child), _("Add")); |
66 | 369 } |
370 else | |
371 { | |
372 show_add_buddy(c->name, NULL); | |
373 } | |
374 | |
375 gtk_widget_grab_focus(c->entry); | |
376 } | |
377 | |
378 | |
379 static void block_callback(GtkWidget *widget, struct conversation *c) | |
380 { | |
381 show_add_perm(c->name); | |
382 gtk_widget_grab_focus(c->entry); | |
383 } | |
384 | |
385 static void warn_callback(GtkWidget *widget, struct conversation *c) | |
386 { | |
387 show_warn_dialog(c->name); | |
388 gtk_widget_grab_focus(c->entry); | |
389 } | |
390 | |
391 static void info_callback(GtkWidget *widget, struct conversation *c) | |
392 { | |
393 serv_get_info(c->name); | |
394 gtk_widget_grab_focus(c->entry); | |
395 } | |
396 | |
397 gboolean user_keypress_callback(GtkWidget *entry, GdkEventKey *event, struct conversation *c) | |
398 { | |
399 int pos; | |
400 if(event->keyval==GDK_Return) { | |
363
1c4ce1da3946
[gaim-migrate @ 373]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
401 if(!(event->state & GDK_SHIFT_MASK) |
1c4ce1da3946
[gaim-migrate @ 373]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
402 && (general_options & OPT_GEN_ENTER_SENDS)) { |
66 | 403 gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c); |
404 //to stop the putting in of the enter character | |
405 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
406 } else { | |
407 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
408 pos=gtk_editable_get_position(GTK_EDITABLE(entry)); | |
409 gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos); | |
410 } | |
411 } | |
412 | |
413 return TRUE; | |
414 | |
415 } | |
416 | |
417 | |
418 static void send_callback(GtkWidget *widget, struct conversation *c) | |
419 { | |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
420 char *buf = g_malloc(BUF_LEN * 4); |
66 | 421 char *buf2; |
422 gchar *buf4; | |
423 int hdrlen; | |
424 | |
283
0f14e6d8a51b
[gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
275
diff
changeset
|
425 /* FIXME : for USE_OSCAR, libfaim can send messages much longer |
0f14e6d8a51b
[gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
275
diff
changeset
|
426 * than this (I think it's about 7K rather than 4K. So we need |
0f14e6d8a51b
[gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
275
diff
changeset
|
427 * to do these checks a little bit differently here */ |
66 | 428 buf4 = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, -1); |
429 g_snprintf(buf, BUF_LONG, "%s", buf4); | |
430 g_free(buf4); | |
431 | |
432 if (!strlen(buf)) { | |
433 return; | |
434 } | |
435 | |
436 if (general_options & OPT_GEN_SEND_LINKS) { | |
437 linkify_text(buf); | |
438 } | |
439 | |
440 /* Let us determine how long the message CAN be. | |
441 * toc_send_im is 11 chars long + 2 quotes. | |
442 * + 2 spaces + 6 for the header + 2 for good | |
443 * measure = 23 bytes + the length of normalize c->name */ | |
444 | |
445 buf2 = g_malloc(BUF_LONG); | |
446 | |
447 hdrlen = 23 + strlen(normalize(c->name)); | |
448 | |
449 /* printf("%d %d %d\n", strlen(buf), hdrlen, BUF_LONG);*/ | |
450 | |
451 if (font_options & OPT_FONT_BOLD) { | |
452 g_snprintf(buf2, BUF_LONG, "<B>%s</B>", buf); | |
453 strcpy(buf, buf2); | |
454 } | |
455 | |
456 if (font_options & OPT_FONT_ITALIC) { | |
457 g_snprintf(buf2, BUF_LONG, "<I>%s</I>", buf); | |
458 strcpy(buf, buf2); | |
459 } | |
460 | |
461 if (font_options & OPT_FONT_UNDERLINE) { | |
462 g_snprintf(buf2, BUF_LONG, "<U>%s</U>", buf); | |
463 strcpy(buf, buf2); | |
464 } | |
465 | |
466 if (font_options & OPT_FONT_STRIKE) { | |
467 g_snprintf(buf2, BUF_LONG, "<STRIKE>%s</STRIKE>", buf); | |
468 strcpy(buf, buf2); | |
469 } | |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
470 |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
471 #ifdef GAIM_PLUGINS |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
472 { |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
473 GList *ca = callbacks; |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
474 struct gaim_callback *g; |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
475 void (*function)(char *, char **, void *); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
476 char *buffy = g_strdup(buf); |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
477 while (ca) { |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
478 g = (struct gaim_callback *)(ca->data); |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
479 if (g->event == event_im_send && g->function != NULL) { |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
480 function = g->function; |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
481 (*function)(c->name, &buffy, g->data); |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
482 } |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
483 ca = ca->next; |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
484 } |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
485 if (!buffy) { |
102
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
486 g_free(buf2); |
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
487 return; |
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
488 } |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
489 g_snprintf(buf, BUF_LONG, "%s", buffy); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
490 g_free(buffy); |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
491 } |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
492 #endif |
66 | 493 |
494 write_to_conv(c, buf, WFLAG_SEND); | |
495 | |
496 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1); | |
497 | |
498 escape_text(buf); | |
499 if (escape_message(buf) > MSG_LEN - hdrlen) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
500 do_error_dialog(_("Message too long, some data truncated."), _("Error")); |
66 | 501 } |
502 | |
503 serv_send_im(c->name, buf, 0); | |
504 | |
505 quiet_set(c->bold, FALSE); | |
506 quiet_set(c->strike, FALSE); | |
507 quiet_set(c->italic, FALSE); | |
508 quiet_set(c->underline, FALSE); | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
509 quiet_set(c->font, FALSE); |
66 | 510 quiet_set(c->palette, FALSE); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
511 quiet_set(c->link, FALSE); |
66 | 512 |
513 if (c->makesound && (sound_options & OPT_SOUND_SEND)) | |
514 play_sound(SEND); | |
515 | |
375
1eae69f076d2
[gaim-migrate @ 385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
373
diff
changeset
|
516 if ((general_options & OPT_GEN_BACK_ON_IM) && awaymessage != NULL) { |
66 | 517 do_im_back(); |
518 } | |
519 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
520 set_font_face(NULL, c); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
521 |
66 | 522 gtk_widget_grab_focus(c->entry); |
523 | |
524 g_free(buf2); | |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
525 g_free(buf); |
66 | 526 } |
527 | |
528 static int | |
529 entry_key_pressed(GtkWidget *w, GtkWidget *entry) | |
530 { | |
531 check_everything(w); | |
532 return TRUE; | |
533 } | |
534 | |
535 /*------------------------------------------------------------------------*/ | |
536 /* HTML-type stuff */ | |
537 /*------------------------------------------------------------------------*/ | |
538 | |
539 int count_tag(GtkWidget *entry, char *s1, char *s2) | |
540 { | |
541 char *p1, *p2; | |
542 int res=0; | |
543 char *tmp, *tmpo, h; | |
544 tmpo = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
545 h = tmpo[GTK_EDITABLE(entry)->current_pos]; | |
546 tmpo[GTK_EDITABLE(entry)->current_pos]='\0'; | |
547 tmp=tmpo; | |
548 do { | |
549 p1 = strstr(tmp, s1); | |
550 p2 = strstr(tmp, s2); | |
551 if (p1 && p2) { | |
552 if (p1 < p2) { | |
553 res=1; | |
554 tmp = p1 +strlen(s1); | |
555 } else if (p2 < p1) { | |
556 res = 0; | |
557 tmp = p2 + strlen(s2); | |
558 } | |
559 } else { | |
560 if (p1) { | |
561 res = 1; | |
562 tmp = p1 + strlen(s1); | |
563 } else if (p2) { | |
564 res = 0; | |
565 tmp = p2 + strlen(s2); | |
566 } | |
567 } | |
568 } while (p1 || p2); | |
569 tmpo[GTK_EDITABLE(entry)->current_pos]=h; | |
570 g_free(tmpo); | |
571 return res; | |
572 } | |
573 | |
574 | |
575 int invert_tags(GtkWidget *entry, char *s1, char *s2, int really) | |
576 { | |
577 int start = GTK_EDITABLE(entry)->selection_start_pos; | |
578 int finish = GTK_EDITABLE(entry)->selection_end_pos; | |
579 char *s; | |
580 | |
581 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
582 if (!strncasecmp(&s[start], s1, strlen(s1)) && | |
583 !strncasecmp(&s[finish - strlen(s2)], s2, strlen(s2))) { | |
584 if (really) { | |
585 gtk_editable_delete_text(GTK_EDITABLE(entry), start, start + strlen(s1)); | |
586 gtk_editable_delete_text(GTK_EDITABLE(entry), finish - strlen(s2) - strlen(s1), finish - strlen(s1)); | |
587 } | |
588 g_free(s); | |
589 return 1; | |
590 } | |
591 g_free(s); | |
592 return 0; | |
593 } | |
594 | |
595 | |
596 void remove_tags(GtkWidget *entry, char *tag) | |
597 { | |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
598 char *s, *t; |
66 | 599 int start = GTK_EDITABLE(entry)->selection_start_pos; |
600 int finish = GTK_EDITABLE(entry)->selection_end_pos; | |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
601 int temp; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
602 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
66 | 603 t = s; |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
604 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
605 if (start > finish) |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
606 { |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
607 temp = start; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
608 start = finish; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
609 finish = temp; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
610 } |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
611 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
612 if (strstr(tag, "<FONT SIZE=")) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
613 { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
614 while((t = strstr(t, "<FONT SIZE="))) { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
615 if (((t-s) < finish) && ((t-s) >= start)) { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
616 gtk_editable_delete_text(GTK_EDITABLE(entry), (t-s), (t-s) + strlen(tag)); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
617 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
618 t = s; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
619 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
620 else t++; |
68 | 621 } |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
622 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
623 else |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
624 { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
625 while((t = strstr(t, tag))) { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
626 if (((t-s) < finish) && ((t-s) >= start)) { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
627 gtk_editable_delete_text(GTK_EDITABLE(entry), (t-s), (t-s) + strlen(tag)); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
628 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
629 t = s; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
630 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
631 else t++; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
632 } |
66 | 633 } |
634 g_free(s); | |
635 } | |
636 | |
637 void surround(GtkWidget *entry, char *pre, char *post) | |
638 { | |
639 int pos = GTK_EDITABLE(entry)->current_pos; | |
640 int dummy; | |
641 int start, finish; | |
642 if (GTK_EDITABLE(entry)->has_selection) { | |
643 remove_tags(entry, pre); | |
644 remove_tags(entry, post); | |
645 start = GTK_EDITABLE(entry)->selection_start_pos; | |
646 finish = GTK_EDITABLE(entry)->selection_end_pos; | |
647 if (start > finish) { | |
648 dummy = finish; | |
649 finish = start; | |
650 start = dummy; | |
651 } | |
652 dummy = start; | |
653 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &dummy); | |
654 dummy = finish + strlen(pre); | |
655 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy); | |
656 gtk_editable_select_region(GTK_EDITABLE(entry), start, finish + strlen(pre) + strlen(post)); | |
657 } else { | |
658 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &pos); | |
659 dummy = pos; | |
660 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy); | |
661 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | |
662 } | |
663 gtk_widget_grab_focus(entry); | |
664 } | |
665 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
666 void advance_past(GtkWidget *entry, char *pre, char *post) |
66 | 667 { |
668 char *s, *s2; | |
669 int pos; | |
670 if (invert_tags(entry, pre, post, 1)) | |
671 return; | |
672 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
673 pos = GTK_EDITABLE(entry)->current_pos; | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
674 sprintf(debug_buff,_("Currently at %d\n"),pos); |
66 | 675 debug_print(debug_buff); |
676 s2= strstr(&s[pos], post); | |
677 if (s2) | |
678 pos = s2 - s + strlen(post); | |
679 else | |
187 | 680 pos=strlen(s); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
681 sprintf(debug_buff,_("Setting position to %d\n"),pos); |
66 | 682 debug_print(debug_buff); |
683 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | |
684 gtk_widget_grab_focus(entry); | |
685 } | |
686 | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
687 static void toggle_color(GtkWidget *color, struct conversation *c) |
66 | 688 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
689 if (state_lock) |
66 | 690 return; |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
691 if (GTK_TOGGLE_BUTTON(color)->active) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
692 show_color_dialog(c, color); |
189
50dc3db25513
[gaim-migrate @ 199]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
187
diff
changeset
|
693 else |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
694 advance_past(c->entry, "<FONT COLOR>", "</FONT>" ); |
66 | 695 } |
696 | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
697 static void toggle_font(GtkWidget *font, struct conversation *c) |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
698 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
699 if (state_lock) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
700 return; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
701 if (GTK_TOGGLE_BUTTON(font)->active) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
702 show_font_dialog(c, font); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
703 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
704 advance_past(c->entry, "<FONT FACE>", "</FONT>"); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
705 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
706 return; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
707 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
708 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
709 void do_link(GtkWidget *linky, GtkWidget *entry) |
66 | 710 { |
711 if (state_lock) | |
712 return; | |
713 if (GTK_TOGGLE_BUTTON(linky)->active) | |
714 show_add_link(entry, linky); | |
715 else | |
716 advance_past(entry, "<A HREF>", "</A>" ); | |
717 } | |
718 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
719 void do_strike(GtkWidget *strike, GtkWidget *entry) |
66 | 720 { |
721 if (state_lock) | |
722 return; | |
723 if (GTK_TOGGLE_BUTTON(strike)->active) | |
724 surround(entry, "<STRIKE>","</STRIKE>"); | |
725 else | |
726 advance_past(entry, "<STRIKE>", "</STRIKE>"); | |
727 } | |
728 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
729 void do_bold(GtkWidget *bold, GtkWidget *entry) |
66 | 730 { |
731 if (state_lock) | |
732 return; | |
733 if (GTK_TOGGLE_BUTTON(bold)->active) | |
734 surround(entry, "<B>","</B>"); | |
735 else | |
736 advance_past(entry, "<B>", "</B>"); | |
737 } | |
738 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
739 void do_underline(GtkWidget *underline, GtkWidget *entry) |
66 | 740 { |
741 if (state_lock) | |
742 return; | |
743 if (GTK_TOGGLE_BUTTON(underline)->active) | |
744 surround(entry, "<U>","</U>"); | |
745 else | |
746 advance_past(entry, "<U>", "</U>"); | |
747 } | |
748 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
749 void do_italic(GtkWidget *italic, GtkWidget *entry) |
66 | 750 { |
751 if (state_lock) | |
752 return; | |
753 if (GTK_TOGGLE_BUTTON(italic)->active) | |
754 surround(entry, "<I>","</I>"); | |
755 else | |
756 advance_past(entry, "<I>", "</I>"); | |
757 } | |
758 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
759 /* html code to modify font sizes must all be the same length, */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
760 /* currently set to 15 chars */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
761 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
762 void do_small(GtkWidget *small, GtkWidget *entry) |
66 | 763 { |
764 if (state_lock) | |
765 return; | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
766 surround(entry, "<FONT SIZE=\"1\">","</FONT>"); |
66 | 767 } |
768 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
769 void do_normal(GtkWidget *normal, GtkWidget *entry) |
66 | 770 { |
771 if (state_lock) | |
772 return; | |
88 | 773 surround(entry, "<FONT SIZE=\"3\">","</FONT>"); |
66 | 774 } |
775 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
776 void do_big(GtkWidget *big, GtkWidget *entry) |
66 | 777 { |
778 if (state_lock) | |
779 return; | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
780 surround(entry, "<FONT SIZE=\"5\">","</FONT>"); |
66 | 781 } |
782 | |
783 void check_everything(GtkWidget *entry) | |
784 { | |
785 struct conversation *c; | |
206 | 786 |
66 | 787 c = (struct conversation *)gtk_object_get_user_data(GTK_OBJECT(entry)); |
788 if (!c) return; | |
789 if (invert_tags(entry, "<B>", "</B>", 0)) | |
790 quiet_set(c->bold, TRUE); | |
791 else if (count_tag(entry, "<B>", "</B>")) | |
792 quiet_set(c->bold, TRUE); | |
793 else | |
794 quiet_set(c->bold,FALSE); | |
795 if (invert_tags(entry, "<I>", "</I>", 0)) | |
796 quiet_set(c->italic, TRUE); | |
797 else if (count_tag(entry, "<I>", "</I>")) | |
798 quiet_set(c->italic, TRUE); | |
799 else | |
800 quiet_set(c->italic, FALSE); | |
801 | |
802 if (invert_tags(entry, "<FONT COLOR", "</FONT>", 0)) | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
803 quiet_set(c->palette, TRUE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
804 else if (count_tag(entry, "<FONT COLOR", "</FONT>")) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
805 quiet_set(c->palette, TRUE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
806 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
807 quiet_set(c->palette, FALSE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
808 |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
809 if (invert_tags(entry, "<FONT FACE", "</FONT>", 0)) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
810 quiet_set(c->font, TRUE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
811 else if (count_tag(entry, "<FONT FACE", "</FONT>")) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
812 quiet_set(c->font, TRUE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
813 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
814 quiet_set(c->font, FALSE); |
66 | 815 |
816 if (invert_tags(entry, "<A HREF", "</A>", 0)) | |
817 quiet_set(c->link, TRUE); | |
818 else if (count_tag(entry, "<A HREF", "</A>")) | |
819 quiet_set(c->link, TRUE); | |
820 else | |
821 quiet_set(c->link, FALSE); | |
822 | |
823 if (invert_tags(entry, "<U>", "</U>", 0)) | |
824 quiet_set(c->underline, TRUE); | |
825 else if (count_tag(entry, "<U>", "</U>")) | |
826 quiet_set(c->underline, TRUE); | |
827 else | |
828 quiet_set(c->underline, FALSE); | |
829 | |
830 if (invert_tags(entry, "<STRIKE>", "</STRIKE>", 0)) | |
831 quiet_set(c->strike, TRUE); | |
832 else if (count_tag(entry, "<STRIKE>", "</STRIKE>")) | |
833 quiet_set(c->strike, TRUE); | |
834 else | |
835 quiet_set(c->strike, FALSE); | |
836 } | |
837 | |
838 | |
839 /*------------------------------------------------------------------------*/ | |
840 /* Takin care of the window.. */ | |
841 /*------------------------------------------------------------------------*/ | |
842 | |
843 | |
844 void write_to_conv(struct conversation *c, char *what, int flags) | |
845 { | |
846 char *buf = g_malloc(BUF_LONG); | |
847 char *buf2 = g_malloc(BUF_LONG); | |
848 char *who = NULL; | |
849 FILE *fd; | |
850 char colour[10]; | |
337 | 851 GdkBitmap *mask; |
852 GdkPixmap *face; | |
853 int state; | |
854 int y; | |
855 int i; | |
389 | 856 char *smiley = g_malloc(7); |
337 | 857 |
66 | 858 if (flags & WFLAG_SYSTEM) { |
859 | |
860 gtk_html_freeze(GTK_HTML(c->text)); | |
861 | |
862 gtk_html_append_text(GTK_HTML(c->text), what, 0); | |
337 | 863 |
864 gtk_html_append_text(GTK_HTML(c->text), "<BR>", 0); | |
66 | 865 |
866 gtk_html_thaw(GTK_HTML(c->text)); | |
867 | |
868 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | |
869 char *t1; | |
870 | |
871 if (general_options & OPT_GEN_STRIP_HTML) { | |
872 t1 = strip_html(what); | |
873 } else { | |
874 t1 = what; | |
875 } | |
373
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
363
diff
changeset
|
876 fd = open_log_file(c->name); |
66 | 877 fprintf(fd, "%s\n", t1); |
878 fclose(fd); | |
879 if (general_options & OPT_GEN_STRIP_HTML) { | |
880 g_free(t1); | |
881 } | |
882 } | |
883 | |
884 } else { | |
885 | |
886 if (flags & WFLAG_RECV) { | |
887 strcpy(colour, "#ff0000"); | |
145
41bd1cd48571
[gaim-migrate @ 155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
128
diff
changeset
|
888 who = c->name; |
66 | 889 } else if (flags & WFLAG_SEND) { |
890 strcpy(colour, "#0000ff"); | |
891 who = current_user->username; | |
892 } | |
893 | |
145
41bd1cd48571
[gaim-migrate @ 155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
128
diff
changeset
|
894 if (flags & WFLAG_AUTO) |
66 | 895 sprintf(buf2, " %s", AUTO_RESPONSE); |
896 else | |
897 buf2[0]=0; /* sprintf(buf2, ""); */ | |
898 | |
899 if (display_options & OPT_DISP_SHOW_TIME) | |
900 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s %s:%s</B></FONT> ", colour, date(), who, buf2); | |
901 else | |
902 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s:%s</B></FONT> ", colour, who, buf2); | |
903 | |
904 gtk_html_freeze(GTK_HTML(c->text)); | |
905 | |
337 | 906 y = 0; |
907 state = 0; | |
908 buf2[0] = 0; | |
909 | |
910 | |
911 gtk_html_append_text(GTK_HTML(c->text), buf, 0); | |
912 | |
913 if (display_options & OPT_DISP_SHOW_SMILEY) | |
914 { | |
915 for (i = 0; i < strlen(what); i++) | |
916 { | |
917 buf2[y] = what[i]; | |
918 y++; | |
919 | |
389 | 920 if ( (what[i] == ':') || (what[i] == ';') || (what[i] == 'O') ) |
337 | 921 { |
389 | 922 if (state < 2) |
337 | 923 { |
924 smiley[state] = what[i]; | |
389 | 925 state++; |
337 | 926 } |
927 else | |
389 | 928 { |
337 | 929 state = 0; |
389 | 930 } |
337 | 931 } |
389 | 932 else if ( (what[i] == '-') || (what[i] == '^') || (what[i] == 'o') ) |
337 | 933 { |
389 | 934 if ((state == 1) || (state==2)) |
337 | 935 { |
936 smiley[state] = what[i]; | |
389 | 937 state++; |
938 } | |
337 | 939 else |
389 | 940 { |
337 | 941 state = 0; |
389 | 942 } |
337 | 943 } |
944 else if ((what[i] == ')') || (what[i] == '*') || (what[i] == '(') || | |
945 (what[i] == 'p') || (what[i] == 'P') || (what[i] == '$') || | |
946 (what[i] == '!') || (what[i] == 'D') || (what[i] == 'X') ) | |
947 { | |
948 if ( (state == 1) && (what[i] == ')') ) | |
949 { | |
950 smiley[state] = what[i]; | |
951 smiley[state+1] = 0; | |
952 buf2[y - state - 1] = 0; | |
953 y = 0; | |
954 face = gdk_pixmap_create_from_xpm_d(c->window->window, &mask, &c->window->style->white, smile_happy_xpm); | |
955 gtk_html_append_text(GTK_HTML(c->text), buf2, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0); | |
956 gtk_html_add_pixmap(GTK_HTML(c->text), face, 0); | |
957 state = 0; | |
958 } | |
389 | 959 else if ( (state == 2) || (state == 3)) |
337 | 960 { |
961 smiley[state] = what[i]; | |
962 smiley[state+1] = 0; | |
963 buf2[y - state - 1] = 0; | |
964 y = 0; | |
965 | |
966 if (!strcasecmp(smiley, ":-(")) | |
967 { | |
968 face = gdk_pixmap_create_from_xpm_d(c->window->window, &mask, &c->window->style->white, smile_sad_xpm); | |
969 } | |
970 else if (!strcasecmp(smiley, ";-)")) | |
971 { | |
972 face = gdk_pixmap_create_from_xpm_d(c->window->window, &mask, &c->window->style->white, smile_wink_xpm); | |
973 } | |
974 else | |
975 { | |
976 face = gdk_pixmap_create_from_xpm_d(c->window->window, &mask, &c->window->style->white, smile_happy_xpm); | |
977 } | |
978 | |
979 gtk_html_append_text(GTK_HTML(c->text), buf2, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0); | |
980 gtk_html_add_pixmap(GTK_HTML(c->text), face, 0); | |
981 state = 0; | |
982 } | |
983 else | |
984 state = 0; | |
985 } | |
986 else | |
987 { | |
988 state = 0; | |
989 } | |
990 } | |
991 | |
992 if (buf2) | |
993 { | |
994 buf2[y] = 0; | |
995 gtk_html_append_text(GTK_HTML(c->text), buf2, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0); | |
996 } | |
997 } | |
998 else | |
999 { | |
1000 gtk_html_append_text(GTK_HTML(c->text), what, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0); | |
1001 } | |
66 | 1002 |
1003 gtk_html_append_text(GTK_HTML(c->text), "<BR>", 0); | |
1004 | |
1005 | |
1006 gtk_html_thaw(GTK_HTML(c->text)); | |
1007 | |
1008 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | |
1009 char *t1, *t2; | |
1010 | |
1011 if (general_options & OPT_GEN_STRIP_HTML) { | |
1012 t1 = strip_html(buf); | |
1013 t2 = strip_html(what); | |
1014 } else { | |
1015 t1 = buf; | |
1016 t2 = what; | |
1017 } | |
373
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
363
diff
changeset
|
1018 fd = open_log_file(c->name); |
66 | 1019 fprintf(fd, "%s%s\n", t1, t2); |
1020 fclose(fd); | |
1021 if (general_options & OPT_GEN_STRIP_HTML) { | |
1022 g_free(t1); | |
1023 g_free(t2); | |
1024 } | |
1025 } | |
1026 } | |
1027 | |
1028 /* if (!GTK_WIDGET_MAPPED(c->window)) { | |
1029 | |
1030 if (dark_icon_pm == NULL) | |
1031 dark_icon_pm = gdk_pixmap_create_from_xpm_d(c->window->window, &dark_icon_bm, | |
1032 NULL, (gchar **)aimicon2_xpm); | |
1033 gdk_window_set_icon(c->window->window, NULL, dark_icon_pm, dark_icon_bm); | |
1034 } | |
1035 */ | |
1036 | |
1037 if (general_options & OPT_GEN_POPUP_WINDOWS) | |
81 | 1038 gdk_window_show(c->window->window); |
66 | 1039 |
337 | 1040 g_free(smiley); |
66 | 1041 g_free(buf); |
1042 g_free(buf2); | |
1043 } | |
1044 | |
1045 | |
1046 | |
206 | 1047 static void check_spelling( GtkEditable * editable, gchar * new_text, |
1048 gint length, gint * position, | |
1049 gpointer data ) | |
1050 { | |
207 | 1051 if (general_options & OPT_GEN_CHECK_SPELLING) |
1052 { | |
1053 gtk_signal_handler_block_by_func(GTK_OBJECT(editable), | |
1054 GTK_SIGNAL_FUNC(check_spelling), data); | |
1055 gtk_text_set_point(GTK_TEXT(editable), *position); | |
1056 gtk_text_insert(GTK_TEXT(editable), NULL, &(GTK_WIDGET(editable)->style->fg[0]), NULL, new_text, length ); | |
1057 if(isspace(new_text[0])) | |
1058 { | |
1059 gtk_text_freeze(GTK_TEXT(editable)); | |
209 | 1060 spell_checker(GTK_WIDGET(editable)); |
207 | 1061 gtk_text_thaw(GTK_TEXT(editable)); |
1062 } | |
1063 gtk_signal_handler_unblock_by_func(GTK_OBJECT(editable), | |
1064 GTK_SIGNAL_FUNC(check_spelling), data); | |
1065 gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert-text"); | |
1066 } | |
206 | 1067 } |
66 | 1068 |
1069 | |
1070 void show_conv(struct conversation *c) | |
1071 { | |
1072 GtkWidget *win; | |
1073 char buf[256]; | |
1074 GtkWidget *text; | |
1075 GtkWidget *sw; | |
1076 GtkWidget *send; | |
1077 GtkWidget *info; | |
1078 GtkWidget *warn; | |
1079 GtkWidget *block; | |
308
e5fa88351dc8
[gaim-migrate @ 318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
1080 /* GtkWidget *color; */ |
66 | 1081 GtkWidget *close; |
1082 GtkWidget *entry; | |
1083 GtkWidget *toolbar; | |
1084 GtkWidget *bbox; | |
1085 GtkWidget *vbox; | |
81 | 1086 GtkWidget *vbox2; |
1087 GtkWidget *paned; | |
66 | 1088 GtkWidget *add; |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1089 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i, *wood_i, *palette_i, *link_i, *font_i; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1090 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p, *wood_p, *palette_p, *link_p, *font_p; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1091 GtkWidget *strike, *small, *normal, *big, *bold, *italic, *underline, *speaker, *wood, *palette, *link, *font; |
66 | 1092 GdkBitmap *mask; |
1093 | |
1094 win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
1095 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE); | |
1096 | |
1097 gtk_widget_realize(win); | |
1098 aol_icon(win->window); | |
1099 | |
1100 | |
1101 c->window = win; | |
1102 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1103 send = gtk_button_new_with_label(_("Send")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1104 info = gtk_button_new_with_label(_("Info")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1105 warn = gtk_button_new_with_label(_("Warn")); |
308
e5fa88351dc8
[gaim-migrate @ 318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
1106 /* color = gtk_button_new_with_label("Color"); */ |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1107 close = gtk_button_new_with_label(_("Close")); |
66 | 1108 if (find_buddy(c->name) != NULL) { |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1109 add = gtk_button_new_with_label(_("Remove")); |
66 | 1110 } |
1111 else { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1112 add = gtk_button_new_with_label(_("Add")); |
66 | 1113 } |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1114 block = gtk_button_new_with_label(_("Block")); |
66 | 1115 |
1116 | |
1117 bbox = gtk_hbox_new(TRUE, 0); | |
1118 vbox = gtk_vbox_new(FALSE, 0); | |
81 | 1119 vbox2 = gtk_vbox_new(FALSE, 0); |
1120 paned = gtk_vpaned_new(); | |
66 | 1121 |
81 | 1122 gtk_paned_pack1(GTK_PANED(paned), vbox, FALSE, TRUE); |
1123 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); | |
1124 gtk_widget_show(vbox2); | |
1125 gtk_widget_show(paned); | |
1126 | |
66 | 1127 entry = gtk_text_new(NULL, NULL); |
1128 gtk_text_set_editable(GTK_TEXT(entry), TRUE); | |
1129 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE); | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1130 |
66 | 1131 /* Toolbar */ |
1132 toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); | |
1133 | |
1134 link_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
1135 &win->style->white, link_xpm ); | |
1136 link_p = gtk_pixmap_new(link_i, mask); | |
1137 gtk_widget_show(link_p); | |
1138 | |
1139 palette_i = gdk_pixmap_create_from_xpm_d (win->window, &mask, | |
1140 &win->style->white, palette_xpm ); | |
1141 palette_p = gtk_pixmap_new(palette_i, mask); | |
1142 gtk_widget_show(palette_p); | |
1143 | |
1144 wood_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1145 &win->style->white, wood_xpm ); | |
1146 wood_p = gtk_pixmap_new(wood_i, mask); | |
1147 gtk_widget_show(wood_p); | |
1148 speaker_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1149 &win->style->white, speaker_xpm ); | |
1150 speaker_p = gtk_pixmap_new(speaker_i, mask); | |
1151 gtk_widget_show(speaker_p); | |
1152 c->makesound=1; | |
1153 strike_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1154 &win->style->white, strike_xpm ); | |
1155 strike_p = gtk_pixmap_new(strike_i, mask); | |
1156 gtk_widget_show(strike_p); | |
1157 bold_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1158 &win->style->white, bold_xpm ); | |
1159 bold_p = gtk_pixmap_new(bold_i, mask); | |
1160 gtk_widget_show(bold_p); | |
1161 italic_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1162 &win->style->white, italic_xpm ); | |
1163 italic_p = gtk_pixmap_new(italic_i, mask); | |
1164 gtk_widget_show(italic_p); | |
1165 underline_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1166 &win->style->white, underline_xpm ); | |
1167 underline_p = gtk_pixmap_new(underline_i, mask); | |
1168 gtk_widget_show(underline_p); | |
1169 small_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1170 &win->style->white, small_xpm ); | |
1171 small_p = gtk_pixmap_new(small_i, mask); | |
1172 gtk_widget_show(small_p); | |
1173 normal_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1174 &win->style->white, normal_xpm ); | |
1175 normal_p = gtk_pixmap_new(normal_i, mask); | |
1176 gtk_widget_show(normal_p); | |
1177 big_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1178 &win->style->white, big_xpm ); | |
1179 big_p = gtk_pixmap_new(big_i, mask); | |
1180 gtk_widget_show(big_p); | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1181 font_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1182 &win->style->white, fontface_xpm ); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1183 font_p = gtk_pixmap_new(font_i, mask); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1184 gtk_widget_show(font_p); |
66 | 1185 |
1186 bold = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
1187 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1188 _("Bold"), _("Bold Text"), _("Bold"), bold_p, |
66 | 1189 GTK_SIGNAL_FUNC(do_bold), entry); |
1190 italic = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
1191 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1192 NULL, _("Italics"), _("Italics Text"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1193 _("Italics"), italic_p, GTK_SIGNAL_FUNC(do_italic), entry); |
66 | 1194 underline = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1195 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1196 NULL, _("Underline"), _("Underline Text"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1197 _("Underline"), underline_p, GTK_SIGNAL_FUNC(do_underline), entry); |
66 | 1198 strike = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1199 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1200 NULL, _("Strike"), _("Strike through Text"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1201 _("Strike"), strike_p, GTK_SIGNAL_FUNC(do_strike), entry); |
66 | 1202 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1203 small = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), _("Small"), _("Decrease font size"), _("Small"), small_p, GTK_SIGNAL_FUNC(do_small), entry); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1204 normal = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), _("Normal"), _("Normal font size"), _("Normal"), normal_p, GTK_SIGNAL_FUNC(do_normal), entry); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1205 big = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), _("Big"), _("Increase font size"), _("Big"), big_p, GTK_SIGNAL_FUNC(do_big), entry); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1206 font = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1207 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1208 NULL, _("Font"), _("Select Font"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1209 _("Font"), font_p, GTK_SIGNAL_FUNC(toggle_font), c); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1210 |
309
97cdac04c0f5
[gaim-migrate @ 319]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
308
diff
changeset
|
1211 if (!(font_options & OPT_FONT_FACE)) |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1212 gtk_widget_set_sensitive(GTK_WIDGET(font), FALSE); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1213 |
66 | 1214 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); |
1215 link = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1216 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, _("Link"), _("Insert Link"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1217 _("Link"), link_p, GTK_SIGNAL_FUNC(do_link), entry); |
66 | 1218 palette = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1219 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1220 NULL, _("Color"), _("Text Color"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1221 _("Color"), palette_p, GTK_SIGNAL_FUNC(toggle_color), c); |
66 | 1222 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1223 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1224 NULL, _("Logging"), _("Enable logging"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1225 _("Logging"), wood_p, GTK_SIGNAL_FUNC(toggle_loggle), c); |
66 | 1226 speaker = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1227 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1228 NULL, _("Sound"), _("Enable sounds"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1229 _("Sound"), speaker_p, GTK_SIGNAL_FUNC(set_option), &c->makesound); |
66 | 1230 c->makesound=0; |
1231 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(speaker), TRUE); | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1232 |
66 | 1233 state_lock = 1; |
1234 if (find_log_info(c->name)) | |
1235 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), TRUE); | |
1236 else | |
1237 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), FALSE); | |
1238 state_lock = 0; | |
1239 | |
1240 gtk_widget_show(toolbar); | |
1241 | |
1242 c->entry = entry; | |
1243 c->bold = bold; | |
1244 c->strike = strike; | |
1245 c->italic = italic; | |
1246 c->underline = underline; | |
1247 c->log_button = wood; | |
1248 c->palette = palette; | |
1249 c->link = link; | |
1250 c->add_button = add; | |
308
e5fa88351dc8
[gaim-migrate @ 318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
1251 c->font = font; |
66 | 1252 |
1253 gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE); | |
1254 | |
1255 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); | |
1256 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); | |
1257 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); | |
1258 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); | |
1259 | |
1260 gtk_object_set_user_data(GTK_OBJECT(entry), c); | |
1261 | |
1262 | |
1263 | |
1264 gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(send_callback),c); | |
1265 | |
1266 /* Text box */ | |
1267 | |
1268 | |
1269 text = gtk_html_new(NULL, NULL); | |
1270 | |
1271 gtk_html_set_editable(GTK_HTML(text), FALSE); | |
1272 /* gtk_html_set_transparent(GTK_HTML(text), (transparent) ? TRUE : FALSE);*/ | |
1273 c->text = text; | |
1274 | |
1275 sw = gtk_scrolled_window_new (NULL, NULL); | |
1276 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), | |
1277 GTK_POLICY_NEVER, | |
1278 GTK_POLICY_ALWAYS); | |
1279 gtk_widget_show(sw); | |
1280 gtk_container_add(GTK_CONTAINER(sw), text); | |
1281 gtk_widget_show(text); | |
1282 | |
1283 | |
1284 | |
1285 | |
1286 GTK_HTML (text)->hadj->step_increment = 10.0; | |
1287 GTK_HTML (text)->vadj->step_increment = 10.0; | |
1288 gtk_widget_set_usize(sw, 320, 150); | |
1289 | |
1290 | |
1291 | |
1292 /* Ready and pack buttons */ | |
1293 gtk_object_set_user_data(GTK_OBJECT(win), c); | |
1294 gtk_object_set_user_data(GTK_OBJECT(close), c); | |
1295 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), c); | |
1296 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), c); | |
1297 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(add_callback), c); | |
1298 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), c); | |
1299 gtk_signal_connect(GTK_OBJECT(warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c); | |
1300 gtk_signal_connect(GTK_OBJECT(block), "clicked", GTK_SIGNAL_FUNC(block_callback), c); | |
308
e5fa88351dc8
[gaim-migrate @ 318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
1301 /* gtk_signal_connect(GTK_OBJECT(color), "clicked", GTK_SIGNAL_FUNC(color_callback), c); */ |
66 | 1302 |
1303 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(user_keypress_callback), c); | |
81 | 1304 gtk_widget_set_usize(entry, 300, 25); |
66 | 1305 |
1306 gtk_box_pack_start(GTK_BOX(bbox), send, TRUE, TRUE, 5); | |
1307 gtk_box_pack_start(GTK_BOX(bbox), info, TRUE, TRUE, 5); | |
1308 gtk_box_pack_start(GTK_BOX(bbox), warn, TRUE, TRUE, 5); | |
1309 gtk_box_pack_start(GTK_BOX(bbox), block, TRUE, TRUE, 5); | |
308
e5fa88351dc8
[gaim-migrate @ 318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
1310 /* gtk_box_pack_start(GTK_BOX(bbox), color, TRUE, TRUE, 5); */ |
66 | 1311 gtk_box_pack_start(GTK_BOX(bbox), add, TRUE, TRUE, 5); |
1312 gtk_box_pack_start(GTK_BOX(bbox), close, TRUE, TRUE, 5); | |
1313 | |
1314 /* pack and fill the rest */ | |
1315 | |
1316 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 5); | |
81 | 1317 gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, FALSE, 5); |
1318 gtk_box_pack_start(GTK_BOX(vbox2), entry, TRUE, TRUE, 5); | |
1319 gtk_box_pack_start(GTK_BOX(vbox2), bbox, FALSE, FALSE, 5); | |
66 | 1320 |
1321 gtk_widget_show(send); | |
1322 gtk_widget_show(info); | |
1323 gtk_widget_show(warn); | |
1324 /* gtk_widget_show(color); */ | |
1325 gtk_widget_show(close); | |
1326 gtk_widget_show(add); | |
1327 gtk_widget_show(block); | |
1328 gtk_widget_show(bbox); | |
1329 gtk_widget_show(vbox); | |
1330 gtk_widget_show(entry); | |
1331 gtk_widget_show(text); | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1332 |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1333 c->font_dialog = NULL; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1334 c->color_dialog = NULL; |
67 | 1335 |
81 | 1336 gtk_container_add(GTK_CONTAINER(win), paned); |
66 | 1337 gtk_container_border_width(GTK_CONTAINER(win), 10); |
1338 | |
1339 if ((find_log_info(c->name)) || ((general_options & OPT_GEN_LOG_ALL))) | |
1340 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name); | |
1341 else | |
1342 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name); | |
1343 gtk_window_set_title(GTK_WINDOW(win), buf); | |
1344 gtk_window_set_focus(GTK_WINDOW(win),entry); | |
1345 | |
1346 gtk_signal_connect(GTK_OBJECT(win), "delete_event", GTK_SIGNAL_FUNC(delete_event_convo), c); | |
206 | 1347 gtk_signal_connect(GTK_OBJECT(entry), "insert-text", GTK_SIGNAL_FUNC(check_spelling), entry); |
66 | 1348 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed), entry); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1349 |
315
68637b451377
[gaim-migrate @ 325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
1350 if (fontface) |
68637b451377
[gaim-migrate @ 325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
1351 strncpy(c->current_fontface, fontface, sizeof(c->current_fontface)); |
68637b451377
[gaim-migrate @ 325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
1352 if (fontname) |
68637b451377
[gaim-migrate @ 325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
1353 strncpy(c->current_fontname, fontname, sizeof(c->current_fontname)); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1354 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1355 set_font_face(NULL, c); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1356 |
66 | 1357 gtk_widget_show(win); |
1358 } | |
1359 | |
1360 |