[sysprof/newui: 12/24] Make sure there is always a caller in the callers view.



commit 07d936157bd36f7c3abb3e3d5458021e72d967c0
Author: SÃren Sandmann Pedersen <sandmann daimi au dk>
Date:   Tue Nov 9 09:13:26 2010 -0500

    Make sure there is always a caller in the callers view.
    
    This hacks around a GTK+ bug where the initial size allocation is
    screwed up for empty tree views.

 sysprof.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/sysprof.c b/sysprof.c
index 29a48b8..5cdb29e 100644
--- a/sysprof.c
+++ b/sysprof.c
@@ -486,10 +486,22 @@ add_callers (GtkListStore  *list_store,
 	     Profile       *profile,
 	     ProfileCaller *callers)
 {
+    GtkTreeIter iter;
+
+    if (!callers)
+    {
+	gtk_list_store_append (list_store, &iter);
+
+	gtk_list_store_set (
+	    list_store, &iter,
+	    CALLERS_NAME, "",
+	    CALLERS_SELF, 0.0,
+	    CALLERS_TOTAL, 0.0, -1);
+    }
+    
     while (callers)
     {
 	gchar *name;
-	GtkTreeIter iter;
 	double profile_size = profile_get_size (profile);
 
 	if (callers->name)
@@ -1120,6 +1132,14 @@ on_object_selection_changed (GtkTreeSelection *selection,
 
     fill_callers_list (app);
 
+    gtk_tree_view_columns_autosize (app->callers_view);
+
+    gtk_widget_set_size_request (app->callers_view, 2, 2);
+    gtk_widget_hide (app->callers_view);
+    gtk_widget_show (app->callers_view);
+
+    gtk_widget_set_size_request (app->callers_view, -1, -1);
+
 #if 0
     if (get_current_object (app))
 	expand_descendants_tree (app);



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