Mercurial > pidgin
comparison src/gtkstatusbox.c @ 12619:dc995f73c101
[gaim-migrate @ 14955]
Remove the gtkimhtmltoolbar from the gtkstatusbox. It's used by few (any?)
protocols other than AIM, and it takes up a lot of room and makes my
buddy list be wider than it needs to be (or the gtkimhtml has a horizontal
scroll bar).
I think I like it best without it. But I'd be ok with having a short
version of this.
I also wouldn't mind having a keyboard shortcut to insert a link. Or maybe
auto-linkifying HTMLable away messages.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 22 Dec 2005 04:21:30 +0000 |
parents | 51b0ce9d45d9 |
children | 8512c990967b |
comparison
equal
deleted
inserted
replaced
12618:204bd8fac61f | 12619:dc995f73c101 |
---|---|
30 #include "savedstatuses.h" | 30 #include "savedstatuses.h" |
31 #include "status.h" | 31 #include "status.h" |
32 #include "debug.h" | 32 #include "debug.h" |
33 | 33 |
34 #include "gtkgaim.h" | 34 #include "gtkgaim.h" |
35 #include "gtkimhtmltoolbar.h" | |
36 #include "gtksavedstatuses.h" | 35 #include "gtksavedstatuses.h" |
37 #include "gtkstock.h" | 36 #include "gtkstock.h" |
38 #include "gtkstatusbox.h" | 37 #include "gtkstatusbox.h" |
39 #include "gtkutils.h" | 38 #include "gtkutils.h" |
40 | 39 |
160 gtk_widget_show_all(status_box->vbox); | 159 gtk_widget_show_all(status_box->vbox); |
161 status_box->imhtml_visible = TRUE; | 160 status_box->imhtml_visible = TRUE; |
162 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); | 161 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); |
163 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); | 162 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); |
164 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0); | 163 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0); |
165 gtk_widget_hide(status_box->toolbar); | |
166 gtk_widget_hide(status_box->hsep); | |
167 } | 164 } |
168 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); | 165 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); |
169 gtk_gaim_status_box_refresh(status_box); | 166 gtk_gaim_status_box_refresh(status_box); |
170 } | 167 } |
171 } | 168 } |
404 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), FALSE); | 401 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), FALSE); |
405 | 402 |
406 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); | 403 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); |
407 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); | 404 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); |
408 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0); | 405 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0); |
409 gtk_widget_hide(status_box->toolbar); | |
410 gtk_widget_hide(status_box->hsep); | |
411 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), TRUE); | 406 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), TRUE); |
412 } | 407 } |
413 | 408 |
414 /* Stop suppressing the "changed" signal. */ | 409 /* Stop suppressing the "changed" signal. */ |
415 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); | 410 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); |
685 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 6, NULL); | 680 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 6, NULL); |
686 | 681 |
687 status_box->vbox = gtk_vbox_new(0, FALSE); | 682 status_box->vbox = gtk_vbox_new(0, FALSE); |
688 vbox = gtk_vbox_new(0,FALSE); | 683 vbox = gtk_vbox_new(0,FALSE); |
689 status_box->imhtml = gtk_imhtml_new(NULL, NULL); | 684 status_box->imhtml = gtk_imhtml_new(NULL, NULL); |
690 status_box->toolbar = gtk_imhtmltoolbar_new(); | |
691 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(status_box->toolbar), status_box->imhtml); | |
692 status_box->hsep = gtk_hseparator_new(); | |
693 | 685 |
694 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml)); | 686 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml)); |
695 #if 0 | 687 #if 0 |
696 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event", | 688 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event", |
697 G_CALLBACK(button_pressed_cb), status_box); | 689 G_CALLBACK(button_pressed_cb), status_box); |
712 GTK_BIN(status_box)->child = status_box->toggle_button; | 704 GTK_BIN(status_box)->child = status_box->toggle_button; |
713 status_box->sw = gtk_scrolled_window_new(NULL, NULL); | 705 status_box->sw = gtk_scrolled_window_new(NULL, NULL); |
714 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(status_box->sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | 706 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(status_box->sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
715 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(status_box->sw), GTK_SHADOW_IN); | 707 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(status_box->sw), GTK_SHADOW_IN); |
716 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(status_box->sw), vbox); | 708 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(status_box->sw), vbox); |
717 gtk_box_pack_start(GTK_BOX(vbox), status_box->toolbar, FALSE, FALSE, 0); | |
718 gtk_box_pack_start(GTK_BOX(vbox), status_box->hsep, FALSE, FALSE, 0); | |
719 gtk_box_pack_start(GTK_BOX(vbox), status_box->imhtml, TRUE, TRUE, 0); | 709 gtk_box_pack_start(GTK_BOX(vbox), status_box->imhtml, TRUE, TRUE, 0); |
720 | 710 |
721 gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0); | 711 gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0); |
722 | 712 |
723 g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event", | 713 g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event", |
746 requisition->height += 3; | 736 requisition->height += 3; |
747 | 737 |
748 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req); | 738 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req); |
749 if (box_req.height > 1) | 739 if (box_req.height > 1) |
750 requisition->height = requisition->height + box_req.height + 3; | 740 requisition->height = requisition->height + box_req.height + 3; |
751 | |
752 if (GTK_GAIM_STATUS_BOX(widget)->typing) { | |
753 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->toolbar, &box_req); | |
754 requisition->height = requisition->height + box_req.height; | |
755 } | |
756 | 741 |
757 requisition->width = 1; | 742 requisition->width = 1; |
758 } | 743 } |
759 | 744 |
760 static void | 745 static void |
1070 pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(status_box->imhtml)); | 1055 pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(status_box->imhtml)); |
1071 pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(status_box->imhtml)); | 1056 pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(status_box->imhtml)); |
1072 | 1057 |
1073 height = (oneline.height + pad_top + pad_bottom) * lines; | 1058 height = (oneline.height + pad_top + pad_bottom) * lines; |
1074 height += (oneline.height + pad_inside) * (wrapped_lines - lines); | 1059 height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
1075 | |
1076 if (status_box->typing) { | |
1077 GtkRequisition requisition; | |
1078 | |
1079 gtk_widget_size_request(status_box->toolbar, &requisition); | |
1080 height += requisition.height; | |
1081 } | |
1082 | 1060 |
1083 gtk_widget_set_size_request(status_box->vbox, -1, height); | 1061 gtk_widget_set_size_request(status_box->vbox, -1, height); |
1084 } | 1062 } |
1085 | 1063 |
1086 static void remove_typing_cb(GtkGaimStatusBox *status_box) | 1064 static void remove_typing_cb(GtkGaimStatusBox *status_box) |
1120 g_object_unref(status_box->pixbuf); | 1098 g_object_unref(status_box->pixbuf); |
1121 status_box->pixbuf = pixbuf; | 1099 status_box->pixbuf = pixbuf; |
1122 if (status_box->typing) | 1100 if (status_box->typing) |
1123 g_source_remove(status_box->typing); | 1101 g_source_remove(status_box->typing); |
1124 status_box->typing = 0; | 1102 status_box->typing = 0; |
1125 gtk_widget_hide(status_box->hsep); | |
1126 gtk_widget_hide(status_box->toolbar); | |
1127 | 1103 |
1128 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) | 1104 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
1129 { | 1105 { |
1130 if (type == GTK_GAIM_STATUS_BOX_TYPE_CUSTOM) | 1106 if (type == GTK_GAIM_STATUS_BOX_TYPE_CUSTOM) |
1131 { | 1107 { |
1173 GtkTextBuffer *buf; | 1149 GtkTextBuffer *buf; |
1174 GtkTextIter start, end; | 1150 GtkTextIter start, end; |
1175 gtk_widget_show_all(status_box->vbox); | 1151 gtk_widget_show_all(status_box->vbox); |
1176 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) { | 1152 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) { |
1177 status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); | 1153 status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); |
1178 } else { | 1154 } |
1179 gtk_widget_hide(status_box->toolbar); | 1155 gtk_widget_grab_focus(status_box->imhtml); |
1180 gtk_widget_hide(status_box->hsep); | |
1181 } | |
1182 gtk_widget_grab_focus(status_box->imhtml); | |
1183 buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml)); | 1156 buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml)); |
1184 gtk_text_buffer_get_start_iter(buf, &start); | 1157 gtk_text_buffer_get_start_iter(buf, &start); |
1185 gtk_text_buffer_get_end_iter(buf, &end); | 1158 gtk_text_buffer_get_end_iter(buf, &end); |
1186 gtk_text_buffer_move_mark_by_name(buf, "insert", &end); | 1159 gtk_text_buffer_move_mark_by_name(buf, "insert", &end); |
1187 gtk_text_buffer_move_mark_by_name(buf, "selection_bound", &start); | 1160 gtk_text_buffer_move_mark_by_name(buf, "selection_bound", &start); |
1203 if (box->typing) { | 1176 if (box->typing) { |
1204 gtk_gaim_status_box_pulse_typing(box); | 1177 gtk_gaim_status_box_pulse_typing(box); |
1205 g_source_remove(box->typing); | 1178 g_source_remove(box->typing); |
1206 } | 1179 } |
1207 box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, box); | 1180 box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, box); |
1208 gtk_widget_show(box->hsep); | |
1209 gtk_widget_show(box->toolbar); | |
1210 } | 1181 } |
1211 gtk_gaim_status_box_refresh(box); | 1182 gtk_gaim_status_box_refresh(box); |
1212 } | 1183 } |
1213 | 1184 |
1214 static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data) | 1185 static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data) |