[gnome-chat] conversation-view: Add hack to force TextView to wrap rather than grow
- From: Yosef Or Boczko <yoseforb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chat] conversation-view: Add hack to force TextView to wrap rather than grow
- Date: Wed, 16 Oct 2013 13:35:14 +0000 (UTC)
commit b03f9eade9a098b3d3b70b1f13601f61e34d5d7b
Author: Yosef Or Boczko <yoseforb gmail com>
Date: Wed Oct 16 16:28:57 2013 +0300
conversation-view: Add hack to force TextView to wrap rather than grow
GtkTextView's horizontal size request will grow over time
when added to a GtkScrolledWindow with horizontal scrolling
disabled, even when the TextView is set up to wrap lines.
As a workaround, we overwrite its size request with a constant
width to force the text to wrap around.
See 65ce0de0e3abc9de4fd672c31a92120bf548c518 commit in polari.
src/chat-conversation-view.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/chat-conversation-view.c b/src/chat-conversation-view.c
index 7c9166d..393a5c6 100644
--- a/src/chat-conversation-view.c
+++ b/src/chat-conversation-view.c
@@ -31,6 +31,15 @@ G_DEFINE_TYPE_WITH_CODE (ChatConversationView, chat_conversation_view, GTK_TYPE_
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
chat_conversation_view_buildable_init));
+static void
+chat_conversation_get_preferred_width (GtkWidget *widget, gint *minimum_width, gint *natural_width)
+{
+ if (minimum_width)
+ *minimum_width = 1;
+
+ if (natural_width)
+ *natural_width = 1;
+}
static void
chat_conversation_view_init (ChatConversationView *self)
@@ -44,6 +53,8 @@ chat_conversation_view_class_init (ChatConversationViewClass *class)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->get_preferred_width = chat_conversation_get_preferred_width;
+
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/chat/conversation-view.ui");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]