summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Čerman2020-02-18 21:09:10 +0100
committerOndrej Čerman2020-02-18 21:09:10 +0100
commite3d4b60da670cff66c53f0e66bb1b1ef907a66d4 (patch)
treeb03cf20e5ff42f947715fe5aea7d91c2081fb873
parentd3464ba638a1f34ce95aea491617251f150afae3 (diff)
Auto resize FIX: take vertical separator into account
-rw-r--r--src/gui.c5
1 files 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) {