diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2002-09-23 20:13:58 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2002-09-23 20:13:58 +0800 |
commit | 8c48e7682cfbc8aac611ffefe5db12736257b716 (patch) | |
tree | 26f3f6743bc0986cab624c9aae4882f8cb28f72a /calendar/pcs | |
parent | 8d44d5b8fae0d145e9698edcd2c752ff8755a307 (diff) | |
download | gsoc2013-evolution-8c48e7682cfbc8aac611ffefe5db12736257b716.tar gsoc2013-evolution-8c48e7682cfbc8aac611ffefe5db12736257b716.tar.gz gsoc2013-evolution-8c48e7682cfbc8aac611ffefe5db12736257b716.tar.bz2 gsoc2013-evolution-8c48e7682cfbc8aac611ffefe5db12736257b716.tar.lz gsoc2013-evolution-8c48e7682cfbc8aac611ffefe5db12736257b716.tar.xz gsoc2013-evolution-8c48e7682cfbc8aac611ffefe5db12736257b716.tar.zst gsoc2013-evolution-8c48e7682cfbc8aac611ffefe5db12736257b716.zip |
remove timeout function always and re-add it if the query is in progress.
2002-09-23 Rodrigo Moya <rodrigo@ximian.com>
* pcs/query.c (start_cached_query_cb): remove timeout function always
and re-add it if the query is in progress.
svn path=/trunk/; revision=18166
Diffstat (limited to 'calendar/pcs')
-rw-r--r-- | calendar/pcs/query.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/calendar/pcs/query.c b/calendar/pcs/query.c index 19686e2d4d..2ca9ad8409 100644 --- a/calendar/pcs/query.c +++ b/calendar/pcs/query.c @@ -1447,6 +1447,10 @@ start_cached_query_cb (gpointer data) priv = info->query->priv; + g_source_remove (info->tid); + priv->cached_timeouts = g_list_remove (priv->cached_timeouts, + GINT_TO_POINTER (info->tid)); + /* if the query hasn't started yet, we add the listener */ if (priv->state == QUERY_START_PENDING || priv->state == QUERY_WAIT_FOR_BACKEND) { @@ -1456,19 +1460,14 @@ start_cached_query_cb (gpointer data) 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, - GINT_TO_POINTER (info->tid)); - } 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, + /* if it's in progress, we re-add the timeout */ + info->tid = g_timeout_add (100, (GSourceFunc) start_cached_query_cb, info); + priv->cached_timeouts = g_list_append (priv->cached_timeouts, GINT_TO_POINTER (info->tid)); + return FALSE; + } else if (priv->state == QUERY_PARSE_ERROR) { /* notify listener of error */ CORBA_exception_init (&ev); GNOME_Evolution_Calendar_QueryListener_notifyQueryDone ( @@ -1483,13 +1482,10 @@ start_cached_query_cb (gpointer data) CORBA_exception_free (&ev); + /* remove all traces of this query */ 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)); - /* if the query is done, then we just notify the listener */ g_hash_table_foreach (priv->uids, (GHFunc) notify_uid_cb, info); |