diff options
author | Sean Egan <seanegan@pidgin.im> | 2007-01-17 09:47:55 +0000 |
---|---|---|
committer | Sean Egan <seanegan@pidgin.im> | 2007-01-17 09:47:55 +0000 |
commit | b455531b720cca51ab2bdb09eee6cad4d51e23af (patch) | |
tree | fc86c8f20e3be7e23802bc8719d527f9bd1f44f0 | |
parent | f5458399e79b526ac12c890564453102ac987f0f (diff) | |
download | pidgin-b455531b720cca51ab2bdb09eee6cad4d51e23af.tar.gz |
[gaim-migrate @ 18147]
when auto-growing a conversation entry to fit text without scrollbars, reset to the
default size once the message is sent
-rw-r--r-- | gtk/gtkconv.c | 21 | ||||
-rw-r--r-- | gtk/gtkconv.h | 3 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gtk/gtkconv.c b/gtk/gtkconv.c index f353bc6f1b..053ad42290 100644 --- a/gtk/gtkconv.c +++ b/gtk/gtkconv.c @@ -451,6 +451,18 @@ send_history_add(GaimGtkConversation *gtkconv, const char *message) gtkconv->send_history = g_list_prepend(first, NULL); } +static void +reset_default_size(GaimGtkConversation *gtkconv) +{ + GaimConversation *conv = gtkconv->active_conv; + if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) + gtk_widget_set_size_request(gtkconv->lower_hbox, -1, + gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); + else + gtk_widget_set_size_request(gtkconv->lower_hbox, -1, + gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); +} + static gboolean check_for_and_do_command(GaimConversation *conv) { @@ -537,6 +549,10 @@ send_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) return; if (check_for_and_do_command(conv)) { + if (gtkconv->entry_growing) { + reset_default_size(gtkconv); + gtkconv->entry_growing = FALSE; + } gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); return; } @@ -586,6 +602,10 @@ send_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) g_free(buf); gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); + if (gtkconv->entry_growing) { + reset_default_size(gtkconv); + gtkconv->entry_growing = FALSE; + } gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE); } @@ -3992,6 +4012,7 @@ static void resize_imhtml_cb(GaimGtkConversation *gtkconv) gtk_widget_size_request(gtkconv->lower_hbox, &sr); if (sr.height < height + GAIM_HIG_BOX_SPACE) { gtkconv->auto_resize = TRUE; + gtkconv->entry_growing = TRUE; gtk_widget_set_size_request(gtkconv->lower_hbox, -1, height + GAIM_HIG_BOX_SPACE); g_idle_add(reset_auto_resize_cb, gtkconv); } diff --git a/gtk/gtkconv.h b/gtk/gtkconv.h index 53dfbd368b..eb57b4a34b 100644 --- a/gtk/gtkconv.h +++ b/gtk/gtkconv.h @@ -131,6 +131,9 @@ struct _GaimGtkConversation * is being resized by a non-user-initiated * event, such as the buddy icon appearing */ + gboolean entry_growing; /* True if the size of the entry was set + * automatically by typing too much to fit + * in one line */ GtkWidget *close; /* "x" on the tab */ GtkWidget *icon; |