Mercurial > pidgin
changeset 9468:4d0b0d5485e6
[gaim-migrate @ 10293]
(23:23:20) datallah: LSchiere: if you are up to it, this:
http://www.butfer.com/gaim-patches/gtkconv_send_file.patch, makes it so
that you can send files to people from the conversation window.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 07 Jul 2004 03:24:37 +0000 |
parents | b6971539f7af |
children | 51235d29c583 |
files | src/gtkconv.c src/gtkconv.h |
diffstat | 2 files changed, 73 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkconv.c Wed Jul 07 01:51:28 2004 +0000 +++ b/src/gtkconv.c Wed Jul 07 03:24:37 2004 +0000 @@ -683,6 +683,13 @@ } static void +send_file_cb(GtkWidget *widget, GaimConversation *conv) +{ + serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); + +} + +static void do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info) { const char *buddy, *message; @@ -956,6 +963,18 @@ } static void +menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) +{ + GaimConvWindow *win = (GaimConvWindow *)data; + GaimConversation *conv = gaim_conv_window_get_active_conversation(win); + + if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { + serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); + } + +} + +static void menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) { GaimConvWindow *win = (GaimConvWindow *)data; @@ -1267,6 +1286,15 @@ } static void +menu_chat_send_file_cb(GtkWidget *w, GaimConversation *conv) +{ + const char *who = g_object_get_data(G_OBJECT(w), "user_data"); + GaimConnection *gc = gaim_conversation_get_gc(conv); + + serv_send_file(gc, who, NULL); +} + +static void menu_chat_info_cb(GtkWidget *w, GaimConversation *conv) { char *who; @@ -1343,6 +1371,16 @@ gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); gtk_widget_show(button); + if (gc && prpl_info && prpl_info->send_file + && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who))) { + button = gtk_menu_item_new_with_label(_("Send File")); + g_signal_connect(G_OBJECT(button), "activate", + G_CALLBACK(menu_chat_send_file_cb), conv); + g_object_set_data(G_OBJECT(button), "user_data", who); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), button); + gtk_widget_show(button); + } + if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) button = gtk_menu_item_new_with_label(_("Un-Ignore")); else @@ -2557,9 +2595,11 @@ gtk_widget_show(gtkconv->send); gtk_widget_show(gtkconv->u.im->warn); gtk_widget_show(gtkconv->u.im->block); + gtk_widget_show(gtkconv->u.im->send_file); /* Deal with menu items */ gtk_widget_show(gtkwin->menu.view_log); + gtk_widget_show(gtkwin->menu.send_file); gtk_widget_show(gtkwin->menu.add_pounce); gtk_widget_show(gtkwin->menu.get_info); gtk_widget_show(gtkwin->menu.warn); @@ -2592,6 +2632,7 @@ /* Deal with menu items */ gtk_widget_hide(gtkwin->menu.view_log); + gtk_widget_hide(gtkwin->menu.send_file); gtk_widget_hide(gtkwin->menu.add_pounce); gtk_widget_hide(gtkwin->menu.get_info); gtk_widget_hide(gtkwin->menu.warn); @@ -2638,6 +2679,10 @@ (prpl_info->warn != NULL)); gtk_widget_set_sensitive(gtkconv->u.im->block, (prpl_info->add_deny != NULL)); + gtk_widget_set_sensitive(gtkconv->u.im->send_file, + (prpl_info->send_file + && (!prpl_info->can_receive_file + || prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { @@ -2676,6 +2721,10 @@ (prpl_info->chat_invite != NULL)); if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { + gtk_widget_set_sensitive(gtkwin->menu.send_file, + (gc && prpl_info->send_file != NULL + && (!prpl_info->can_receive_file + || prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); if (gaim_find_buddy(gaim_conversation_get_account(conv), gaim_conversation_get_name(conv)) == NULL) gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE); @@ -2709,12 +2758,14 @@ if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { gtk_widget_set_sensitive(gtkconv->u.im->warn, FALSE); gtk_widget_set_sensitive(gtkconv->u.im->block, FALSE); + gtk_widget_set_sensitive(gtkconv->u.im->send_file, FALSE); } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { gtk_widget_set_sensitive(gtkconv->u.chat->invite, FALSE); } /* Then deal with menu items */ gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE); + gtk_widget_set_sensitive(gtkwin->menu.send_file, FALSE); gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE); gtk_widget_set_sensitive(gtkwin->menu.get_info, FALSE); gtk_widget_set_sensitive(gtkwin->menu.warn, FALSE); @@ -3392,6 +3443,7 @@ { "/Conversation/sep1", NULL, NULL, 0, "<Separator>" }, + { N_("/Conversation/Se_nd File..."), NULL, menu_send_file_cb, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER }, { N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb, 0, NULL }, { N_("/Conversation/_Get Info"), NULL, menu_get_info_cb, 0, @@ -3474,6 +3526,10 @@ N_("/Conversation/View Log")); /* --- */ + gtkwin->menu.send_file = + gtk_item_factory_get_widget(gtkwin->menu.item_factory, + N_("/Conversation/Send File...")); + gtkwin->menu.add_pounce = gtk_item_factory_get_widget(gtkwin->menu.item_factory, N_("/Conversation/Add Buddy Pounce...")); @@ -3586,6 +3642,13 @@ _("Block the user"), NULL); gtk_box_pack_start(GTK_BOX(parent), gtkim->block, FALSE, FALSE, 0); + /* Block button */ + gtkim->send_file = gaim_gtk_change_text(_("Send File"), gtkim->send_file, + GAIM_STOCK_FILE_TRANSFER, GAIM_CONV_IM); + gtk_tooltips_set_tip(gtkconv->tooltips, gtkim->send_file, + _("Send a file to the user"), NULL); + gtk_box_pack_start(GTK_BOX(parent), gtkim->send_file, FALSE, FALSE, 0); + /* Add button */ gtkconv->add = gaim_gtk_change_text(_("Add"), gtkconv->add, GTK_STOCK_ADD, GAIM_CONV_IM); @@ -3609,6 +3672,7 @@ gtk_button_set_relief(GTK_BUTTON(gtkim->warn), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(gtkim->block), GTK_RELIEF_NONE); + gtk_button_set_relief(GTK_BUTTON(gtkim->send_file), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(gtkconv->info), GTK_RELIEF_NONE); @@ -3616,6 +3680,7 @@ gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); gtk_size_group_add_widget(gtkconv->sg, gtkim->block); + gtk_size_group_add_widget(gtkconv->sg, gtkim->send_file); gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); @@ -3623,9 +3688,10 @@ gtk_box_reorder_child(GTK_BOX(parent), gtkim->warn, 1); gtk_box_reorder_child(GTK_BOX(parent), gtkim->block, 2); - gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 3); - gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 4); - gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 5); + gtk_box_reorder_child(GTK_BOX(parent), gtkim->send_file,3); + gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 4); + gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 5); + gtk_box_reorder_child(GTK_BOX(parent), gtkconv->info, 6); gaim_gtkconv_update_buttons_by_protocol(conv); @@ -3640,6 +3706,8 @@ G_CALLBACK(warn_cb), conv); g_signal_connect(G_OBJECT(gtkim->block), "clicked", G_CALLBACK(block_cb), conv); + g_signal_connect(G_OBJECT(gtkim->send_file), "clicked", + G_CALLBACK(send_file_cb), conv); g_signal_connect(G_OBJECT(gtkconv->add), "clicked", G_CALLBACK(add_remove_cb), conv); g_signal_connect(G_OBJECT(gtkconv->remove), "clicked",
--- a/src/gtkconv.h Wed Jul 07 01:51:28 2004 +0000 +++ b/src/gtkconv.h Wed Jul 07 03:24:37 2004 +0000 @@ -53,6 +53,7 @@ GtkWidget *view_log; + GtkWidget *send_file; GtkWidget *add_pounce; GtkWidget *get_info; GtkWidget *warn; @@ -96,6 +97,7 @@ { GtkWidget *warn; GtkWidget *block; + GtkWidget *send_file; GtkWidget *sep1; GtkWidget *sep2; GtkWidget *check;