Make GtkCMCList/Tree use "text", not "fg" rc property for text color.
authorAndrej Kacian <ticho@claws-mail.org>
Tue, 13 Feb 2018 22:50:15 +0000 (23:50 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Tue, 13 Feb 2018 22:50:15 +0000 (23:50 +0100)
Closes bug #3880.

src/folderview.c
src/gtk/gtkcmclist.c
src/gtk/gtkcmctree.c
src/summaryview.c

index 8a7383a..d807486 100644 (file)
@@ -709,7 +709,7 @@ void folderview_init(FolderView *folderview)
                }
                gtkut_convert_int_to_gdk_color(prefs_common.color[COL_NEW], &gdk_color);
                normal_color_style = gtk_style_copy(normal_style);
-               normal_color_style->fg[GTK_STATE_NORMAL] = gdk_color;
+               normal_color_style->text[GTK_STATE_NORMAL] = gdk_color;
        }
 
        if (!bold_style) {
@@ -735,10 +735,10 @@ void folderview_init(FolderView *folderview)
                        }
                }
                bold_color_style = gtk_style_copy(bold_style);
-               bold_color_style->fg[GTK_STATE_NORMAL] = gdk_color;
+               bold_color_style->text[GTK_STATE_NORMAL] = gdk_color;
 
                bold_tgtfold_style = gtk_style_copy(bold_style);
-               bold_tgtfold_style->fg[GTK_STATE_NORMAL] = folderview->color_op;
+               bold_tgtfold_style->text[GTK_STATE_NORMAL] = folderview->color_op;
        }
 }
 
