fix table row style (GTK3) default tip

Sun, 28 Dec 2025 16:13:34 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 28 Dec 2025 16:13:34 +0100
changeset 1031
8f72e54b423e
parent 1030
1f6caf5b60fb

fix table row style (GTK3)

ui/gtk/list.c file | annotate | diff | comparison | revisions
--- a/ui/gtk/list.c	Sun Dec 28 15:38:50 2025 +0100
+++ b/ui/gtk/list.c	Sun Dec 28 16:13:34 2025 +0100
@@ -1021,7 +1021,7 @@
         void *data = listview->getvalue(list, elm, row, c, listview->getvaluedata, &freevalue);
         
         UiModelType type = model->types[i];
-        
+        UiTextStyle cstyle = { 0, 0 };
         if(getstyle) {
             // in case the column is icon+text, only get a style for the text column
             int style_col = c;
@@ -1032,8 +1032,15 @@
             // Get the individual column style 
             // The column style overrides the row style, however if no column style
             // is provided, we stick with the row style
-            if(getstyle(list, elm, row, style_col, listview->getstyledata, &style)) {
+            if(getstyle(list, elm, row, style_col, listview->getstyledata, &cstyle)) {
                 style_set = TRUE;
+                cstyle.text_style |= style.text_style;
+                if(!cstyle.fg_set) {
+                    cstyle.fg_set = style.fg_set;
+                    cstyle.fg = style.fg;
+                }
+            } else {
+                cstyle = style;
             }
         }
 
@@ -1139,7 +1146,7 @@
             
             GValue style_weight_value = G_VALUE_INIT;
             g_value_init(&style_weight_value, G_TYPE_INT);
-            if(style.text_style & UI_TEXT_STYLE_BOLD) {
+            if(cstyle.text_style & UI_TEXT_STYLE_BOLD) {
                 g_value_set_int(&style_weight_value, 600);
             } else {
                 g_value_set_int(&style_weight_value, 400);
@@ -1148,7 +1155,7 @@
             
             GValue style_underline_value = G_VALUE_INIT;
             g_value_init(&style_underline_value, G_TYPE_INT);
-            if(style.text_style & UI_TEXT_STYLE_UNDERLINE) {
+            if(cstyle.text_style & UI_TEXT_STYLE_UNDERLINE) {
                 g_value_set_int(&style_underline_value, PANGO_UNDERLINE_SINGLE);
             } else {
                 g_value_set_int(&style_underline_value, PANGO_UNDERLINE_NONE);
@@ -1157,7 +1164,7 @@
             
             GValue style_italic_value = G_VALUE_INIT;
             g_value_init(&style_italic_value, G_TYPE_INT);
-            if(style.text_style & UI_TEXT_STYLE_ITALIC) {
+            if(cstyle.text_style & UI_TEXT_STYLE_ITALIC) {
                 g_value_set_int(&style_italic_value, PANGO_STYLE_ITALIC);
             } else {
                 g_value_set_int(&style_italic_value, PANGO_STYLE_NORMAL);
@@ -1166,12 +1173,12 @@
             
             GValue style_fgset_value = G_VALUE_INIT;
             g_value_init(&style_fgset_value, G_TYPE_BOOLEAN);
-            g_value_set_boolean(&style_fgset_value, style.fg_set);
+            g_value_set_boolean(&style_fgset_value, cstyle.fg_set);
             gtk_list_store_set_value(store, iter, soff + 4, &style_fgset_value);
             
-            if(style.fg_set) {
+            if(cstyle.fg_set) {
                 char buf[8];
-                snprintf(buf, 8, "#%02X%02X%02X", (int)style.fg.red, (int)style.fg.green, (int)style.fg.blue);
+                snprintf(buf, 8, "#%02X%02X%02X", (int)cstyle.fg.red, (int)cstyle.fg.green, (int)cstyle.fg.blue);
                 
                 GValue style_fg_value = G_VALUE_INIT;
                 g_value_init(&style_fg_value, G_TYPE_STRING);

mercurial