[gtkmm] Changes from 2.0 to 2.4? (My old cellrenderer doesn't work anymore)


I'm trying to compile my old GTK-- 2.0 application with 2.4, and it
almost works out of the box, except SigC renaming the slot function.

The only thing that I can't get to work is the custom cellrenderer I had
implemented: one of the TreeView columns has a set<string> datatype, and
I subclassed Gtk::CellRendererText with a simple render_vfunc function
that prepares a string with a comma-separated list of the items in the
set and allows CellRendererText to do the job:

void TagsetCellRenderer::render_vfunc(const Glib::RefPtr<Gdk::Window>& window,
                                        Gtk::Widget& widget,
                                        const Gdk::Rectangle& rect1,
                                        const Gdk::Rectangle& cell_area,
                                        const Gdk::Rectangle& rect2,
                                        Gtk::CellRendererState flags)
    set<string> ts = _property_tagset.get_value();
    fprintf(stderr, "%d tags in line\n", ts.size());
    string tags;
    for (set<string>::const_iterator j = ts.begin();
            j != ts.end(); j++)
        if (j == ts.begin())
            tags += *j;
            tags += ", " + *j;

    Gtk::CellRendererText::render_vfunc(window, widget, rect1, cell_area, rect2, flags);

Here's how I add the column:

  TagsetCellRenderer*const renderer = new TagsetCellRenderer(*this);
  Gtk::TreeViewColumn*const column  = new Gtk::TreeViewColumn("Tags", *Gtk::manage(renderer));
  column->add_attribute(renderer->property_tagset(), itemListModelColumns.tags);

Now, it did work, it doesn't now.  The fprintf in render_vfunc doesn't
get called, so it appears that the method itself doesn't get called.
However, Gtk::CellRendererText::render_vfunc is still there in the
header file...

Question 1: what happened?
Question 2: is there a 2.0->2.4 migration guide?
Question 3: will there be a whole chapter on creating custom cell
	    renderers in the Gtk-- tutorial?  In my history with Gtk--,
	    everything has always been smooth except cell renderers:
	    appearently, some work is still needed in that field :(



GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini <enrico debian org>

Attachment: signature.asc
Description: Digital signature

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