pidgin/gtkconv.c

changeset 28112
ce9a7ec4f6e1
parent 27779
ad70fa8a4ae2
child 28129
9259178fbac7
equal deleted inserted replaced
28111:61de2e173be9 28112:ce9a7ec4f6e1
3324 } 3324 }
3325 return ret; 3325 return ret;
3326 } 3326 }
3327 3327
3328 static void 3328 static void
3329 regenerate_media_items(PidginWindow *win)
3330 {
3331 #ifdef USE_VV
3332 PurpleAccount *account;
3333 PurpleConversation *conv;
3334
3335 conv = pidgin_conv_window_get_active_conversation(win);
3336
3337 if (conv == NULL) {
3338 purple_debug_error("gtkconv", "couldn't get active conversation"
3339 " when regenerating media items\n");
3340 return;
3341 }
3342
3343 account = purple_conversation_get_account(conv);
3344
3345 if (account == NULL) {
3346 purple_debug_error("gtkconv", "couldn't get account when"
3347 " regenerating media items\n");
3348 return;
3349 }
3350
3351 /*
3352 * Check if account support voice and/or calls, and
3353 * if the current buddy supports it.
3354 */
3355 if (account != NULL && purple_conversation_get_type(conv)
3356 == PURPLE_CONV_TYPE_IM) {
3357 PurpleMediaCaps caps =
3358 purple_prpl_get_media_caps(account,
3359 purple_conversation_get_name(conv));
3360
3361 gtk_widget_set_sensitive(win->audio_call,
3362 caps & PURPLE_MEDIA_CAPS_AUDIO
3363 ? TRUE : FALSE);
3364 gtk_widget_set_sensitive(win->video_call,
3365 caps & PURPLE_MEDIA_CAPS_VIDEO
3366 ? TRUE : FALSE);
3367 gtk_widget_set_sensitive(win->audio_video_call,
3368 caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO
3369 ? TRUE : FALSE);
3370 } else if (purple_conversation_get_type(conv)
3371 == PURPLE_CONV_TYPE_CHAT) {
3372 /* for now, don't care about chats... */
3373 gtk_widget_set_sensitive(win->audio_call, FALSE);
3374 gtk_widget_set_sensitive(win->video_call, FALSE);
3375 gtk_widget_set_sensitive(win->audio_video_call, FALSE);
3376 } else {
3377 gtk_widget_set_sensitive(win->audio_call, FALSE);
3378 gtk_widget_set_sensitive(win->video_call, FALSE);
3379 gtk_widget_set_sensitive(win->audio_video_call, FALSE);
3380 }
3381 #endif
3382 }
3383
3384 static void
3329 regenerate_options_items(PidginWindow *win) 3385 regenerate_options_items(PidginWindow *win)
3330 { 3386 {
3331 GtkWidget *menu; 3387 GtkWidget *menu;
3332 PidginConversation *gtkconv; 3388 PidginConversation *gtkconv;
3333 GList *list; 3389 GList *list;
3408 } 3464 }
3409 3465
3410 static void menubar_activated(GtkWidget *item, gpointer data) 3466 static void menubar_activated(GtkWidget *item, gpointer data)
3411 { 3467 {
3412 PidginWindow *win = data; 3468 PidginWindow *win = data;
3469 regenerate_media_items(win);
3413 regenerate_options_items(win); 3470 regenerate_options_items(win);
3414 regenerate_plugins_items(win); 3471 regenerate_plugins_items(win);
3415 3472
3416 /* The following are to make sure the 'More' submenu is not regenerated every time 3473 /* The following are to make sure the 'More' submenu is not regenerated every time
3417 * the focus shifts from 'Conversations' to some other menu and back. */ 3474 * the focus shifts from 'Conversations' to some other menu and back. */
6482 6539
6483 if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) 6540 if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY)
6484 buttons |= GTK_IMHTML_CUSTOM_SMILEY; 6541 buttons |= GTK_IMHTML_CUSTOM_SMILEY;
6485 else 6542 else
6486 buttons &= ~GTK_IMHTML_CUSTOM_SMILEY; 6543 buttons &= ~GTK_IMHTML_CUSTOM_SMILEY;
6487
6488 #ifdef USE_VV
6489 /* check if account support voice calls, and if the current buddy
6490 supports it */
6491 if (account != NULL && purple_conversation_get_type(conv)
6492 == PURPLE_CONV_TYPE_IM) {
6493 PurpleMediaCaps caps =
6494 purple_prpl_get_media_caps(account,
6495 purple_conversation_get_name(conv));
6496
6497 gtk_widget_set_sensitive(win->audio_call,
6498 caps & PURPLE_MEDIA_CAPS_AUDIO
6499 ? TRUE : FALSE);
6500 gtk_widget_set_sensitive(win->video_call,
6501 caps & PURPLE_MEDIA_CAPS_VIDEO
6502 ? TRUE : FALSE);
6503 gtk_widget_set_sensitive(win->audio_video_call,
6504 caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO
6505 ? TRUE : FALSE);
6506 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
6507 /* for now, don't care about chats... */
6508 gtk_widget_set_sensitive(win->audio_call, FALSE);
6509 gtk_widget_set_sensitive(win->video_call, FALSE);
6510 gtk_widget_set_sensitive(win->audio_video_call, FALSE);
6511 } else {
6512 gtk_widget_set_sensitive(win->audio_call, FALSE);
6513 gtk_widget_set_sensitive(win->video_call, FALSE);
6514 gtk_widget_set_sensitive(win->audio_video_call, FALSE);
6515 }
6516 #endif
6517 6544
6518 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); 6545 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons);
6519 if (account != NULL) 6546 if (account != NULL)
6520 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account)); 6547 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account));
6521 6548

mercurial