Mercurial > pidgin
comparison src/gtkconv.c @ 9750:4f8476beabf5
[gaim-migrate @ 10617]
Fix chat buttons and make a few more tweaks
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 15 Aug 2004 15:45:35 +0000 |
parents | a2fd9abea23a |
children | 4a8bf81b82ae |
comparison
equal
deleted
inserted
replaced
9749:a2fd9abea23a | 9750:4f8476beabf5 |
---|---|
3667 | 3667 |
3668 buttons = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); | 3668 buttons = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
3669 button = gaim_pixbuf_button_from_stock( | 3669 button = gaim_pixbuf_button_from_stock( |
3670 (buttons == GAIM_BUTTON_IMAGE ? NULL : text), | 3670 (buttons == GAIM_BUTTON_IMAGE ? NULL : text), |
3671 (buttons == GAIM_BUTTON_TEXT ? NULL : icon), | 3671 (buttons == GAIM_BUTTON_TEXT ? NULL : icon), |
3672 GAIM_CONV_IM); | 3672 GAIM_BUTTON_VERTICAL); |
3673 gtk_tooltips_set_tip(tooltips, button, tooltip, NULL); | 3673 gtk_tooltips_set_tip(tooltips, button, tooltip, NULL); |
3674 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | 3674 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
3675 g_signal_connect(G_OBJECT(button), "clicked", | 3675 g_signal_connect(G_OBJECT(button), "clicked", |
3676 G_CALLBACK(callback), data); | 3676 G_CALLBACK(callback), data); |
3677 | 3677 |
3683 { | 3683 { |
3684 GaimConnection *gc; | 3684 GaimConnection *gc; |
3685 GaimGtkConversation *gtkconv; | 3685 GaimGtkConversation *gtkconv; |
3686 GaimGtkImPane *gtkim; | 3686 GaimGtkImPane *gtkim; |
3687 GaimButtonStyle button_type; | 3687 GaimButtonStyle button_type; |
3688 GtkWidget *hbox; | |
3689 GList *children; | 3688 GList *children; |
3690 | 3689 |
3691 gtkconv = GAIM_GTK_CONVERSATION(conv); | 3690 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3692 gtkim = gtkconv->u.im; | 3691 gtkim = gtkconv->u.im; |
3693 gc = gaim_conversation_get_gc(conv); | 3692 gc = gaim_conversation_get_gc(conv); |
3697 while (children != NULL) { | 3696 while (children != NULL) { |
3698 gtk_container_remove(GTK_CONTAINER(parent), children->data); | 3697 gtk_container_remove(GTK_CONTAINER(parent), children->data); |
3699 children = g_list_remove(children, children->data); | 3698 children = g_list_remove(children, children->data); |
3700 } | 3699 } |
3701 | 3700 |
3702 /* The buttons, in order from left to right: */ | 3701 /* The buttons, from left to right */ |
3703 hbox = gtk_hbox_new(TRUE, 0); | |
3704 gtk_box_pack_start(GTK_BOX(parent), hbox, TRUE, TRUE, 0); | |
3705 gtk_widget_show(hbox); | |
3706 | 3702 |
3707 /* Warn button */ | 3703 /* Warn button */ |
3708 gtkim->warn = new_gtkconv_button(GAIM_STOCK_WARN, _("Warn"), | 3704 gtkim->warn = new_gtkconv_button(GAIM_STOCK_WARN, _("Warn"), |
3709 _("Warn the user"), | 3705 _("Warn the user"), |
3710 gtkconv->tooltips, warn_cb, conv); | 3706 gtkconv->tooltips, warn_cb, conv); |
3711 gtk_box_pack_start(GTK_BOX(hbox), gtkim->warn, FALSE, FALSE, 0); | 3707 gtk_box_pack_start(GTK_BOX(parent), gtkim->warn, TRUE, TRUE, 0); |
3712 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); | 3708 gtk_size_group_add_widget(gtkconv->sg, gtkim->warn); |
3713 | 3709 |
3714 /* Block button */ | 3710 /* Block button */ |
3715 gtkim->block = new_gtkconv_button(GAIM_STOCK_BLOCK, _("Block"), | 3711 gtkim->block = new_gtkconv_button(GAIM_STOCK_BLOCK, _("Block"), |
3716 _("Block the user"), | 3712 _("Block the user"), |
3717 gtkconv->tooltips, block_cb, conv); | 3713 gtkconv->tooltips, block_cb, conv); |
3718 gtk_box_pack_start(GTK_BOX(hbox), gtkim->block, FALSE, FALSE, 0); | 3714 gtk_box_pack_start(GTK_BOX(parent), gtkim->block, TRUE, TRUE, 0); |
3719 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); | 3715 gtk_size_group_add_widget(gtkconv->sg, gtkim->block); |
3720 | 3716 |
3721 /* Send File button */ | 3717 /* Send File button */ |
3722 gtkim->send_file = new_gtkconv_button(GAIM_STOCK_FILE_TRANSFER, _("Send File"), | 3718 gtkim->send_file = new_gtkconv_button(GAIM_STOCK_FILE_TRANSFER, _("Send File"), |
3723 _("Send a file to the user"), | 3719 _("Send a file to the user"), |
3724 gtkconv->tooltips, send_file_cb, conv); | 3720 gtkconv->tooltips, send_file_cb, conv); |
3725 gtk_box_pack_start(GTK_BOX(hbox), gtkim->send_file, FALSE, FALSE, 0); | 3721 gtk_box_pack_start(GTK_BOX(parent), gtkim->send_file, TRUE, TRUE, 0); |
3726 gtk_size_group_add_widget(gtkconv->sg, gtkim->send_file); | 3722 gtk_size_group_add_widget(gtkconv->sg, gtkim->send_file); |
3727 | 3723 |
3728 /* Add button */ | 3724 /* Add button */ |
3729 gtkconv->add = new_gtkconv_button(GTK_STOCK_ADD, _("Add"), | 3725 gtkconv->add = new_gtkconv_button(GTK_STOCK_ADD, _("Add"), |
3730 _("Add the user to your buddy list"), | 3726 _("Add the user to your buddy list"), |
3731 gtkconv->tooltips, add_remove_cb, conv); | 3727 gtkconv->tooltips, add_remove_cb, conv); |
3732 gtk_box_pack_start(GTK_BOX(hbox), gtkconv->add, FALSE, FALSE, 0); | 3728 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, TRUE, TRUE, 0); |
3733 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | 3729 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); |
3734 | 3730 |
3735 /* Remove button */ | 3731 /* Remove button */ |
3736 gtkconv->remove = new_gtkconv_button(GTK_STOCK_REMOVE, _("Remove"), | 3732 gtkconv->remove = new_gtkconv_button(GTK_STOCK_REMOVE, _("Remove"), |
3737 _("Remove the user from your buddy list"), | 3733 _("Remove the user from your buddy list"), |
3738 gtkconv->tooltips, add_remove_cb, conv); | 3734 gtkconv->tooltips, add_remove_cb, conv); |
3739 gtk_box_pack_start(GTK_BOX(hbox), gtkconv->remove, FALSE, FALSE, 0); | 3735 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, TRUE, TRUE, 0); |
3740 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | 3736 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); |
3741 | 3737 |
3742 /* Info button */ | 3738 /* Info button */ |
3743 gtkconv->info = new_gtkconv_button(GAIM_STOCK_INFO, _("Info"), | 3739 gtkconv->info = new_gtkconv_button(GAIM_STOCK_INFO, _("Info"), |
3744 _("Get the user's information"), | 3740 _("Get the user's information"), |
3745 gtkconv->tooltips, info_cb, conv); | 3741 gtkconv->tooltips, info_cb, conv); |
3746 gtk_box_pack_start(GTK_BOX(hbox), gtkconv->info, FALSE, FALSE, 0); | 3742 gtk_box_pack_start(GTK_BOX(parent), gtkconv->info, TRUE, TRUE, 0); |
3747 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); | 3743 gtk_size_group_add_widget(gtkconv->sg, gtkconv->info); |
3748 | 3744 |
3749 /* Send button */ | 3745 /* Send button */ |
3750 gtkconv->send = new_gtkconv_button(GAIM_STOCK_SEND, _("Send"), | 3746 gtkconv->send = new_gtkconv_button(GAIM_STOCK_SEND, _("Send"), |
3751 _("Send message"), | 3747 _("Send message"), |
3772 { | 3768 { |
3773 GaimConnection *gc; | 3769 GaimConnection *gc; |
3774 GaimGtkConversation *gtkconv; | 3770 GaimGtkConversation *gtkconv; |
3775 GaimGtkChatPane *gtkchat; | 3771 GaimGtkChatPane *gtkchat; |
3776 GaimButtonStyle button_type; | 3772 GaimButtonStyle button_type; |
3773 GList *children; | |
3777 | 3774 |
3778 gtkconv = GAIM_GTK_CONVERSATION(conv); | 3775 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3779 gtkchat = gtkconv->u.chat; | 3776 gtkchat = gtkconv->u.chat; |
3780 gc = gaim_conversation_get_gc(conv); | 3777 gc = gaim_conversation_get_gc(conv); |
3781 | 3778 |
3782 /* From right to left... */ | 3779 /* Remove anything else in our parent */ |
3780 children = gtk_container_get_children(GTK_CONTAINER(parent)); | |
3781 while (children != NULL) { | |
3782 gtk_container_remove(GTK_CONTAINER(parent), children->data); | |
3783 children = g_list_remove(children, children->data); | |
3784 } | |
3785 | |
3786 /* The buttons, from left to right */ | |
3787 | |
3788 /* Invite */ | |
3789 gtkchat->invite = new_gtkconv_button(GAIM_STOCK_INVITE, _("Invite"), | |
3790 _("Invite a usuer"), | |
3791 gtkconv->tooltips, invite_cb, conv); | |
3792 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, TRUE, TRUE, 0); | |
3793 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); | |
3794 | |
3795 /* Add button */ | |
3796 gtkconv->add = new_gtkconv_button(GTK_STOCK_ADD, _("Add"), | |
3797 _("Add the chat to your buddy list"), | |
3798 gtkconv->tooltips, add_remove_cb, conv); | |
3799 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, TRUE, TRUE, 0); | |
3800 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3801 | |
3802 /* Remove button */ | |
3803 gtkconv->remove = new_gtkconv_button(GTK_STOCK_REMOVE, _("Remove"), | |
3804 _("Remove the chat from your buddy list"), | |
3805 gtkconv->tooltips, add_remove_cb, conv); | |
3806 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, TRUE, TRUE, 0); | |
3807 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
3783 | 3808 |
3784 /* Send button */ | 3809 /* Send button */ |
3785 gtkconv->send = gaim_pixbuf_button_from_stock(_("Send"), | 3810 gtkconv->send = new_gtkconv_button(GAIM_STOCK_SEND, _("Send"), |
3786 GAIM_STOCK_SEND, GAIM_CONV_CHAT); | 3811 _("Send message"), |
3787 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->send, _("Send"), NULL); | 3812 gtkconv->tooltips, send_cb, conv); |
3788 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); | 3813 gtk_box_pack_end(GTK_BOX(parent), gtkconv->send, FALSE, FALSE, 0); |
3814 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
3789 | 3815 |
3790 /* Separator */ | 3816 /* Separator */ |
3791 if (gtkchat->sep != NULL) | |
3792 gtk_widget_destroy(gtkchat->sep); | |
3793 | |
3794 gtkchat->sep = gtk_vseparator_new(); | 3817 gtkchat->sep = gtk_vseparator_new(); |
3795 gtk_box_pack_end(GTK_BOX(parent), gtkchat->sep, FALSE, TRUE, 0); | 3818 gtk_box_pack_end(GTK_BOX(parent), gtkchat->sep, FALSE, TRUE, 0); |
3796 gtk_widget_show(gtkchat->sep); | 3819 gtk_widget_show(gtkchat->sep); |
3797 | |
3798 /* Invite */ | |
3799 gtkchat->invite = gaim_pixbuf_button_from_stock(_("Invite"), | |
3800 GAIM_STOCK_INVITE, GAIM_CONV_CHAT); | |
3801 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->invite, | |
3802 _("Invite a user"), NULL); | |
3803 gtk_box_pack_start(GTK_BOX(parent), gtkchat->invite, FALSE, FALSE, 0); | |
3804 | |
3805 /* Add button */ | |
3806 gtkconv->add = gaim_pixbuf_button_from_stock(_("Add"), | |
3807 GTK_STOCK_ADD, GAIM_CONV_CHAT); | |
3808 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->add, | |
3809 _("Add the chat to your buddy list"), NULL); | |
3810 gtk_box_pack_start(GTK_BOX(parent), gtkconv->add, FALSE, FALSE, 0); | |
3811 | |
3812 /* Remove button */ | |
3813 gtkconv->remove = gaim_pixbuf_button_from_stock(_("Remove"), | |
3814 GTK_STOCK_REMOVE, GAIM_CONV_CHAT); | |
3815 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->remove, | |
3816 _("Remove the chat from your buddy list"), NULL); | |
3817 gtk_box_pack_start(GTK_BOX(parent), gtkconv->remove, FALSE, FALSE, 0); | |
3818 | |
3819 /* Set the relief on these. */ | |
3820 gtk_button_set_relief(GTK_BUTTON(gtkchat->invite), GTK_RELIEF_NONE); | |
3821 gtk_button_set_relief(GTK_BUTTON(gtkconv->add), GTK_RELIEF_NONE); | |
3822 gtk_button_set_relief(GTK_BUTTON(gtkconv->remove), GTK_RELIEF_NONE); | |
3823 gtk_button_set_relief(GTK_BUTTON(gtkconv->send), GTK_RELIEF_NONE); | |
3824 | |
3825 gtk_size_group_add_widget(gtkconv->sg, gtkchat->invite); | |
3826 gtk_size_group_add_widget(gtkconv->sg, gtkconv->add); | |
3827 gtk_size_group_add_widget(gtkconv->sg, gtkconv->remove); | |
3828 gtk_size_group_add_widget(gtkconv->sg, gtkconv->send); | |
3829 | |
3830 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->add, 1); | |
3831 gtk_box_reorder_child(GTK_BOX(parent), gtkconv->remove, 3); | |
3832 gtk_box_reorder_child(GTK_BOX(parent), gtkchat->invite, 3); | |
3833 | 3820 |
3834 gaim_gtkconv_update_buttons_by_protocol(conv); | 3821 gaim_gtkconv_update_buttons_by_protocol(conv); |
3835 | 3822 |
3836 /* Check if the buttons should be visible or not */ | 3823 /* Check if the buttons should be visible or not */ |
3837 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); | 3824 button_type = gaim_prefs_get_int("/gaim/gtk/conversations/button_type"); |
3838 if (button_type == GAIM_BUTTON_NONE) | 3825 if (button_type == GAIM_BUTTON_NONE) |
3839 gtk_widget_hide(gtkconv->bbox); | 3826 gtk_widget_hide(gtkconv->bbox); |
3840 else | 3827 else |
3841 gtk_widget_show(gtkconv->bbox); | 3828 gtk_widget_show(gtkconv->bbox); |
3842 | |
3843 /* Callbacks */ | |
3844 g_signal_connect(G_OBJECT(gtkchat->invite), "clicked", | |
3845 G_CALLBACK(invite_cb), conv); | |
3846 g_signal_connect(G_OBJECT(gtkconv->add), "clicked", | |
3847 G_CALLBACK(add_remove_cb), conv); | |
3848 g_signal_connect(G_OBJECT(gtkconv->remove), "clicked", | |
3849 G_CALLBACK(add_remove_cb), conv); | |
3850 g_signal_connect(G_OBJECT(gtkconv->send), "clicked", | |
3851 G_CALLBACK(send_cb), conv); | |
3852 } | 3829 } |
3853 | 3830 |
3854 | 3831 |
3855 static void topic_callback(GtkWidget *w, GaimConversation *conv) | 3832 static void topic_callback(GtkWidget *w, GaimConversation *conv) |
3856 { | 3833 { |
4168 gtk_widget_show(gtkconv->entry); | 4145 gtk_widget_show(gtkconv->entry); |
4169 | 4146 |
4170 /* Setup the bottom button box. */ | 4147 /* Setup the bottom button box. */ |
4171 gtkconv->bbox = gtk_hbox_new(FALSE, 6); | 4148 gtkconv->bbox = gtk_hbox_new(FALSE, 6); |
4172 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); | 4149 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
4173 gtk_widget_show(gtkconv->bbox); | |
4174 | |
4175 setup_chat_buttons(conv, gtkconv->bbox); | 4150 setup_chat_buttons(conv, gtkconv->bbox); |
4176 | 4151 |
4177 /* | 4152 /* |
4178 * Focus for chat windows should be as follows: | 4153 * Focus for chat windows should be as follows: |
4179 * Tab title -> chat topic -> conversation scrollback -> user list -> | 4154 * Tab title -> chat topic -> conversation scrollback -> user list -> |