aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-09-20 02:39:46 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-09-20 02:39:46 +0800
commit2bd5999a46871c499f7e162692dc26efdb791129 (patch)
tree1f5748f69708ecd45942fcf86c666b2955626f6d
parentc480805ecc1fbde31fcc0d3b772c3fee3f18bdf1 (diff)
downloadgsoc2013-evolution-2bd5999a46871c499f7e162692dc26efdb791129.tar.gz
gsoc2013-evolution-2bd5999a46871c499f7e162692dc26efdb791129.tar.zst
gsoc2013-evolution-2bd5999a46871c499f7e162692dc26efdb791129.zip
added a list of EComponentListener's to control the lifetime of the
2002-09-19 Rodrigo Moya <rodrigo@ximian.com> * pcs/query.c: added a list of EComponentListener's to control the lifetime of the listeners. (query_init): initialize new member. (query_destroy): free new member. (start_cached_query_cb): create a EComponentListener for the new listener being added. svn path=/trunk/; revision=18122
-rw-r--r--calendar/ChangeLog9
-rw-r--r--calendar/pcs/query.c37
2 files changed, 45 insertions, 1 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index a4c68caa0b..b39e4aec63 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,14 @@
2002-09-19 Rodrigo Moya <rodrigo@ximian.com>
+ * pcs/query.c: added a list of EComponentListener's to control the
+ lifetime of the listeners.
+ (query_init): initialize new member.
+ (query_destroy): free new member.
+ (start_cached_query_cb): create a EComponentListener for the new
+ listener being added.
+
+2002-09-19 Rodrigo Moya <rodrigo@ximian.com>
+
More fixes for #24210
* pcs/query.c: added list of cached queries and changed the Query
diff --git a/calendar/pcs/query.c b/calendar/pcs/query.c
index 686620c686..73d40324b2 100644
--- a/calendar/pcs/query.c
+++ b/calendar/pcs/query.c
@@ -30,6 +30,7 @@
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-exception.h>
#include <gal/widgets/e-unicode.h>
+#include <e-util/e-component-listener.h>
#include <e-util/e-sexp.h>
#include <cal-util/cal-recur.h>
#include <cal-util/timeutil.h>
@@ -67,6 +68,7 @@ struct _QueryPrivate {
/* Listeners to which we report changes in the live query */
GList *listeners;
+ GList *component_listeners;
/* Sexp that defines the query */
char *sexp;
@@ -138,6 +140,7 @@ query_init (Query *query)
priv->qb = NULL;
priv->default_zone = NULL;
priv->listeners = NULL;
+ priv->component_listeners = NULL;
priv->sexp = NULL;
priv->timeout_id = 0;
@@ -211,6 +214,12 @@ query_destroy (GtkObject *object)
priv->listeners = NULL;
}
+ if (priv->component_listeners != NULL) {
+ g_list_foreach (priv->component_listeners, (GFunc) gtk_object_unref, NULL);
+ g_list_free (priv->component_listeners);
+ priv->component_listeners = NULL;
+ }
+
if (priv->sexp) {
g_free (priv->sexp);
priv->sexp = NULL;
@@ -1387,6 +1396,20 @@ start_query_cb (gpointer data)
}
static void
+listener_died_cb (EComponentListener *cl, gpointer data)
+{
+ QueryPrivate *priv;
+ Query *query = QUERY (data);
+
+ priv = query->priv;
+
+ priv->listeners = g_list_remove (priv->listeners, e_component_listener_get_component (cl));
+
+ priv->component_listeners = g_list_remove (priv->component_listeners, cl);
+ gtk_object_unref (GTK_OBJECT (cl));
+}
+
+static void
notify_uid_cb (gpointer key, gpointer value, gpointer data)
{
CORBA_Environment ev;
@@ -1415,6 +1438,7 @@ start_cached_query_cb (gpointer data)
{
CORBA_Environment ev;
QueryPrivate *priv;
+ EComponentListener *cl;
StartCachedQueryInfo *info = (StartCachedQueryInfo *) data;
priv = info->query->priv;
@@ -1424,10 +1448,16 @@ start_cached_query_cb (gpointer data)
priv->state == QUERY_WAIT_FOR_BACKEND) {
priv->listeners = g_list_append (priv->listeners, info->ql);
- g_free (info);
+ cl = e_component_listener_new (info->ql, 0);
+ priv->component_listeners = g_list_append (priv->component_listeners, cl);
+ gtk_signal_connect (GTK_OBJECT (cl), "component_died",
+ GTK_SIGNAL_FUNC (listener_died_cb), info->query);
+
priv->cached_timeouts = g_list_remove (priv->cached_timeouts,
GPOINTER_TO_INT (info->tid));
+ g_free (info);
+
return FALSE;
} else if (priv->state == QUERY_IN_PROGRESS) {
/* if it's in progress, we just wait */
@@ -1443,6 +1473,11 @@ start_cached_query_cb (gpointer data)
priv->listeners = g_list_append (priv->listeners, info->ql);
+ cl = e_component_listener_new (info->ql, 0);
+ priv->component_listeners = g_list_append (priv->component_listeners, cl);
+ gtk_signal_connect (GTK_OBJECT (cl), "component_died",
+ GTK_SIGNAL_FUNC (listener_died_cb), info->query);
+
CORBA_exception_init (&ev);
GNOME_Evolution_Calendar_QueryListener_notifyQueryDone (
info->ql,