Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 29692:fb99a0067812
propagate from branch 'im.pidgin.pidgin' (head 70d69397ed952b26b453423c381c70d6783eb66d)
to branch 'im.pidgin.cpw.attention_ui' (head 1cf0dea282a0d0e4aeac4770e0150d6d0c10830a)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Thu, 13 Aug 2009 17:42:44 +0000 |
parents | 338d6a211055 6f27b4d8c1c3 |
children | 7925bb7f2aa7 |
comparison
equal
deleted
inserted
replaced
29691:338d6a211055 | 29692:fb99a0067812 |
---|---|
3344 } | 3344 } |
3345 return ret; | 3345 return ret; |
3346 } | 3346 } |
3347 | 3347 |
3348 static void | 3348 static void |
3349 regenerate_media_items(PidginWindow *win) | |
3350 { | |
3351 #ifdef USE_VV | |
3352 PurpleAccount *account; | |
3353 PurpleConversation *conv; | |
3354 | |
3355 conv = pidgin_conv_window_get_active_conversation(win); | |
3356 | |
3357 if (conv == NULL) { | |
3358 purple_debug_error("gtkconv", "couldn't get active conversation" | |
3359 " when regenerating media items\n"); | |
3360 return; | |
3361 } | |
3362 | |
3363 account = purple_conversation_get_account(conv); | |
3364 | |
3365 if (account == NULL) { | |
3366 purple_debug_error("gtkconv", "couldn't get account when" | |
3367 " regenerating media items\n"); | |
3368 return; | |
3369 } | |
3370 | |
3371 /* | |
3372 * Check if account support voice and/or calls, and | |
3373 * if the current buddy supports it. | |
3374 */ | |
3375 if (account != NULL && purple_conversation_get_type(conv) | |
3376 == PURPLE_CONV_TYPE_IM) { | |
3377 PurpleMediaCaps caps = | |
3378 purple_prpl_get_media_caps(account, | |
3379 purple_conversation_get_name(conv)); | |
3380 | |
3381 gtk_widget_set_sensitive(win->audio_call, | |
3382 caps & PURPLE_MEDIA_CAPS_AUDIO | |
3383 ? TRUE : FALSE); | |
3384 gtk_widget_set_sensitive(win->video_call, | |
3385 caps & PURPLE_MEDIA_CAPS_VIDEO | |
3386 ? TRUE : FALSE); | |
3387 gtk_widget_set_sensitive(win->audio_video_call, | |
3388 caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO | |
3389 ? TRUE : FALSE); | |
3390 } else if (purple_conversation_get_type(conv) | |
3391 == PURPLE_CONV_TYPE_CHAT) { | |
3392 /* for now, don't care about chats... */ | |
3393 gtk_widget_set_sensitive(win->audio_call, FALSE); | |
3394 gtk_widget_set_sensitive(win->video_call, FALSE); | |
3395 gtk_widget_set_sensitive(win->audio_video_call, FALSE); | |
3396 } else { | |
3397 gtk_widget_set_sensitive(win->audio_call, FALSE); | |
3398 gtk_widget_set_sensitive(win->video_call, FALSE); | |
3399 gtk_widget_set_sensitive(win->audio_video_call, FALSE); | |
3400 } | |
3401 #endif | |
3402 } | |
3403 | |
3404 static void | |
3349 regenerate_options_items(PidginWindow *win) | 3405 regenerate_options_items(PidginWindow *win) |
3350 { | 3406 { |
3351 GtkWidget *menu; | 3407 GtkWidget *menu; |
3352 PidginConversation *gtkconv; | 3408 PidginConversation *gtkconv; |
3353 GList *list; | 3409 GList *list; |
3428 } | 3484 } |
3429 | 3485 |
3430 static void menubar_activated(GtkWidget *item, gpointer data) | 3486 static void menubar_activated(GtkWidget *item, gpointer data) |
3431 { | 3487 { |
3432 PidginWindow *win = data; | 3488 PidginWindow *win = data; |
3489 regenerate_media_items(win); | |
3433 regenerate_options_items(win); | 3490 regenerate_options_items(win); |
3434 regenerate_plugins_items(win); | 3491 regenerate_plugins_items(win); |
3435 | 3492 |
3436 /* The following are to make sure the 'More' submenu is not regenerated every time | 3493 /* The following are to make sure the 'More' submenu is not regenerated every time |
3437 * the focus shifts from 'Conversations' to some other menu and back. */ | 3494 * the focus shifts from 'Conversations' to some other menu and back. */ |
4329 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ | 4386 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ |
4330 g_free(new_topic); | 4387 g_free(new_topic); |
4331 return; | 4388 return; |
4332 } | 4389 } |
4333 | 4390 |
4334 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic); | 4391 if (current_topic) |
4392 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic); | |
4393 else | |
4394 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), ""); | |
4395 | |
4335 prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), | 4396 prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), |
4336 new_topic); | 4397 new_topic); |
4337 | 4398 |
4338 g_free(new_topic); | 4399 g_free(new_topic); |
4339 } | 4400 } |
5397 received_im_msg_cb(PurpleAccount *account, char *sender, char *message, | 5458 received_im_msg_cb(PurpleAccount *account, char *sender, char *message, |
5398 PurpleConversation *conv, PurpleMessageFlags flags) | 5459 PurpleConversation *conv, PurpleMessageFlags flags) |
5399 { | 5460 { |
5400 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); | 5461 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); |
5401 gboolean hide = FALSE; | 5462 gboolean hide = FALSE; |
5463 guint timer; | |
5402 | 5464 |
5403 /* create hidden conv if hide_new pref is always */ | 5465 /* create hidden conv if hide_new pref is always */ |
5404 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always") == 0) | 5466 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always") == 0) |
5405 hide = TRUE; | 5467 hide = TRUE; |
5406 | 5468 |
5419 | 5481 |
5420 if (hide) { | 5482 if (hide) { |
5421 ui_ops->create_conversation = pidgin_conv_new_hidden; | 5483 ui_ops->create_conversation = pidgin_conv_new_hidden; |
5422 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); | 5484 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
5423 ui_ops->create_conversation = pidgin_conv_new; | 5485 ui_ops->create_conversation = pidgin_conv_new; |
5486 } | |
5487 | |
5488 /* Somebody wants to keep this conversation around, so don't time it out */ | |
5489 timer = GPOINTER_TO_INT(purple_conversation_get_data(conv, "close-timer")); | |
5490 if (timer) { | |
5491 purple_timeout_remove(timer); | |
5492 purple_conversation_set_data(conv, "close-timer", GINT_TO_POINTER(0)); | |
5424 } | 5493 } |
5425 } | 5494 } |
5426 | 5495 |
5427 static void | 5496 static void |
5428 pidgin_conv_destroy(PurpleConversation *conv) | 5497 pidgin_conv_destroy(PurpleConversation *conv) |
6507 | 6576 |
6508 if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) | 6577 if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) |
6509 buttons |= GTK_IMHTML_CUSTOM_SMILEY; | 6578 buttons |= GTK_IMHTML_CUSTOM_SMILEY; |
6510 else | 6579 else |
6511 buttons &= ~GTK_IMHTML_CUSTOM_SMILEY; | 6580 buttons &= ~GTK_IMHTML_CUSTOM_SMILEY; |
6512 | |
6513 #ifdef USE_VV | |
6514 /* check if account support voice calls, and if the current buddy | |
6515 supports it */ | |
6516 if (account != NULL && purple_conversation_get_type(conv) | |
6517 == PURPLE_CONV_TYPE_IM) { | |
6518 PurpleMediaCaps caps = | |
6519 purple_prpl_get_media_caps(account, | |
6520 purple_conversation_get_name(conv)); | |
6521 | |
6522 gtk_widget_set_sensitive(win->audio_call, | |
6523 caps & PURPLE_MEDIA_CAPS_AUDIO | |
6524 ? TRUE : FALSE); | |
6525 gtk_widget_set_sensitive(win->video_call, | |
6526 caps & PURPLE_MEDIA_CAPS_VIDEO | |
6527 ? TRUE : FALSE); | |
6528 gtk_widget_set_sensitive(win->audio_video_call, | |
6529 caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO | |
6530 ? TRUE : FALSE); | |
6531 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { | |
6532 /* for now, don't care about chats... */ | |
6533 gtk_widget_set_sensitive(win->audio_call, FALSE); | |
6534 gtk_widget_set_sensitive(win->video_call, FALSE); | |
6535 gtk_widget_set_sensitive(win->audio_video_call, FALSE); | |
6536 } else { | |
6537 gtk_widget_set_sensitive(win->audio_call, FALSE); | |
6538 gtk_widget_set_sensitive(win->video_call, FALSE); | |
6539 gtk_widget_set_sensitive(win->audio_video_call, FALSE); | |
6540 } | |
6541 #endif | |
6542 | 6581 |
6543 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | 6582 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); |
6544 if (account != NULL) | 6583 if (account != NULL) |
6545 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account)); | 6584 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account)); |
6546 | 6585 |