Mercurial > pidgin.yaz
comparison src/gtkconv.c @ 7949:b356e2a9d7fc
[gaim-migrate @ 8623]
Add scrollbars to the text input widgets for away messages and conversations.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 29 Dec 2003 05:14:16 +0000 |
parents | 4eb96e3cf633 |
children | fb66c2ee4446 |
comparison
equal
deleted
inserted
replaced
7948:68c3dcba7310 | 7949:b356e2a9d7fc |
---|---|
3512 GaimConnection *gc; | 3512 GaimConnection *gc; |
3513 GtkWidget *vpaned, *hpaned; | 3513 GtkWidget *vpaned, *hpaned; |
3514 GtkWidget *vbox, *hbox; | 3514 GtkWidget *vbox, *hbox; |
3515 GtkWidget *lbox, *bbox; | 3515 GtkWidget *lbox, *bbox; |
3516 GtkWidget *label; | 3516 GtkWidget *label; |
3517 GtkWidget *sw2; | |
3518 GtkWidget *list; | 3517 GtkWidget *list; |
3519 GtkWidget *button; | 3518 GtkWidget *button; |
3520 GtkWidget *frame; | 3519 GtkWidget *sw; |
3521 GtkListStore *ls; | 3520 GtkListStore *ls; |
3522 GtkCellRenderer *rend; | 3521 GtkCellRenderer *rend; |
3523 GtkTreeViewColumn *col; | 3522 GtkTreeViewColumn *col; |
3524 | 3523 |
3525 gtkconv = GAIM_GTK_CONVERSATION(conv); | 3524 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3598 gtkchat->count = gtk_label_new(_("0 people in room")); | 3597 gtkchat->count = gtk_label_new(_("0 people in room")); |
3599 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); | 3598 gtk_box_pack_start(GTK_BOX(lbox), gtkchat->count, FALSE, FALSE, 0); |
3600 gtk_widget_show(gtkchat->count); | 3599 gtk_widget_show(gtkchat->count); |
3601 | 3600 |
3602 /* Setup the list of users. */ | 3601 /* Setup the list of users. */ |
3603 sw2 = gtk_scrolled_window_new(NULL, NULL); | 3602 sw = gtk_scrolled_window_new(NULL, NULL); |
3604 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | 3603 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
3605 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | 3604 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
3606 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw2), GTK_SHADOW_IN); | 3605 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
3607 gtk_box_pack_start(GTK_BOX(lbox), sw2, TRUE, TRUE, 0); | 3606 gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); |
3608 gtk_widget_show(sw2); | 3607 gtk_widget_show(sw); |
3609 | 3608 |
3610 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | 3609 ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); |
3611 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, | 3610 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, |
3612 GTK_SORT_ASCENDING); | 3611 GTK_SORT_ASCENDING); |
3613 | 3612 |
3634 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); | 3633 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); |
3635 gtk_widget_show(list); | 3634 gtk_widget_show(list); |
3636 | 3635 |
3637 gtkchat->list = list; | 3636 gtkchat->list = list; |
3638 | 3637 |
3639 gtk_container_add(GTK_CONTAINER(sw2), list); | 3638 gtk_container_add(GTK_CONTAINER(sw), list); |
3640 | 3639 |
3641 /* Setup the user list toolbar. */ | 3640 /* Setup the user list toolbar. */ |
3642 bbox = gtk_hbox_new(TRUE, 5); | 3641 bbox = gtk_hbox_new(TRUE, 5); |
3643 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); | 3642 gtk_box_pack_start(GTK_BOX(lbox), bbox, FALSE, FALSE, 0); |
3644 gtk_widget_show(bbox); | 3643 gtk_widget_show(bbox); |
3687 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); | 3686 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
3688 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar.toolbar, | 3687 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar.toolbar, |
3689 FALSE, FALSE, 0); | 3688 FALSE, FALSE, 0); |
3690 | 3689 |
3691 /* Setup the entry widget. */ | 3690 /* Setup the entry widget. */ |
3692 frame = gtk_frame_new(NULL); | 3691 sw = gtk_scrolled_window_new(NULL, NULL); |
3693 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | 3692 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
3694 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); | 3693 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
3695 gtk_widget_show(frame); | 3694 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
3695 GTK_SHADOW_IN); | |
3696 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
3697 gtk_widget_show(sw); | |
3696 | 3698 |
3697 gtkconv->entry = gtk_imhtml_new(NULL, NULL); | 3699 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
3698 gtkconv->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | 3700 gtkconv->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
3699 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); | 3701 gaim_setup_imhtml(gtkconv->entry); |
3700 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | 3702 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); |
3701 gaim_setup_imhtml(gtkconv->entry); | |
3702 default_formatize(conv); | 3703 default_formatize(conv); |
3703 | |
3704 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); | 3704 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); |
3705 gtk_widget_set_size_request(gtkconv->entry, -1, | 3705 gtk_widget_set_size_request(gtkconv->entry, -1, |
3706 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"), | 3706 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"), |
3707 25)); | 3707 25)); |
3708 | 3708 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
3709 /* Connect the signal handlers. */ | 3709 |
3710 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", | 3710 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", |
3711 G_CALLBACK(entry_key_pressed_cb_1), | 3711 G_CALLBACK(entry_key_pressed_cb_1), |
3712 gtkconv->entry_buffer); | 3712 gtkconv->entry_buffer); |
3713 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
3714 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
3713 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | 3715 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3714 G_CALLBACK(entry_stop_rclick_cb), NULL); | 3716 G_CALLBACK(entry_stop_rclick_cb), NULL); |
3715 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | |
3716 G_CALLBACK(entry_key_pressed_cb_2), conv); | |
3717 | 3717 |
3718 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) | 3718 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
3719 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); | 3719 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
3720 | 3720 |
3721 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); | 3721 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
3722 gtk_widget_show(gtkconv->entry); | 3722 gtk_widget_show(gtkconv->entry); |
3723 | 3723 |
3724 /* Setup the bottom button box. */ | 3724 /* Setup the bottom button box. */ |
3725 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | 3725 gtkconv->bbox = gtk_hbox_new(FALSE, 5); |
3726 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); | 3726 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->bbox, FALSE, FALSE, 0); |
3737 GaimGtkConversation *gtkconv; | 3737 GaimGtkConversation *gtkconv; |
3738 GaimGtkImPane *gtkim; | 3738 GaimGtkImPane *gtkim; |
3739 GtkWidget *paned; | 3739 GtkWidget *paned; |
3740 GtkWidget *vbox; | 3740 GtkWidget *vbox; |
3741 GtkWidget *vbox2; | 3741 GtkWidget *vbox2; |
3742 GtkWidget *frame; | 3742 GtkWidget *sw; |
3743 | 3743 |
3744 gtkconv = GAIM_GTK_CONVERSATION(conv); | 3744 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3745 gtkim = gtkconv->u.im; | 3745 gtkim = gtkconv->u.im; |
3746 | 3746 |
3747 /* Setup the outer pane. */ | 3747 /* Setup the outer pane. */ |
3776 | 3776 |
3777 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | 3777 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), |
3778 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); | 3778 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
3779 | 3779 |
3780 gaim_setup_imhtml(gtkconv->imhtml); | 3780 gaim_setup_imhtml(gtkconv->imhtml); |
3781 | |
3782 gtk_widget_show(gtkconv->imhtml); | 3781 gtk_widget_show(gtkconv->imhtml); |
3783 | 3782 |
3784 vbox2 = gtk_vbox_new(FALSE, 5); | 3783 vbox2 = gtk_vbox_new(FALSE, 5); |
3785 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); | 3784 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); |
3786 gtk_widget_show(vbox2); | 3785 gtk_widget_show(vbox2); |
3789 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); | 3788 gtkconv->toolbar.toolbar = build_conv_toolbar(conv); |
3790 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar.toolbar, | 3789 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar.toolbar, |
3791 FALSE, FALSE, 0); | 3790 FALSE, FALSE, 0); |
3792 | 3791 |
3793 /* Setup the entry widget. */ | 3792 /* Setup the entry widget. */ |
3794 frame = gtk_frame_new(NULL); | 3793 sw = gtk_scrolled_window_new(NULL, NULL); |
3795 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | 3794 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
3796 gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0); | 3795 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
3797 gtk_widget_show(frame); | 3796 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
3797 GTK_SHADOW_IN); | |
3798 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); | |
3799 gtk_widget_show(sw); | |
3798 | 3800 |
3799 gtkconv->entry = gtk_imhtml_new(NULL, NULL); | 3801 gtkconv->entry = gtk_imhtml_new(NULL, NULL); |
3802 gtkconv->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
3803 gaim_setup_imhtml(gtkconv->entry); | |
3800 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | 3804 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); |
3801 gaim_setup_imhtml(gtkconv->entry); | |
3802 default_formatize(conv); | 3805 default_formatize(conv); |
3803 gtkconv->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | |
3804 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); | |
3805 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); | 3806 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); |
3806 gtk_widget_set_size_request(gtkconv->entry, -1, | 3807 gtk_widget_set_size_request(gtkconv->entry, -1, |
3807 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"), | 3808 MAX(gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"), |
3808 25)); | 3809 25)); |
3810 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); | |
3809 | 3811 |
3810 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", | 3812 g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", |
3811 G_CALLBACK(entry_key_pressed_cb_1), | 3813 G_CALLBACK(entry_key_pressed_cb_1), |
3812 gtkconv->entry_buffer); | 3814 gtkconv->entry_buffer); |
3813 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | 3815 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
3821 G_CALLBACK(delete_text_cb), conv); | 3823 G_CALLBACK(delete_text_cb), conv); |
3822 | 3824 |
3823 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) | 3825 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
3824 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); | 3826 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
3825 | 3827 |
3826 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); | 3828 gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); |
3827 gtk_widget_show(gtkconv->entry); | 3829 gtk_widget_show(gtkconv->entry); |
3828 | 3830 |
3829 gtkconv->bbox = gtk_hbox_new(FALSE, 5); | 3831 gtkconv->bbox = gtk_hbox_new(FALSE, 5); |
3830 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); | 3832 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0); |
3831 gtk_widget_show(gtkconv->bbox); | 3833 gtk_widget_show(gtkconv->bbox); |