@@ -1729,7 +1729,7 @@ static void folderview_update_node(FolderView *folderview, GtkCMCTreeNode *node)
                if (item->prefs->color > 0 && !use_color) {
                        gtkut_convert_int_to_gdk_color(item->prefs->color, &gdk_color);
                        color_style = gtk_style_copy(bold_style);
-                       color_style->fg[GTK_STATE_NORMAL] = gdk_color;
+                       color_style->text[GTK_STATE_NORMAL] = gdk_color;
                        style = color_style;
                } else if (use_color) {
                        style = bold_color_style;
@@ -1748,7 +1748,7 @@ static void folderview_update_node(FolderView *folderview, GtkCMCTreeNode *node)
                GdkColor gdk_color;
                gtkut_convert_int_to_gdk_color(item->prefs->color, &gdk_color);
                color_style = gtk_style_copy(normal_style);
-               color_style->fg[GTK_STATE_NORMAL] = gdk_color;
+               color_style->text[GTK_STATE_NORMAL] = gdk_color;
                style = color_style;
        } else {
                style = normal_style;
@@ -2752,7 +2752,7 @@ void folderview_set_target_folder_color(gint color_op)
                folderview = (FolderView *)list->data;
                gtkut_convert_int_to_gdk_color(color_op, &folderview->color_op);
                if (firstone) {
-                       bold_tgtfold_style->fg[GTK_STATE_NORMAL] =
+                       bold_tgtfold_style->text[GTK_STATE_NORMAL] =
                                folderview->color_op;
                        firstone = 0;
                }
index 369d715..4f175ad 100644 (file)
@@ -5976,7 +5976,7 @@ draw_row (GtkCMCList     *clist,
          if (layout)
            {
              gint row_center_offset = (clist->row_height - logical_rect.height - 1) / 2;
-             gdk_cairo_set_source_color(cr, clist_row->fg_set ? &clist_row->foreground : &style->fg[state]);
+             gdk_cairo_set_source_color(cr, clist_row->fg_set ? &clist_row->foreground : &style->text[state]);
              cairo_move_to(cr, offset, row_rectangle.y + row_center_offset + clist_row->cell[i].vertical);
              pango_cairo_show_layout(cr, layout);
               g_object_unref (G_OBJECT (layout));
@@ -5997,7 +5997,7 @@ draw_row (GtkCMCList     *clist,
       if (!area) {
        cairo_rectangle(cr, row_rectangle.x, row_rectangle.y,
                            row_rectangle.width + 1, row_rectangle.height);
-       gdk_cairo_set_source_color(cr, &style->fg[GTK_STATE_NORMAL]);
+       gdk_cairo_set_source_color(cr, &style->text[GTK_STATE_NORMAL]);
        cairo_stroke(cr);
       }
       else if (gdk_rectangle_intersect (area, &row_rectangle,
@@ -6005,7 +6005,7 @@ draw_row (GtkCMCList     *clist,
        {
          cairo_rectangle(cr, row_rectangle.x, row_rectangle.y,
                            row_rectangle.width + 1, row_rectangle.height);
-         gdk_cairo_set_source_color(cr, &style->fg[GTK_STATE_NORMAL]);
+         gdk_cairo_set_source_color(cr, &style->text[GTK_STATE_NORMAL]);
          cairo_stroke(cr);
        }
     }
index d1d587d..0046b38 100644 (file)
@@ -445,7 +445,7 @@ draw_expander (GtkCMCTree     *ctree,
   /* pixel offsets +/- 1 or +/- justification_factor here and there ..
    * to fill correctly, somewhat ... what do I do wrong?
    */
-  gdk_cairo_set_source_color(cr, &gtk_widget_get_style(GTK_WIDGET(ctree))->fg[GTK_STATE_NORMAL]);
+  gdk_cairo_set_source_color(cr, &gtk_widget_get_style(GTK_WIDGET(ctree))->text[GTK_STATE_NORMAL]);
   if (ctree_row->expanded)
   {
     gint tmp3 = PM_SIZE / 2;
@@ -670,7 +670,7 @@ draw_row (GtkCMCList     *clist,
   if (clist_row->fg_set && state != GTK_STATE_SELECTED)
        fgcolor = &clist_row->foreground;
   else
-       fgcolor = &style->fg[clist_row->state];
+       fgcolor = &style->text[clist_row->state];
   /* draw the cell borders */
   if (area)
     {
@@ -927,7 +927,7 @@ draw_row (GtkCMCList     *clist,
        {
            cairo_set_line_width(cr, 1.0);
            cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
-           gdk_cairo_set_source_color(cr, &style->fg[GTK_STATE_NORMAL]);
+           gdk_cairo_set_source_color(cr, &style->text[GTK_STATE_NORMAL]);
            cairo_move_to (cr, row_rectangle.x, row_rectangle.y + 0.5);
            cairo_line_to (cr, row_rectangle.x + row_rectangle.width, row_rectangle.y + 0.5);
            cairo_move_to (cr, row_rectangle.x, row_rectangle.y + row_rectangle.height - 0.5);
index ce7062b..60938ef 100644 (file)
@@ -886,10 +886,10 @@ static void summary_set_fonts(SummaryView *summaryview)
                        }
                }
                bold_marked_style = gtk_style_copy(bold_style);
-               bold_marked_style->fg[GTK_STATE_NORMAL] =
+               bold_marked_style->text[GTK_STATE_NORMAL] =
                        summaryview->color_marked;
                bold_deleted_style = gtk_style_copy(bold_style);
-               bold_deleted_style->fg[GTK_STATE_NORMAL] =
+               bold_deleted_style->text[GTK_STATE_NORMAL] =
                        summaryview->color_dim;
        }
 
@@ -5877,22 +5877,22 @@ void summary_set_colorlabel_color(GtkCMCTree *ctree, GtkCMCTreeNode *node,
        if (color_index < 0 || color_index >= N_COLOR_LABELS) {
                if (!prev_style) return;
                style = gtk_style_copy(prev_style);
-               color = ctree_style->fg[GTK_STATE_NORMAL];
-               style->fg[GTK_STATE_NORMAL] = color;
-               color = ctree_style->fg[GTK_STATE_SELECTED];
-               style->fg[GTK_STATE_SELECTED] = color;
+               color = ctree_style->text[GTK_STATE_NORMAL];
+               style->text[GTK_STATE_NORMAL] = color;
+               color = ctree_style->text[GTK_STATE_SELECTED];
+               style->text[GTK_STATE_SELECTED] = color;
        } else {
                if (prev_style)
                        style = gtk_style_copy(prev_style);
                else
                        style = gtk_style_copy(ctree_style);
                color = colorlabel_get_color(color_index);
-               style->fg[GTK_STATE_NORMAL] = color;
+               style->text[GTK_STATE_NORMAL] = color;
                /* get the average of label color and selected fg color
                   for visibility */
-               style->fg[GTK_STATE_SELECTED].red   = (color.red   + 3*ctree_style->fg[GTK_STATE_SELECTED].red  ) / 4;
-               style->fg[GTK_STATE_SELECTED].green = (color.green + 3*ctree_style->fg[GTK_STATE_SELECTED].green) / 4;
-               style->fg[GTK_STATE_SELECTED].blue  = (color.blue  + 3*ctree_style->fg[GTK_STATE_SELECTED].blue ) / 4;
+               style->text[GTK_STATE_SELECTED].red   = (color.red   + 3*ctree_style->text[GTK_STATE_SELECTED].red  ) / 4;
+               style->text[GTK_STATE_SELECTED].green = (color.green + 3*ctree_style->text[GTK_STATE_SELECTED].green) / 4;
+               style->text[GTK_STATE_SELECTED].blue  = (color.blue  + 3*ctree_style->text[GTK_STATE_SELECTED].blue ) / 4;
        }
 
        gtk_cmctree_node_set_row_style(ctree, node, style);