diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2002-09-26 19:14:56 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2002-09-26 19:14:56 +0800 |
commit | faad22f59697728e87601c46d17605426ed46b6b (patch) | |
tree | 7eb7a0b8b7f47fc2e4c69832542903b89d61202e /calendar/pcs | |
parent | 3cb66ed22a86f8e193f4a28cb8cc3ddd31f427bd (diff) | |
download | gsoc2013-evolution-faad22f59697728e87601c46d17605426ed46b6b.tar.gz gsoc2013-evolution-faad22f59697728e87601c46d17605426ed46b6b.tar.zst gsoc2013-evolution-faad22f59697728e87601c46d17605426ed46b6b.zip |
Should fix once for all #24210
2002-09-26 Rodrigo Moya <rodrigo@ximian.com>
Should fix once for all #24210
* idl/evolution-calendar.idl: changed the notifyObjUpdated method
of the QueryListener interface accept a list of UIDs.
* cal-client/query-listener.[ch] (impl_notifyObjUpdated): likewise for
the QueryListener class.
* cal-client/cal-query.c (obj_updated_cb): changed to adapt the
multiple-id's received in the QueryListener class' signal to the
one-by-one update notification of the public CalQuery class, thus
keeping the changes needed for this minimal.
* pcs/query.c (add_component, start_cached_query_cb): changed to
send sequences of UIDs.
svn path=/trunk/; revision=18232
Diffstat (limited to 'calendar/pcs')
-rw-r--r-- | calendar/pcs/query.c | 69 |
1 files changed, 49 insertions, 20 deletions
diff --git a/calendar/pcs/query.c b/calendar/pcs/query.c index debee6a920..1ec802318b 100644 --- a/calendar/pcs/query.c +++ b/calendar/pcs/query.c @@ -983,9 +983,17 @@ add_component (Query *query, const char *uid, gboolean query_in_progress, int n_ CORBA_exception_init (&ev); for (l = priv->listeners; l != NULL; l = l->next) { + GNOME_Evolution_Calendar_CalObjUIDSeq *corba_uids; + + corba_uids = GNOME_Evolution_Calendar_CalObjUIDSeq__alloc (); + CORBA_sequence_set_release (corba_uids, TRUE); + corba_uids->_buffer = CORBA_sequence_GNOME_Evolution_Calendar_CalObjUID_allocbuf (1); + corba_uids->_length = 1; + corba_uids->_buffer[0] = CORBA_string_dup (uid); + GNOME_Evolution_Calendar_QueryListener_notifyObjUpdated ( l->data, - (char *) uid, + corba_uids, query_in_progress, n_scanned, total, @@ -994,6 +1002,8 @@ add_component (Query *query, const char *uid, gboolean query_in_progress, int n_ if (BONOBO_EX (&ev)) g_message ("add_component(): Could not notify the listener of an " "updated component"); + + CORBA_free (corba_uids); } CORBA_exception_free (&ev); @@ -1425,26 +1435,12 @@ listener_died_cb (EComponentListener *cl, gpointer data) } static void -notify_uid_cb (gpointer key, gpointer value, gpointer data) +add_uid_cb (gpointer key, gpointer value, gpointer data) { - CORBA_Environment ev; char *uid = (char *) key; - StartCachedQueryInfo *info = (StartCachedQueryInfo *) data; - - CORBA_exception_init (&ev); - GNOME_Evolution_Calendar_QueryListener_notifyObjUpdated ( - info->ql, - uid, - FALSE, - g_hash_table_size (info->query->priv->uids), - g_hash_table_size (info->query->priv->uids), - &ev); - - if (BONOBO_EX (&ev)) - g_message ("notify_uid_cb(): Could not notify the listener of an " - "updated component"); + GList **uidlist = (GList **) data; - CORBA_exception_free (&ev); + *uidlist = g_list_append (*uidlist, uid); } /* Idle handler for starting a cached query */ @@ -1497,9 +1493,42 @@ start_cached_query_cb (gpointer data) cached_queries = g_list_remove (cached_queries, info->query); bonobo_object_unref (BONOBO_OBJECT (info->query)); } else if (priv->state == QUERY_DONE) { - /* if the query is done, then we just notify the listener */ - g_hash_table_foreach (priv->uids, (GHFunc) notify_uid_cb, info); + int len; + GList *uid_list = NULL, *l; + + /* if the query is done, then we just notify the listener of all the + * UIDS we've got so far, all at once */ + g_hash_table_foreach (priv->uids, (GHFunc) add_uid_cb, &uid_list); + + len = g_list_length (uid_list); + if (len > 0) { + int n; + GNOME_Evolution_Calendar_CalObjUIDSeq *corba_uids; + + corba_uids = GNOME_Evolution_Calendar_CalObjUIDSeq__alloc (); + CORBA_sequence_set_release (corba_uids, TRUE); + corba_uids->_buffer = CORBA_sequence_GNOME_Evolution_Calendar_CalObjUID_allocbuf (len); + corba_uids->_length = len; + + for (l = uid_list, n = 0; l != NULL; l = l->next, n++) + corba_uids->_buffer[n] = CORBA_string_dup ((CORBA_char *) l->data); + + GNOME_Evolution_Calendar_QueryListener_notifyObjUpdated ( + info->ql, + corba_uids, + TRUE, + len, + len, &ev); + + if (BONOBO_EX (&ev)) + g_message ("start_cached_query_cb(): Could not notify the listener of all " + "cached components"); + + CORBA_free (corba_uids); + g_list_free (uid_list); + } + /* setup private data and notify listener that the query ended */ priv->listeners = g_list_append (priv->listeners, info->ql); cl = e_component_listener_new (info->ql, 0); |