[Glade-users] Fwd: Failing to display a custom fake property



On Fri, Feb 7, 2014 at 6:23 PM, Alejandro T. Colombini
<atcolombini at gmail.com> wrote:
Hi,
  thank you for replying, and sorry for the lack of information, I've solved
the problem of the values not displaying and it had nothing to do with glade
itself.

  What I'm doing is to set a fake property to store a list of pairs of
strings in the glade files and then load them in a internal structure of the
buildable object this property belongs to. To set this list, I've declared
the fake property as a GtkListStore (with two columns), so it can be used
both for storing the property in the glade plugin until it is written to the
UI definition of my object, and also as a model of the GtkTreeView used as
input of the property for the user to set those pairs of strings. So the
value of the property is an object (a GtkListStore), but the values I
actually need are the contents of this object, which are then written to the
XML inside a set of custom tags. All this is working right now.

  The problem I had was that the values set in the GtkListStore through the
GtkTreeView were not showing, but it was just because I made a mistake when
defining the GtkCellRenderers, and I wasn't paying attention to it due to
the warning shown by Glade while setting the value of the property itself.

  The warning is still showing when I set the value of the property (the
GtkListStore) using the glade_command family of functions but the undo/redo
is working. This is the only thing left to fix in the plugin. These are the
warnings shown when:
     - using glade_command_set_property or glade_command_set_property_value
with a value for the property:
      (glade:5091): GladeUI-CRITICAL **: Object type property refers to an
object outside the project
      (glade:5091): GladeUI-CRITICAL **: glade_property_update_prop_refs:
assertion `gnew != NULL' failed

     - using glade_command_set_property or glade_command_set_property_value
with NULL (to unset the value):
      (glade:5091): GladeUI-CRITICAL **: glade_property_update_prop_refs:
assertion `gold != NULL' failed

  The second and third messages are also emitted when using the
glade_property_set and glade_property_set_value functions.

  If you need more information about anything, let me know and I'll try to
provide it. Thanks.

Ok I have an idea what's going on - however I'm still guessing so you may
have to clarify.

My "guess" is that somewhere in your plugin, you are adding a new object
to the project and you want that new widget to automatically refer to this
GtkListStore which you are adding at the same time.

A few notes should help to set you straight, assuming that you are trying
to atomically add a "foo" which starts out referring to "bar":

  A.) If you want to set a property reference, you must absolutely refer to
        an object which is in the project - which means that "bar" must be
        added to the project *before* having "foo" refer to it.

  B.) I may be helpful to know that you don't need the GladeCommand interface
        for setting up values on a GladeWidget before adding it to the
project, any
        properties set on a GladeWidget *before* adding it to the
project will be
        remembered as the initial values upon the project addition command.

        Of course if you are setting the value of the newly created
object to another
        project object - *that* other project object must also be
undoably added to
        the project.

  C.) Remember to use glade_command_push/pop_group() to ensure the addition
        of both objects become an atomic command.

Hope this solves it for you.

Cheers,
     -Tristan




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