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 | |
parent | 3cb66ed22a86f8e193f4a28cb8cc3ddd31f427bd (diff) | |
download | gsoc2013-evolution-faad22f59697728e87601c46d17605426ed46b6b.tar gsoc2013-evolution-faad22f59697728e87601c46d17605426ed46b6b.tar.gz gsoc2013-evolution-faad22f59697728e87601c46d17605426ed46b6b.tar.bz2 gsoc2013-evolution-faad22f59697728e87601c46d17605426ed46b6b.tar.lz gsoc2013-evolution-faad22f59697728e87601c46d17605426ed46b6b.tar.xz 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')
-rw-r--r-- | calendar/ChangeLog | 18 | ||||
-rw-r--r-- | calendar/cal-client/cal-query.c | 10 | ||||
-rw-r--r-- | calendar/cal-client/query-listener.c | 6 | ||||
-rw-r--r-- | calendar/cal-client/query-listener.h | 2 | ||||
-rw-r--r-- | calendar/idl/evolution-calendar.idl | 4 | ||||
-rw-r--r-- | calendar/pcs/query.c | 69 |
6 files changed, 80 insertions, 29 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index b4669e5c5f..a7fd2aeb4a 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,21 @@ +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. + 2002-09-25 Dan Winship <danw@ximian.com> * gui/component-factory.c (folder_types): Add "calendar/public" diff --git a/calendar/cal-client/cal-query.c b/calendar/cal-client/cal-query.c index e1bef97e3c..80ffe5c845 100644 --- a/calendar/cal-client/cal-query.c +++ b/calendar/cal-client/cal-query.c @@ -244,18 +244,22 @@ marshal_query_done (GtkObject *object, GtkSignalFunc func, gpointer func_data, G /* Callback used when an object is updated in the query */ static void obj_updated_cb (QueryListener *ql, - const GNOME_Evolution_Calendar_CalObjUID uid, + const GNOME_Evolution_Calendar_CalObjUIDSeq *uids, CORBA_boolean query_in_progress, CORBA_long n_scanned, CORBA_long total, gpointer data) { CalQuery *query; + int n; query = CAL_QUERY (data); - gtk_signal_emit (GTK_OBJECT (query), query_signals[OBJ_UPDATED], - uid, query_in_progress, (int) n_scanned, (int) total); + for (n = 0; n < uids->_length; n++) { + gtk_signal_emit (GTK_OBJECT (query), query_signals[OBJ_UPDATED], + uids->_buffer[n], query_in_progress, + (int) n_scanned, (int) total); + } } /* Callback used when an object is removed from the query */ diff --git a/calendar/cal-client/query-listener.c b/calendar/cal-client/query-listener.c index 1b21c1e667..ab02f2faca 100644 --- a/calendar/cal-client/query-listener.c +++ b/calendar/cal-client/query-listener.c @@ -47,7 +47,7 @@ static void query_listener_init (QueryListener *ql); static void query_listener_destroy (GtkObject *object); static void impl_notifyObjUpdated (PortableServer_Servant servant, - GNOME_Evolution_Calendar_CalObjUID uid, + GNOME_Evolution_Calendar_CalObjUIDSeq *uids, CORBA_boolean query_in_progress, CORBA_long n_scanned, CORBA_long total, @@ -146,7 +146,7 @@ query_listener_destroy (GtkObject *object) /* ::notifyObjUpdated() method */ static void impl_notifyObjUpdated (PortableServer_Servant servant, - GNOME_Evolution_Calendar_CalObjUID uid, + GNOME_Evolution_Calendar_CalObjUIDSeq *uids, CORBA_boolean query_in_progress, CORBA_long n_scanned, CORBA_long total, @@ -162,7 +162,7 @@ impl_notifyObjUpdated (PortableServer_Servant servant, return; g_assert (priv->obj_updated_fn != NULL); - (* priv->obj_updated_fn) (ql, uid, query_in_progress, n_scanned, total, priv->fn_data); + (* priv->obj_updated_fn) (ql, uids, query_in_progress, n_scanned, total, priv->fn_data); } /* ::notifyObjRemoved() method */ diff --git a/calendar/cal-client/query-listener.h b/calendar/cal-client/query-listener.h index e553d37a49..65cc9fbad4 100644 --- a/calendar/cal-client/query-listener.h +++ b/calendar/cal-client/query-listener.h @@ -53,7 +53,7 @@ typedef struct { /* Notification functions */ typedef void (* QueryListenerObjUpdatedFn) (QueryListener *ql, - const GNOME_Evolution_Calendar_CalObjUID uid, + const GNOME_Evolution_Calendar_CalObjUIDSeq *uids, CORBA_boolean query_in_progress, CORBA_long n_scanned, CORBA_long total, diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl index d235d11061..abd3954dbd 100644 --- a/calendar/idl/evolution-calendar.idl +++ b/calendar/idl/evolution-calendar.idl @@ -263,12 +263,12 @@ module Calendar { /* Listener for changes in a query of a calendar */ interface QueryListener : Bonobo::Unknown { - /* Called when a component is added or changed. If + /* Called when components are added or changed. If * query_in_progress is true, then the initial query results are * being populated and the other arguments indicate the * percentage of completion Otherwise, the percent value is * unspecified. */ - void notifyObjUpdated (in CalObjUID uid, + void notifyObjUpdated (in CalObjUIDSeq uids, in boolean query_in_progress, in long n_scanned, in long total); 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); |