diff src/gtkconv.c @ 7619:994b2d782711

[gaim-migrate @ 8243] Juan Pablo Mendoza made file sending a little more generic, UI-wise, and added drag-and-drop file sending, as well as a Send File in the conversation menu. Congrats Juan on the $400 bounty. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 24 Nov 2003 02:35:27 +0000
parents 59c1cee97cbb
children bfe3a796b2c2
line wrap: on
line diff
--- a/src/gtkconv.c	Mon Nov 24 02:28:42 2003 +0000
+++ b/src/gtkconv.c	Mon Nov 24 02:35:27 2003 +0000
@@ -881,6 +881,20 @@
 }
 
 static void
+menu_sendfile_cb(gpointer data, guint action, GtkWidget *widget)
+{
+	GaimConvWindow *win = (GaimConvWindow *)data;
+	GaimConversation *conv;
+	GaimConnection *gc;
+
+	conv = gaim_conv_window_get_active_conversation(win);
+
+	gc = gaim_conversation_get_gc(conv);
+
+	gaim_prpl_ask_send_file (gc, gaim_conversation_get_name (conv));
+}
+
+static void
 menu_warn_cb(gpointer data, guint action, GtkWidget *widget)
 {
 	GaimConvWindow *win = (GaimConvWindow *)data;
@@ -2079,6 +2093,15 @@
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 	}
 
+
+	if (gaim_prpl_has_send_file (gc, gaim_conversation_get_name(conv))) {
+		gtk_widget_show(gtkwin->menu.sendfile);
+		gtk_widget_set_sensitive(gtkwin->menu.sendfile, TRUE);
+	} else {
+		gtk_widget_hide(gtkwin->menu.sendfile);
+		gtk_widget_set_sensitive(gtkwin->menu.sendfile, FALSE);
+	}
+
 	/* Update the menubar */
 	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
 		gtk_widget_show(gtkwin->menu.view_log);
@@ -2937,6 +2960,9 @@
 	{ N_("/Conversation/In_vite..."), NULL, menu_invite_cb, 0,
 	  "<StockItem>", GAIM_STOCK_INVITE },
 
+	{ N_("/Conversation/Send _File..."), NULL, menu_sendfile_cb, 0,
+	  "<StockItem>", GAIM_STOCK_INVITE },
+
 	{ "/Conversation/sep2", NULL, NULL, 0, "<Separator>" },
 
 	{ N_("/Conversation/Insert _URL..."), NULL, menu_insert_link_cb, 0,
@@ -3025,6 +3051,10 @@
 		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
 									N_("/Conversation/Invite..."));
 
+	gtkwin->menu.sendfile =
+		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
+									N_("/Conversation/Send File..."));
+
 	/* --- */
 
 	gtkwin->menu.insert_link =