[gtksourceview] Enable wrapping for the default info widget



commit 27c6e3b0ecae4ac250325d3ccb8587a8c4b1818d
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sun Oct 4 02:04:30 2009 +0200

    Enable wrapping for the default info widget
    
    The solution is to set a -1, -1 size request before setting text in the label.
    Then after setting the proposal info text in the label, check the size request
    and if it exceeds the maximum width, explicitly force the width to that
    specific size.

 gtksourceview/gtksourcecompletion.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 96efa92..5ebcd5d 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -908,10 +908,20 @@ update_proposal_info_real (GtkSourceCompletion         *completion,
 		/* If there is no special custom widget, use the default */
 		if (info_widget == NULL)
 		{
+			gint width;
+
 			info_widget = completion->priv->default_info;
 			text = gtk_source_completion_proposal_get_info (proposal);
+			gtk_widget_set_size_request (info_widget, -1, -1);
 			
 			gtk_label_set_markup (GTK_LABEL (info_widget), text != NULL ? text : _("No extra information available"));
+			
+			gtk_widget_get_size_request (info_widget, &width, NULL);
+			
+			if (width > WINDOW_WIDTH)
+			{
+				gtk_widget_set_size_request (info_widget, width, -1);
+			}
 		}
 		else
 		{
@@ -2746,6 +2756,8 @@ initialize_ui (GtkSourceCompletion *completion)
 	
 	gtk_misc_set_alignment (GTK_MISC (completion->priv->default_info), 0.5, 0.5);
 	gtk_label_set_selectable (GTK_LABEL (completion->priv->default_info), TRUE);
+	gtk_label_set_line_wrap (GTK_LABEL (completion->priv->default_info), TRUE);
+
 	gtk_widget_show (completion->priv->default_info);
 	
 	gtk_source_completion_info_set_widget (GTK_SOURCE_COMPLETION_INFO (completion->priv->info_window), 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]