Mercurial > pidgin.yaz
comparison src/gtkconv.c @ 7712:2823111061ba
[gaim-migrate @ 8357]
I did a few things to my drag-and-drop patch. First, I moved the
application/x-im-contact parsing code into its own function, so we don't
have to duplicate stuff. The reason I did this is because Sean suggested
support for dragging x-im-contacts into conversation windows, which is
also implemented now, and it rocks. :)
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 03 Dec 2003 02:03:25 +0000 |
parents | 8a40952f5f67 |
children | 9f6dc7b4fc57 |
comparison
equal
deleted
inserted
replaced
7711:ebd43be54140 | 7712:2823111061ba |
---|---|
3776 GaimConversation *conv) | 3776 GaimConversation *conv) |
3777 { | 3777 { |
3778 GaimConvWindow *win = conv->window; | 3778 GaimConvWindow *win = conv->window; |
3779 GaimConversation *c; | 3779 GaimConversation *c; |
3780 | 3780 |
3781 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) { | 3781 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) |
3782 { | |
3782 GaimBlistNode *n = NULL; | 3783 GaimBlistNode *n = NULL; |
3783 GaimBuddy *b; | 3784 GaimBuddy *b; |
3784 memcpy(&n, sd->data, sizeof(n)); | 3785 memcpy(&n, sd->data, sizeof(n)); |
3785 | 3786 |
3786 if (GAIM_BLIST_NODE_IS_CONTACT(n)) | 3787 if (GAIM_BLIST_NODE_IS_CONTACT(n)) |
3791 return; | 3792 return; |
3792 | 3793 |
3793 c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); | 3794 c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); |
3794 | 3795 |
3795 gaim_conv_window_add_conversation(win, c); | 3796 gaim_conv_window_add_conversation(win, c); |
3797 } | |
3798 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) | |
3799 { | |
3800 char *protocol = NULL; | |
3801 char *username = NULL; | |
3802 GaimAccount *account; | |
3803 | |
3804 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account, | |
3805 &protocol, &username, NULL)) | |
3806 { | |
3807 if (account == NULL) | |
3808 { | |
3809 gaim_notify_error(NULL, NULL, | |
3810 _("You are not currently signed on with an account that " | |
3811 "can add that buddy."), NULL); | |
3812 } | |
3813 else | |
3814 { | |
3815 gaim_conversation_new(GAIM_CONV_IM, account, username); | |
3816 } | |
3817 } | |
3818 | |
3819 if (username != NULL) g_free(username); | |
3820 if (protocol != NULL) g_free(protocol); | |
3821 | |
3822 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | |
3796 } | 3823 } |
3797 } | 3824 } |
3798 | 3825 |
3799 /************************************************************************** | 3826 /************************************************************************** |
3800 * GTK+ window ops | 3827 * GTK+ window ops |
3942 | 3969 |
3943 static const GtkTargetEntry te[] = | 3970 static const GtkTargetEntry te[] = |
3944 { | 3971 { |
3945 {"text/plain", 0, 0}, | 3972 {"text/plain", 0, 0}, |
3946 {"text/uri-list", 0, 1}, | 3973 {"text/uri-list", 0, 1}, |
3947 {"GAIM_BLIST_NODE", 0, 2}, | 3974 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 2}, |
3948 {"STRING", 0, 3} | 3975 {"STRING", 0, 3}, |
3976 {"application/x-im-contact", 0, 4} | |
3949 }; | 3977 }; |
3950 | 3978 |
3951 static void | 3979 static void |
3952 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) | 3980 gaim_gtk_add_conversation(GaimConvWindow *win, GaimConversation *conv) |
3953 { | 3981 { |