RE: g_object_class_install_property



Hi Daniel and Tristan,

Thanks for your replies.

 

I did succeed installing the properties, more or less same as you have
defined in the example.

 

I have one concern here,

After I had installed the properties , I had used g_object_new
(GTK_TYPE_WIDGET, NULL) to create the object in gtk_widget_new() function.

But (as per ur example) gnome_db_grid_set_property () wasn?t invoked.

But when I created the object by passing the ?first_argument? name, i.e
g_object_new(GTK_TYPE_WIDGET, ?raw_grid?, value, NULL) only then 

gnome_db_grid_set_property() was invoked.

 

All I want to know is, Well the above stated behaviour of GTK is default
behavior or Am I going wrong some where.

 

Thanks,

 

Madhusudan E,

HTIPL, Bangalore-08

 

- 9980527224

www.huawei.com

 

This e-mail and attachments contain confidential information from HUAWEI,
which is intended only for the person or entity whose address is listed
above. Any use of the information contained herein in any way (including,
but not limited to, total or partial disclosure, reproduction, or
dissemination) by persons other than the intended recipient's) is
prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it!

  _____  

From: Daniel Espinosa [mailto:esodan gmail com] 
Sent: Wednesday, August 23, 2006 11:10 PM
To: Tristan Van Berkom
Cc: Madhusudan E; gtk-app-devel-list gnome org
Subject: Re: g_object_class_install_property

 

For an example of how to create GObjects (all GktWidgets are derived from
it), you can check the code in CVS for diferent objects in Gnome-DB in:

http://cvs.gnome.org/viewcvs/libgnomedb/libgnomedb/ 

Gnome-Db defines a lot of new Widgets to manipulate data from Data Bases,
then I think is a good example. Review the GObject documentation.

You mus have a your_widget_class_init function with this:

/* Properties */
        object_class->set_property = gnome_db_grid_set_property;
        object_class->get_property = gnome_db_grid_get_property;
    g_object_class_install_property (object_class, PROP_RAW_GRID, 
                                         g_param_spec_object ("raw_grid",
NULL, NULL, 
                                  GNOME_DB_TYPE_RAW_GRID,
                                  G_PARAM_READABLE));
    g_object_class_install_property (object_class, PROP_INFO,
                                         g_param_spec_object ("widget_info",
NULL, NULL, 
                                  GNOME_DB_TYPE_DATA_WIDGET_INFO, 
                                  G_PARAM_READABLE));



2006/8/23, Tristan Van Berkom <tvb gnome org>:

Madhusudan E wrote:
Hi,
The property wasn't defined on the object, But it started working when I
defined the first_property in g_object_new().

I have a query here,
Doesn't the gobject_class->set_property function be invoked without
sending 
the first_property parameter in g_object_new().
If not then somewhere it needs to documented.


I dont understand your question really,
   - g_object_new() creates an object with the specified properties 
     (if any properties are specified - otherwise they are assumed to be
     the defaults that you specified in the GParamSpec)
   - You can later set these properties using g_object_set()
   - If you cant set a property using g_object_set() later on - then you 
     probably didnt give it G_PARAM_WRITABLE permissions or you called it
     G_PARAM_CONSTRUCT_ONLY.

Cheers,
                -Tristan
_______________________________________________
gtk-app-devel-list mailing list 
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




-- 
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (entrámite, pero para los cuates:
LIBRE) 




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