Re: Having issues porting a CellRenderer / CellEditable to Gtk3

On 08.07.2012 05:20, Daniel Kasak wrote:
One of my Gtk2 projects has some customer CellRenderers. I've done the
basic s/Gtk2/Gtk3/ on everything ... and now my treeview code is dying with:

GLib-GObject-CRITICAL **: Object class My__CellEditableText doesn't
implement property 'editing-canceled' from interface 'GtkCellEditable'
line 233.

That's just a (strong) warning, your program will normally not exit due to this. Also, if your gtk+ >= 2.20, you will also get this warning with Gtk2.

Are there any docs on this ( ie what's required when subclassing a
GtkCellEditable ) ... or even better ... what's changed between Gtk2 and
Gtk3 more generally?

Well, what is required to implement an interface actually depends on the interface. There is some general documentation at <>, but much of it shows boilerplate code that Glib::Object::Subclass handles for you already. For GtkCellEditable, it seems like nothing is really required, the default implementations are sufficient. If you wanted to pass such an editable to code that assumes a fully general editable, maybe something would break, I'm not sure.

To get rid of the property warning, you would use

use Glib::Object::Subclass
  properties => [
    Glib::ParamSpec->boolean (
      'Editing canceled',
      'Editing canceled',
      [qw/readable writable/]
  interfaces => [ Gtk2::CellEditable:: ];

But that doesn't currently work correctly, at least on my machine, because the order that the 'properties' and 'interfaces' args from above reach the type registration machinery is currently random. The warning occurs if 'interfaces' is processed before 'properties'. The attached patch to Glib fixes this for me.

Also, this warning would not occur if Glib handled interface properties more smartly: <>.

For now, I think it's safe for you to ignore this warning.

Attachment: order-fix.patch
Description: Text Data

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