Re: bonobo_control_set_property question



Jeroen Zwartepoorte wrote:
Hi,

According to the BonoboPropertyControl API docs: "Each control in a
multi-page configuration should expose a string property named
"bonobo:title" which contains a translated label suitable for using in a
tabbed dialog."

So i tried to do this:

        /* Create new BonoboControl */
        ctrl =  bonobo_control_new (box);
        g_assert (ctrl != NULL);

        /* Set property page title */
        bonobo_control_set_property (ctrl, "bonobo:title", "Scintilla");

You must create that property first. Simply create a standard PropertyBag and attach it to the control.

You can take a look at bonobo-conf/bonobo-config-control.c to see how this works (impl_Bonobo_PropertyControl_getControl). Here is some code:
 

        control = bonobo_control_new (w);
        
        property_bag = bonobo_property_bag_new (config_control_get_prop,
                                                NULL, pd->name);

        bonobo_property_bag_add (property_bag, "bonobo:title", 0, 
                                 BONOBO_ARG_STRING, NULL, NULL, 
                                 BONOBO_PROPERTY_READABLE);

        bonobo_object_add_interface (BONOBO_OBJECT (control),
                                     BONOBO_OBJECT (property_bag));


But I do not like that interface at all, and I am unsure if I have implemented it the right way. Maybe I should use the PropertyBag set with bonobo_control_set_properties instead of aggregating one (Michael)? Why don't we simply aggregate a PropertyBag with a control instead of using bonobo_control_set_properties()?

- Dietmar



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