From e3d4b60da670cff66c53f0e66bb1b1ef907a66d4 Mon Sep 17 00:00:00 2001 From: Ondrej Čerman Date: Tue, 18 Feb 2020 21:09:10 +0100 Subject: Auto resize FIX: take vertical separator into account --- src/gui.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui.c b/src/gui.c index 44ff382..ba768d6 100644 --- a/src/gui.c +++ b/src/gui.c @@ -185,7 +185,7 @@ static gboolean mid_search_eq_func(GtkTreeModel *model, gint column, const gchar } static void resize_to_treeview(GtkWindow* window, GtkTreeView* treeview) { - gint uiHeight, cellHeight, rows; + gint uiHeight, cellHeight, vSeparator, rows; GdkRectangle r; GtkTreeViewColumn *col = gtk_tree_view_get_column(treeview, 0); @@ -193,12 +193,13 @@ static void resize_to_treeview(GtkWindow* window, GtkTreeView* treeview) { return; gtk_tree_view_column_cell_get_size(col, NULL, NULL, NULL, NULL, &cellHeight); + gtk_widget_style_get(GTK_WIDGET(treeview), "vertical-separator", &vSeparator, NULL); rows = gtk_tree_model_iter_n_children(gtk_tree_view_get_model(treeview), NULL); gtk_tree_view_get_visible_rect(treeview, &r); uiHeight = defaultHeight - r.height; - gtk_window_resize(window, 500, uiHeight + cellHeight * rows); + gtk_window_resize(window, 500, uiHeight + (vSeparator + cellHeight) * rows); } int start_gui (SensorSource *ss) { -- cgit v1.2.3-70-g09d2