I'm writing a Python app (gtimelog) that uses a Gtk.Paned to implement an
optional side pane.  I've an action ("win.show-task-pane") bound to a key
(F9) that is implemented as a Gio.PropertyAction linked to the "visible"
property of the Gtk.Box on the right.  I also have a Gio.Settings
binding of a setting (org.gtimelog show-task-pane) to the same "visible"
property of the same Gtk.Box (using Gio.SettingsBindFlags.DEFAULT) to
make this choice persistent.  In addition, I keep the position of the
Gtk.Paned in gsettings (org.gtimelog task-pane-position) as well and set
it on startup by calling Gtk.Paned.set_position().

The problem is that with Gtk+ 3.20.8, if my application starts with the
task pane hidden and I then press F9 to show it, I get these two

    (gtimelog:3639): Gtk-WARNING **: Allocating size to  0x1ca4320 without 
calling gtk_widget_get_preferred_width/height(). How does the code know the 
size to allocate?

    (gtimelog:3639): Gtk-WARNING **: Allocating size to GtkBox 0x1a4ba50 
without calling gtk_widget_get_preferred_width/height(). How does the code know 
the size to allocate?

The first widget (0x1ca4320) is the main window (there's no class name
because it's a class defined in Python).  The second widget (0x1a4ba50)
is the Gtk.Box I'm hiding and showing (called "task_pane" in the .ui file).

There are no warnings after that, even if I hide and show the pane
again.  There no warnings whatsoever if the Gtk.Box is shown initially
on startup (because gsettings say it should be visible).

What am I doing wrong?  How can I make the warning go away?

If you'd like to play with the code, you can do that with

  git clone https://github.com/gtimelog/gtimelog
  cd gtimelog
  make          # to compile the gsettings schema

Marius Gedminas
But it makes the Linux kernel a bit like a bookstore that started with Greek,
Korean, and Japanese, and was happily organizing their books by character set,
and then added a section for the Latin character set, only to find that people
who can read the Latin character set can still only read a small fraction of
the books that use it, on account of a surprising lack of standardization in
the pronunciation, vocabulary, and grammar.
                -- iabervon explains ARM on lwn.net
gtk-app-devel-list mailing list

Reply via email to