Mercurial > pidgin
comparison src/gtkconv.c @ 9909:ebca3bbc6719
[gaim-migrate @ 10801]
(12:58:49) nosnilmot: LSchiere: I've got a few patches :) 1) Avoids a g_log
when closing conversations on disconnected accounts
http://nosnilmot.com/patches/gaim-0.83cvs-gtkconv-glog-quieter.patch
(12:59:20) nosnilmot: 2) Some conversation signal fix-lets, which reduces
g_log warnings when closing gaim with conversations open
http://nosnilmot.com/patches/gaim-0.83cvs-conv-signal-fixes.patch
(12:59:45) nosnilmot: 3) Drag-and-drop buddy support for the Invite dialog
: http://nosnilmot.com/patches/gaim-0.83cvs-invite-dnd.patch
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sun, 29 Aug 2004 16:59:47 +0000 |
parents | 18a787538ad2 |
children | e74eb0d11f86 |
comparison
equal
deleted
inserted
replaced
9908:e46e63a96f07 | 9909:ebca3bbc6719 |
---|---|
677 | 677 |
678 g_free(info); | 678 g_free(info); |
679 } | 679 } |
680 | 680 |
681 static void | 681 static void |
682 invite_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, | |
683 GtkSelectionData *sd, guint inf, guint t, gpointer data) | |
684 { | |
685 InviteBuddyInfo *info = (InviteBuddyInfo *)data; | |
686 const char *convprotocol; | |
687 | |
688 convprotocol = gaim_account_get_protocol_id(gaim_conversation_get_account(info->conv)); | |
689 | |
690 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) | |
691 { | |
692 GaimBlistNode *node = NULL; | |
693 GaimBuddy *buddy; | |
694 | |
695 memcpy(&node, sd->data, sizeof(node)); | |
696 | |
697 if (GAIM_BLIST_NODE_IS_CONTACT(node)) | |
698 buddy = gaim_contact_get_priority_buddy((GaimContact *)node); | |
699 else if (GAIM_BLIST_NODE_IS_BUDDY(node)) | |
700 buddy = (GaimBuddy *)node; | |
701 else | |
702 return; | |
703 | |
704 if (strcmp(convprotocol, gaim_account_get_protocol_id(buddy->account))) | |
705 { | |
706 gaim_notify_error(NULL, NULL, | |
707 _("That buddy is not on the same protocol as this " | |
708 "chat"), NULL); | |
709 } | |
710 else | |
711 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name); | |
712 | |
713 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | |
714 } | |
715 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) | |
716 { | |
717 char *protocol = NULL; | |
718 char *username = NULL; | |
719 GaimAccount *account; | |
720 | |
721 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, | |
722 &protocol, &username, NULL)) | |
723 { | |
724 if (account == NULL) | |
725 { | |
726 gaim_notify_error(NULL, NULL, | |
727 _("You are not currently signed on with an account that " | |
728 "can invite that buddy."), NULL); | |
729 } | |
730 else if (strcmp(convprotocol, gaim_account_get_protocol_id(account))) | |
731 { | |
732 gaim_notify_error(NULL, NULL, | |
733 _("That buddy is not on the same protocol as this " | |
734 "chat"), NULL); | |
735 } | |
736 else | |
737 { | |
738 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), username); | |
739 } | |
740 } | |
741 | |
742 if (username != NULL) g_free(username); | |
743 if (protocol != NULL) g_free(protocol); | |
744 | |
745 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | |
746 } | |
747 } | |
748 | |
749 static const GtkTargetEntry dnd_targets[] = | |
750 { | |
751 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0}, | |
752 {"application/x-im-contact", 0, 1} | |
753 }; | |
754 | |
755 static void | |
682 invite_cb(GtkWidget *widget, GaimConversation *conv) | 756 invite_cb(GtkWidget *widget, GaimConversation *conv) |
683 { | 757 { |
684 InviteBuddyInfo *info = NULL; | 758 InviteBuddyInfo *info = NULL; |
685 | 759 |
686 if (invite_dialog == NULL) { | 760 if (invite_dialog == NULL) { |
713 GTK_RESPONSE_OK); | 787 GTK_RESPONSE_OK); |
714 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); | 788 gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), 6); |
715 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); | 789 gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE); |
716 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); | 790 gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE); |
717 | 791 |
792 info->window = GTK_WIDGET(invite_dialog); | |
793 | |
718 /* Setup the outside spacing. */ | 794 /* Setup the outside spacing. */ |
719 vbox = GTK_DIALOG(invite_dialog)->vbox; | 795 vbox = GTK_DIALOG(invite_dialog)->vbox; |
720 | 796 |
721 gtk_box_set_spacing(GTK_BOX(vbox), 12); | 797 gtk_box_set_spacing(GTK_BOX(vbox), 12); |
722 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); | 798 gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); |
786 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); | 862 gtk_label_set_mnemonic_widget(GTK_LABEL(label), info->message); |
787 | 863 |
788 /* Connect the signals. */ | 864 /* Connect the signals. */ |
789 g_signal_connect(G_OBJECT(invite_dialog), "response", | 865 g_signal_connect(G_OBJECT(invite_dialog), "response", |
790 G_CALLBACK(do_invite), info); | 866 G_CALLBACK(do_invite), info); |
867 /* Setup drag-and-drop */ | |
868 gtk_drag_dest_set(info->window, | |
869 GTK_DEST_DEFAULT_MOTION | | |
870 GTK_DEST_DEFAULT_DROP, | |
871 dnd_targets, | |
872 sizeof(dnd_targets) / sizeof(GtkTargetEntry), | |
873 GDK_ACTION_COPY); | |
874 gtk_drag_dest_set(info->entry, | |
875 GTK_DEST_DEFAULT_MOTION | | |
876 GTK_DEST_DEFAULT_DROP, | |
877 dnd_targets, | |
878 sizeof(dnd_targets) / sizeof(GtkTargetEntry), | |
879 GDK_ACTION_COPY); | |
880 | |
881 g_signal_connect(G_OBJECT(info->window), "drag_data_received", | |
882 G_CALLBACK(invite_dnd_recv), info); | |
883 g_signal_connect(G_OBJECT(info->entry), "drag_data_received", | |
884 G_CALLBACK(invite_dnd_recv), info); | |
885 | |
791 } | 886 } |
792 | 887 |
793 gtk_widget_show_all(invite_dialog); | 888 gtk_widget_show_all(invite_dialog); |
794 | 889 |
795 if (info != NULL) | 890 if (info != NULL) |
2596 | 2691 |
2597 win = gaim_conversation_get_window(conv); | 2692 win = gaim_conversation_get_window(conv); |
2598 gtkwin = GAIM_GTK_WINDOW(win); | 2693 gtkwin = GAIM_GTK_WINDOW(win); |
2599 gtkconv = GAIM_GTK_CONVERSATION(conv); | 2694 gtkconv = GAIM_GTK_CONVERSATION(conv); |
2600 gc = gaim_conversation_get_gc(conv); | 2695 gc = gaim_conversation_get_gc(conv); |
2601 account = gaim_connection_get_account(gc); | 2696 account = gaim_conversation_get_account(conv); |
2602 | 2697 |
2603 if (gc != NULL) | 2698 if (gc != NULL) |
2604 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 2699 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
2605 | 2700 |
2606 if (gtkwin->menu.send_as != NULL) | 2701 if (gtkwin->menu.send_as != NULL) |