pidgin/gtkconv.c

changeset 39759
ea1401483849
parent 39711
ce5050149408
child 39812
d9367dc7edfd
child 39814
c21f36658ac4
equal deleted inserted replaced
39758:a0e894209b3e 39759:ea1401483849
1349 gtk_widget_set_sensitive(button, FALSE); 1349 gtk_widget_set_sensitive(button, FALSE);
1350 else 1350 else
1351 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1351 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1352 } 1352 }
1353 1353
1354 if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, get_info)) { 1354 if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, get_info)) {
1355 button = pidgin_new_menu_item(menu, _("Info"), 1355 button = pidgin_new_menu_item(menu, _("Info"),
1356 PIDGIN_STOCK_TOOLBAR_USER_INFO, 1356 PIDGIN_STOCK_TOOLBAR_USER_INFO,
1357 G_CALLBACK(menu_chat_info_cb), 1357 G_CALLBACK(menu_chat_info_cb),
1358 PIDGIN_CONVERSATION(conv)); 1358 PIDGIN_CONVERSATION(conv));
1359 1359
1361 gtk_widget_set_sensitive(button, FALSE); 1361 gtk_widget_set_sensitive(button, FALSE);
1362 else 1362 else
1363 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); 1363 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free);
1364 } 1364 }
1365 1365
1366 if (!is_me && protocol && !(purple_protocol_get_options(protocol) & OPT_PROTO_UNIQUE_CHATNAME) && PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, add_buddy)) { 1366 if (!is_me && protocol && !(purple_protocol_get_options(protocol) & OPT_PROTO_UNIQUE_CHATNAME) && PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, add_buddy)) {
1367 if ((buddy = purple_blist_find_buddy(account, who)) != NULL) 1367 if ((buddy = purple_blist_find_buddy(account, who)) != NULL)
1368 button = pidgin_new_menu_item(menu, _("Remove"), 1368 button = pidgin_new_menu_item(menu, _("Remove"),
1369 GTK_STOCK_REMOVE, 1369 GTK_STOCK_REMOVE,
1370 G_CALLBACK(menu_chat_add_remove_cb), 1370 G_CALLBACK(menu_chat_add_remove_cb),
1371 PIDGIN_CONVERSATION(conv)); 1371 PIDGIN_CONVERSATION(conv));
2699 GHashTable *components; 2699 GHashTable *components;
2700 PurpleAccount *account = purple_conversation_get_account(conv); 2700 PurpleAccount *account = purple_conversation_get_account(conv);
2701 PurpleProtocol *protocol = 2701 PurpleProtocol *protocol =
2702 purple_protocols_find(purple_account_get_protocol_id(account)); 2702 purple_protocols_find(purple_account_get_protocol_id(account));
2703 if (purple_account_get_connection(account) != NULL && 2703 if (purple_account_get_connection(account) != NULL &&
2704 PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, info_defaults)) { 2704 PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, info_defaults)) {
2705 components = purple_protocol_chat_iface_info_defaults(protocol, purple_account_get_connection(account), 2705 components = purple_protocol_chat_iface_info_defaults(protocol, purple_account_get_connection(account),
2706 purple_conversation_get_name(conv)); 2706 purple_conversation_get_name(conv));
2707 } else { 2707 } else {
2708 components = g_hash_table_new_full(g_str_hash, g_str_equal, 2708 components = g_hash_table_new_full(g_str_hash, g_str_equal,
2709 g_free, g_free); 2709 g_free, g_free);
3779 gc = purple_conversation_get_connection(conv); 3779 gc = purple_conversation_get_connection(conv);
3780 3780
3781 if(!gc || !(protocol = purple_connection_get_protocol(gc))) 3781 if(!gc || !(protocol = purple_connection_get_protocol(gc)))
3782 return; 3782 return;
3783 3783
3784 if(!PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, set_topic)) 3784 if(!PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, set_topic))
3785 return; 3785 return;
3786 3786
3787 gtkconv = PIDGIN_CONVERSATION(conv); 3787 gtkconv = PIDGIN_CONVERSATION(conv);
3788 gtkchat = gtkconv->u.chat; 3788 gtkchat = gtkconv->u.chat;
3789 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text))); 3789 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)));
4061 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); 4061 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
4062 4062
4063 gtkchat->topic_text = gtk_entry_new(); 4063 gtkchat->topic_text = gtk_entry_new();
4064 gtk_widget_set_size_request(gtkchat->topic_text, -1, BUDDYICON_SIZE_MIN); 4064 gtk_widget_set_size_request(gtkchat->topic_text, -1, BUDDYICON_SIZE_MIN);
4065 4065
4066 if(!PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, set_topic)) { 4066 if(!PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, set_topic)) {
4067 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE); 4067 gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE);
4068 } else { 4068 } else {
4069 g_signal_connect(G_OBJECT(gtkchat->topic_text), "activate", 4069 g_signal_connect(G_OBJECT(gtkchat->topic_text), "activate",
4070 G_CALLBACK(topic_callback), gtkconv); 4070 G_CALLBACK(topic_callback), gtkconv);
4071 } 4071 }
5283 #endif 5283 #endif
5284 5284
5285 /* Deal with menu items */ 5285 /* Deal with menu items */
5286 gtk_action_set_sensitive(win->menu->view_log, TRUE); 5286 gtk_action_set_sensitive(win->menu->view_log, TRUE);
5287 gtk_action_set_sensitive(win->menu->add_pounce, TRUE); 5287 gtk_action_set_sensitive(win->menu->add_pounce, TRUE);
5288 gtk_action_set_sensitive(win->menu->get_info, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, get_info))); 5288 gtk_action_set_sensitive(win->menu->get_info, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, get_info)));
5289 gtk_action_set_sensitive(win->menu->invite, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, invite))); 5289 gtk_action_set_sensitive(win->menu->invite, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, invite)));
5290 gtk_action_set_sensitive(win->menu->insert_link, (features & PURPLE_CONNECTION_FLAG_HTML)); 5290 gtk_action_set_sensitive(win->menu->insert_link, (features & PURPLE_CONNECTION_FLAG_HTML));
5291 gtk_action_set_sensitive(win->menu->insert_image, !(features & PURPLE_CONNECTION_FLAG_NO_IMAGES)); 5291 gtk_action_set_sensitive(win->menu->insert_image, !(features & PURPLE_CONNECTION_FLAG_NO_IMAGES));
5292 5292
5293 if (PURPLE_IS_IM_CONVERSATION(conv)) 5293 if (PURPLE_IS_IM_CONVERSATION(conv))
5294 { 5294 {
5299 purple_protocol_xfer_can_receive(PURPLE_PROTOCOL_XFER(protocol), gc, name) 5299 purple_protocol_xfer_can_receive(PURPLE_PROTOCOL_XFER(protocol), gc, name)
5300 ) { 5300 ) {
5301 can_send_file = TRUE; 5301 can_send_file = TRUE;
5302 } 5302 }
5303 5303
5304 gtk_action_set_sensitive(win->menu->add, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, add_buddy))); 5304 gtk_action_set_sensitive(win->menu->add, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, add_buddy)));
5305 gtk_action_set_sensitive(win->menu->remove, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, remove_buddy))); 5305 gtk_action_set_sensitive(win->menu->remove, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, remove_buddy)));
5306 gtk_action_set_sensitive(win->menu->send_file, can_send_file); 5306 gtk_action_set_sensitive(win->menu->send_file, can_send_file);
5307 gtk_action_set_sensitive(win->menu->get_attention, (PURPLE_IS_PROTOCOL_ATTENTION(protocol))); 5307 gtk_action_set_sensitive(win->menu->get_attention, (PURPLE_IS_PROTOCOL_ATTENTION(protocol)));
5308 gtk_action_set_sensitive(win->menu->alias, 5308 gtk_action_set_sensitive(win->menu->alias,
5309 (account != NULL) && 5309 (account != NULL) &&
5310 (purple_blist_find_buddy(account, purple_conversation_get_name(conv)) != NULL)); 5310 (purple_blist_find_buddy(account, purple_conversation_get_name(conv)) != NULL));
5311 } 5311 }
5312 else if (PURPLE_IS_CHAT_CONVERSATION(conv)) 5312 else if (PURPLE_IS_CHAT_CONVERSATION(conv))
5313 { 5313 {
5314 gtk_action_set_sensitive(win->menu->add, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, join))); 5314 gtk_action_set_sensitive(win->menu->add, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, join)));
5315 gtk_action_set_sensitive(win->menu->remove, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, join))); 5315 gtk_action_set_sensitive(win->menu->remove, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, join)));
5316 gtk_action_set_sensitive(win->menu->alias, 5316 gtk_action_set_sensitive(win->menu->alias,
5317 (account != NULL) && 5317 (account != NULL) &&
5318 (purple_blist_find_chat(account, purple_conversation_get_name(conv)) != NULL)); 5318 (purple_blist_find_chat(account, purple_conversation_get_name(conv)) != NULL));
5319 } 5319 }
5320 5320
7801 PurpleProtocol *protocol = NULL; 7801 PurpleProtocol *protocol = NULL;
7802 7802
7803 gc = purple_conversation_get_connection(conv); 7803 gc = purple_conversation_get_connection(conv);
7804 if (gc != NULL) 7804 if (gc != NULL)
7805 protocol = purple_connection_get_protocol(gc); 7805 protocol = purple_connection_get_protocol(gc);
7806 if (protocol && !PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, set_topic)) 7806 if (protocol && !PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, set_topic))
7807 /* This protocol doesn't support setting the chat room topic */ 7807 /* This protocol doesn't support setting the chat room topic */
7808 return FALSE; 7808 return FALSE;
7809 7809
7810 text = purple_chat_conversation_get_topic(PURPLE_CHAT_CONVERSATION(conv)); 7810 text = purple_chat_conversation_get_topic(PURPLE_CHAT_CONVERSATION(conv));
7811 } 7811 }

mercurial