Mercurial > pidgin
diff src/prpl.c @ 2189:dca8e00d7de0
[gaim-migrate @ 2199]
I've decided I like Russ Dill's file transfer stuff and will have that go into gaim when i get around to it.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 29 Aug 2001 20:58:08 +0000 |
parents | 0befa2d2e540 |
children | 657dbe515608 |
line wrap: on
line diff
--- a/src/prpl.c Wed Aug 29 00:04:59 2001 +0000 +++ b/src/prpl.c Wed Aug 29 20:58:08 2001 +0000 @@ -549,124 +549,3 @@ } else if (gc->email_win) gtk_widget_destroy(gc->email_win); } - -/* -struct ft_req { - struct gaim_connection *gc; - gboolean send; - gboolean multiple; - guint size; - char *name; - ft_callback cb; - gpointer data; - GtkWidget *fd; -}; - -static void ftrrno(gpointer w, struct ft_req *fr) -{ - if (fr->fd && (w != fr->fd)) { - gtk_widget_destroy(fr->fd); - return; - } - if (fr->cb) - fr->cb(fr->gc, NULL, TRUE, fr->data); - if (fr->name) - g_free(fr->name); - g_free(fr); -} - -static void do_exist_dialog(const char *name, unsigned long size, struct ft_req *fr) -{ - \* - GtkWidget *window; - GtkWidget *vbox; - GtkWidget *label; - GtkWidget *hbox; - GtkWidget *button; - char buf[8192]; - - g_snprintf(buf, sizeof(buf), "It appears that %s already exists. Do you want to " - "overwrite the file%s or cancel the transfer?", name, - (size <= fr->size) ? ", resume the download," : ""); - - window = gtk_window_new(GTK_WINDOW_DIALOG); - *\ -} - -static void ftgotfile(gpointer w, struct ft_req *fr) -{ - const char *fname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fr->fd)); - if (!fr->multiple && file_is_dir(fname, fr->fd)) - return; - - if (!fr->multiple && !fr->send) { - struct stat st; - if (stat(fname, &st) == 0) { - do_exist_dialog(fname, st.st_size, fr); - return; - } - } - - fr->cb(fr->gc, fname, FT_EXIST_DNE, fr->data); - fr->cb = NULL; - - gtk_widget_destroy(fr->fd); -} - -static void ftrrok(gpointer w, struct ft_req *ft) -{ - \* ft is going to be free'd as soon as we leave this function, so we'll copy it *\ - struct ft_req *fr = g_memdup(ft, sizeof(struct ft_req)); - char buf[256]; - - if (fr->send) - fr->fd = gtk_file_selection_new(_("Gaim - Select File")); - else - fr->fd = gtk_file_selection_new(_("Gaim - Send File")); - - g_snprintf(buf, sizeof(buf), "%s/%s", g_get_home_dir(), fr->name ? fr->name : ""); - gtk_file_selection_set_filename(GTK_FILE_SELECTION(fr->fd), buf); - - gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fr->fd)->ok_button), "clicked", - GTK_SIGNAL_FUNC(ftgotfile), fr); - gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fr->fd)->cancel_button), "clicked", - GTK_SIGNAL_FUNC(ftrrno), fr); - gtk_signal_connect(GTK_OBJECT(fr->fd), "destroy", GTK_SIGNAL_FUNC(ftrrno), fr); - - gtk_widget_show(fr->fd); -} - -void ft_receive_request(struct gaim_connection *gc, const char *who, gboolean send, gboolean multiple, - char *name, guint size, ft_callback cb, gpointer data) -{ - char buf[8192]; - struct ft_req *fr = g_new0(struct ft_req, 1); - - fr->gc = gc; - fr->send = send; - fr->multiple = multiple; - fr->size = size; - if (name) - fr->name = g_strdup(name); - fr->cb = cb; - fr->data = data; - - if (send) - g_snprintf(buf, sizeof(buf), "%s has just asked %s to send a file.", - who, gc->username); - else if (multiple) - g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive some files.", - who, gc->username); - else if (name && size) - g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive %s (%d bytes).", - who, gc->username, name, size); - else if (name) - g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive %s.", - who, gc->username, name); - else - g_snprintf(buf, sizeof(buf), "%s has just asked %s to receive a file.", - who, gc->username); - - do_ask_dialog(buf, fr, ftrrok, ftrrno); -} -*/