# HG changeset patch # User Eric Warmenhoven # Date 957348079 0 # Node ID 89c9334d3484633d9a52afea1434983c455a3432 # Parent 2042a38da38b1b6d1c0169c2d9e94b6a3f6a46be [gaim-migrate @ 222] Added pthread code. Keep your fingers crossed.... :P committer: Tailor Script diff -r 2042a38da38b -r 89c9334d3484 configure.in --- a/configure.in Wed May 03 00:34:30 2000 +0000 +++ b/configure.in Wed May 03 10:01:19 2000 +0000 @@ -16,6 +16,16 @@ AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h) +AC_CHECK_HEADERS(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not found ***])) + +dnl Taken from Mozilla's and xchat's configure.in's :) +AC_CHECK_LIB(pthread, pthread_create, _PTHREAD_LDFLAGS="-lpthread", + AC_CHECK_LIB(c_r, pthread_create, _PTHREAD_LDFLAGS="-lc_r", + AC_CHECK_LIB(pthreads, pthread_create, _PTHREAD_LDFLAGS="-lpthreads", + AC_MSG_ERROR([*** POSIX thread library not found ***]) + ) + ) +) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -38,7 +48,7 @@ AC_ARG_ENABLE(plugins, [ --disable-plugins compile with out plugin support],enable_plugins=no,enable_plugins=yes) GAIM_CFLAGS="$CFLAGS -I../" -GAIM_LIBS="$LIBS" +GAIM_LIBS="$LIBS $_PTHREAD_LDFLAGS" GAIM_LDADD="$LDADD" LIBFAIM_DO="" diff -r 2042a38da38b -r 89c9334d3484 src/rvous.c --- a/src/rvous.c Wed May 03 00:34:30 2000 +0000 +++ b/src/rvous.c Wed May 03 10:01:19 2000 +0000 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "gaim.h" @@ -149,7 +150,8 @@ guint32 rcv; char *c; int cont = 1; - GtkWidget *fw = NULL, *fbar = NULL, *label = NULL, *button = NULL; + GtkWidget *fw = NULL, *fbar = NULL, *label = NULL; + GtkWidget *button = NULL, *pct = NULL; if (!(ft->f = fopen(file,"w"))) { buf = g_malloc(BUF_LONG); @@ -248,19 +250,21 @@ fw = gtk_dialog_new(); buf = g_malloc(2048); - snprintf(buf, 2048, "Receiving %s from %s (%d bytes)", ft->filename, - ft->user, ft->size); + snprintf(buf, 2048, "Receiving %s from %s", ft->filename, ft->user); label = gtk_label_new(buf); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(fw)->vbox), label, 0, 0, 5); gtk_widget_show(label); fbar = gtk_progress_bar_new(); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(fw)->action_area), fbar, 0, 0, 5); gtk_widget_show(fbar); + pct = gtk_label_new("0 %"); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(fw)->action_area), pct, 0, 0, 5); + gtk_widget_show(pct); button = gtk_button_new_with_label("Cancel"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(fw)->action_area), button, 0, 0, 5); gtk_widget_show(button); gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc)toggle, &cont); - gtk_window_set_title(GTK_WINDOW(fw), "File Transfer"); + gtk_window_set_title(GTK_WINDOW(fw), "Gaim - File Transfer"); gtk_widget_realize(fw); aol_icon(fw->window); gtk_widget_show(fw); @@ -284,11 +288,14 @@ rcv += read_rv; for (i = 0; i < read_rv; i++) fprintf(ft->f, "%c", buf[i]); - snprintf(buf, 2048, "Receiving %s from %s (%d / %d bytes)", - header + 186, ft->user, rcv, ft->size); + snprintf(buf, 2048, "Receiving %s from %s", + header + 186, ft->user); gtk_label_set_text(GTK_LABEL(label), buf); gtk_progress_bar_update(GTK_PROGRESS_BAR(fbar), (float)(rcv)/(float)(ft->size)); + sprintf(buf, "%d / %d K (%2.0f %%)", rcv/1024, ft->size/1024, + 100*((float)rcv)/((float)ft->size)); + gtk_label_set_text(GTK_LABEL(pct), buf); while(gtk_events_pending()) gtk_main_iteration(); } diff -r 2042a38da38b -r 89c9334d3484 src/toc.c --- a/src/toc.c Wed May 03 00:34:30 2000 +0000 +++ b/src/toc.c Wed May 03 10:01:19 2000 +0000 @@ -32,6 +32,7 @@ #include #include #include +#include #include "gaim.h" #include "gnome_applet_mgr.h" @@ -607,6 +608,8 @@ if (!strcmp(uuid, FILE_SEND_UID)) { /* we're getting a file */ + pthread_t thread; + for (i=0; i<4; i++) { sscanf(strtok(NULL, ":"), "%d", &unk[i]); if (unk[i] == 10001) @@ -644,7 +647,9 @@ for (i--; i >= 0; i--) g_free(messages[i]); - accept_file_dialog(ft); + pthread_create(&thread, NULL, + (void*(*)(void*))accept_file_dialog, ft); + pthread_detach(thread); } else if (!strcmp(uuid, FILE_GET_UID)) { /* we're sending a file */ for (i=0; i<4; i++) {