Re: Querying oaf of the interfaces a component implements ?
- From: rodrigo linuxave net
- To: Elliot Lee <sopwith redhat com>
- Cc: gnome-components-list gnome org
- Subject: Re: Querying oaf of the interfaces a component implements ?
- Date: Thu, 19 Oct 2000 15:09:05 +0200
Elliot Lee wrote:
> On Tue, 17 Oct 2000 rodrigo linuxave net wrote:
>
> > ok, here's what I'm trying to do. I've got a window which shows a list of all the
> > components of my application, and I want to let the user activate/deactivate
> > them. So, first of all, I need to know if the component is running or not to add
> > the corresponding icon next to it (one for activated and another one for
> > not-activated).
> >
> > Then, if possible, I want to let the user start/stop those components. BTW, those
> > components are GenericFactory's.
> >
> > It is a sort of goad-browser, but for only my components.
>
> OK, as long as you are aware of the race condition inherent in utilizing
> the information on whether the component is active, I'll try to explain
> how I would do it:
>
> list = oaf_query("is_rodrigos_component = true");
> active_list = oaf_query("is_rodrigos_component = true and _active = true");
> And then use active_list to go through the list and mark things as active.
>
ok, here's how I've done it. As I don't understand very well the race condition you
talk about, please tell me if what I'm trying would have any consequence:
First, I've got this function:
gboolean
gda_corba_oafiid_is_active (const gchar *oafiid)
{
OAF_ServerInfoList* servlist;
CORBA_Environment ev;
gchar* query;
g_return_val_if_fail(oafiid != NULL, FALSE);
query = g_strdup_printf("iid = '%s' AND _active = true", oafiid);
CORBA_exception_init(&ev);
servlist = oaf_query(query, NULL, &ev);
CORBA_exception_free(&ev);
g_free((gpointer) query);
if (servlist)
{
/* FIXME: free servlist */
return TRUE;
}
return FALSE;
}
This function will be called repeatedly (even several times for the same OAFIID) from
another part of the program.
Is that ok?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]