How do I eliminate spacing/padding between a GtkTreeView's rows?

I’m trying to get rid of spacing between rows of a GtkTreeView presenting a single list. I managed to do this with a GtkMenu’s items and some iffy CSS, but I cannot find the right properties/CSS-selectors to do the same with a tree view.

The reason I need this is for properly showing directory art in the VICE emulator when previewing a disk image, using the old CBM font as used on their 8-bit machines, below is a screenshot of what I managed to do with the GtkMenu(Item) stuff and a bunch of CSS:

Currently, using a GtkTreeView looks like this:

As you can see, the spacing between the rows results in the dir art being broken. (Ignore the PETSCII-to-UTF8 encoding issues, I can fix that). So hopefully someone can point me in the right direction to fix this. I usually stay away from CSS and let the user’s theme handle how the UI looks, but in this case, I’ll have to customize the look of the widget.

Please, don’t use a GtkTreeView to show a grid of data: it’s not what the widget is for. It’s not even what GtkMenu is for, to be honest, and the fact that you made it work does not imply it’s a good idea.

You probably need a custom widget—have you thought about deriving GtkDrawingArea and drawing the data yourself using the appropriate grid?

We need the displayed ‘directory’ to be clickable so we can copy the selected file to a virtual floppy and autostart the file from that floppy.

I suppose I could try a GtkDrawingArea to render the directory, as long as that allows us to get an index of the selected file. Also, what kind of backend does the GtkDrawingArea need, if at all? We’re having some trouble with intel OpenGL drivers not rendering GtkGlArea’s properly (or not at all).

None. GtkDrawingArea is just an empty widget that lets you draw on it with Cairo, just like any other widget.

I’m not saying you should replace anything else, just the preview widget.

I’ll try using GtkDrawingArea, see what that does. I wasn’t very happy with setting top/bottom margins of the label in the menu item to -2px anyway.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.