Mercurial > pidgin
comparison src/conversation.c @ 3630:9682c0e022c6
[gaim-migrate @ 3753]
Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Fri, 11 Oct 2002 03:14:01 +0000 |
parents | afc5bb164c5a |
children | e2391338c394 |
comparison
equal
deleted
inserted
replaced
3629:afc5bb164c5a | 3630:9682c0e022c6 |
---|---|
21 | 21 |
22 #ifdef HAVE_CONFIG_H | 22 #ifdef HAVE_CONFIG_H |
23 #include <config.h> | 23 #include <config.h> |
24 #endif | 24 #endif |
25 #include <string.h> | 25 #include <string.h> |
26 #ifndef _WIN32 | |
26 #include <sys/time.h> | 27 #include <sys/time.h> |
28 #include <unistd.h> | |
29 #include <gdk/gdkx.h> | |
30 #include <X11/Xlib.h> | |
31 #else | |
32 #ifdef small | |
33 #undef small | |
34 #endif | |
35 #endif /*_WIN32*/ | |
27 #include <sys/types.h> | 36 #include <sys/types.h> |
28 #include <sys/stat.h> | 37 #include <sys/stat.h> |
29 #include <unistd.h> | |
30 #include <stdio.h> | 38 #include <stdio.h> |
31 #include <stdlib.h> | 39 #include <stdlib.h> |
32 #include <errno.h> | 40 #include <errno.h> |
33 #include <ctype.h> | 41 #include <ctype.h> |
34 #include <gdk/gdkx.h> | |
35 #include <X11/Xlib.h> | |
36 #include <gtk/gtk.h> | 42 #include <gtk/gtk.h> |
37 #include "gtkimhtml.h" | 43 #include "gtkimhtml.h" |
38 #include <gdk/gdkkeysyms.h> | 44 #include <gdk/gdkkeysyms.h> |
39 #include "convo.h" | 45 #include "convo.h" |
40 #include "gtkspell.h" | 46 #include "gtkspell.h" |
41 #include "prpl.h" | 47 #include "prpl.h" |
48 | |
49 #ifdef _WIN32 | |
50 #include "win32dep.h" | |
51 #endif | |
42 | 52 |
43 #include "pixmaps/bold.xpm" | 53 #include "pixmaps/bold.xpm" |
44 #include "pixmaps/italic.xpm" | 54 #include "pixmaps/italic.xpm" |
45 #include "pixmaps/underline.xpm" | 55 #include "pixmaps/underline.xpm" |
46 #include "pixmaps/strike.xpm" | 56 #include "pixmaps/strike.xpm" |
438 | 448 |
439 void save_convo(GtkWidget *save, struct conversation *c) | 449 void save_convo(GtkWidget *save, struct conversation *c) |
440 { | 450 { |
441 char buf[BUF_LONG]; | 451 char buf[BUF_LONG]; |
442 GtkWidget *window = gtk_file_selection_new(_("Gaim - Save Conversation")); | 452 GtkWidget *window = gtk_file_selection_new(_("Gaim - Save Conversation")); |
443 g_snprintf(buf, sizeof(buf), "%s/%s.log", g_get_home_dir(), normalize(c->name)); | 453 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log", gaim_home_dir(), normalize(c->name)); |
444 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); | 454 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
445 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c); | 455 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c); |
446 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), | 456 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
447 "clicked", GTK_SIGNAL_FUNC(do_save_convo), window); | 457 "clicked", GTK_SIGNAL_FUNC(do_save_convo), window); |
448 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), | 458 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), |
495 | 505 |
496 void insert_image(GtkWidget *save, struct conversation *c) | 506 void insert_image(GtkWidget *save, struct conversation *c) |
497 { | 507 { |
498 char buf[BUF_LONG]; | 508 char buf[BUF_LONG]; |
499 GtkWidget *window = gtk_file_selection_new(_("Gaim - Insert Image")); | 509 GtkWidget *window = gtk_file_selection_new(_("Gaim - Insert Image")); |
500 g_snprintf(buf, sizeof(buf), "%s/", g_get_home_dir()); | 510 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); |
501 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); | 511 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
502 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c); | 512 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c); |
503 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), | 513 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
504 "clicked", GTK_SIGNAL_FUNC(do_insert_image), window); | 514 "clicked", GTK_SIGNAL_FUNC(do_insert_image), window); |
505 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), | 515 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), |
1056 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | 1066 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
1057 show_im_dialog(); | 1067 show_im_dialog(); |
1058 } else if (event->keyval == 'z') { | 1068 } else if (event->keyval == 'z') { |
1059 key_is_typing = FALSE; | 1069 key_is_typing = FALSE; |
1060 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | 1070 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
1071 #ifndef _WIN32 | |
1061 XIconifyWindow(GDK_DISPLAY(), | 1072 XIconifyWindow(GDK_DISPLAY(), |
1062 GDK_WINDOW_XWINDOW(c->window->window), | 1073 GDK_WINDOW_XWINDOW(c->window->window), |
1063 ((_XPrivDisplay)GDK_DISPLAY())->default_screen); | 1074 ((_XPrivDisplay)GDK_DISPLAY())->default_screen); |
1075 #endif | |
1064 } | 1076 } |
1065 | 1077 |
1066 | 1078 |
1067 if ((!c->is_chat && (im_options & OPT_IM_ONE_WINDOW)) || | 1079 if ((!c->is_chat && (im_options & OPT_IM_ONE_WINDOW)) || |
1068 (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) { | 1080 (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) { |
1358 g_free(buf); | 1370 g_free(buf); |
1359 | 1371 |
1360 if (err < 0) { | 1372 if (err < 0) { |
1361 if (err == -E2BIG) | 1373 if (err == -E2BIG) |
1362 do_error_dialog(_("Unable to send message. The message is too large"), NULL, GAIM_ERROR); | 1374 do_error_dialog(_("Unable to send message. The message is too large"), NULL, GAIM_ERROR); |
1375 #ifndef _WIN32 | |
1363 else if (err == -ENOTCONN) | 1376 else if (err == -ENOTCONN) |
1364 debug_printf("Not yet connected\n"); | 1377 debug_printf("Not yet connected\n"); |
1378 #else | |
1379 else if (err == SOCKET_ERROR) | |
1380 if( WSAENOTCONN == WSAGetLastError() ) | |
1381 debug_printf("Not yet connected\n"); | |
1382 #endif | |
1365 else | 1383 else |
1366 do_error_dialog(_("Unable to send message"), NULL, GAIM_ERROR); | 1384 do_error_dialog(_("Unable to send message"), NULL, GAIM_ERROR); |
1367 } else { | 1385 } else { |
1368 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1); | 1386 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1); |
1369 | 1387 |
3474 return; | 3492 return; |
3475 } | 3493 } |
3476 | 3494 |
3477 c->save_icon = gtk_file_selection_new(_("Gaim - Save Icon")); | 3495 c->save_icon = gtk_file_selection_new(_("Gaim - Save Icon")); |
3478 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(c->save_icon)); | 3496 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(c->save_icon)); |
3479 g_snprintf(buf, BUF_LEN - 1, "%s/%s.icon", g_get_home_dir(), c->name); | 3497 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S "%s.icon", gaim_home_dir(), c->name); |
3480 gtk_file_selection_set_filename(GTK_FILE_SELECTION(c->save_icon), buf); | 3498 gtk_file_selection_set_filename(GTK_FILE_SELECTION(c->save_icon), buf); |
3481 gtk_signal_connect(GTK_OBJECT(c->save_icon), "delete_event", | 3499 gtk_signal_connect(GTK_OBJECT(c->save_icon), "delete_event", |
3482 GTK_SIGNAL_FUNC(des_save_icon), c); | 3500 GTK_SIGNAL_FUNC(des_save_icon), c); |
3483 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(c->save_icon)->ok_button), "clicked", | 3501 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(c->save_icon)->ok_button), "clicked", |
3484 GTK_SIGNAL_FUNC(do_save_icon), c); | 3502 GTK_SIGNAL_FUNC(do_save_icon), c); |
3611 if (!data) | 3629 if (!data) |
3612 return; | 3630 return; |
3613 | 3631 |
3614 /* this is such an evil hack, i don't know why i'm even considering it. | 3632 /* this is such an evil hack, i don't know why i'm even considering it. |
3615 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ | 3633 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ |
3616 g_snprintf(filename, sizeof(filename), "%s/gaimicon-%s.%d", g_get_tmp_dir(), c->name, getpid()); | 3634 g_snprintf(filename, sizeof(filename), "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", g_get_tmp_dir(), c->name, getpid()); |
3617 file = fopen(filename, "w"); | 3635 file = fopen(filename, "w"); |
3618 if (!file) | 3636 if (!file) |
3619 return; | 3637 return; |
3620 fwrite(data, 1, len, file); | 3638 fwrite(data, 1, len, file); |
3621 fclose(file); | 3639 fclose(file); |