Mercurial > pidgin.yaz
changeset 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 | 68c3dcba7310 |
children | 7b8407d8c546 |
files | src/dialogs.c src/gtkconv.c |
diffstat | 2 files changed, 59 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dialogs.c Mon Dec 29 02:30:38 2003 +0000 +++ b/src/dialogs.c Mon Dec 29 05:14:16 2003 +0000 @@ -1217,12 +1217,9 @@ void create_away_mess(GtkWidget *widget, void *dummy) { - GtkWidget *hbox; - GtkWidget *titlebox; - GtkWidget *tbox; + GtkWidget *vbox, *hbox; GtkWidget *label; - GtkWidget *frame; - GtkWidget *fbox; + GtkWidget *sw; GtkWidget *button; struct create_away *ca = g_new0(struct create_away, 1); @@ -1230,35 +1227,42 @@ /* Set up window */ GAIM_DIALOG(ca->window); gtk_widget_set_size_request(ca->window, -1, 250); - gtk_container_set_border_width(GTK_CONTAINER(ca->window), 5); + gtk_container_set_border_width(GTK_CONTAINER(ca->window), 6); gtk_window_set_role(GTK_WINDOW(ca->window), "away_mess"); gtk_window_set_title(GTK_WINDOW(ca->window), _("New away message")); g_signal_connect(G_OBJECT(ca->window), "delete_event", G_CALLBACK(destroy_dialog), ca->window); - tbox = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(ca->window), tbox); - - frame = gtk_frame_new(_("New away message")); - gtk_box_pack_start(GTK_BOX(tbox), frame, TRUE, TRUE, 0); + /* + * This would be higgy... but I think it's pretty ugly --Mark + * If you want to use this, make sure you add the vbox to the hbox below + */ + /* + hbox = gtk_hbox_new(FALSE, 12); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 12); + gtk_container_add(GTK_CONTAINER(ca->window), hbox); + */ - fbox = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); - gtk_container_add(GTK_CONTAINER(frame), fbox); + vbox = gtk_vbox_new(FALSE, 12); + gtk_container_add(GTK_CONTAINER(ca->window), vbox); - titlebox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(fbox), titlebox, FALSE, FALSE, 0); + /* Away message title */ + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new(_("Away title: ")); - gtk_box_pack_start(GTK_BOX(titlebox), label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); ca->entry = gtk_entry_new(); - gtk_box_pack_start(GTK_BOX(titlebox), ca->entry, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), ca->entry, TRUE, TRUE, 0); gtk_widget_grab_focus(ca->entry); - frame = gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); - gtk_box_pack_start(GTK_BOX(fbox), frame, TRUE, TRUE, 0); + /* Away message text */ + sw = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); + gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); ca->text = gtk_text_view_new(); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(ca->text), GTK_WRAP_WORD_CHAR); @@ -1266,7 +1270,7 @@ if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(ca->text)); - gtk_container_add(GTK_CONTAINER(frame), ca->text); + gtk_container_add(GTK_CONTAINER(sw), ca->text); if (dummy) { struct away_message *amt; @@ -1291,7 +1295,7 @@ } hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(tbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); button = gaim_pixbuf_button_from_stock(_("Save"), GTK_STOCK_SAVE, GAIM_BUTTON_HORIZONTAL); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(save_away_mess), ca);
--- a/src/gtkconv.c Mon Dec 29 02:30:38 2003 +0000 +++ b/src/gtkconv.c Mon Dec 29 05:14:16 2003 +0000 @@ -3514,10 +3514,9 @@ GtkWidget *vbox, *hbox; GtkWidget *lbox, *bbox; GtkWidget *label; - GtkWidget *sw2; GtkWidget *list; GtkWidget *button; - GtkWidget *frame; + GtkWidget *sw; GtkListStore *ls; GtkCellRenderer *rend; GtkTreeViewColumn *col; @@ -3600,12 +3599,12 @@ gtk_widget_show(gtkchat->count); /* Setup the list of users. */ - sw2 = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), + sw = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw2), GTK_SHADOW_IN); - gtk_box_pack_start(GTK_BOX(lbox), sw2, TRUE, TRUE, 0); - gtk_widget_show(sw2); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); + gtk_box_pack_start(GTK_BOX(lbox), sw, TRUE, TRUE, 0); + gtk_widget_show(sw); ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), 1, @@ -3636,7 +3635,7 @@ gtkchat->list = list; - gtk_container_add(GTK_CONTAINER(sw2), list); + gtk_container_add(GTK_CONTAINER(sw), list); /* Setup the user list toolbar. */ bbox = gtk_hbox_new(TRUE, 5); @@ -3689,36 +3688,37 @@ FALSE, FALSE, 0); /* Setup the entry widget. */ - frame = gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); - gtk_widget_show(frame); + sw = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), + GTK_SHADOW_IN); + gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); + gtk_widget_show(sw); gtkconv->entry = gtk_imhtml_new(NULL, NULL); gtkconv->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); - g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); + gaim_setup_imhtml(gtkconv->entry); gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); - gaim_setup_imhtml(gtkconv->entry); default_formatize(conv); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); gtk_widget_set_size_request(gtkconv->entry, -1, MAX(gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height"), 25)); - - /* Connect the signal handlers. */ + g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); + g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", G_CALLBACK(entry_key_pressed_cb_1), gtkconv->entry_buffer); + g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", + G_CALLBACK(entry_key_pressed_cb_2), conv); g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event", G_CALLBACK(entry_stop_rclick_cb), NULL); - g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", - G_CALLBACK(entry_key_pressed_cb_2), conv); if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); - gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); + gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); gtk_widget_show(gtkconv->entry); /* Setup the bottom button box. */ @@ -3739,7 +3739,7 @@ GtkWidget *paned; GtkWidget *vbox; GtkWidget *vbox2; - GtkWidget *frame; + GtkWidget *sw; gtkconv = GAIM_GTK_CONVERSATION(conv); gtkim = gtkconv->u.im; @@ -3778,7 +3778,6 @@ gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); gaim_setup_imhtml(gtkconv->imhtml); - gtk_widget_show(gtkconv->imhtml); vbox2 = gtk_vbox_new(FALSE, 5); @@ -3791,21 +3790,24 @@ FALSE, FALSE, 0); /* Setup the entry widget. */ - frame = gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); - gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, 0); - gtk_widget_show(frame); + sw = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), + GTK_SHADOW_IN); + gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); + gtk_widget_show(sw); gtkconv->entry = gtk_imhtml_new(NULL, NULL); + gtkconv->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); + gaim_setup_imhtml(gtkconv->entry); gtk_imhtml_set_editable(GTK_IMHTML(gtkconv->entry), TRUE); - gaim_setup_imhtml(gtkconv->entry); default_formatize(conv); - gtkconv->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); - g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); gtk_widget_set_size_request(gtkconv->entry, -1, MAX(gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height"), 25)); + g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); g_signal_connect_swapped(G_OBJECT(gtkconv->entry), "key_press_event", G_CALLBACK(entry_key_pressed_cb_1), @@ -3823,7 +3825,7 @@ if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(gtkconv->entry)); - gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); + gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry)); gtk_widget_show(gtkconv->entry); gtkconv->bbox = gtk_hbox_new(FALSE, 5);