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 {
|
79
|
328 char buf[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 }
|
|
375
|
|
376 write_to_conv(c, buf, WFLAG_SEND);
|
|
377
|
|
378 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1);
|
|
379
|
|
380 escape_text(buf);
|
|
381 if (escape_message(buf) > MSG_LEN - hdrlen) {
|
|
382 do_error_dialog("Message too long, some data truncated.", "Error");
|
|
383 }
|
|
384
|
|
385 serv_send_im(c->name, buf, 0);
|
|
386
|
|
387 quiet_set(c->bold, FALSE);
|
|
388 quiet_set(c->strike, FALSE);
|
|
389 quiet_set(c->italic, FALSE);
|
|
390 quiet_set(c->underline, FALSE);
|
|
391 quiet_set(c->palette, FALSE);
|
|
392 quiet_set(c->link, FALSE);
|
|
393
|
|
394 if (c->makesound && (sound_options & OPT_SOUND_SEND))
|
|
395 play_sound(SEND);
|
|
396
|
|
397 if (awaymessage != NULL) {
|
|
398 do_im_back();
|
|
399 }
|
|
400
|
|
401
|
|
402 gtk_widget_grab_focus(c->entry);
|
|
403
|
|
404 g_free(buf2);
|
|
405
|
|
406 }
|
|
407
|
|
408 static int
|
|
409 entry_key_pressed(GtkWidget *w, GtkWidget *entry)
|
|
410 {
|
|
411 check_everything(w);
|
|
412 return TRUE;
|
|
413 }
|
|
414
|
|
415 /*------------------------------------------------------------------------*/
|
|
416 /* HTML-type stuff */
|
|
417 /*------------------------------------------------------------------------*/
|
|
418
|
|
419 int count_tag(GtkWidget *entry, char *s1, char *s2)
|
|
420 {
|
|
421 char *p1, *p2;
|
|
422 int res=0;
|
|
423 char *tmp, *tmpo, h;
|
|
424 tmpo = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
|
|
425 h = tmpo[GTK_EDITABLE(entry)->current_pos];
|
|
426 tmpo[GTK_EDITABLE(entry)->current_pos]='\0';
|
|
427 tmp=tmpo;
|
|
428 do {
|
|
429 p1 = strstr(tmp, s1);
|
|
430 p2 = strstr(tmp, s2);
|
|
431 if (p1 && p2) {
|
|
432 if (p1 < p2) {
|
|
433 res=1;
|
|
434 tmp = p1 +strlen(s1);
|
|
435 } else if (p2 < p1) {
|
|
436 res = 0;
|
|
437 tmp = p2 + strlen(s2);
|
|
438 }
|
|
439 } else {
|
|
440 if (p1) {
|
|
441 res = 1;
|
|
442 tmp = p1 + strlen(s1);
|
|
443 } else if (p2) {
|
|
444 res = 0;
|
|
445 tmp = p2 + strlen(s2);
|
|
446 }
|
|
447 }
|
|
448 } while (p1 || p2);
|
|
449 tmpo[GTK_EDITABLE(entry)->current_pos]=h;
|
|
450 g_free(tmpo);
|
|
451 return res;
|
|
452 }
|
|
453
|
|
454
|
|
455 int invert_tags(GtkWidget *entry, char *s1, char *s2, int really)
|
|
456 {
|
|
457 int start = GTK_EDITABLE(entry)->selection_start_pos;
|
|
458 int finish = GTK_EDITABLE(entry)->selection_end_pos;
|
|
459 char *s;
|
|
460
|
|
461 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
|
|
462 if (!strncasecmp(&s[start], s1, strlen(s1)) &&
|
|
463 !strncasecmp(&s[finish - strlen(s2)], s2, strlen(s2))) {
|
|
464 if (really) {
|
|
465 gtk_editable_delete_text(GTK_EDITABLE(entry), start, start + strlen(s1));
|
|
466 gtk_editable_delete_text(GTK_EDITABLE(entry), finish - strlen(s2) - strlen(s1), finish - strlen(s1));
|
|
467 }
|
|
468 g_free(s);
|
|
469 return 1;
|
|
470 }
|
|
471 g_free(s);
|
|
472 return 0;
|
|
473 }
|
|
474
|
|
475
|
|
476 void remove_tags(GtkWidget *entry, char *tag)
|
|
477 {
|
|
478 char *s;
|
|
479 char *t;
|
|
480 int start = GTK_EDITABLE(entry)->selection_start_pos;
|
|
481 int finish = GTK_EDITABLE(entry)->selection_end_pos;
|
|
482 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
|
|
483 t = s;
|
|
484 while((t = strstr(t, tag))) {
|
68
|
485 if (((t-s) < finish) && ((t-s) >= start)) {
|
66
|
486 gtk_editable_delete_text(GTK_EDITABLE(entry), (t-s), (t-s) + strlen(tag));
|
68
|
487 }
|
66
|
488 else t++;
|
|
489 }
|
|
490 g_free(s);
|
|
491 }
|
|
492
|
|
493 void surround(GtkWidget *entry, char *pre, char *post)
|
|
494 {
|
|
495 int pos = GTK_EDITABLE(entry)->current_pos;
|
|
496 int dummy;
|
|
497 int start, finish;
|
|
498 if (GTK_EDITABLE(entry)->has_selection) {
|
|
499 remove_tags(entry, pre);
|
|
500 remove_tags(entry, post);
|
|
501 start = GTK_EDITABLE(entry)->selection_start_pos;
|
|
502 finish = GTK_EDITABLE(entry)->selection_end_pos;
|
|
503 if (start > finish) {
|
|
504 dummy = finish;
|
|
505 finish = start;
|
|
506 start = dummy;
|
|
507 }
|
|
508 dummy = start;
|
|
509 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &dummy);
|
|
510 dummy = finish + strlen(pre);
|
|
511 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy);
|
|
512 gtk_editable_select_region(GTK_EDITABLE(entry), start, finish + strlen(pre) + strlen(post));
|
|
513 } else {
|
|
514 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &pos);
|
|
515 dummy = pos;
|
|
516 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy);
|
|
517 gtk_editable_set_position(GTK_EDITABLE(entry), pos);
|
|
518 }
|
|
519 gtk_widget_grab_focus(entry);
|
|
520 }
|
|
521
|
|
522 static void advance_past(GtkWidget *entry, char *pre, char *post)
|
|
523 {
|
|
524 char *s, *s2;
|
|
525 int pos;
|
|
526 if (invert_tags(entry, pre, post, 1))
|
|
527 return;
|
|
528 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
|
|
529 pos = GTK_EDITABLE(entry)->current_pos;
|
|
530 sprintf(debug_buff,"Currently at %d\n",pos);
|
|
531 debug_print(debug_buff);
|
|
532 s2= strstr(&s[pos], post);
|
|
533 if (s2)
|
|
534 pos = s2 - s + strlen(post);
|
|
535 else
|
|
536 pos=-1;
|
|
537 sprintf(debug_buff,"Setting position to %d\n",pos);
|
|
538 debug_print(debug_buff);
|
|
539 gtk_editable_set_position(GTK_EDITABLE(entry), pos);
|
|
540 gtk_widget_grab_focus(entry);
|
|
541 }
|
|
542
|
|
543 static void toggle_color(GtkWidget *color, GtkWidget *entry)
|
|
544 {
|
|
545 if (state_lock)
|
|
546 return;
|
|
547 if (GTK_TOGGLE_BUTTON(color)->active)
|
|
548 show_color_dialog(entry, color);
|
|
549 else
|
|
550 advance_past(entry, "<FONT COLOR>", "</FONT>");
|
|
551 }
|
|
552
|
|
553 static void do_link(GtkWidget *linky, GtkWidget *entry)
|
|
554 {
|
|
555 if (state_lock)
|
|
556 return;
|
|
557 if (GTK_TOGGLE_BUTTON(linky)->active)
|
|
558 show_add_link(entry, linky);
|
|
559 else
|
|
560 advance_past(entry, "<A HREF>", "</A>" );
|
|
561 }
|
|
562
|
|
563 static void do_strike(GtkWidget *strike, GtkWidget *entry)
|
|
564 {
|
|
565 if (state_lock)
|
|
566 return;
|
|
567 if (GTK_TOGGLE_BUTTON(strike)->active)
|
|
568 surround(entry, "<STRIKE>","</STRIKE>");
|
|
569 else
|
|
570 advance_past(entry, "<STRIKE>", "</STRIKE>");
|
|
571 }
|
|
572
|
|
573 static void do_bold(GtkWidget *bold, GtkWidget *entry)
|
|
574 {
|
|
575 if (state_lock)
|
|
576 return;
|
|
577 if (GTK_TOGGLE_BUTTON(bold)->active)
|
|
578 surround(entry, "<B>","</B>");
|
|
579 else
|
|
580 advance_past(entry, "<B>", "</B>");
|
|
581 }
|
|
582
|
|
583 static void do_underline(GtkWidget *underline, GtkWidget *entry)
|
|
584 {
|
|
585 if (state_lock)
|
|
586 return;
|
|
587 if (GTK_TOGGLE_BUTTON(underline)->active)
|
|
588 surround(entry, "<U>","</U>");
|
|
589 else
|
|
590 advance_past(entry, "<U>", "</U>");
|
|
591 }
|
|
592
|
|
593 static void do_italic(GtkWidget *italic, GtkWidget *entry)
|
|
594 {
|
|
595 if (state_lock)
|
|
596 return;
|
|
597 if (GTK_TOGGLE_BUTTON(italic)->active)
|
|
598 surround(entry, "<I>","</I>");
|
|
599 else
|
|
600 advance_past(entry, "<I>", "</I>");
|
|
601 }
|
|
602
|
|
603 static void do_small(GtkWidget *small, GtkWidget *entry)
|
|
604 {
|
|
605 if (state_lock)
|
|
606 return;
|
|
607 surround(entry, "<FONT SIZE=\"+1\">","</FONT>");
|
|
608 }
|
|
609
|
|
610 static void do_normal(GtkWidget *normal, GtkWidget *entry)
|
|
611 {
|
|
612 if (state_lock)
|
|
613 return;
|
|
614 surround(entry, "<FONT SIZE=\"+3\">","</FONT>");
|
|
615 }
|
|
616
|
|
617 static void do_big(GtkWidget *big, GtkWidget *entry)
|
|
618 {
|
|
619 if (state_lock)
|
|
620 return;
|
|
621 surround(entry, "<FONT SIZE=\"+5\">","</FONT>");
|
|
622 }
|
|
623
|
|
624 void check_everything(GtkWidget *entry)
|
|
625 {
|
|
626 struct conversation *c;
|
|
627 c = (struct conversation *)gtk_object_get_user_data(GTK_OBJECT(entry));
|
|
628 if (!c) return;
|
|
629 if (invert_tags(entry, "<B>", "</B>", 0))
|
|
630 quiet_set(c->bold, TRUE);
|
|
631 else if (count_tag(entry, "<B>", "</B>"))
|
|
632 quiet_set(c->bold, TRUE);
|
|
633 else
|
|
634 quiet_set(c->bold,FALSE);
|
|
635 if (invert_tags(entry, "<I>", "</I>", 0))
|
|
636 quiet_set(c->italic, TRUE);
|
|
637 else if (count_tag(entry, "<I>", "</I>"))
|
|
638 quiet_set(c->italic, TRUE);
|
|
639 else
|
|
640 quiet_set(c->italic, FALSE);
|
|
641
|
|
642 if (invert_tags(entry, "<FONT COLOR", "</FONT>", 0))
|
|
643 quiet_set(c->palette, TRUE);
|
|
644 else if (count_tag(entry, "<FONT COLOR", "</FONT>"))
|
|
645 quiet_set(c->palette, TRUE);
|
|
646 else
|
|
647 quiet_set(c->palette, FALSE);
|
|
648
|
|
649 if (invert_tags(entry, "<A HREF", "</A>", 0))
|
|
650 quiet_set(c->link, TRUE);
|
|
651 else if (count_tag(entry, "<A HREF", "</A>"))
|
|
652 quiet_set(c->link, TRUE);
|
|
653 else
|
|
654 quiet_set(c->link, FALSE);
|
|
655
|
|
656 if (invert_tags(entry, "<U>", "</U>", 0))
|
|
657 quiet_set(c->underline, TRUE);
|
|
658 else if (count_tag(entry, "<U>", "</U>"))
|
|
659 quiet_set(c->underline, TRUE);
|
|
660 else
|
|
661 quiet_set(c->underline, FALSE);
|
|
662
|
|
663 if (invert_tags(entry, "<STRIKE>", "</STRIKE>", 0))
|
|
664 quiet_set(c->strike, TRUE);
|
|
665 else if (count_tag(entry, "<STRIKE>", "</STRIKE>"))
|
|
666 quiet_set(c->strike, TRUE);
|
|
667 else
|
|
668 quiet_set(c->strike, FALSE);
|
|
669 }
|
|
670
|
|
671
|
|
672 /*------------------------------------------------------------------------*/
|
|
673 /* Takin care of the window.. */
|
|
674 /*------------------------------------------------------------------------*/
|
|
675
|
|
676
|
|
677 void write_to_conv(struct conversation *c, char *what, int flags)
|
|
678 {
|
|
679 char *buf = g_malloc(BUF_LONG);
|
|
680 char *buf2 = g_malloc(BUF_LONG);
|
|
681 char *who = NULL;
|
|
682 FILE *fd;
|
|
683 char colour[10];
|
|
684
|
|
685 if (flags & WFLAG_SYSTEM) {
|
|
686
|
|
687 gtk_html_freeze(GTK_HTML(c->text));
|
|
688
|
|
689 gtk_html_append_text(GTK_HTML(c->text), what, 0);
|
|
690
|
|
691 gtk_html_append_text(GTK_HTML(c->text), "<BR>", 0);
|
|
692
|
|
693 gtk_html_thaw(GTK_HTML(c->text));
|
|
694
|
|
695
|
|
696 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) {
|
|
697 char *t1;
|
|
698
|
|
699 if (general_options & OPT_GEN_STRIP_HTML) {
|
|
700 t1 = strip_html(what);
|
|
701 } else {
|
|
702 t1 = what;
|
|
703 }
|
|
704 fd = open_log_file(c);
|
|
705 fprintf(fd, "%s\n", t1);
|
|
706 fclose(fd);
|
|
707 if (general_options & OPT_GEN_STRIP_HTML) {
|
|
708 g_free(t1);
|
|
709 }
|
|
710 }
|
|
711
|
|
712 } else {
|
|
713
|
|
714 if (flags & WFLAG_RECV) {
|
|
715 strcpy(colour, "#ff0000");
|
|
716 who = c->name;
|
|
717 } else if (flags & WFLAG_SEND) {
|
|
718 strcpy(colour, "#0000ff");
|
|
719 who = current_user->username;
|
|
720 }
|
|
721
|
|
722 if (flags & WFLAG_AUTO && flags & WFLAG_SEND)
|
|
723 sprintf(buf2, " %s", AUTO_RESPONSE);
|
|
724 else
|
|
725 buf2[0]=0; /* sprintf(buf2, ""); */
|
|
726
|
|
727 if (display_options & OPT_DISP_SHOW_TIME)
|
|
728 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s %s:%s</B></FONT> ", colour, date(), who, buf2);
|
|
729 else
|
|
730 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s:%s</B></FONT> ", colour, who, buf2);
|
|
731
|
|
732 gtk_html_freeze(GTK_HTML(c->text));
|
|
733
|
|
734 gtk_html_append_text(GTK_HTML(c->text), buf, 0);
|
|
735 gtk_html_append_text(GTK_HTML(c->text), what, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0);
|
|
736
|
|
737 gtk_html_append_text(GTK_HTML(c->text), "<BR>", 0);
|
|
738
|
|
739
|
|
740 gtk_html_thaw(GTK_HTML(c->text));
|
|
741
|
|
742 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) {
|
|
743 char *t1, *t2;
|
|
744
|
|
745 if (general_options & OPT_GEN_STRIP_HTML) {
|
|
746 t1 = strip_html(buf);
|
|
747 t2 = strip_html(what);
|
|
748 } else {
|
|
749 t1 = buf;
|
|
750 t2 = what;
|
|
751 }
|
|
752 fd = open_log_file(c);
|
|
753 fprintf(fd, "%s%s\n", t1, t2);
|
|
754 fclose(fd);
|
|
755 if (general_options & OPT_GEN_STRIP_HTML) {
|
|
756 g_free(t1);
|
|
757 g_free(t2);
|
|
758 }
|
|
759 }
|
|
760 }
|
|
761
|
|
762 /* if (!GTK_WIDGET_MAPPED(c->window)) {
|
|
763
|
|
764 if (dark_icon_pm == NULL)
|
|
765 dark_icon_pm = gdk_pixmap_create_from_xpm_d(c->window->window, &dark_icon_bm,
|
|
766 NULL, (gchar **)aimicon2_xpm);
|
|
767 gdk_window_set_icon(c->window->window, NULL, dark_icon_pm, dark_icon_bm);
|
|
768 }
|
|
769 */
|
|
770
|
|
771 if (general_options & OPT_GEN_POPUP_WINDOWS)
|
|
772 gdk_window_raise(c->window->window);
|
|
773
|
|
774
|
|
775 g_free(buf);
|
|
776 g_free(buf2);
|
|
777 }
|
|
778
|
|
779
|
|
780
|
|
781
|
|
782
|
|
783 void show_conv(struct conversation *c)
|
|
784 {
|
|
785 GtkWidget *win;
|
|
786 char buf[256];
|
|
787 GtkWidget *text;
|
|
788 GtkWidget *sw;
|
|
789 GtkWidget *send;
|
|
790 GtkWidget *info;
|
|
791 GtkWidget *warn;
|
|
792 GtkWidget *block;
|
|
793 GtkWidget *color;
|
|
794 GtkWidget *close;
|
|
795 GtkWidget *entry;
|
|
796 GtkWidget *toolbar;
|
|
797 GtkWidget *bbox;
|
|
798 GtkWidget *vbox;
|
|
799 GtkWidget *add;
|
|
800 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i, *wood_i, *palette_i, *link_i;
|
|
801 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p, *wood_p, *palette_p, *link_p;
|
|
802 GtkWidget *strike, *small, *normal, *big, *bold, *italic, *underline, *speaker, *wood, *palette, *link;
|
|
803 GdkBitmap *mask;
|
|
804
|
|
805 win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
806 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
|
|
807
|
|
808 gtk_widget_realize(win);
|
|
809 aol_icon(win->window);
|
|
810
|
|
811
|
|
812 c->window = win;
|
|
813
|
|
814 send = gtk_button_new_with_label("Send");
|
|
815 info = gtk_button_new_with_label("Info");
|
|
816 warn = gtk_button_new_with_label("Warn");
|
|
817 color = gtk_button_new_with_label("Color");
|
|
818 close = gtk_button_new_with_label("Close");
|
|
819 if (find_buddy(c->name) != NULL) {
|
|
820 add = gtk_button_new_with_label("Remove");
|
|
821 }
|
|
822 else {
|
|
823 add = gtk_button_new_with_label("Add");
|
|
824 }
|
|
825 block = gtk_button_new_with_label("Block");
|
|
826
|
|
827
|
|
828 bbox = gtk_hbox_new(TRUE, 0);
|
|
829 vbox = gtk_vbox_new(FALSE, 0);
|
|
830
|
|
831 entry = gtk_text_new(NULL, NULL);
|
|
832 gtk_text_set_editable(GTK_TEXT(entry), TRUE);
|
|
833 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE);
|
|
834
|
|
835 /* Toolbar */
|
|
836 toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS);
|
|
837
|
|
838 link_i = gdk_pixmap_create_from_xpm_d(win->window, &mask,
|
|
839 &win->style->white, link_xpm );
|
|
840 link_p = gtk_pixmap_new(link_i, mask);
|
|
841 gtk_widget_show(link_p);
|
|
842
|
|
843 palette_i = gdk_pixmap_create_from_xpm_d (win->window, &mask,
|
|
844 &win->style->white, palette_xpm );
|
|
845 palette_p = gtk_pixmap_new(palette_i, mask);
|
|
846 gtk_widget_show(palette_p);
|
|
847
|
|
848 wood_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
|
|
849 &win->style->white, wood_xpm );
|
|
850 wood_p = gtk_pixmap_new(wood_i, mask);
|
|
851 gtk_widget_show(wood_p);
|
|
852 speaker_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
|
|
853 &win->style->white, speaker_xpm );
|
|
854 speaker_p = gtk_pixmap_new(speaker_i, mask);
|
|
855 gtk_widget_show(speaker_p);
|
|
856 c->makesound=1;
|
|
857 strike_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
|
|
858 &win->style->white, strike_xpm );
|
|
859 strike_p = gtk_pixmap_new(strike_i, mask);
|
|
860 gtk_widget_show(strike_p);
|
|
861 bold_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
|
|
862 &win->style->white, bold_xpm );
|
|
863 bold_p = gtk_pixmap_new(bold_i, mask);
|
|
864 gtk_widget_show(bold_p);
|
|
865 italic_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
|
|
866 &win->style->white, italic_xpm );
|
|
867 italic_p = gtk_pixmap_new(italic_i, mask);
|
|
868 gtk_widget_show(italic_p);
|
|
869 underline_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
|
|
870 &win->style->white, underline_xpm );
|
|
871 underline_p = gtk_pixmap_new(underline_i, mask);
|
|
872 gtk_widget_show(underline_p);
|
|
873 small_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
|
|
874 &win->style->white, small_xpm );
|
|
875 small_p = gtk_pixmap_new(small_i, mask);
|
|
876 gtk_widget_show(small_p);
|
|
877 normal_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
|
|
878 &win->style->white, normal_xpm );
|
|
879 normal_p = gtk_pixmap_new(normal_i, mask);
|
|
880 gtk_widget_show(normal_p);
|
|
881 big_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask,
|
|
882 &win->style->white, big_xpm );
|
|
883 big_p = gtk_pixmap_new(big_i, mask);
|
|
884 gtk_widget_show(big_p);
|
|
885
|
|
886
|
|
887 bold = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
|
|
888 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL,
|
|
889 "Bold", "Bold Text", "Bold", bold_p,
|
|
890 GTK_SIGNAL_FUNC(do_bold), entry);
|
|
891 italic = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
|
|
892 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
|
893 NULL, "Italics", "Italics Text",
|
|
894 "Italics", italic_p, GTK_SIGNAL_FUNC(do_italic), entry);
|
|
895 underline = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
|
|
896 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
|
897 NULL, "Underline", "Underline Text",
|
|
898 "Underline", underline_p, GTK_SIGNAL_FUNC(do_underline), entry);
|
|
899 strike = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
|
|
900 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
|
901 NULL, "Strike", "Strike through Text",
|
|
902 "Strike", strike_p, GTK_SIGNAL_FUNC(do_strike), entry);
|
|
903 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
|
|
904 small = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Small", "Decrease font size", "Small", small_p, GTK_SIGNAL_FUNC(do_small), entry);
|
|
905 normal = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Normal", "Normal font size", "Normal", normal_p, GTK_SIGNAL_FUNC(do_normal), entry);
|
|
906 big = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Big", "Increase font size", "Big", big_p, GTK_SIGNAL_FUNC(do_big), entry);
|
|
907 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
|
|
908 link = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
|
|
909 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, "Link", "Insert Link",
|
|
910 "Link", link_p, GTK_SIGNAL_FUNC(do_link), entry);
|
|
911 palette = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
|
|
912 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
|
913 NULL, "Color", "Text Color",
|
|
914 "Color", palette_p, GTK_SIGNAL_FUNC(toggle_color), entry);
|
|
915 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
|
|
916 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
|
917 NULL, "Logging", "Enable logging",
|
|
918 "Logging", wood_p, GTK_SIGNAL_FUNC(toggle_loggle), c);
|
|
919 speaker = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
|
|
920 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
|
921 NULL, "Sound", "Enable sounds",
|
|
922 "Sound", speaker_p, GTK_SIGNAL_FUNC(set_option), &c->makesound);
|
|
923 c->makesound=0;
|
|
924 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(speaker), TRUE);
|
|
925
|
|
926 state_lock = 1;
|
|
927 if (find_log_info(c->name))
|
|
928 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), TRUE);
|
|
929 else
|
|
930 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), FALSE);
|
|
931 state_lock = 0;
|
|
932
|
|
933 gtk_widget_show(toolbar);
|
|
934
|
|
935 c->entry = entry;
|
|
936 c->bold = bold;
|
|
937 c->strike = strike;
|
|
938 c->italic = italic;
|
|
939 c->underline = underline;
|
|
940 c->log_button = wood;
|
|
941 c->palette = palette;
|
|
942 c->link = link;
|
|
943 c->add_button = add;
|
|
944
|
|
945 gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE);
|
|
946
|
|
947 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE);
|
|
948 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE);
|
|
949 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE);
|
|
950 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE);
|
|
951
|
|
952 gtk_object_set_user_data(GTK_OBJECT(entry), c);
|
|
953
|
|
954
|
|
955
|
|
956 gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(send_callback),c);
|
|
957
|
|
958 /* Text box */
|
|
959
|
|
960
|
|
961 text = gtk_html_new(NULL, NULL);
|
|
962
|
|
963 gtk_html_set_editable(GTK_HTML(text), FALSE);
|
|
964 /* gtk_html_set_transparent(GTK_HTML(text), (transparent) ? TRUE : FALSE);*/
|
|
965 c->text = text;
|
|
966
|
|
967 sw = gtk_scrolled_window_new (NULL, NULL);
|
|
968 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
|
969 GTK_POLICY_NEVER,
|
|
970 GTK_POLICY_ALWAYS);
|
|
971 gtk_widget_show(sw);
|
|
972 gtk_container_add(GTK_CONTAINER(sw), text);
|
|
973 gtk_widget_show(text);
|
|
974
|
|
975
|
|
976
|
|
977
|
|
978 GTK_HTML (text)->hadj->step_increment = 10.0;
|
|
979 GTK_HTML (text)->vadj->step_increment = 10.0;
|
|
980 gtk_widget_set_usize(sw, 320, 150);
|
|
981
|
|
982
|
|
983
|
|
984 /* Ready and pack buttons */
|
|
985 gtk_object_set_user_data(GTK_OBJECT(win), c);
|
|
986 gtk_object_set_user_data(GTK_OBJECT(close), c);
|
|
987 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), c);
|
|
988 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), c);
|
|
989 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
|
|
990 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), c);
|
|
991 gtk_signal_connect(GTK_OBJECT(warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c);
|
|
992 gtk_signal_connect(GTK_OBJECT(block), "clicked", GTK_SIGNAL_FUNC(block_callback), c);
|
|
993 gtk_signal_connect(GTK_OBJECT(color), "clicked", GTK_SIGNAL_FUNC(color_callback), c);
|
|
994
|
|
995 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(user_keypress_callback), c);
|
68
|
996 gtk_widget_set_usize(entry, 300, 70);
|
66
|
997
|
|
998 gtk_box_pack_start(GTK_BOX(bbox), send, TRUE, TRUE, 5);
|
|
999 gtk_box_pack_start(GTK_BOX(bbox), info, TRUE, TRUE, 5);
|
|
1000 gtk_box_pack_start(GTK_BOX(bbox), warn, TRUE, TRUE, 5);
|
|
1001 gtk_box_pack_start(GTK_BOX(bbox), block, TRUE, TRUE, 5);
|
|
1002 gtk_box_pack_start(GTK_BOX(bbox), color, TRUE, TRUE, 5);
|
|
1003 gtk_box_pack_start(GTK_BOX(bbox), add, TRUE, TRUE, 5);
|
|
1004 gtk_box_pack_start(GTK_BOX(bbox), close, TRUE, TRUE, 5);
|
|
1005
|
|
1006 /* pack and fill the rest */
|
|
1007
|
|
1008 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 5);
|
68
|
1009 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 5);
|
|
1010 gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 5);
|
|
1011 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5);
|
66
|
1012
|
|
1013
|
|
1014
|
|
1015
|
|
1016 gtk_widget_show(send);
|
|
1017 gtk_widget_show(info);
|
|
1018 gtk_widget_show(warn);
|
|
1019 /* gtk_widget_show(color); */
|
|
1020 gtk_widget_show(close);
|
|
1021 gtk_widget_show(add);
|
|
1022 gtk_widget_show(block);
|
|
1023 gtk_widget_show(bbox);
|
|
1024 gtk_widget_show(vbox);
|
|
1025 gtk_widget_show(entry);
|
|
1026 gtk_widget_show(text);
|
|
1027
|
67
|
1028
|
68
|
1029 gtk_container_add(GTK_CONTAINER(win), vbox);
|
66
|
1030 gtk_container_border_width(GTK_CONTAINER(win), 10);
|
|
1031
|
|
1032 if ((find_log_info(c->name)) || ((general_options & OPT_GEN_LOG_ALL)))
|
|
1033 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name);
|
|
1034 else
|
|
1035 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name);
|
|
1036 gtk_window_set_title(GTK_WINDOW(win), buf);
|
|
1037 gtk_window_set_focus(GTK_WINDOW(win),entry);
|
|
1038
|
|
1039 gtk_signal_connect(GTK_OBJECT(win), "delete_event", GTK_SIGNAL_FUNC(delete_event_convo), c);
|
|
1040 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed), entry);
|
|
1041
|
|
1042 gtk_widget_show(win);
|
|
1043
|
|
1044 }
|
|
1045
|
|
1046
|