pidgin/gtkconv.c

changeset 38827
3573c82d32d8
parent 38433
361c801c4536
child 38833
47a8f1e4c414
equal deleted inserted replaced
38648:9ff9acf9fa14 38827:3573c82d32d8
1677 gtk_widget_set_sensitive(button, FALSE); 1677 gtk_widget_set_sensitive(button, FALSE);
1678 else 1678 else
1679 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1679 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1680 1680
1681 1681
1682 if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, XFER_IFACE, send)) 1682 if (protocol && PURPLE_IS_PROTOCOL_XFER(protocol))
1683 { 1683 {
1684 gboolean can_receive_file = TRUE; 1684 gboolean can_receive_file = TRUE;
1685 1685
1686 button = pidgin_new_menu_item(menu, _("Send File"), 1686 button = pidgin_new_menu_item(menu, _("Send File"),
1687 PIDGIN_STOCK_TOOLBAR_SEND_FILE, G_CALLBACK(menu_chat_send_file_cb), 1687 PIDGIN_STOCK_TOOLBAR_SEND_FILE, G_CALLBACK(menu_chat_send_file_cb),
1691 can_receive_file = FALSE; 1691 can_receive_file = FALSE;
1692 else { 1692 else {
1693 gchar *real_who = NULL; 1693 gchar *real_who = NULL;
1694 real_who = purple_protocol_chat_iface_get_user_real_name(protocol, gc, 1694 real_who = purple_protocol_chat_iface_get_user_real_name(protocol, gc,
1695 purple_chat_conversation_get_id(chat), who); 1695 purple_chat_conversation_get_id(chat), who);
1696 if (!(!PURPLE_PROTOCOL_IMPLEMENTS(protocol, XFER_IFACE, can_receive) || 1696
1697 purple_protocol_xfer_iface_can_receive(protocol, gc, real_who ? real_who : who))) 1697 if (!purple_protocol_xfer_can_receive(protocol, gc, real_who ? real_who : who)) {
1698 can_receive_file = FALSE; 1698 can_receive_file = FALSE;
1699 }
1700
1699 g_free(real_who); 1701 g_free(real_who);
1700 } 1702 }
1701 1703
1702 if (!can_receive_file) 1704 if (!can_receive_file)
1703 gtk_widget_set_sensitive(button, FALSE); 1705 gtk_widget_set_sensitive(button, FALSE);
7422 gtk_action_set_sensitive(win->menu->insert_link, (features & PURPLE_CONNECTION_FLAG_HTML)); 7424 gtk_action_set_sensitive(win->menu->insert_link, (features & PURPLE_CONNECTION_FLAG_HTML));
7423 gtk_action_set_sensitive(win->menu->insert_image, !(features & PURPLE_CONNECTION_FLAG_NO_IMAGES)); 7425 gtk_action_set_sensitive(win->menu->insert_image, !(features & PURPLE_CONNECTION_FLAG_NO_IMAGES));
7424 7426
7425 if (PURPLE_IS_IM_CONVERSATION(conv)) 7427 if (PURPLE_IS_IM_CONVERSATION(conv))
7426 { 7428 {
7429 gboolean can_send_file = FALSE;
7430 const gchar *name = purple_conversation_get_name(conv);
7431
7432 if (PURPLE_IS_PROTOCOL_XFER(protocol) &&
7433 purple_protocol_xfer_can_receive(PURPLE_PROTOCOL_XFER(protocol), gc, name)
7434 ) {
7435 can_send_file = TRUE;
7436 }
7437
7427 gtk_action_set_sensitive(win->menu->add, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, add_buddy))); 7438 gtk_action_set_sensitive(win->menu->add, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, add_buddy)));
7428 gtk_action_set_sensitive(win->menu->remove, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, remove_buddy))); 7439 gtk_action_set_sensitive(win->menu->remove, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, remove_buddy)));
7429 gtk_action_set_sensitive(win->menu->send_file, 7440 gtk_action_set_sensitive(win->menu->send_file, can_send_file);
7430 (PURPLE_PROTOCOL_IMPLEMENTS(protocol, XFER_IFACE, send) &&
7431 (!PURPLE_PROTOCOL_IMPLEMENTS(protocol, XFER_IFACE, can_receive) ||
7432 purple_protocol_xfer_iface_can_receive(protocol, gc, purple_conversation_get_name(conv)))));
7433 gtk_action_set_sensitive(win->menu->get_attention, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, ATTENTION_IFACE, send))); 7441 gtk_action_set_sensitive(win->menu->get_attention, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, ATTENTION_IFACE, send)));
7434 gtk_action_set_sensitive(win->menu->alias, 7442 gtk_action_set_sensitive(win->menu->alias,
7435 (account != NULL) && 7443 (account != NULL) &&
7436 (purple_blist_find_buddy(account, purple_conversation_get_name(conv)) != NULL)); 7444 (purple_blist_find_buddy(account, purple_conversation_get_name(conv)) != NULL));
7437 } 7445 }

mercurial