Using GnomeDbControl



Hi Rodrigo!

I've started to create config control components for the postgres provider. You
will find the two new files for this on CVS: gda-postgres-config-main.c and
gda-postgres-config.gnorba.

At the moment I have created a small component to manage users in the DB (there
is still nothing behind the widget interface!), and a sample global config
component which just creates a notebook and set a page with the small widget
just mentionned above. This is what appears in the .gnorba file, 2 interfaces:
[control-factory:gnome-db-config]
[control-factory:gnome-db-users-list]

It seems to be working quite correctly. But I have a problem with the
declaration of properties: for now I cannot declare any more properties than
what will be declared in the control_factory() function from gnome-db-control.c
(what I will then call 'global properties' because they apply to ALL
GnomeDbControl objects)

Enabling components to declare their own specific properties is necessary:
every component will 'inherit' the global properties as a GnomeDbObject, but
needs to set its own specific properties.

What I suggest is that we declare:

typedef void (*GnomeDbControlProps)(BonoboPropertyBag  *pb, GtkWidget *data);
struct _GnomeDbControl
{
  BonoboObject          bonobo_object;
  BonoboGenericFactory* factory;
  GnomeDbControlFunc    create_widget_cb;
  GnomeDbControlProps   declare_props;
};

and change function _new to:
GtkObject*  gnome_db_control_new(const gchar *id, 
                                 GnomeDbControlFunc func,
                                 GnomeDbControlProps props);

a GnomeDbControlProps migth be something like:

void declare_users_list_props_cb (BonoboPropertyBag  *pb, GtkWidget *data)
{
  bonobo_property_bag_add_full(pb, "my_prop", 1, BONOBO_ARG_BOOLEAN, NULL, 
                               "Component's own property", 0,
                               my_set_prop_func, my_get_prop_func, data);
}

and we modify the function control_factory() by adding a line (after line 93):
if (control->declare_props) control->declare_props(pb, widget);

If my explanations are clear, what do you think of all this?

Thanks,

Vivien




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