A couple of gobject/parameter issues



As Jonathan mentioned in his mail, he has been working recently
on making the new tree widget work so that the properties of
the cell render widget come from the columns of the model.

That is, you have the model table:

 Model Column  1           2             3
 Type          boolean     color         string  

 And the view is defined as:

 column a:
   check indicator renderer
      ::value <= model column 1
  
  column b:
    text label renderer
      ::background_gdk <= model column 2
      ::text <= model column 3    
  
So, that's the general setup. To be forward-looking, Jonathan has been
doing this in terms of GValue/GParam instead of GtkArg. In
helping Jonathan with this, I've (re)discovered a couple of
problems that GObject/GValue has.

 1) Memory management 
    (this is a reminder of http://www.gtk.org/~otaylor/gtk/gobject/issue3.html)

   There is apparently no way to create a GValue that does _not_
   own its context. But forcing a copy for non-refcounted objects
   (strings, events, etc.) when passing them to a signal or 
   setting an argument is horrible inefficiency.

   Two different different variants on a solution (an owned flag
   or  convention) are discussed at the above URL.

 2) Boxed types

   One of the common types for cell renderers is a a GdkColor.
   But we seem to be lacking a framework in the type system
   implementing a reasonable GDK_TYPE_GDK_COLOR.

   The basic interface is I think we'd want for handling boxed
   types would look like:

    typedef gpointer (*GBoxedCopyFunc) (gconstpointer orig_boxed);
    typedef void (*GBoxedCopyFunc) (gpointer orig_boxed);

    GType g_type_register_boxed (const char     *type_name,
                                 GBoxedCopyFunc *copy_func,
                                 GBoxedFreeFunc *free_func);
   
    GParamSpec* g_param_spec_boxed (const gchar *name,
                                    const gchar *nick,
                                    const gchar *blurb,
                                    GType        boxed_type,
                                    gpointer     default_boxed,
                                    GParamFlags  flags);

    /* do we need default_value, or is NULL appropriate? */

    void g_value_set_boxed (GValue  *value,
                            GType    boxed_type,
                            gpointer boxed); 

   This looks pretty straightforward to implement by adding
   a new fundemental type G_TYPE_BOXED (classed, !instatiable,
   derivable, !deep_derivable), and storing the copy and free
   functions in the class structure.

   Does that make sense to you?
 
 3) Can we call parameters properties or attributes. Please?
    Pretty please?

Regards,
                                        Owen



 


 





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