diff options
Diffstat (limited to 'calendar/pcs')
-rw-r--r-- | calendar/pcs/query.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/calendar/pcs/query.c b/calendar/pcs/query.c index 28513d3822..33289ed107 100644 --- a/calendar/pcs/query.c +++ b/calendar/pcs/query.c @@ -1265,6 +1265,40 @@ populate_query (Query *query) priv->state = QUERY_IN_PROGRESS; } +/* Callback used when a component changes in the backend */ +static void +backend_obj_updated_cb (CalBackend *backend, const char *uid, gpointer data) +{ + Query *query; + + query = QUERY (data); + + bonobo_object_ref (BONOBO_OBJECT (query)); + + match_component (query, uid, FALSE, 0, 0); + remove_from_pending (query, uid); + + bonobo_object_unref (BONOBO_OBJECT (query)); +} + +/* Callback used when a component is removed from the backend */ +static void +backend_obj_removed_cb (CalBackend *backend, const char *uid, gpointer data) +{ + Query *query; + QueryPrivate *priv; + + query = QUERY (data); + priv = query->priv; + + bonobo_object_ref (BONOBO_OBJECT (query)); + + remove_component (query, uid); + remove_from_pending (query, uid); + + bonobo_object_unref (BONOBO_OBJECT (query)); +} + /* Idle handler for starting a query */ static gboolean start_query_cb (gpointer data) @@ -1284,6 +1318,13 @@ start_query_cb (gpointer data) populate_query (query); + gtk_signal_connect (GTK_OBJECT (priv->backend), "obj_updated", + GTK_SIGNAL_FUNC (backend_obj_updated_cb), + query); + gtk_signal_connect (GTK_OBJECT (priv->backend), "obj_removed", + GTK_SIGNAL_FUNC (backend_obj_removed_cb), + query); + return FALSE; } @@ -1307,40 +1348,6 @@ backend_opened_cb (CalBackend *backend, CalBackendOpenStatus status, gpointer da } } -/* Callback used when a component changes in the backend */ -static void -backend_obj_updated_cb (CalBackend *backend, const char *uid, gpointer data) -{ - Query *query; - - query = QUERY (data); - - bonobo_object_ref (BONOBO_OBJECT (query)); - - match_component (query, uid, FALSE, 0, 0); - remove_from_pending (query, uid); - - bonobo_object_unref (BONOBO_OBJECT (query)); -} - -/* Callback used when a component is removed from the backend */ -static void -backend_obj_removed_cb (CalBackend *backend, const char *uid, gpointer data) -{ - Query *query; - QueryPrivate *priv; - - query = QUERY (data); - priv = query->priv; - - bonobo_object_ref (BONOBO_OBJECT (query)); - - remove_component (query, uid); - remove_from_pending (query, uid); - - bonobo_object_unref (BONOBO_OBJECT (query)); -} - /** * query_construct: * @query: A live search query. @@ -1388,13 +1395,6 @@ query_construct (Query *query, priv->default_zone = cal_backend_get_default_timezone (backend); - gtk_signal_connect (GTK_OBJECT (priv->backend), "obj_updated", - GTK_SIGNAL_FUNC (backend_obj_updated_cb), - query); - gtk_signal_connect (GTK_OBJECT (priv->backend), "obj_removed", - GTK_SIGNAL_FUNC (backend_obj_removed_cb), - query); - priv->sexp = g_strdup (sexp); /* Queue the query to be started asynchronously */ |