aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-09-23 19:50:12 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-09-23 19:50:12 +0800
commit8d44d5b8fae0d145e9698edcd2c752ff8755a307 (patch)
treef8e567900267fec95952dee01facbb16b06ee429 /calendar/pcs
parentb6adbdba7deac2a78987be98f71f0c19efb2c4bc (diff)
downloadgsoc2013-evolution-8d44d5b8fae0d145e9698edcd2c752ff8755a307.tar.gz
gsoc2013-evolution-8d44d5b8fae0d145e9698edcd2c752ff8755a307.tar.zst
gsoc2013-evolution-8d44d5b8fae0d145e9698edcd2c752ff8755a307.zip
move success notification code to its own code block, since it was being
2002-09-23 Rodrigo Moya <rodrigo@ximian.com> * pcs/query.c (start_cached_query_cb): move success notification code to its own code block, since it was being run for parse errors also. Also, remove all traces of the query from the cache if there is an error. Also, use GINT_TO_POINTER instead of GPOINTER_TO_INT. svn path=/trunk/; revision=18165
Diffstat (limited to 'calendar/pcs')
-rw-r--r--calendar/pcs/query.c61
1 files changed, 34 insertions, 27 deletions
diff --git a/calendar/pcs/query.c b/calendar/pcs/query.c
index 15b5c41ec2..19686e2d4d 100644
--- a/calendar/pcs/query.c
+++ b/calendar/pcs/query.c
@@ -1458,15 +1458,18 @@ start_cached_query_cb (gpointer data)
GTK_SIGNAL_FUNC (listener_died_cb), info->query);
priv->cached_timeouts = g_list_remove (priv->cached_timeouts,
- GPOINTER_TO_INT (info->tid));
+ GINT_TO_POINTER (info->tid));
- g_free (info);
-
- return FALSE;
} else if (priv->state == QUERY_IN_PROGRESS) {
/* if it's in progress, we just wait */
return TRUE;
} else if (priv->state == QUERY_PARSE_ERROR) {
+ /* remove all traces of this query */
+ g_source_remove (info->tid);
+ priv->cached_timeouts = g_list_remove (priv->cached_timeouts,
+ GINT_TO_POINTER (info->tid));
+
+ /* notify listener of error */
CORBA_exception_init (&ev);
GNOME_Evolution_Calendar_QueryListener_notifyQueryDone (
info->ql,
@@ -1479,33 +1482,37 @@ start_cached_query_cb (gpointer data)
"a parse error");
CORBA_exception_free (&ev);
- }
- /* if the query is done, then we just notify the listener */
- g_source_remove (info->tid);
- priv->cached_timeouts = g_list_remove (priv->cached_timeouts,
- GPOINTER_TO_INT (info->tid));
-
- g_hash_table_foreach (priv->uids, (GHFunc) notify_uid_cb, info);
+ cached_queries = g_list_remove (cached_queries, info->query);
+ bonobo_object_unref (BONOBO_OBJECT (info->query));
+ } else if (priv->state == QUERY_DONE) {
+ g_source_remove (info->tid);
+ priv->cached_timeouts = g_list_remove (priv->cached_timeouts,
+ GINT_TO_POINTER (info->tid));
- priv->listeners = g_list_append (priv->listeners, info->ql);
+ /* if the query is done, then we just notify the listener */
+ g_hash_table_foreach (priv->uids, (GHFunc) notify_uid_cb, 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->listeners = g_list_append (priv->listeners, info->ql);
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_QueryListener_notifyQueryDone (
- info->ql,
- GNOME_Evolution_Calendar_QueryListener_SUCCESS,
- "",
- &ev);
- if (BONOBO_EX (&ev))
- g_message ("start_cached_query_cb(): Could not notify the listener of "
- "a finished query");
+ 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_free (&ev);
+ CORBA_exception_init (&ev);
+ GNOME_Evolution_Calendar_QueryListener_notifyQueryDone (
+ info->ql,
+ GNOME_Evolution_Calendar_QueryListener_SUCCESS,
+ "",
+ &ev);
+ if (BONOBO_EX (&ev))
+ g_message ("start_cached_query_cb(): Could not notify the listener of "
+ "a finished query");
+
+ CORBA_exception_free (&ev);
+ }
+
g_free (info);
return FALSE;
@@ -1544,7 +1551,7 @@ backend_destroyed_cb (GtkObject *object, gpointer data)
query = QUERY (data);
cached_queries = g_list_remove (cached_queries, query);
- bonobo_object_unref (query);
+ bonobo_object_unref (BONOBO_OBJECT (query));
}
/**