GtkTreeView. How to hide or show an individual cell in a row



Hello,
I am making a GTK3 application with GtkTreeView listing.
The simple listing will show country flags + names and number of
radio-channels (to later choose from).

I want to show a button or icon in a column (in the cell) when the row has
been selected.
Otherwise the cell should be empty (button/icon is hidden).

So I want to show the cell content when row is selected, otherwise hide it
(hide the button).
How to do this?
Please be generous with examples and explanation, especially if you refer
to CSS and internal layouts of cell renderers.

Here is an example GTK3 application with GtkTreeView (sortable and
filterable view) with some data.
The sample shows a “small-arrow.png” icon in the last column. This is the
cell I want to hide/show depending on the row is/is not selected.

Sample code: test1.c and small-arrow.png
Get them from:
https://drive.google.com/drive/folders/1JfCzZPPKvtT13bIwu-dgqvKD_zwDySnt?usp=sharing

// Compile and link it
gcc -Wall -o test1 test1.c $(pkg-config --cflags --libs gtk±3.0)

// Run it
./test1

Same question on Discourse.GNOME:
https://discourse.gnome.org/t/gtktreeview-how-to-hide-or-show-an-individual-cell-in-a-row/739

Cumprimentos
Osmo Moma Antero
Wine tasting lad in
Portugal

-- 
Sent from my PC, laptop or phone with Ubuntu-Linux.


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