Re: SimpleList and CellRenderer tweaking




On Wednesday, May 12, 2004, at 06:52 PM, Jörn Reder wrote:

    my $bold_cr = Gtk2::CellRendererText->new;
    $bold_cr->set ( weight => 700 );

    $slist->get_column($_)->add_attribute($bold_cr, weight_set => 5)
            for (0..3);

you're adding the attribute on a new cell renderer that you're not using; however, the cell renderer you pass to add_attributes must be one that you've already packed into the column. also, you have an off-by-one on the loop if you just want the first three. i think you want instead something like this:

  for (0..2) {
      my $col = $slist->get_column ($_);
my $cell = ($col->get_cell_renderers)[0]; #consider only the first
      $col->add_attribute ($cell, weight_set => 5);
  }


But I get only an assertion warning for the ->add_attribute(...) line:

  Gtk-CRITICAL **: file gtktreeviewcolumn.c: line 1359
    (gtk_tree_view_column_add_attribute): assertion `info != NULL'

GtkTreeViewColumn stores a list of structures that contain the attributes you add for each cell renderer, keyed on the cell renderers; since you hadn't added $bold_cr to the column, it didn't know anything about it and complained.



--
She's obviously your child. She looks like you, she talks a lot, and most of it is gibberish.
  -- Elysse, to me, of Zella.




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