X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fcontrolflow%2Fprocesslist.c;h=383c3e8e658cd1c6308f599d1ee37a57a36131f9;hb=ec7a5af61127aa50a1839eee5be99ce53494c57b;hp=9401d81a0f3f819cc601dc0f9e6f9d15dfc50445;hpb=8badf73a4acfc1b9d1ff2c8c2f04c0ed8feaa1cf;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c index 9401d81a..383c3e8e 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c @@ -400,26 +400,16 @@ ProcessList *processlist_construct(void) renderer = gtk_cell_renderer_text_new (); process_list->renderer = renderer; - gint vertical_separator; - gtk_widget_style_get (GTK_WIDGET (process_list->process_list_widget), - "vertical-separator", &vertical_separator, - NULL); - gtk_cell_renderer_get_size(renderer, - GTK_WIDGET(process_list->process_list_widget), - NULL, - NULL, - NULL, - NULL, - &process_list->cell_height); - -#if GTK_CHECK_VERSION(2,4,15) - guint ypad; - g_object_get(G_OBJECT(renderer), "ypad", &ypad, NULL); + /* Add a temporary row to the model to get the cell size when the first + * real process is added. */ + GtkTreeIter iter; + GtkTreePath *path; + path = gtk_tree_path_new_first(); + gtk_tree_model_get_iter (gtk_tree_view_get_model(GTK_TREE_VIEW(process_list->process_list_widget)), &iter, path); + gtk_list_store_append(process_list->list_store, &iter); + gtk_tree_path_free(path); - process_list->cell_height += ypad; -#endif - process_list->cell_height += vertical_separator; - + process_list->cell_height = 0; // not ready to get size yet. column = gtk_tree_view_column_new_with_attributes ( "Process", renderer, @@ -673,6 +663,21 @@ int processlist_add( ProcessList *process_list, hashed_process_data->x.under_marked = FALSE; hashed_process_data->next_good_time = ltt_time_zero; + if (process_list->cell_height == 0) { + GtkTreePath *path; + GdkRectangle rect; + GtkTreeIter iter; + + path = gtk_tree_path_new_first(); + gtk_tree_model_get_iter (gtk_tree_view_get_model(GTK_TREE_VIEW(process_list->process_list_widget)), &iter, path); + gtk_tree_view_get_background_area( + GTK_TREE_VIEW(process_list->process_list_widget), + path, NULL, &rect); + gtk_list_store_remove(process_list->list_store, &iter); + gtk_tree_path_free (path); + process_list->cell_height = rect.height; + } + /* Add a new row to the model */ gtk_list_store_append ( process_list->list_store, &hashed_process_data->y_iter); @@ -697,9 +702,19 @@ int processlist_add( ProcessList *process_list, (gpointer)hashed_process_data); process_list->number_of_process++; +#if 0 + GtkTreePath *path; + GdkRectangle rect; + gtk_widget_queue_draw(process_list->process_list_widget); + path = gtk_tree_path_new_first(); + gtk_tree_view_get_background_area(GTK_TREE_VIEW(process_list->process_list_widget), + path, NULL, &rect); + gtk_tree_path_free (path); + process_list->cell_height = rect.height; +#endif //0 - hashed_process_data->height = process_list->cell_height; + hashed_process_data->height = process_list->cell_height; g_assert(hashed_process_data->height != 0); *height = hashed_process_data->height * process_list->number_of_process;