[monkey-bubble: 265/753] New typedef. (GnomeSelectorClientAsyncFunc): New typedef.
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 265/753] New typedef. (GnomeSelectorClientAsyncFunc): New typedef.
- Date: Wed, 14 Jul 2010 22:17:55 +0000 (UTC)
commit fc68599e4580b6ec68b8bd70ab43bde3ead163cb
Author: Martin Baulig <baulig suse de>
Date: Tue May 8 19:58:43 2001 +0000
New typedef. (GnomeSelectorClientAsyncFunc): New typedef.
2001-05-08 Martin Baulig <baulig suse de>
* gnome-selector-client.h
(GnomeSelectorClientAsyncHandle): New typedef.
(GnomeSelectorClientAsyncFunc): New typedef.
(gnome_selector_client_get_uri): New function.
(gnome_selector_client_set_uri): New function.
libgnomeui/ChangeLog | 8 ++
libgnomeui/gnome-component-widget.c | 135 ++++++++++++++++++++++++++++++++++-
libgnomeui/gnome-component-widget.h | 32 +++++++-
3 files changed, 169 insertions(+), 6 deletions(-)
---
diff --git a/libgnomeui/ChangeLog b/libgnomeui/ChangeLog
index 563c06c..47f8eca 100644
--- a/libgnomeui/ChangeLog
+++ b/libgnomeui/ChangeLog
@@ -1,5 +1,13 @@
2001-05-08 Martin Baulig <baulig suse de>
+ * gnome-selector-client.h
+ (GnomeSelectorClientAsyncHandle): New typedef.
+ (GnomeSelectorClientAsyncFunc): New typedef.
+ (gnome_selector_client_get_uri): New function.
+ (gnome_selector_client_set_uri): New function.
+
+2001-05-08 Martin Baulig <baulig suse de>
+
* gnome-selectorP.h: Removed.
* gnome-selector.[ch]: Removed, this is now in libgnome.
* gnome-file-selector.[ch]: Removed, this is now in libgnome.
diff --git a/libgnomeui/gnome-component-widget.c b/libgnomeui/gnome-component-widget.c
index 5fb3313..425e991 100644
--- a/libgnomeui/gnome-component-widget.c
+++ b/libgnomeui/gnome-component-widget.c
@@ -27,13 +27,21 @@
#include <config.h>
#include <libgnomeui/gnome-entry.h>
#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-async.h>
struct _GnomeSelectorClientPrivate {
GNOME_Selector selector;
+ Bonobo_EventSource_ListenerId listener_id;
+
+ GNOME_Selector_ClientID client_id;
+
+ GList *async_ops;
};
static BonoboWidgetClass *gnome_selector_client_parent_class;
+static GNOME_Selector_AsyncID last_async_id = 0;
+
static void
gnome_selector_client_finalize (GObject *object)
{
@@ -84,11 +92,34 @@ gnome_selector_client_get_type (void)
return type;
}
+static void
+gnome_selector_client_event_cb (BonoboListener *listener, char *event_name,
+ CORBA_any *any, CORBA_Environment *ev, gpointer user_data)
+{
+ GnomeSelectorClient *client;
+ GNOME_Selector_AsyncReply *async_reply;
+
+ g_return_if_fail (user_data != NULL);
+ g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (user_data));
+ g_return_if_fail (any != NULL);
+ g_return_if_fail (CORBA_TypeCode_equal (any->_type, TC_GNOME_Selector_AsyncReply, ev));
+ g_return_if_fail (!BONOBO_EX (ev));
+
+ client = GNOME_SELECTOR_CLIENT (user_data);
+
+ async_reply = any->_value;
+
+ g_message (G_STRLOC ": %p - `%s' - (%d,%d) - `%s' - %d", client, event_name,
+ async_reply->ctx.client_id, async_reply->ctx.async_id, async_reply->uri,
+ async_reply->success);
+}
+
GnomeSelectorClient *
gnome_selector_client_construct (GnomeSelectorClient *client, GNOME_Selector corba_selector,
Bonobo_UIContainer uic)
{
Bonobo_Control corba_control;
+ Bonobo_EventSource event_source;
CORBA_Environment ev;
g_return_val_if_fail (client != NULL, NULL);
@@ -117,6 +148,28 @@ gnome_selector_client_construct (GnomeSelectorClient *client, GNOME_Selector cor
return NULL;
}
+ client->_priv->client_id = GNOME_Selector_getClientID (client->_priv->selector, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_object_unref (G_OBJECT (client));
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ event_source = GNOME_Selector_getEventSource (client->_priv->selector, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_object_unref (G_OBJECT (client));
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ client->_priv->listener_id = bonobo_event_source_client_add_listener
+ (event_source, gnome_selector_client_event_cb, NULL, &ev, client);
+ if (BONOBO_EX (&ev)) {
+ g_object_unref (G_OBJECT (client));
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
CORBA_exception_free (&ev);
return client;
@@ -166,8 +219,6 @@ gnome_selector_client_set_entry_text (GnomeSelectorClient *client,
CORBA_exception_init (&ev);
GNOME_Selector_setEntryText (client->_priv->selector, text, &ev);
CORBA_exception_free (&ev);
-
-
}
void
@@ -185,3 +236,83 @@ gnome_selector_client_activate_entry (GnomeSelectorClient *client)
CORBA_exception_free (&ev);
}
+struct _GnomeSelectorClientAsyncHandle {
+ GNOME_Selector_AsyncContext *async_ctx;
+ GnomeSelectorClient *client;
+ gchar *uri;
+ guint timeout_msec;
+ GnomeSelectorClientAsyncFunc async_func;
+ gpointer user_data;
+};
+
+static GnomeSelectorClientAsyncHandle *
+_gnome_selector_client_async_handle_get (GnomeSelectorClient *client,
+ const char *uri,
+ GnomeSelectorClientAsyncFunc async_func,
+ gpointer async_data)
+{
+ GnomeSelectorClientAsyncHandle *async_handle;
+
+ g_return_val_if_fail (client != NULL, NULL);
+ g_return_val_if_fail (GNOME_IS_SELECTOR_CLIENT (client), NULL);
+
+ async_handle = g_new0 (GnomeSelectorClientAsyncHandle, 1);
+ async_handle->client = client;
+ async_handle->async_func = async_func;
+ async_handle->user_data = async_data;
+ async_handle->uri = g_strdup (uri);
+
+ async_handle->async_ctx = GNOME_Selector_AsyncContext__alloc ();
+ async_handle->async_ctx->client_id = client->_priv->client_id;
+ async_handle->async_ctx->async_id = ++last_async_id;
+ async_handle->async_ctx->user_data._type = TC_null;
+
+ g_object_ref (G_OBJECT (async_handle->client));
+
+ client->_priv->async_ops = g_list_prepend (client->_priv->async_ops,
+ async_handle);
+
+ return async_handle;
+}
+
+gchar *
+gnome_selector_client_get_uri (GnomeSelectorClient *client)
+{
+ gchar *retval = NULL;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (client != NULL, NULL);
+ g_return_val_if_fail (GNOME_IS_SELECTOR_CLIENT (client), NULL);
+
+ g_assert (client->_priv->selector != CORBA_OBJECT_NIL);
+
+ CORBA_exception_init (&ev);
+ retval = GNOME_Selector_getURI (client->_priv->selector, &ev);
+ CORBA_exception_free (&ev);
+
+ return retval;
+}
+
+void
+gnome_selector_client_set_uri (GnomeSelectorClient *client,
+ GnomeSelectorClientAsyncHandle **async_handle_return,
+ const gchar *uri,
+ guint timeout_msec,
+ GnomeSelectorClientAsyncFunc async_func,
+ gpointer user_data)
+{
+ CORBA_Environment ev;
+ GnomeSelectorClientAsyncHandle *async_handle;
+
+ g_return_if_fail (client != NULL);
+ g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (client));
+
+ async_handle = _gnome_selector_client_async_handle_get
+ (client, uri, async_func, user_data);
+ if (async_handle_return)
+ *async_handle_return = async_handle;
+
+ CORBA_exception_init (&ev);
+ GNOME_Selector_setURI (client->_priv->selector, uri, async_handle->async_ctx, &ev);
+ CORBA_exception_free (&ev);
+}
diff --git a/libgnomeui/gnome-component-widget.h b/libgnomeui/gnome-component-widget.h
index 494af6b..32ed732 100644
--- a/libgnomeui/gnome-component-widget.h
+++ b/libgnomeui/gnome-component-widget.h
@@ -51,6 +51,17 @@ typedef struct _GnomeSelectorClient GnomeSelectorClient;
typedef struct _GnomeSelectorClientPrivate GnomeSelectorClientPrivate;
typedef struct _GnomeSelectorClientClass GnomeSelectorClientClass;
+typedef struct _GnomeSelectorClientAsyncHandle GnomeSelectorClientAsyncHandle;
+
+typedef void (*GnomeSelectorClientAsyncFunc) (GnomeSelectorClient *client,
+ GnomeSelectorAsyncHandle *async_handle,
+ GNOME_Selector_AsyncType async_type,
+ const gchar *uri,
+ const gchar *error,
+ gboolean success,
+ gpointer user_data);
+
+
struct _GnomeSelectorClient {
BonoboWidget widget;
@@ -67,12 +78,12 @@ gnome_selector_client_get_type (void) G_GNUC_CONST;
GnomeSelectorClient *
gnome_selector_client_new (GNOME_Selector corba_selector,
- Bonobo_UIContainer uic);
+ Bonobo_UIContainer uic);
GnomeSelectorClient *
gnome_selector_client_construct (GnomeSelectorClient *client,
- GNOME_Selector corba_selector,
- Bonobo_UIContainer uic);
+ GNOME_Selector corba_selector,
+ Bonobo_UIContainer uic);
/* Get/set the text in the entry widget. */
gchar *
@@ -80,13 +91,26 @@ gnome_selector_client_get_entry_text (GnomeSelectorClient *client);
void
gnome_selector_client_set_entry_text (GnomeSelectorClient *client,
- const gchar *text);
+ const gchar *text);
/* If the entry widget is derived from GtkEditable, then we can use this
* function to send an "activate" signal to it. */
void
gnome_selector_client_activate_entry (GnomeSelectorClient *client);
+/* Get/set URI. */
+
+gchar *
+gnome_selector_client_get_uri (GnomeSelectorClient *client);
+
+void
+gnome_selector_client_set_uri (GnomeSelectorClient *client,
+ GnomeSelectorClientAsyncHandle **handle_return,
+ const gchar *uri,
+ guint timeout_msec,
+ GnomeSelectorClientAsyncFunc async_func,
+ gpointer user_data);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]