[glade] GladeStringList: request height for four lines of text
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] GladeStringList: request height for four lines of text
- Date: Sat, 20 Apr 2013 13:42:40 +0000 (UTC)
commit 94dbdf9f343bba7c580f4b75aa5d699def9be296
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sat Apr 20 19:37:45 2013 +0900
GladeStringList: request height for four lines of text
plugins/gtk+/glade-string-list.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
---
diff --git a/plugins/gtk+/glade-string-list.c b/plugins/gtk+/glade-string-list.c
index 4b6f016..aef7138 100644
--- a/plugins/gtk+/glade-string-list.c
+++ b/plugins/gtk+/glade-string-list.c
@@ -521,6 +521,31 @@ treeview_key_press (GtkWidget *treeview,
return FALSE;
}
+static gint
+get_tree_view_height (void)
+{
+ static gint height = -1;
+
+ if (height < 0)
+ {
+ GtkWidget *label = gtk_label_new (NULL);
+ PangoLayout *layout =
+ gtk_widget_create_pango_layout (label,
+ "The quick\n"
+ "brown fox\n"
+ "jumped over\n"
+ "the lazy dog");
+
+ pango_layout_get_pixel_size (layout, NULL, &height);
+
+ g_object_unref (layout);
+ g_object_ref_sink (label);
+ g_object_unref (label);
+ }
+
+ return height;
+}
+
static GtkWidget *
glade_eprop_string_list_create_input (GladeEditorProperty * eprop)
{
@@ -582,7 +607,7 @@ glade_eprop_string_list_create_input (GladeEditorProperty * eprop)
swindow = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (swindow), 150);
+ gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (swindow), get_tree_view_height ());
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]