Mercurial > pidgin
comparison src/gtkconv.c @ 8914:73649ee7f687
[gaim-migrate @ 9684]
" With the removal of the IM & Chat size preferences,
it'd make sense (and it's even suggested in the source
:) ) to save the sizes when widgets are resized." --Stu Tomlinson
i was waiting for such a patch :-)
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Mon, 10 May 2004 04:03:30 +0000 |
parents | 40ebc5ecf86a |
children | 71fddf3f340d |
comparison
equal
deleted
inserted
replaced
8913:d729311f6352 | 8914:73649ee7f687 |
---|---|
214 gaim_conversation_destroy(conv); | 214 gaim_conversation_destroy(conv); |
215 | 215 |
216 return TRUE; | 216 return TRUE; |
217 } | 217 } |
218 | 218 |
219 static gboolean | |
220 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, GaimConversation *conv) | |
221 { | |
222 GaimGtkConversation *gtkconv; | |
223 | |
224 if (!GTK_WIDGET_VISIBLE(w)) | |
225 return FALSE; | |
226 | |
227 if (!GAIM_IS_GTK_CONVERSATION(conv)) | |
228 return FALSE; | |
229 | |
230 gtkconv = GAIM_GTK_CONVERSATION(conv); | |
231 | |
232 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) | |
233 { | |
234 if (w == gtkconv->sw) | |
235 { | |
236 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); | |
237 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height); | |
238 } | |
239 if (w == gtkconv->entry) | |
240 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); | |
241 } | |
242 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) | |
243 { | |
244 if (w == gtkconv->sw) | |
245 { | |
246 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); | |
247 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height); | |
248 } | |
249 if (w == gtkconv->entry) | |
250 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); | |
251 } | |
252 | |
253 return FALSE; | |
254 } | |
255 | |
219 /* Courtesy of Galeon! */ | 256 /* Courtesy of Galeon! */ |
220 static void | 257 static void |
221 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) | 258 tab_close_button_state_changed_cb(GtkWidget *widget, GtkStateType prev_state) |
222 { | 259 { |
223 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) | 260 if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) |
3531 vpaned = gtk_vpaned_new(); | 3568 vpaned = gtk_vpaned_new(); |
3532 gtk_widget_show(vpaned); | 3569 gtk_widget_show(vpaned); |
3533 | 3570 |
3534 /* Setup the top part of the pane. */ | 3571 /* Setup the top part of the pane. */ |
3535 vbox = gtk_vbox_new(FALSE, 6); | 3572 vbox = gtk_vbox_new(FALSE, 6); |
3536 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, FALSE); | 3573 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); |
3537 gtk_widget_show(vbox); | 3574 gtk_widget_show(vbox); |
3538 | 3575 |
3539 if (gc != NULL) | 3576 if (gc != NULL) |
3540 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 3577 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
3541 | 3578 |
3576 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); | 3613 gtk_paned_pack1(GTK_PANED(hpaned), gtkconv->sw, TRUE, TRUE); |
3577 | 3614 |
3578 gtk_widget_set_size_request(gtkconv->sw, | 3615 gtk_widget_set_size_request(gtkconv->sw, |
3579 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), | 3616 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), |
3580 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); | 3617 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); |
3618 | |
3619 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", | |
3620 G_CALLBACK(size_allocate_cb), conv); | |
3581 | 3621 |
3582 gtk_widget_show(gtkconv->sw); | 3622 gtk_widget_show(gtkconv->sw); |
3583 | 3623 |
3584 /* Setup gtkihmtml. */ | 3624 /* Setup gtkihmtml. */ |
3585 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | 3625 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); |
3692 | 3732 |
3693 gtkconv->info = button; | 3733 gtkconv->info = button; |
3694 | 3734 |
3695 /* Build the toolbar. */ | 3735 /* Build the toolbar. */ |
3696 vbox = gtk_vbox_new(FALSE, 6); | 3736 vbox = gtk_vbox_new(FALSE, 6); |
3697 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, FALSE); | 3737 gtk_paned_pack2(GTK_PANED(vpaned), vbox, FALSE, TRUE); |
3698 gtk_widget_show(vbox); | 3738 gtk_widget_show(vbox); |
3699 | 3739 |
3700 gtkconv->toolbar = gtk_imhtmltoolbar_new(); | 3740 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
3701 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar, FALSE, FALSE, 0); | 3741 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->toolbar, FALSE, FALSE, 0); |
3702 | 3742 |
3740 | 3780 |
3741 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | 3781 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
3742 G_CALLBACK(entry_key_press_cb), conv); | 3782 G_CALLBACK(entry_key_press_cb), conv); |
3743 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | 3783 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3744 G_CALLBACK(entry_stop_rclick_cb), NULL); | 3784 G_CALLBACK(entry_stop_rclick_cb), NULL); |
3785 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", | |
3786 G_CALLBACK(size_allocate_cb), conv); | |
3745 | 3787 |
3746 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) | 3788 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
3747 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); | 3789 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); |
3748 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), | 3790 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), |
3749 gtkconv->entry); | 3791 gtkconv->entry); |
3793 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | 3835 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
3794 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), | 3836 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(gtkconv->sw), |
3795 GTK_SHADOW_IN); | 3837 GTK_SHADOW_IN); |
3796 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); | 3838 gtk_box_pack_start(GTK_BOX(vbox), gtkconv->sw, TRUE, TRUE, 0); |
3797 | 3839 |
3798 /* XXX - The following two prefs need to be set whenever the window is resized. */ | |
3799 gtk_widget_set_size_request(gtkconv->sw, | 3840 gtk_widget_set_size_request(gtkconv->sw, |
3800 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), | 3841 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), |
3801 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); | 3842 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); |
3843 g_signal_connect(G_OBJECT(gtkconv->sw), "size-allocate", | |
3844 G_CALLBACK(size_allocate_cb), conv); | |
3802 gtk_widget_show(gtkconv->sw); | 3845 gtk_widget_show(gtkconv->sw); |
3803 | 3846 |
3804 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); | 3847 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); |
3805 gtk_widget_set_name(gtkconv->imhtml, "gtkconv_imhtml"); | 3848 gtk_widget_set_name(gtkconv->imhtml, "gtkconv_imhtml"); |
3806 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); | 3849 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
3817 | 3860 |
3818 gaim_setup_imhtml(gtkconv->imhtml); | 3861 gaim_setup_imhtml(gtkconv->imhtml); |
3819 gtk_widget_show(gtkconv->imhtml); | 3862 gtk_widget_show(gtkconv->imhtml); |
3820 | 3863 |
3821 vbox2 = gtk_vbox_new(FALSE, 6); | 3864 vbox2 = gtk_vbox_new(FALSE, 6); |
3822 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); | 3865 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, TRUE); |
3823 gtk_widget_show(vbox2); | 3866 gtk_widget_show(vbox2); |
3824 | 3867 |
3825 /* Build the toolbar. */ | 3868 /* Build the toolbar. */ |
3826 gtkconv->toolbar = gtk_imhtmltoolbar_new(); | 3869 gtkconv->toolbar = gtk_imhtmltoolbar_new(); |
3827 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar, FALSE, FALSE, 0); | 3870 gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->toolbar, FALSE, FALSE, 0); |
3858 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | 3901 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
3859 gaim_setup_imhtml(gtkconv->entry); | 3902 gaim_setup_imhtml(gtkconv->entry); |
3860 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); | 3903 gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); |
3861 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), | 3904 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), |
3862 GTK_WRAP_WORD_CHAR); | 3905 GTK_WRAP_WORD_CHAR); |
3863 /* XXX - The following pref needs to be set whenever the window is resized. */ | |
3864 gtk_widget_set_size_request(gtkconv->entry, -1, | 3906 gtk_widget_set_size_request(gtkconv->entry, -1, |
3865 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); | 3907 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); |
3866 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); | 3908 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); |
3867 | 3909 |
3868 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | 3910 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
3869 G_CALLBACK(entry_key_press_cb), conv); | 3911 G_CALLBACK(entry_key_press_cb), conv); |
3870 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", | 3912 g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", |
3871 G_CALLBACK(entry_stop_rclick_cb), NULL); | 3913 G_CALLBACK(entry_stop_rclick_cb), NULL); |
3914 g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate", | |
3915 G_CALLBACK(size_allocate_cb), conv); | |
3872 | 3916 |
3873 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", | 3917 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "insert_text", |
3874 G_CALLBACK(insert_text_cb), conv); | 3918 G_CALLBACK(insert_text_cb), conv); |
3875 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", | 3919 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", |
3876 G_CALLBACK(delete_text_cb), conv); | 3920 G_CALLBACK(delete_text_cb), conv); |