Mercurial > pidgin.yaz
changeset 12269:f1515af27443
[gaim-migrate @ 14571]
iff you're typing a status message, show a formatting toolbar.
This still needs work, but I'm going home now. Things you can do before I
get home that would make me happy:
- Iff you're typing a message, moving the cursor around should reset the timeout
- Changing the formatting should reset the timeout
- Some sort of "tiny mode" for the gtkimhtml toolbar would be cool, so that
more buttons will fit
- Figure out why things get crack when the timeout expires. Try selecting some
text and setting Bold or something, and then noticing that everything but
what you've selected turns bold. It's crazy.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 30 Nov 2005 03:49:10 +0000 |
parents | deb955f7ebb7 |
children | a2bbde197826 |
files | src/gtkstatusbox.c src/gtkstatusbox.h |
diffstat | 2 files changed, 29 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkstatusbox.c Wed Nov 30 02:49:43 2005 +0000 +++ b/src/gtkstatusbox.c Wed Nov 30 03:49:10 2005 +0000 @@ -30,6 +30,7 @@ #include "debug.h" #include "gtkgaim.h" +#include "gtkimhtmltoolbar.h" #include "gtksavedstatuses.h" #include "gtkstock.h" #include "gtkstatusbox.h" @@ -486,6 +487,7 @@ static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) { + GtkWidget *vbox; GtkCellRenderer *text_rend; GtkCellRenderer *icon_rend; GtkTextBuffer *buffer; @@ -544,7 +546,12 @@ g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 6, NULL); status_box->vbox = gtk_vbox_new(0, FALSE); - status_box->imhtml = gtk_imhtml_new(NULL, NULL); + vbox = gtk_vbox_new(0,FALSE); + status_box->imhtml = gtk_imhtml_new(NULL, NULL); + status_box->toolbar = gtk_imhtmltoolbar_new(); + gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(status_box->toolbar), status_box->imhtml); + status_box->hsep = gtk_hseparator_new(); + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml)); g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event", G_CALLBACK(button_pressed_cb), status_box); g_signal_connect(G_OBJECT(status_box->toggle_button), "button-release-event", G_CALLBACK(button_released_cb), status_box); @@ -556,7 +563,11 @@ status_box->sw = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(status_box->sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(status_box->sw), GTK_SHADOW_IN); - gtk_container_add(GTK_CONTAINER(status_box->sw), status_box->imhtml); + gtk_container_add(GTK_CONTAINER(status_box->sw), vbox); + gtk_box_pack_start(GTK_BOX(vbox), status_box->toolbar, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), status_box->hsep, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), status_box->imhtml, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event", @@ -610,7 +621,12 @@ gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req); if (box_req.height > 1) requisition->height = requisition->height + box_req.height + 6; - + + if (GTK_GAIM_STATUS_BOX(widget)->typing) { + gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->toolbar, &box_req); + requisition->height = requisition->height + box_req.height; + } + requisition->width = 1; } @@ -898,6 +914,8 @@ g_source_remove(status_box->typing); status_box->typing = 0; gtk_gaim_status_box_refresh(status_box); + gtk_widget_hide(status_box->toolbar); + gtk_widget_hide(status_box->hsep); } static void gtk_gaim_status_box_changed(GtkComboBox *box) @@ -930,6 +948,8 @@ if (status_box->typing) g_source_remove(status_box->typing); status_box->typing = 0; + gtk_widget_hide(status_box->hsep); + gtk_widget_hide(status_box->toolbar); if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) { @@ -977,7 +997,7 @@ if (status_box->imhtml_visible) { gtk_widget_show_all(status_box->vbox); - if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) + if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) status_box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, status_box); gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); gtk_widget_grab_focus(status_box->imhtml); @@ -1001,6 +1021,8 @@ g_source_remove(box->typing); } box->typing = g_timeout_add(3000, (GSourceFunc)remove_typing_cb, box); + gtk_widget_show(box->hsep); + gtk_widget_show(box->toolbar); } gtk_gaim_status_box_refresh(box); }