comparison finch/gntconv.c @ 32716:4f8626d4ef63

propagate from branch 'im.pidgin.pidgin' (head deb06ab6aa118efb674f1a8434ff529e67b28809) to branch 'im.pidgin.cpw.qulogic.gtk3' (head 34c3103eabae4a4c23439048d383f73c94dfd23e)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 23 Feb 2012 08:13:23 +0000
parents f5e193735392
children
comparison
equal deleted inserted replaced
32715:4ae0c82b158d 32716:4f8626d4ef63
50 #include "gntentry.h" 50 #include "gntentry.h"
51 #include "gntlabel.h" 51 #include "gntlabel.h"
52 #include "gntmenu.h" 52 #include "gntmenu.h"
53 #include "gntmenuitem.h" 53 #include "gntmenuitem.h"
54 #include "gntmenuitemcheck.h" 54 #include "gntmenuitemcheck.h"
55 #include "gntmenuutil.h"
55 #include "gntstyle.h" 56 #include "gntstyle.h"
56 #include "gnttextview.h" 57 #include "gnttextview.h"
57 #include "gnttree.h" 58 #include "gnttree.h"
58 #include "gntutils.h" 59 #include "gntutils.h"
59 #include "gntwindow.h" 60 #include "gntwindow.h"
402 if (ggc) 403 if (ggc)
403 gnt_text_view_clear(GNT_TEXT_VIEW(ggc->tv)); 404 gnt_text_view_clear(GNT_TEXT_VIEW(ggc->tv));
404 } 405 }
405 406
406 static void 407 static void
408 gg_extended_menu(FinchConv *ggc)
409 {
410 GntWidget *sub;
411 GList *list;
412
413 sub = gnt_menu_new(GNT_MENU_POPUP);
414 gnt_menuitem_set_submenu(ggc->plugins, GNT_MENU(sub));
415
416 for (list = purple_conversation_get_extended_menu(ggc->active_conv);
417 list; list = g_list_delete_link(list, list))
418 {
419 gnt_append_menu_action(GNT_MENU(sub), list->data, ggc->active_conv);
420 }
421 }
422
423 static void
424 conv_updated(PurpleConversation *conv, PurpleConvUpdateType type)
425 {
426 if (type == PURPLE_CONV_UPDATE_FEATURES) {
427 gg_extended_menu(purple_conversation_get_ui_data(conv));
428 }
429 }
430
431 static void
407 clear_scrollback_cb(GntMenuItem *item, gpointer ggconv) 432 clear_scrollback_cb(GntMenuItem *item, gpointer ggconv)
408 { 433 {
409 FinchConv *ggc = ggconv; 434 FinchConv *ggc = ggconv;
410 purple_conversation_clear_message_history(ggc->active_conv); 435 purple_conversation_clear_message_history(ggc->active_conv);
411 } 436 }
593 PurpleConversation *conv = fc->active_conv; 618 PurpleConversation *conv = fc->active_conv;
594 purple_conv_chat_invite_user(PURPLE_CONV_CHAT(conv), NULL, NULL, TRUE); 619 purple_conv_chat_invite_user(PURPLE_CONV_CHAT(conv), NULL, NULL, TRUE);
595 } 620 }
596 621
597 static void 622 static void
623 plugin_changed_cb(PurplePlugin *p, gpointer data)
624 {
625 gg_extended_menu(data);
626 }
627
628 static void
598 gg_create_menu(FinchConv *ggc) 629 gg_create_menu(FinchConv *ggc)
599 { 630 {
600 GntWidget *menu, *sub; 631 GntWidget *menu, *sub;
601 GntMenuItem *item; 632 GntMenuItem *item;
602 633
663 item = gnt_menuitem_check_new(_("Enable Sounds")); 694 item = gnt_menuitem_check_new(_("Enable Sounds"));
664 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), 695 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item),
665 !(ggc->flags & FINCH_CONV_NO_SOUND)); 696 !(ggc->flags & FINCH_CONV_NO_SOUND));
666 gnt_menu_add_item(GNT_MENU(sub), item); 697 gnt_menu_add_item(GNT_MENU(sub), item);
667 gnt_menuitem_set_callback(item, toggle_sound_cb, ggc); 698 gnt_menuitem_set_callback(item, toggle_sound_cb, ggc);
699
700 item = gnt_menuitem_new(_("Plugins"));
701 gnt_menu_add_item(GNT_MENU(menu), item);
702 ggc->plugins = item;
703
704 gg_extended_menu(ggc);
668 } 705 }
669 706
670 static void 707 static void
671 create_conv_from_userlist(GntWidget *widget, FinchConv *fc) 708 create_conv_from_userlist(GntWidget *widget, FinchConv *fc)
672 { 709 {
873 910
874 purple_signal_connect(purple_cmds_get_handle(), "cmd-added", ggc, 911 purple_signal_connect(purple_cmds_get_handle(), "cmd-added", ggc,
875 G_CALLBACK(cmd_added_cb), ggc); 912 G_CALLBACK(cmd_added_cb), ggc);
876 purple_signal_connect(purple_cmds_get_handle(), "cmd-removed", ggc, 913 purple_signal_connect(purple_cmds_get_handle(), "cmd-removed", ggc,
877 G_CALLBACK(cmd_removed_cb), ggc); 914 G_CALLBACK(cmd_removed_cb), ggc);
915
916 purple_signal_connect(purple_plugins_get_handle(), "plugin-load", ggc,
917 PURPLE_CALLBACK(plugin_changed_cb), ggc);
918 purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", ggc,
919 PURPLE_CALLBACK(plugin_changed_cb), ggc);
878 920
879 g_free(title); 921 g_free(title);
880 gnt_box_give_focus_to_child(GNT_BOX(ggc->window), ggc->entry); 922 gnt_box_give_focus_to_child(GNT_BOX(ggc->window), ggc->entry);
881 g_signal_connect(G_OBJECT(ggc->window), "gained-focus", G_CALLBACK(gained_focus_cb), ggc); 923 g_signal_connect(G_OBJECT(ggc->window), "gained-focus", G_CALLBACK(gained_focus_cb), ggc);
882 } 924 }
1473 PURPLE_CALLBACK(update_buddy_typing), NULL); 1515 PURPLE_CALLBACK(update_buddy_typing), NULL);
1474 purple_signal_connect(purple_conversations_get_handle(), "chat-left", finch_conv_get_handle(), 1516 purple_signal_connect(purple_conversations_get_handle(), "chat-left", finch_conv_get_handle(),
1475 PURPLE_CALLBACK(chat_left_cb), NULL); 1517 PURPLE_CALLBACK(chat_left_cb), NULL);
1476 purple_signal_connect(purple_conversations_get_handle(), "cleared-message-history", finch_conv_get_handle(), 1518 purple_signal_connect(purple_conversations_get_handle(), "cleared-message-history", finch_conv_get_handle(),
1477 PURPLE_CALLBACK(cleared_message_history_cb), NULL); 1519 PURPLE_CALLBACK(cleared_message_history_cb), NULL);
1520 purple_signal_connect(purple_conversations_get_handle(), "conversation-updated", finch_conv_get_handle(),
1521 PURPLE_CALLBACK(conv_updated), NULL);
1478 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", finch_conv_get_handle(), 1522 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", finch_conv_get_handle(),
1479 PURPLE_CALLBACK(buddy_signed_on_off), NULL); 1523 PURPLE_CALLBACK(buddy_signed_on_off), NULL);
1480 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", finch_conv_get_handle(), 1524 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", finch_conv_get_handle(),
1481 PURPLE_CALLBACK(buddy_signed_on_off), NULL); 1525 PURPLE_CALLBACK(buddy_signed_on_off), NULL);
1482 purple_signal_connect(purple_connections_get_handle(), "signed-on", finch_conv_get_handle(), 1526 purple_signal_connect(purple_connections_get_handle(), "signed-on", finch_conv_get_handle(),