Re: GNOME::Selector



Havoc Pennington <hp redhat com> writes:

> Coming in on the thread late - yes, I agree 100%. 
> 
> Why on earth does GnomeSelector use Bonobo if it will still require a
> C API?
> 
> Write a component, or write a widget. Mutant combinations are
> complicated to understand and implement, hard to memory manage,
> bloated, and just generally evil.
> 
> One object/type system per object!
> 
> If one of the object/type systems doesn't meet all needs, we have to
> fix it long-term. Don't work around that by trying to use both at
> once.

No, we need the C API - Bonobo and CORBA works as long as things aren't
async and you aren't interested in return values or errors.

You don't need to use gnome-selector-client.[ch] if you don't want to -
ie. you can call all of GNOME::Selector's methods with `oneway' semantics.

You need to use the C API if you want return values or error messages from
the async functions without fiddling with the event queue yourself.

Don't tell me that

====
void
gnome_selector_client_set_uri (GnomeSelectorClient   *client,
                               GnomeAsyncHandle     **handle_return,
                               const gchar           *uri,
                               guint                  timeout_msec,
                               GnomeAsyncFunc         async_func,
                               gpointer               user_data);
====

is "bloated" or harder to use than

        es = Bonobo_Unknown_queryInterface (selector, "Bonobo/EventSource", &ev);
        bonobo_event_source_client_add_listener (es, event_cb);
        GNOME_Selector_setURI (selector, uri, &ev);
        retval = wait_until_we_get_the_event_on_the_event_source ();
        do_something_with_it (retval);

With the C API this is simply

====
static void
my_async_cb (GnomeAsyncContext *context, GnomeAsyncHandle *async_handle,
             GnomeAsyncType async_type, GObject *object, const gchar *uri,
             gboolean completed, gboolean success, const gchar *error,
             const BonoboArg *result, gpointer user_data)
{
}

gnome_selector_client_set_uri (selector_client, NULL, uri, 5000,
                               my_async_cb, user_data);
====

If you don't like this, it's "allowed" to call all GNOME::Selector methods
with oneway semantics:

        /* FIXME: Make sure ORBit2 let's you pass CORBA_OBJECT_NIL as any. */
        GNOME_Selector_setURI (selector, uri, CORBA_OBJECT_NIL, &ev);

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)




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