[monkey-bubble: 360/753] Added "activate_entry" signal.



commit be6f2acee3589ac3f3e25ed6890b9e0380e6a179
Author: Martin Baulig <baulig suse de>
Date:   Sat Jun 2 17:45:31 2001 +0000

    Added "activate_entry" signal.
    
    2001-06-02  Martin Baulig  <baulig suse de>
    
    	* gnome-selector-client.h (GnomeSelectorClientClass):
    	Added "activate_entry" signal.

 libgnomeui/ChangeLog                |    5 ++
 libgnomeui/gnome-component-widget.c |   73 ++++++++++++++++++++++++++++++-----
 libgnomeui/gnome-component-widget.h |    3 +
 3 files changed, 71 insertions(+), 10 deletions(-)
---
diff --git a/libgnomeui/ChangeLog b/libgnomeui/ChangeLog
index 812102e..f0b56a9 100644
--- a/libgnomeui/ChangeLog
+++ b/libgnomeui/ChangeLog
@@ -1,3 +1,8 @@
+2001-06-02  Martin Baulig  <baulig suse de>
+
+	* gnome-selector-client.h (GnomeSelectorClientClass):
+	Added "activate_entry" signal.
+
 2001-06-01  Peter Williams  <peterw ximian com>
 
 	* pixmaps/Makefile.am (gnome-stock-pixbufs.h): Add
diff --git a/libgnomeui/gnome-component-widget.c b/libgnomeui/gnome-component-widget.c
index 25a51d9..205a28c 100644
--- a/libgnomeui/gnome-component-widget.c
+++ b/libgnomeui/gnome-component-widget.c
@@ -33,7 +33,8 @@
 
 struct _GnomeSelectorClientPrivate {
     GNOME_Selector selector;
-    Bonobo_EventSource_ListenerId listener_id;
+    Bonobo_EventSource_ListenerId async_listener_id;
+    Bonobo_EventSource_ListenerId notify_listener_id;
     GnomeAsyncContext *async_ctx;
 
     gchar *browse_dialog_moniker;
@@ -55,12 +56,26 @@ struct _GnomeSelectorClientPrivate {
     GHashTable *async_ops;
 };
 
+enum {
+    ACTIVATE_ENTRY_SIGNAL,
+    LAST_SIGNAL
+};
+
+static int gnome_selector_client_signals [LAST_SIGNAL] = {0};
+
 static void
-gnome_selector_client_event_cb (BonoboListener    *listener,
-				char              *event_name, 
-				CORBA_any         *any,
-				CORBA_Environment *ev,
-				gpointer           user_data);
+gnome_selector_client_async_event_cb (BonoboListener    *listener,
+				      char              *event_name, 
+				      CORBA_any         *any,
+				      CORBA_Environment *ev,
+				      gpointer           user_data);
+
+static void
+gnome_selector_client_notify_event_cb (BonoboListener    *listener,
+				       char              *event_name, 
+				       CORBA_any         *any,
+				       CORBA_Environment *ev,
+				       gpointer           user_data);
 
 static BonoboWidgetClass *gnome_selector_client_parent_class;
 
@@ -257,6 +272,17 @@ gnome_selector_client_class_init (GnomeSelectorClientClass *klass)
     object_class->set_property = gnome_selector_client_set_property;
     object_class->get_property = gnome_selector_client_get_property;
 
+    gnome_selector_client_signals [ACTIVATE_ENTRY_SIGNAL] =
+	g_signal_newc ("activate_entry",
+		       G_TYPE_FROM_CLASS (object_class),
+		       G_SIGNAL_RUN_LAST,
+		       G_STRUCT_OFFSET (GnomeSelectorClientClass,
+					activate_entry),
+		       NULL, NULL,
+		       g_cclosure_marshal_VOID__STRING,
+		       G_TYPE_NONE,
+		       1, G_TYPE_STRING);
+
     /* Construction properties */
     g_object_class_install_property
 	(object_class,
@@ -481,8 +507,16 @@ gnome_selector_client_construct_from_objref (GnomeSelectorClient *client,
 	return NULL;
     }
 
-    client->_priv->listener_id = bonobo_event_source_client_add_listener
-	(event_source, gnome_selector_client_event_cb, "GNOME/Selector:async", &ev, client);
+    client->_priv->async_listener_id = bonobo_event_source_client_add_listener
+	(event_source, gnome_selector_client_async_event_cb, "GNOME/Selector:async", &ev, client);
+    if (BONOBO_EX (&ev)) {
+	g_object_unref (G_OBJECT (client));
+	CORBA_exception_free (&ev);
+	return NULL;
+    }
+
+    client->_priv->notify_listener_id = bonobo_event_source_client_add_listener
+	(event_source, gnome_selector_client_notify_event_cb, "GNOME/Selector:notify", &ev, client);
     if (BONOBO_EX (&ev)) {
 	g_object_unref (G_OBJECT (client));
 	CORBA_exception_free (&ev);
@@ -560,8 +594,8 @@ gnome_selector_client_activate_entry (GnomeSelectorClient *client)
 }
 
 static void
-gnome_selector_client_event_cb (BonoboListener *listener, char *event_name, 
-				CORBA_any *any, CORBA_Environment *ev, gpointer user_data)
+gnome_selector_client_async_event_cb (BonoboListener *listener, char *event_name, 
+				      CORBA_any *any, CORBA_Environment *ev, gpointer user_data)
 {
     GnomeSelectorClient *client;
     GNOME_Selector_AsyncEvent *async_reply;
@@ -599,6 +633,25 @@ gnome_selector_client_event_cb (BonoboListener *listener, char *event_name,
     gnome_async_handle_completed (async_handle, async_reply->success);
 }
 
+static void
+gnome_selector_client_notify_event_cb (BonoboListener *listener, char *event_name, 
+				       CORBA_any *any, CORBA_Environment *ev, gpointer user_data)
+{
+    GnomeSelectorClient *client;
+
+    g_return_if_fail (user_data != NULL);
+    g_return_if_fail (GNOME_IS_SELECTOR_CLIENT (user_data));
+
+    client = GNOME_SELECTOR_CLIENT (user_data);
+
+    g_message (G_STRLOC ": %p - `%s'", client, event_name);
+
+    if (!strcmp (event_name, "GNOME/Selector:notify:activate-entry"))
+	if (any && CORBA_TypeCode_equal (any->_type, TC_string, ev))
+	    g_signal_emit (G_OBJECT (client), gnome_selector_client_signals [ACTIVATE_ENTRY_SIGNAL], 0,
+			   BONOBO_ARG_GET_STRING (any));
+}
+
 gchar *
 gnome_selector_client_get_uri (GnomeSelectorClient *client)
 {
diff --git a/libgnomeui/gnome-component-widget.h b/libgnomeui/gnome-component-widget.h
index 0490759..d7446d8 100644
--- a/libgnomeui/gnome-component-widget.h
+++ b/libgnomeui/gnome-component-widget.h
@@ -61,6 +61,9 @@ struct _GnomeSelectorClient {
 
 struct _GnomeSelectorClientClass {
     BonoboWidgetClass parent_class;
+
+    void     (*activate_entry)              (GnomeSelectorClient   *client,
+					     const gchar           *entry_text);
 };
 
 GtkType



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