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