Mercurial > pidgin.yaz
annotate src/conversation.c @ 189:50dc3db25513
[gaim-migrate @ 199]
uh huh
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 26 Apr 2000 20:24:35 +0000 |
parents | f5c3e340c5e4 |
children | 610b7ffc4821 |
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 | |
22 #include <string.h> | |
23 #include <sys/time.h> | |
24 #include <sys/types.h> | |
25 #include <sys/stat.h> | |
26 #include <unistd.h> | |
27 #include <stdio.h> | |
28 #include <stdlib.h> | |
29 #include <gtk/gtk.h> | |
30 #include "gaim.h" | |
31 #include "gtkhtml.h" | |
32 #include <gdk/gdkkeysyms.h> | |
33 #include "pixmaps/underline.xpm" | |
34 #include "pixmaps/bold.xpm" | |
35 #include "pixmaps/italic.xpm" | |
36 #include "pixmaps/small.xpm" | |
37 #include "pixmaps/normal.xpm" | |
38 #include "pixmaps/big.xpm" | |
39 #include "pixmaps/speaker.xpm" | |
40 #include "pixmaps/aimicon2.xpm" | |
41 #include "pixmaps/wood.xpm" | |
42 #include "pixmaps/palette.xpm" | |
43 #include "pixmaps/link.xpm" | |
44 #include "pixmaps/strike.xpm" | |
45 | |
46 int state_lock=0; | |
47 | |
48 GdkPixmap *dark_icon_pm = NULL; | |
49 GdkBitmap *dark_icon_bm = NULL; | |
50 | |
51 | |
52 void check_everything(GtkWidget *entry); | |
53 gboolean user_keypress_callback(GtkWidget *entry, GdkEventKey *event, struct conversation *c); | |
54 | |
55 | |
56 /*------------------------------------------------------------------------*/ | |
57 /* Helpers */ | |
58 /*------------------------------------------------------------------------*/ | |
59 | |
60 | |
61 void quiet_set(GtkWidget *tb, int state) | |
62 { | |
63 state_lock=1; | |
64 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(tb), state); | |
65 state_lock=0; | |
66 } | |
67 | |
68 | |
69 void set_state_lock(int i) | |
70 { | |
71 state_lock = i; | |
72 } | |
73 | |
74 struct conversation *new_conversation(char *name) | |
75 { | |
76 struct conversation *c; | |
77 | |
78 c = find_conversation(name); | |
79 | |
80 if (c != NULL) | |
81 return c; | |
82 | |
83 c = (struct conversation *)g_new0(struct conversation, 1); | |
84 g_snprintf(c->name, sizeof(c->name), "%s", name); | |
85 | |
86 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | |
87 FILE *fd; | |
70 | 88 |
66 | 89 fd = open_log_file(c); |
90 if (!(general_options & OPT_GEN_STRIP_HTML)) | |
70 | 91 fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", full_date()); |
66 | 92 else |
70 | 93 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date()); |
94 | |
66 | 95 fclose(fd); |
96 } | |
97 | |
98 show_conv(c); | |
99 conversations = g_list_append(conversations, c); | |
100 return c; | |
101 } | |
102 | |
103 | |
104 struct conversation *find_conversation(char *name) | |
105 { | |
106 char *cuser = g_malloc(64); | |
107 struct conversation *c; | |
108 GList *cnv = conversations; | |
109 | |
110 strcpy(cuser, normalize(name)); | |
111 | |
112 while(cnv) { | |
113 c = (struct conversation *)cnv->data; | |
114 if(!strcasecmp(cuser, normalize(c->name))) { | |
115 g_free(cuser); | |
116 return c; | |
117 } | |
118 cnv = cnv->next; | |
119 } | |
120 g_free(cuser); | |
121 return NULL; | |
122 } | |
123 | |
124 /* --------------------------------------------------- | |
125 * Function to remove a log file entry | |
126 * --------------------------------------------------- | |
127 */ | |
128 | |
129 void rm_log(struct log_conversation *a) | |
130 { | |
131 struct conversation *cnv = find_conversation(a->name); | |
132 char buf[128]; | |
133 | |
134 log_conversations = g_list_remove(log_conversations, a); | |
135 | |
136 save_prefs(); | |
137 | |
138 if (cnv) { | |
139 if (!(general_options & OPT_GEN_LOG_ALL)) | |
140 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, cnv->name); | |
141 else | |
142 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, cnv->name); | |
143 gtk_window_set_title(GTK_WINDOW(cnv->window), buf); | |
144 } | |
145 } | |
146 | |
147 struct log_conversation *find_log_info(char *name) | |
148 { | |
149 char *pname = g_malloc(64); | |
150 GList *lc = log_conversations; | |
151 struct log_conversation *l; | |
152 | |
153 | |
154 strcpy(pname, normalize(name)); | |
155 | |
156 while(lc) { | |
157 l = (struct log_conversation *)lc->data; | |
158 if (!strcasecmp(pname, normalize(l->name))) { | |
159 g_free(pname); | |
160 return l; | |
161 } | |
162 lc = lc->next; | |
163 } | |
164 g_free(pname); | |
165 return NULL; | |
166 } | |
167 | |
168 void delete_conversation(struct conversation *cnv) | |
169 { | |
170 conversations = g_list_remove(conversations, cnv); | |
171 g_free(cnv); | |
172 } | |
173 | |
174 void update_log_convs() | |
175 { | |
176 GList *cnv = conversations; | |
177 struct conversation *c; | |
178 | |
179 while(cnv) { | |
180 c = (struct conversation *)cnv->data; | |
181 | |
182 if (c->log_button) | |
183 gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE); | |
184 | |
185 cnv = cnv->next; | |
186 } | |
187 } | |
188 | |
189 void update_font_buttons() | |
190 { | |
191 GList *cnv = conversations; | |
192 struct conversation *c; | |
193 | |
194 while (cnv) { | |
195 c = (struct conversation *)cnv->data; | |
196 | |
197 if (c->bold) | |
198 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); | |
199 | |
200 if (c->italic) | |
201 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); | |
202 | |
203 if (c->underline) | |
204 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); | |
205 | |
206 if (c->strike) | |
207 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); | |
208 | |
209 cnv = cnv->next; | |
210 } | |
211 } | |
212 | |
213 /* | |
214 void update_transparency() | |
215 { | |
216 GList *cnv = conversations; | |
217 struct conversation *c; | |
218 | |
219 This func should be uncalled! | |
220 | |
221 while(cnv) { | |
222 c = (struct conversation *)cnv->data; | |
223 | |
224 if (c->text) | |
225 gtk_html_set_transparent(GTK_HTML(c->text), | |
226 (transparent) ? TRUE : FALSE); | |
227 | |
228 cnv = cnv->next; | |
229 } | |
230 } | |
231 */ | |
232 | |
233 | |
234 /*------------------------------------------------------------------------*/ | |
235 /* Callbacks */ | |
236 /*------------------------------------------------------------------------*/ | |
237 | |
238 void toggle_loggle(GtkWidget *w, struct conversation *p) | |
239 { | |
240 if (state_lock) | |
241 return; | |
242 | |
243 if (find_log_info(p->name)) | |
244 rm_log(find_log_info(p->name)); | |
245 else | |
246 show_log_dialog(p->name); | |
247 } | |
248 | |
249 | |
250 static int close_callback(GtkWidget *widget, struct conversation *c) | |
251 { | |
252 gtk_widget_destroy(c->window); | |
253 delete_conversation(c); | |
254 return TRUE; | |
255 } | |
256 | |
257 static gint delete_event_convo(GtkWidget *w, GdkEventAny *e, struct conversation *c) | |
258 { | |
259 delete_conversation(c); | |
260 return FALSE; | |
261 } | |
262 | |
263 | |
264 static void color_callback(GtkWidget *widget, struct conversation *c) | |
265 { | |
266 /* show_color_dialog(c); */ | |
267 gtk_widget_grab_focus(c->entry); | |
268 } | |
269 | |
270 static void add_callback(GtkWidget *widget, struct conversation *c) | |
271 { | |
272 if (find_buddy(c->name) != NULL) { | |
273 sprintf(debug_buff,"Removing '%s' from buddylist.\n", c->name); | |
274 debug_print(debug_buff); | |
275 remove_buddy(find_group_by_buddy(c->name), find_buddy(c->name)); | |
276 build_edit_tree(); | |
277 gtk_label_set_text(GTK_LABEL(GTK_BIN(c->add_button)->child), "Add"); | |
278 } | |
279 else | |
280 { | |
281 show_add_buddy(c->name, NULL); | |
282 } | |
283 | |
284 gtk_widget_grab_focus(c->entry); | |
285 } | |
286 | |
287 | |
288 static void block_callback(GtkWidget *widget, struct conversation *c) | |
289 { | |
290 show_add_perm(c->name); | |
291 gtk_widget_grab_focus(c->entry); | |
292 } | |
293 | |
294 static void warn_callback(GtkWidget *widget, struct conversation *c) | |
295 { | |
296 show_warn_dialog(c->name); | |
297 gtk_widget_grab_focus(c->entry); | |
298 } | |
299 | |
300 static void info_callback(GtkWidget *widget, struct conversation *c) | |
301 { | |
302 serv_get_info(c->name); | |
303 gtk_widget_grab_focus(c->entry); | |
304 } | |
305 | |
306 gboolean user_keypress_callback(GtkWidget *entry, GdkEventKey *event, struct conversation *c) | |
307 { | |
308 int pos; | |
309 if(event->keyval==GDK_Return) { | |
310 if(!(event->state & GDK_SHIFT_MASK)){ | |
311 gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c); | |
312 //to stop the putting in of the enter character | |
313 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
314 } else { | |
315 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
316 pos=gtk_editable_get_position(GTK_EDITABLE(entry)); | |
317 gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos); | |
318 } | |
319 } | |
320 | |
321 return TRUE; | |
322 | |
323 } | |
324 | |
325 | |
326 static void send_callback(GtkWidget *widget, struct conversation *c) | |
327 { | |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
328 char *buf = g_malloc(BUF_LEN * 4); |
66 | 329 char *buf2; |
330 gchar *buf4; | |
331 int hdrlen; | |
332 | |
333 buf4 = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, -1); | |
334 g_snprintf(buf, BUF_LONG, "%s", buf4); | |
335 g_free(buf4); | |
336 | |
337 if (!strlen(buf)) { | |
338 return; | |
339 } | |
340 | |
341 if (general_options & OPT_GEN_SEND_LINKS) { | |
342 linkify_text(buf); | |
343 } | |
344 | |
345 /* Let us determine how long the message CAN be. | |
346 * toc_send_im is 11 chars long + 2 quotes. | |
347 * + 2 spaces + 6 for the header + 2 for good | |
348 * measure = 23 bytes + the length of normalize c->name */ | |
349 | |
350 buf2 = g_malloc(BUF_LONG); | |
351 | |
352 hdrlen = 23 + strlen(normalize(c->name)); | |
353 | |
354 /* printf("%d %d %d\n", strlen(buf), hdrlen, BUF_LONG);*/ | |
355 | |
356 if (font_options & OPT_FONT_BOLD) { | |
357 g_snprintf(buf2, BUF_LONG, "<B>%s</B>", buf); | |
358 strcpy(buf, buf2); | |
359 } | |
360 | |
361 if (font_options & OPT_FONT_ITALIC) { | |
362 g_snprintf(buf2, BUF_LONG, "<I>%s</I>", buf); | |
363 strcpy(buf, buf2); | |
364 } | |
365 | |
366 if (font_options & OPT_FONT_UNDERLINE) { | |
367 g_snprintf(buf2, BUF_LONG, "<U>%s</U>", buf); | |
368 strcpy(buf, buf2); | |
369 } | |
370 | |
371 if (font_options & OPT_FONT_STRIKE) { | |
372 g_snprintf(buf2, BUF_LONG, "<STRIKE>%s</STRIKE>", buf); | |
373 strcpy(buf, buf2); | |
374 } | |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
375 |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
376 #ifdef GAIM_PLUGINS |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
377 { |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
378 GList *ca = callbacks; |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
379 struct gaim_callback *g; |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
380 void (*function)(char *, char **, void *); |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
381 while (ca) { |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
382 g = (struct gaim_callback *)(ca->data); |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
383 if (g->event == event_im_send && g->function != NULL) { |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
384 function = g->function; |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
385 (*function)(c->name, &buf, g->data); |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
386 } |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
387 ca = ca->next; |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
388 } |
102
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
389 if (buf == NULL) { |
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
390 g_free(buf2); |
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
391 return; |
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
392 } |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
393 } |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
394 #endif |
66 | 395 |
396 write_to_conv(c, buf, WFLAG_SEND); | |
397 | |
398 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1); | |
399 | |
400 escape_text(buf); | |
401 if (escape_message(buf) > MSG_LEN - hdrlen) { | |
402 do_error_dialog("Message too long, some data truncated.", "Error"); | |
403 } | |
404 | |
405 serv_send_im(c->name, buf, 0); | |
406 | |
407 quiet_set(c->bold, FALSE); | |
408 quiet_set(c->strike, FALSE); | |
409 quiet_set(c->italic, FALSE); | |
410 quiet_set(c->underline, FALSE); | |
411 quiet_set(c->palette, FALSE); | |
412 quiet_set(c->link, FALSE); | |
413 | |
414 if (c->makesound && (sound_options & OPT_SOUND_SEND)) | |
415 play_sound(SEND); | |
416 | |
417 if (awaymessage != NULL) { | |
418 do_im_back(); | |
419 } | |
420 | |
421 | |
422 gtk_widget_grab_focus(c->entry); | |
423 | |
424 g_free(buf2); | |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
425 g_free(buf); |
66 | 426 } |
427 | |
428 static int | |
429 entry_key_pressed(GtkWidget *w, GtkWidget *entry) | |
430 { | |
431 check_everything(w); | |
432 return TRUE; | |
433 } | |
434 | |
435 /*------------------------------------------------------------------------*/ | |
436 /* HTML-type stuff */ | |
437 /*------------------------------------------------------------------------*/ | |
438 | |
439 int count_tag(GtkWidget *entry, char *s1, char *s2) | |
440 { | |
441 char *p1, *p2; | |
442 int res=0; | |
443 char *tmp, *tmpo, h; | |
444 tmpo = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
445 h = tmpo[GTK_EDITABLE(entry)->current_pos]; | |
446 tmpo[GTK_EDITABLE(entry)->current_pos]='\0'; | |
447 tmp=tmpo; | |
448 do { | |
449 p1 = strstr(tmp, s1); | |
450 p2 = strstr(tmp, s2); | |
451 if (p1 && p2) { | |
452 if (p1 < p2) { | |
453 res=1; | |
454 tmp = p1 +strlen(s1); | |
455 } else if (p2 < p1) { | |
456 res = 0; | |
457 tmp = p2 + strlen(s2); | |
458 } | |
459 } else { | |
460 if (p1) { | |
461 res = 1; | |
462 tmp = p1 + strlen(s1); | |
463 } else if (p2) { | |
464 res = 0; | |
465 tmp = p2 + strlen(s2); | |
466 } | |
467 } | |
468 } while (p1 || p2); | |
469 tmpo[GTK_EDITABLE(entry)->current_pos]=h; | |
470 g_free(tmpo); | |
471 return res; | |
472 } | |
473 | |
474 | |
475 int invert_tags(GtkWidget *entry, char *s1, char *s2, int really) | |
476 { | |
477 int start = GTK_EDITABLE(entry)->selection_start_pos; | |
478 int finish = GTK_EDITABLE(entry)->selection_end_pos; | |
479 char *s; | |
480 | |
481 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
482 if (!strncasecmp(&s[start], s1, strlen(s1)) && | |
483 !strncasecmp(&s[finish - strlen(s2)], s2, strlen(s2))) { | |
484 if (really) { | |
485 gtk_editable_delete_text(GTK_EDITABLE(entry), start, start + strlen(s1)); | |
486 gtk_editable_delete_text(GTK_EDITABLE(entry), finish - strlen(s2) - strlen(s1), finish - strlen(s1)); | |
487 } | |
488 g_free(s); | |
489 return 1; | |
490 } | |
491 g_free(s); | |
492 return 0; | |
493 } | |
494 | |
495 | |
496 void remove_tags(GtkWidget *entry, char *tag) | |
497 { | |
498 char *s; | |
499 char *t; | |
500 int start = GTK_EDITABLE(entry)->selection_start_pos; | |
501 int finish = GTK_EDITABLE(entry)->selection_end_pos; | |
502 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
503 t = s; | |
504 while((t = strstr(t, tag))) { | |
68 | 505 if (((t-s) < finish) && ((t-s) >= start)) { |
66 | 506 gtk_editable_delete_text(GTK_EDITABLE(entry), (t-s), (t-s) + strlen(tag)); |
182
b3b188f057f2
[gaim-migrate @ 192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
145
diff
changeset
|
507 t = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
68 | 508 } |
66 | 509 else t++; |
510 } | |
511 g_free(s); | |
512 } | |
513 | |
514 void surround(GtkWidget *entry, char *pre, char *post) | |
515 { | |
516 int pos = GTK_EDITABLE(entry)->current_pos; | |
517 int dummy; | |
518 int start, finish; | |
519 if (GTK_EDITABLE(entry)->has_selection) { | |
520 remove_tags(entry, pre); | |
521 remove_tags(entry, post); | |
522 start = GTK_EDITABLE(entry)->selection_start_pos; | |
523 finish = GTK_EDITABLE(entry)->selection_end_pos; | |
524 if (start > finish) { | |
525 dummy = finish; | |
526 finish = start; | |
527 start = dummy; | |
528 } | |
529 dummy = start; | |
530 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &dummy); | |
531 dummy = finish + strlen(pre); | |
532 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy); | |
533 gtk_editable_select_region(GTK_EDITABLE(entry), start, finish + strlen(pre) + strlen(post)); | |
534 } else { | |
535 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &pos); | |
536 dummy = pos; | |
537 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy); | |
538 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | |
539 } | |
540 gtk_widget_grab_focus(entry); | |
541 } | |
542 | |
543 static void advance_past(GtkWidget *entry, char *pre, char *post) | |
544 { | |
545 char *s, *s2; | |
546 int pos; | |
547 if (invert_tags(entry, pre, post, 1)) | |
548 return; | |
549 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
550 pos = GTK_EDITABLE(entry)->current_pos; | |
551 sprintf(debug_buff,"Currently at %d\n",pos); | |
552 debug_print(debug_buff); | |
553 s2= strstr(&s[pos], post); | |
554 if (s2) | |
555 pos = s2 - s + strlen(post); | |
556 else | |
187 | 557 pos=strlen(s); |
66 | 558 sprintf(debug_buff,"Setting position to %d\n",pos); |
559 debug_print(debug_buff); | |
560 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | |
561 gtk_widget_grab_focus(entry); | |
562 } | |
563 | |
564 static void toggle_color(GtkWidget *color, GtkWidget *entry) | |
565 { | |
566 if (state_lock) | |
567 return; | |
568 if (GTK_TOGGLE_BUTTON(color)->active) | |
569 show_color_dialog(entry, color); | |
189
50dc3db25513
[gaim-migrate @ 199]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
187
diff
changeset
|
570 else |
50dc3db25513
[gaim-migrate @ 199]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
187
diff
changeset
|
571 advance_past(entry, "<FONT COLOR>", "</FONT>" ); |
66 | 572 } |
573 | |
574 static void do_link(GtkWidget *linky, GtkWidget *entry) | |
575 { | |
576 if (state_lock) | |
577 return; | |
578 if (GTK_TOGGLE_BUTTON(linky)->active) | |
579 show_add_link(entry, linky); | |
580 else | |
581 advance_past(entry, "<A HREF>", "</A>" ); | |
582 } | |
583 | |
584 static void do_strike(GtkWidget *strike, GtkWidget *entry) | |
585 { | |
586 if (state_lock) | |
587 return; | |
588 if (GTK_TOGGLE_BUTTON(strike)->active) | |
589 surround(entry, "<STRIKE>","</STRIKE>"); | |
590 else | |
591 advance_past(entry, "<STRIKE>", "</STRIKE>"); | |
592 } | |
593 | |
594 static void do_bold(GtkWidget *bold, GtkWidget *entry) | |
595 { | |
596 if (state_lock) | |
597 return; | |
598 if (GTK_TOGGLE_BUTTON(bold)->active) | |
599 surround(entry, "<B>","</B>"); | |
600 else | |
601 advance_past(entry, "<B>", "</B>"); | |
602 } | |
603 | |
604 static void do_underline(GtkWidget *underline, GtkWidget *entry) | |
605 { | |
606 if (state_lock) | |
607 return; | |
608 if (GTK_TOGGLE_BUTTON(underline)->active) | |
609 surround(entry, "<U>","</U>"); | |
610 else | |
611 advance_past(entry, "<U>", "</U>"); | |
612 } | |
613 | |
614 static void do_italic(GtkWidget *italic, GtkWidget *entry) | |
615 { | |
616 if (state_lock) | |
617 return; | |
618 if (GTK_TOGGLE_BUTTON(italic)->active) | |
619 surround(entry, "<I>","</I>"); | |
620 else | |
621 advance_past(entry, "<I>", "</I>"); | |
622 } | |
623 | |
624 static void do_small(GtkWidget *small, GtkWidget *entry) | |
625 { | |
626 if (state_lock) | |
627 return; | |
88 | 628 surround(entry, "<FONT SIZE=\"-2\">","</FONT>"); |
66 | 629 } |
630 | |
631 static void do_normal(GtkWidget *normal, GtkWidget *entry) | |
632 { | |
633 if (state_lock) | |
634 return; | |
88 | 635 surround(entry, "<FONT SIZE=\"3\">","</FONT>"); |
66 | 636 } |
637 | |
638 static void do_big(GtkWidget *big, GtkWidget *entry) | |
639 { | |
640 if (state_lock) | |
641 return; | |
642 surround(entry, "<FONT SIZE=\"+5\">","</FONT>"); | |
643 } | |
644 | |
645 void check_everything(GtkWidget *entry) | |
646 { | |
647 struct conversation *c; | |
648 c = (struct conversation *)gtk_object_get_user_data(GTK_OBJECT(entry)); | |
649 if (!c) return; | |
650 if (invert_tags(entry, "<B>", "</B>", 0)) | |
651 quiet_set(c->bold, TRUE); | |
652 else if (count_tag(entry, "<B>", "</B>")) | |
653 quiet_set(c->bold, TRUE); | |
654 else | |
655 quiet_set(c->bold,FALSE); | |
656 if (invert_tags(entry, "<I>", "</I>", 0)) | |
657 quiet_set(c->italic, TRUE); | |
658 else if (count_tag(entry, "<I>", "</I>")) | |
659 quiet_set(c->italic, TRUE); | |
660 else | |
661 quiet_set(c->italic, FALSE); | |
662 | |
663 if (invert_tags(entry, "<FONT COLOR", "</FONT>", 0)) | |
664 quiet_set(c->palette, TRUE); | |
665 else if (count_tag(entry, "<FONT COLOR", "</FONT>")) | |
666 quiet_set(c->palette, TRUE); | |
667 else | |
668 quiet_set(c->palette, FALSE); | |
669 | |
670 if (invert_tags(entry, "<A HREF", "</A>", 0)) | |
671 quiet_set(c->link, TRUE); | |
672 else if (count_tag(entry, "<A HREF", "</A>")) | |
673 quiet_set(c->link, TRUE); | |
674 else | |
675 quiet_set(c->link, FALSE); | |
676 | |
677 if (invert_tags(entry, "<U>", "</U>", 0)) | |
678 quiet_set(c->underline, TRUE); | |
679 else if (count_tag(entry, "<U>", "</U>")) | |
680 quiet_set(c->underline, TRUE); | |
681 else | |
682 quiet_set(c->underline, FALSE); | |
683 | |
684 if (invert_tags(entry, "<STRIKE>", "</STRIKE>", 0)) | |
685 quiet_set(c->strike, TRUE); | |
686 else if (count_tag(entry, "<STRIKE>", "</STRIKE>")) | |
687 quiet_set(c->strike, TRUE); | |
688 else | |
689 quiet_set(c->strike, FALSE); | |
690 } | |
691 | |
692 | |
693 /*------------------------------------------------------------------------*/ | |
694 /* Takin care of the window.. */ | |
695 /*------------------------------------------------------------------------*/ | |
696 | |
697 | |
698 void write_to_conv(struct conversation *c, char *what, int flags) | |
699 { | |
700 char *buf = g_malloc(BUF_LONG); | |
701 char *buf2 = g_malloc(BUF_LONG); | |
702 char *who = NULL; | |
703 FILE *fd; | |
704 char colour[10]; | |
705 | |
706 if (flags & WFLAG_SYSTEM) { | |
707 | |
708 gtk_html_freeze(GTK_HTML(c->text)); | |
709 | |
710 gtk_html_append_text(GTK_HTML(c->text), what, 0); | |
711 | |
712 gtk_html_append_text(GTK_HTML(c->text), "<BR>", 0); | |
713 | |
714 gtk_html_thaw(GTK_HTML(c->text)); | |
715 | |
716 | |
717 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | |
718 char *t1; | |
719 | |
720 if (general_options & OPT_GEN_STRIP_HTML) { | |
721 t1 = strip_html(what); | |
722 } else { | |
723 t1 = what; | |
724 } | |
725 fd = open_log_file(c); | |
726 fprintf(fd, "%s\n", t1); | |
727 fclose(fd); | |
728 if (general_options & OPT_GEN_STRIP_HTML) { | |
729 g_free(t1); | |
730 } | |
731 } | |
732 | |
733 } else { | |
734 | |
735 if (flags & WFLAG_RECV) { | |
736 strcpy(colour, "#ff0000"); | |
145
41bd1cd48571
[gaim-migrate @ 155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
128
diff
changeset
|
737 who = c->name; |
66 | 738 } else if (flags & WFLAG_SEND) { |
739 strcpy(colour, "#0000ff"); | |
740 who = current_user->username; | |
741 } | |
742 | |
145
41bd1cd48571
[gaim-migrate @ 155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
128
diff
changeset
|
743 if (flags & WFLAG_AUTO) |
66 | 744 sprintf(buf2, " %s", AUTO_RESPONSE); |
745 else | |
746 buf2[0]=0; /* sprintf(buf2, ""); */ | |
747 | |
748 if (display_options & OPT_DISP_SHOW_TIME) | |
749 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s %s:%s</B></FONT> ", colour, date(), who, buf2); | |
750 else | |
751 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s:%s</B></FONT> ", colour, who, buf2); | |
752 | |
753 gtk_html_freeze(GTK_HTML(c->text)); | |
754 | |
755 gtk_html_append_text(GTK_HTML(c->text), buf, 0); | |
756 gtk_html_append_text(GTK_HTML(c->text), what, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0); | |
757 | |
758 gtk_html_append_text(GTK_HTML(c->text), "<BR>", 0); | |
759 | |
760 | |
761 gtk_html_thaw(GTK_HTML(c->text)); | |
762 | |
763 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | |
764 char *t1, *t2; | |
765 | |
766 if (general_options & OPT_GEN_STRIP_HTML) { | |
767 t1 = strip_html(buf); | |
768 t2 = strip_html(what); | |
769 } else { | |
770 t1 = buf; | |
771 t2 = what; | |
772 } | |
773 fd = open_log_file(c); | |
774 fprintf(fd, "%s%s\n", t1, t2); | |
775 fclose(fd); | |
776 if (general_options & OPT_GEN_STRIP_HTML) { | |
777 g_free(t1); | |
778 g_free(t2); | |
779 } | |
780 } | |
781 } | |
782 | |
783 /* if (!GTK_WIDGET_MAPPED(c->window)) { | |
784 | |
785 if (dark_icon_pm == NULL) | |
786 dark_icon_pm = gdk_pixmap_create_from_xpm_d(c->window->window, &dark_icon_bm, | |
787 NULL, (gchar **)aimicon2_xpm); | |
788 gdk_window_set_icon(c->window->window, NULL, dark_icon_pm, dark_icon_bm); | |
789 } | |
790 */ | |
791 | |
792 if (general_options & OPT_GEN_POPUP_WINDOWS) | |
81 | 793 gdk_window_show(c->window->window); |
66 | 794 |
795 | |
796 g_free(buf); | |
797 g_free(buf2); | |
798 } | |
799 | |
800 | |
801 | |
802 | |
803 | |
804 void show_conv(struct conversation *c) | |
805 { | |
806 GtkWidget *win; | |
807 char buf[256]; | |
808 GtkWidget *text; | |
809 GtkWidget *sw; | |
810 GtkWidget *send; | |
811 GtkWidget *info; | |
812 GtkWidget *warn; | |
813 GtkWidget *block; | |
814 GtkWidget *color; | |
815 GtkWidget *close; | |
816 GtkWidget *entry; | |
817 GtkWidget *toolbar; | |
818 GtkWidget *bbox; | |
819 GtkWidget *vbox; | |
81 | 820 GtkWidget *vbox2; |
821 GtkWidget *paned; | |
66 | 822 GtkWidget *add; |
823 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i, *wood_i, *palette_i, *link_i; | |
824 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p, *wood_p, *palette_p, *link_p; | |
825 GtkWidget *strike, *small, *normal, *big, *bold, *italic, *underline, *speaker, *wood, *palette, *link; | |
826 GdkBitmap *mask; | |
827 | |
828 win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
829 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE); | |
830 | |
831 gtk_widget_realize(win); | |
832 aol_icon(win->window); | |
833 | |
834 | |
835 c->window = win; | |
836 | |
837 send = gtk_button_new_with_label("Send"); | |
838 info = gtk_button_new_with_label("Info"); | |
839 warn = gtk_button_new_with_label("Warn"); | |
840 color = gtk_button_new_with_label("Color"); | |
841 close = gtk_button_new_with_label("Close"); | |
842 if (find_buddy(c->name) != NULL) { | |
843 add = gtk_button_new_with_label("Remove"); | |
844 } | |
845 else { | |
846 add = gtk_button_new_with_label("Add"); | |
847 } | |
848 block = gtk_button_new_with_label("Block"); | |
849 | |
850 | |
851 bbox = gtk_hbox_new(TRUE, 0); | |
852 vbox = gtk_vbox_new(FALSE, 0); | |
81 | 853 vbox2 = gtk_vbox_new(FALSE, 0); |
854 paned = gtk_vpaned_new(); | |
66 | 855 |
81 | 856 gtk_paned_pack1(GTK_PANED(paned), vbox, FALSE, TRUE); |
857 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); | |
858 gtk_widget_show(vbox2); | |
859 gtk_widget_show(paned); | |
860 | |
66 | 861 entry = gtk_text_new(NULL, NULL); |
862 gtk_text_set_editable(GTK_TEXT(entry), TRUE); | |
863 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE); | |
864 | |
865 /* Toolbar */ | |
866 toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); | |
867 | |
868 link_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
869 &win->style->white, link_xpm ); | |
870 link_p = gtk_pixmap_new(link_i, mask); | |
871 gtk_widget_show(link_p); | |
872 | |
873 palette_i = gdk_pixmap_create_from_xpm_d (win->window, &mask, | |
874 &win->style->white, palette_xpm ); | |
875 palette_p = gtk_pixmap_new(palette_i, mask); | |
876 gtk_widget_show(palette_p); | |
877 | |
878 wood_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
879 &win->style->white, wood_xpm ); | |
880 wood_p = gtk_pixmap_new(wood_i, mask); | |
881 gtk_widget_show(wood_p); | |
882 speaker_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
883 &win->style->white, speaker_xpm ); | |
884 speaker_p = gtk_pixmap_new(speaker_i, mask); | |
885 gtk_widget_show(speaker_p); | |
886 c->makesound=1; | |
887 strike_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
888 &win->style->white, strike_xpm ); | |
889 strike_p = gtk_pixmap_new(strike_i, mask); | |
890 gtk_widget_show(strike_p); | |
891 bold_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
892 &win->style->white, bold_xpm ); | |
893 bold_p = gtk_pixmap_new(bold_i, mask); | |
894 gtk_widget_show(bold_p); | |
895 italic_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
896 &win->style->white, italic_xpm ); | |
897 italic_p = gtk_pixmap_new(italic_i, mask); | |
898 gtk_widget_show(italic_p); | |
899 underline_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
900 &win->style->white, underline_xpm ); | |
901 underline_p = gtk_pixmap_new(underline_i, mask); | |
902 gtk_widget_show(underline_p); | |
903 small_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
904 &win->style->white, small_xpm ); | |
905 small_p = gtk_pixmap_new(small_i, mask); | |
906 gtk_widget_show(small_p); | |
907 normal_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
908 &win->style->white, normal_xpm ); | |
909 normal_p = gtk_pixmap_new(normal_i, mask); | |
910 gtk_widget_show(normal_p); | |
911 big_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
912 &win->style->white, big_xpm ); | |
913 big_p = gtk_pixmap_new(big_i, mask); | |
914 gtk_widget_show(big_p); | |
915 | |
916 | |
917 bold = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
918 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, | |
919 "Bold", "Bold Text", "Bold", bold_p, | |
920 GTK_SIGNAL_FUNC(do_bold), entry); | |
921 italic = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
922 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
923 NULL, "Italics", "Italics Text", | |
924 "Italics", italic_p, GTK_SIGNAL_FUNC(do_italic), entry); | |
925 underline = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
926 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
927 NULL, "Underline", "Underline Text", | |
928 "Underline", underline_p, GTK_SIGNAL_FUNC(do_underline), entry); | |
929 strike = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
930 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
931 NULL, "Strike", "Strike through Text", | |
932 "Strike", strike_p, GTK_SIGNAL_FUNC(do_strike), entry); | |
933 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); | |
934 small = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Small", "Decrease font size", "Small", small_p, GTK_SIGNAL_FUNC(do_small), entry); | |
935 normal = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Normal", "Normal font size", "Normal", normal_p, GTK_SIGNAL_FUNC(do_normal), entry); | |
936 big = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Big", "Increase font size", "Big", big_p, GTK_SIGNAL_FUNC(do_big), entry); | |
937 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); | |
938 link = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
939 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, "Link", "Insert Link", | |
940 "Link", link_p, GTK_SIGNAL_FUNC(do_link), entry); | |
941 palette = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
942 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
943 NULL, "Color", "Text Color", | |
944 "Color", palette_p, GTK_SIGNAL_FUNC(toggle_color), entry); | |
945 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
946 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
947 NULL, "Logging", "Enable logging", | |
948 "Logging", wood_p, GTK_SIGNAL_FUNC(toggle_loggle), c); | |
949 speaker = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
950 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
951 NULL, "Sound", "Enable sounds", | |
952 "Sound", speaker_p, GTK_SIGNAL_FUNC(set_option), &c->makesound); | |
953 c->makesound=0; | |
954 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(speaker), TRUE); | |
955 | |
956 state_lock = 1; | |
957 if (find_log_info(c->name)) | |
958 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), TRUE); | |
959 else | |
960 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), FALSE); | |
961 state_lock = 0; | |
962 | |
963 gtk_widget_show(toolbar); | |
964 | |
965 c->entry = entry; | |
966 c->bold = bold; | |
967 c->strike = strike; | |
968 c->italic = italic; | |
969 c->underline = underline; | |
970 c->log_button = wood; | |
971 c->palette = palette; | |
972 c->link = link; | |
973 c->add_button = add; | |
974 | |
975 gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE); | |
976 | |
977 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); | |
978 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); | |
979 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); | |
980 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); | |
981 | |
982 gtk_object_set_user_data(GTK_OBJECT(entry), c); | |
983 | |
984 | |
985 | |
986 gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(send_callback),c); | |
987 | |
988 /* Text box */ | |
989 | |
990 | |
991 text = gtk_html_new(NULL, NULL); | |
992 | |
993 gtk_html_set_editable(GTK_HTML(text), FALSE); | |
994 /* gtk_html_set_transparent(GTK_HTML(text), (transparent) ? TRUE : FALSE);*/ | |
995 c->text = text; | |
996 | |
997 sw = gtk_scrolled_window_new (NULL, NULL); | |
998 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), | |
999 GTK_POLICY_NEVER, | |
1000 GTK_POLICY_ALWAYS); | |
1001 gtk_widget_show(sw); | |
1002 gtk_container_add(GTK_CONTAINER(sw), text); | |
1003 gtk_widget_show(text); | |
1004 | |
1005 | |
1006 | |
1007 | |
1008 GTK_HTML (text)->hadj->step_increment = 10.0; | |
1009 GTK_HTML (text)->vadj->step_increment = 10.0; | |
1010 gtk_widget_set_usize(sw, 320, 150); | |
1011 | |
1012 | |
1013 | |
1014 /* Ready and pack buttons */ | |
1015 gtk_object_set_user_data(GTK_OBJECT(win), c); | |
1016 gtk_object_set_user_data(GTK_OBJECT(close), c); | |
1017 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), c); | |
1018 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), c); | |
1019 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(add_callback), c); | |
1020 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), c); | |
1021 gtk_signal_connect(GTK_OBJECT(warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c); | |
1022 gtk_signal_connect(GTK_OBJECT(block), "clicked", GTK_SIGNAL_FUNC(block_callback), c); | |
1023 gtk_signal_connect(GTK_OBJECT(color), "clicked", GTK_SIGNAL_FUNC(color_callback), c); | |
1024 | |
1025 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(user_keypress_callback), c); | |
81 | 1026 gtk_widget_set_usize(entry, 300, 25); |
66 | 1027 |
1028 gtk_box_pack_start(GTK_BOX(bbox), send, TRUE, TRUE, 5); | |
1029 gtk_box_pack_start(GTK_BOX(bbox), info, TRUE, TRUE, 5); | |
1030 gtk_box_pack_start(GTK_BOX(bbox), warn, TRUE, TRUE, 5); | |
1031 gtk_box_pack_start(GTK_BOX(bbox), block, TRUE, TRUE, 5); | |
1032 gtk_box_pack_start(GTK_BOX(bbox), color, TRUE, TRUE, 5); | |
1033 gtk_box_pack_start(GTK_BOX(bbox), add, TRUE, TRUE, 5); | |
1034 gtk_box_pack_start(GTK_BOX(bbox), close, TRUE, TRUE, 5); | |
1035 | |
1036 /* pack and fill the rest */ | |
1037 | |
1038 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 5); | |
81 | 1039 gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, FALSE, 5); |
1040 gtk_box_pack_start(GTK_BOX(vbox2), entry, TRUE, TRUE, 5); | |
1041 gtk_box_pack_start(GTK_BOX(vbox2), bbox, FALSE, FALSE, 5); | |
66 | 1042 |
1043 | |
1044 | |
1045 | |
1046 gtk_widget_show(send); | |
1047 gtk_widget_show(info); | |
1048 gtk_widget_show(warn); | |
1049 /* gtk_widget_show(color); */ | |
1050 gtk_widget_show(close); | |
1051 gtk_widget_show(add); | |
1052 gtk_widget_show(block); | |
1053 gtk_widget_show(bbox); | |
1054 gtk_widget_show(vbox); | |
1055 gtk_widget_show(entry); | |
1056 gtk_widget_show(text); | |
1057 | |
67 | 1058 |
81 | 1059 gtk_container_add(GTK_CONTAINER(win), paned); |
66 | 1060 gtk_container_border_width(GTK_CONTAINER(win), 10); |
1061 | |
1062 if ((find_log_info(c->name)) || ((general_options & OPT_GEN_LOG_ALL))) | |
1063 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name); | |
1064 else | |
1065 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name); | |
1066 gtk_window_set_title(GTK_WINDOW(win), buf); | |
1067 gtk_window_set_focus(GTK_WINDOW(win),entry); | |
1068 | |
1069 gtk_signal_connect(GTK_OBJECT(win), "delete_event", GTK_SIGNAL_FUNC(delete_event_convo), c); | |
1070 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed), entry); | |
1071 | |
1072 gtk_widget_show(win); | |
1073 | |
1074 } | |
1075 | |
1076 |