gtk_ctree_node_set_{foreground|background}



hi lars,

gtk_ctree_node_set_foreground() currently looks like:

void
gtk_ctree_node_set_foreground (GtkCTree     *ctree,
                               GtkCTreeNode *node,
                               GdkColor     *color)
{
  g_return_if_fail (ctree != NULL);
  g_return_if_fail (GTK_IS_CTREE (ctree));
  g_return_if_fail (node != NULL);

  if (color)
    {
      GTK_CTREE_ROW (node)->row.foreground = *color;
      GTK_CTREE_ROW (node)->row.fg_set = TRUE;
    }
  else
    GTK_CTREE_ROW (node)->row.fg_set = FALSE;

  tree_draw_node (ctree, node);
}

it is assuming that the GdkColor is already allocated (and if one retrives
the color from GTK_WIDGET(ctree)->style, that means that the ctree must already
be realized).

i'd suggest that the code will be changed to always assume that the color is
not yet allocated and thus it will either
- immediatedly allocate the color if the ctree is already realized, or
- store the color in ->row.foreground as currently, and allocate all
  row colors that have ->row.fg_set or ->row.bg_set set to TRUE
  upon realization.

multiple color allocations don't do any harm with owen's recent gdk_color
changes, so we should be on the save side with this.

---
ciaoTJ



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