Re: ORBit2 and async stuff



Hi Michael,

how does the following API look ?

The CORBA API (ClientID is unique per GNOME::Selector object, AsyncID is set by the client to
identify the async job):

====
    interface Selector : Bonobo::Unknown {
	typedef unsigned long ClientID;
	typedef unsigned long AsyncID;

	ClientID getClientID ();

	enum AsyncType {
	    ASYNC_TYPE_UNSPECIFIED,
	    ASYNC_TYPE_CHECK_URI,
	    ASYNC_TYPE_SCAN_DIRECTORY,
	    ASYNC_TYPE_CHECK_FILENAME,
	    ASYNC_TYPE_CHECK_DIRECTORY,
	    ASYNC_TYPE_ADD_FILE,
	    ASYNC_TYPE_ADD_DIRECTORY,
	    ASYNC_TYPE_ADD_URI,
	    ASYNC_TYPE_ADD_URI_LIST,
	    ASYNC_TYPE_SET_URI
	};

	struct AsyncData {
	    ClientID client_id;
	    AsyncID async_id;
	    any user_data;
	};

	struct AsyncReply {
	    AsyncData    async_data;
	    AsyncType    type;
	    string       uri;
	    boolean      success;
	    string       error;
	};

	Bonobo::Control getControl ();
	Bonobo::EventSource getEventSource ();

	string getEntryText ();
	void setEntryText (in string text);
	void activateEntry ();

	string getURI ();
	void setURI (in string uri,
		     in AsyncData async_data);
    };
====

Client API (GnomeAsyncContext is a BonoboObject, GnomeAsyncHandle an opaque struct and
GnomeAsyncType an integer value):

====
typedef void (*GnomeAsyncFunc)              (GnomeAsyncContext  *ctx,
					     GnomeAsyncHandle   *async_handle,
					     GnomeAsyncType      async_type,
					     GObject            *object,
					     const gchar        *uri,
					     const gchar        *error,
					     gboolean            success,
					     gpointer            user_data);

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

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




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