aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client/cal-query.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/cal-client/cal-query.c')
-rw-r--r--calendar/cal-client/cal-query.c406
1 files changed, 0 insertions, 406 deletions
diff --git a/calendar/cal-client/cal-query.c b/calendar/cal-client/cal-query.c
deleted file mode 100644
index 97e7b81240..0000000000
--- a/calendar/cal-client/cal-query.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/* Evolution calendar - Live query client object
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtksignal.h>
-#include <bonobo/bonobo-exception.h>
-#include "cal-query.h"
-#include "query-listener.h"
-
-
-
-/* Private part of the CalQuery structure */
-struct _CalQueryPrivate {
- /* Our query listener implementation */
- QueryListener *ql;
-
- /* Handle to the query in the server */
- GNOME_Evolution_Calendar_Query corba_query;
-};
-
-
-
-static void cal_query_class_init (CalQueryClass *class);
-static void cal_query_init (CalQuery *query);
-static void cal_query_destroy (GtkObject *object);
-
-/* Signal IDs */
-enum {
- OBJ_UPDATED,
- OBJ_REMOVED,
- QUERY_DONE,
- EVAL_ERROR,
- LAST_SIGNAL
-};
-
-static void marshal_obj_updated (GtkObject *object,
- GtkSignalFunc func, gpointer func_data,
- GtkArg *args);
-static void marshal_query_done (GtkObject *object,
- GtkSignalFunc func, gpointer func_data,
- GtkArg *args);
-
-static guint query_signals[LAST_SIGNAL];
-
-static GtkObjectClass *parent_class;
-
-
-
-/**
- * cal_query_get_type:
- *
- * Registers the #CalQuery class if necessary, and returns the type ID assigned
- * to it.
- *
- * Return value: The type ID of the #CalQuery class.
- **/
-GtkType
-cal_query_get_type (void)
-{
- static GtkType cal_query_type = 0;
-
- if (!cal_query_type) {
- static const GtkTypeInfo cal_query_info = {
- "CalQuery",
- sizeof (CalQuery),
- sizeof (CalQueryClass),
- (GtkClassInitFunc) cal_query_class_init,
- (GtkObjectInitFunc) cal_query_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- cal_query_type = gtk_type_unique (GTK_TYPE_OBJECT, &cal_query_info);
- }
-
- return cal_query_type;
-}
-
-/* Class initialization function for the calendar query */
-static void
-cal_query_class_init (CalQueryClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) class;
-
- parent_class = gtk_type_class (GTK_TYPE_OBJECT);
-
- query_signals[OBJ_UPDATED] =
- gtk_signal_new ("obj_updated",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (CalQueryClass, obj_updated),
- marshal_obj_updated,
- GTK_TYPE_NONE, 4,
- GTK_TYPE_STRING,
- GTK_TYPE_BOOL,
- GTK_TYPE_INT,
- GTK_TYPE_INT);
- query_signals[OBJ_REMOVED] =
- gtk_signal_new ("obj_removed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (CalQueryClass, obj_removed),
- gtk_marshal_NONE__STRING,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_STRING);
- query_signals[QUERY_DONE] =
- gtk_signal_new ("query_done",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (CalQueryClass, query_done),
- marshal_query_done,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_ENUM,
- GTK_TYPE_STRING);
- query_signals[EVAL_ERROR] =
- gtk_signal_new ("eval_error",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (CalQueryClass, eval_error),
- gtk_marshal_NONE__STRING,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_STRING);
-
- gtk_object_class_add_signals (object_class, query_signals, LAST_SIGNAL);
-
- class->obj_updated = NULL;
- class->obj_removed = NULL;
- class->query_done = NULL;
- class->eval_error = NULL;
-
- object_class->destroy = cal_query_destroy;
-}
-
-/* Object initialization function for the calendar query */
-static void
-cal_query_init (CalQuery *query)
-{
- CalQueryPrivate *priv;
-
- priv = g_new0 (CalQueryPrivate, 1);
- query->priv = priv;
-
- priv->ql = NULL;
- priv->corba_query = CORBA_OBJECT_NIL;
-}
-
-/* Destroy handler for the calendar query */
-static void
-cal_query_destroy (GtkObject *object)
-{
- CalQuery *query;
- CalQueryPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_QUERY (object));
-
- query = CAL_QUERY (object);
- priv = query->priv;
-
- /* The server unrefs the query listener, so we just NULL it out here */
- query_listener_stop_notification (priv->ql);
- priv->ql = NULL;
-
- if (priv->corba_query != CORBA_OBJECT_NIL) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (priv->corba_query, &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("cal_query_destroy(): Could not release/unref the query");
-
- CORBA_exception_free (&ev);
- priv->corba_query = CORBA_OBJECT_NIL;
- }
-
- g_free (priv);
- query->priv = NULL;
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-
-/* Marshalers */
-
-typedef void (* ObjUpdatedFunc) (CalQuery *query, const char *uid,
- gboolean query_in_progress, int n_scanned, int total,
- gpointer data);
-
-static void
-marshal_obj_updated (GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg *args)
-{
- ObjUpdatedFunc f;
-
- f = (ObjUpdatedFunc) func;
-
- (* f) (CAL_QUERY (object), GTK_VALUE_STRING (args[0]),
- GTK_VALUE_BOOL (args[1]), GTK_VALUE_INT (args[2]), GTK_VALUE_INT (args[3]),
- func_data);
-}
-
-typedef void (* QueryDoneFunc) (CalQuery *query, CalQueryDoneStatus status, const char *error_str,
- gpointer data);
-
-static void
-marshal_query_done (GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg *args)
-{
- QueryDoneFunc f;
-
- f = (QueryDoneFunc) func;
-
- (* f) (CAL_QUERY (object), GTK_VALUE_ENUM (args[0]), GTK_VALUE_STRING (args[1]),
- func_data);
-}
-
-
-
-/* Callback used when an object is updated in the query */
-static void
-obj_updated_cb (QueryListener *ql,
- const GNOME_Evolution_Calendar_CalObjUID uid,
- CORBA_boolean query_in_progress,
- CORBA_long n_scanned,
- CORBA_long total,
- gpointer data)
-{
- CalQuery *query;
-
- query = CAL_QUERY (data);
-
- gtk_signal_emit (GTK_OBJECT (query), query_signals[OBJ_UPDATED],
- uid, query_in_progress, (int) n_scanned, (int) total);
-}
-
-/* Callback used when an object is removed from the query */
-static void
-obj_removed_cb (QueryListener *ql,
- const GNOME_Evolution_Calendar_CalObjUID uid,
- gpointer data)
-{
- CalQuery *query;
-
- query = CAL_QUERY (data);
-
- gtk_signal_emit (GTK_OBJECT (query), query_signals[OBJ_REMOVED],
- uid);
-}
-
-/* Callback used when the query terminates */
-static void
-query_done_cb (QueryListener *ql,
- GNOME_Evolution_Calendar_QueryListener_QueryDoneStatus corba_status,
- const CORBA_char *error_str,
- gpointer data)
-{
- CalQuery *query;
- CalQueryDoneStatus status;
-
- query = CAL_QUERY (data);
-
- switch (corba_status) {
- case GNOME_Evolution_Calendar_QueryListener_SUCCESS:
- status = CAL_QUERY_DONE_SUCCESS;
- break;
-
- case GNOME_Evolution_Calendar_QueryListener_PARSE_ERROR:
- status = CAL_QUERY_DONE_PARSE_ERROR;
- break;
-
- default:
- g_assert_not_reached ();
- return;
- }
-
- gtk_signal_emit (GTK_OBJECT (query), query_signals[QUERY_DONE],
- status, error_str);
-}
-
-/* Callback used when an error occurs when evaluating the query */
-static void
-eval_error_cb (QueryListener *ql,
- const CORBA_char *error_str,
- gpointer data)
-{
- CalQuery *query;
-
- query = CAL_QUERY (data);
-
- gtk_signal_emit (GTK_OBJECT (query), query_signals[EVAL_ERROR],
- error_str);
-}
-
-/**
- * cal_query_construct:
- * @query: A calendar query.
- * @cal: Handle to an open calendar.
- * @sexp: S-expression that defines the query.
- *
- * Constructs a query object by issuing the query creation request to the
- * calendar server.
- *
- * Return value: The same value as @query on success, or NULL if the request
- * failed.
- **/
-CalQuery *
-cal_query_construct (CalQuery *query,
- GNOME_Evolution_Calendar_Cal cal,
- const char *sexp)
-{
- CalQueryPrivate *priv;
- GNOME_Evolution_Calendar_QueryListener corba_ql;
- CORBA_Environment ev;
-
- g_return_val_if_fail (query != NULL, NULL);
- g_return_val_if_fail (IS_CAL_QUERY (query), NULL);
- g_return_val_if_fail (sexp != NULL, NULL);
-
- priv = query->priv;
-
- priv->ql = query_listener_new (obj_updated_cb,
- obj_removed_cb,
- query_done_cb,
- eval_error_cb,
- query);
- if (!priv->ql) {
- g_message ("cal_query_construct(): Could not create the query listener");
- return NULL;
- }
-
- corba_ql = BONOBO_OBJREF (priv->ql);
-
- CORBA_exception_init (&ev);
- priv->corba_query = GNOME_Evolution_Calendar_Cal_getQuery (cal, sexp, corba_ql, &ev);
-
- if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_CouldNotCreate)) {
- g_message ("cal_query_construct(): The server could not create the query");
- goto error;
- } else if (BONOBO_EX (&ev)) {
- g_message ("cal_query_construct(): Could not issue the getQuery() request");
- goto error;
- }
-
- CORBA_exception_free (&ev);
-
- return query;
-
- error:
-
- CORBA_exception_free (&ev);
-
- bonobo_object_unref (BONOBO_OBJECT (priv->ql));
- priv->ql = NULL;
- priv->corba_query = CORBA_OBJECT_NIL;
- return NULL;
-}
-
-/**
- * cal_query_new:
- * @cal: Handle to an open calendar.
- * @sexp: S-expression that defines the query.
- *
- * Creates a new query object by issuing the query creation request to the
- * calendar server.
- *
- * Return value: A newly-created query object, or NULL if the request failed.
- **/
-CalQuery *
-cal_query_new (GNOME_Evolution_Calendar_Cal cal,
- const char *sexp)
-{
- CalQuery *query;
-
- query = gtk_type_new (CAL_QUERY_TYPE);
-
- if (!cal_query_construct (query, cal, sexp)) {
- gtk_object_unref (GTK_OBJECT (query));
- return NULL;
- }
-
- return query;
-}
86b5605bacd1b05fb0c07e17044'>- Update to 1.06sergei2004-06-113-6/+10 * - Trim newlines at the end of patcheskrion2004-06-114-5/+2 * - Update to 0.6.6pav2004-06-1014-100/+179 * - Update to 5.0.0RC3 releaseale2004-06-088-28/+10 * Fix compilation of FreeTDS MSSQL extension.ale2004-06-082-0/+24 * Upgrade to 0.8.11.des2004-06-083-118/+36 * upgrade to 2.39.235.1693ijliao2004-06-083-135/+23 * Upgrade to 5.4.tg2004-06-073-41/+95 * Re-chase the curl shared library version.kris2004-06-071-1/+1 * Don't use Makefile.kde anymoremarkus2004-06-061-4/+4 * Update to the 2004-06-04 snapshot of GCC 3.4.1.gerald2004-06-0626-195/+195 * Sync with new bsd.autotools.mkade2004-06-0511-15/+15 * Use ${CC} instead of cc on dynamic linkings.perky2004-06-043-12/+39 * Update ftp/curl to 7.12.0 and bump the shared library version in allroam2004-06-044-6/+8 * Update to 4.3.7 release.ale2004-06-043-52/+3 * Change the way we handle the version numbering to be more correctnetchild2004-06-031-2/+2 * Resurrect lang/squeak: Squeak3 is the latest stable version.vs2004-06-0321-3/+303 * Putting commit bit in storage. I don't have the timepatrick2004-06-034-4/+4 * Unbreak on -STABLE:thierry2004-06-031-9/+3 * Update to 8.0.066.p067.1.netchild2004-06-032-2/+3 * - mark BROKEN on amd64dinoex2004-06-021-0/+3 * Upgrade to 0.8.10, and use cpio(1) instead of tar(1) to install docs.des2004-06-013-35/+118 * Install on install phases and unmark BROKEN.perky2004-05-311-8/+6 * Add missing filekris2004-05-311-0/+1 * BROKEN: Installs files during build phasekris2004-05-311-0/+2 * - fix configure for amd64dinoex2004-05-311-5/+4 * 1. Update to 5.8.4.tobez2004-05-3135-695/+2880 * BROKEN: Missing BUILD_DEPENDSkris2004-05-301-0/+2 * - Update to 0.61 and unbreakpav2004-05-304-60/+29 * Replace explicit XFree86-4-libraries dependencies with USE_XLIB, USE_XPM, andanholt2004-05-303-3/+3 * - Fix one building problem (it still don't build)pav2004-05-302-1/+12 * - Fix MASTER_SITESkrion2004-05-303-3/+3 * Reenable to build for 2.3.4.perky2004-05-291-2/+2 * Upgrade to version R9C-1.olgeni2004-05-2818-330/+70 * remove maintainershipedwin2004-05-281-1/+1 * Update to 2.3.4.perky2004-05-271-0/+5 * - Update to Python 2.3.4.perky2004-05-2718-273/+21 * Update to 7.1.038.netchild2004-05-262-3/+3 * fix for ports/66514 problem and update to 8.0.046maho2004-05-263-7/+10 * Fix plist w.r.t INSTALL_ALSO_AS_SSSL.vs2004-05-252-4/+7 * Remove databases/postgresql-client because there can't be a -server, and havingmat2004-05-253-3/+3 * - Add proftpd-mysql port, a slave port of proftpd with mysql support.clement2004-05-252-0/+20 * Introduce MASTER_SITE_PHP and add several more mirror sites worldwide.knu2004-05-243-24/+6 * Note that sparc64 isn't supported.vs2004-05-241-1/+1 * - Update to 0.8pav2004-05-233-4/+17 * Unbreak: fix documentation checksum.olgeni2004-05-232-3/+1 * Resign maintainership to ports@. gnome@ hasn't been that active in maintainingmarcus2004-05-221-1/+1 * - mark BROKEN on ia64dinoex2004-05-211-0/+3 * - Update to version 0.24krion2004-05-212-4/+3 * - Add more MASTER_SITESkrion2004-05-211-1/+3 * - Fix MASTER_SITESkrion2004-05-211-3/+2 * This DEPRECATED port is also BROKEN with current versions of ocaml.kris2004-05-211-0/+1 * Upgrade to 7.6.9.vanilla2004-05-202-4/+4 * Upgrade to 0.93b.thierry2004-05-203-56/+5 * Upgrade to 0.93a.thierry2004-05-2010-6271/+5831 * Use %%DOCSDIR%% in plist.vs2004-05-181-7/+7 * - Update to 3.6-3vs2004-05-1712-413/+229 * Fix the ezm3 port to deal with 64-bit time_t on the sparc64 platform.jdp2004-05-171-1/+8 * Restore maintainer; his email was bouncing last week and I fat-fingered thekris2004-05-163-3/+3 * Reset bouncing maintainer address:kris2004-05-163-3/+3 * As previously announced, remove lang/tclX80. It is no longer used by anylinimon2004-05-159-515/+0 * As previously announced, remove lang/ruby-python. Its dependendencies arelinimon2004-05-155-170/+0 * As previously announced, remove the following deprecated ports:linimon2004-05-151-2/+0 * Update to the 2004-05-05 snapshot of GCC 3.3.4.gerald2004-05-152-13/+13 * - Update to 0.0.2krion2004-05-154-3/+55 * BROKEN on sparc64: Build failskris2004-05-131-0/+4 * BROKEN on sparc64: Coredump during buildkris2004-05-131-1/+7 * BROKEN on sparc64: Install fails (trying to install missing java support)kris2004-05-131-0/+4 * Needs autoconf213 already at patch-time -> PATCH_DEPENDS.vs2004-05-121-0/+1 * lang/pike74 is buggy and very difficult to adapt to the 5.x branch.linimon2004-05-127-851/+0 * Remove pike74. This development version has been supplanted by pike76.linimon2004-05-121-1/+0 * Add the mirror http://www.mirror.ac.uk/sites/www.haskell.org/ to MASTER_SITES.obraun2004-05-127-7/+19 * - Update to version 2.744krion2004-05-112-4/+4 * Add sdcc, Small Device C Compiler, a Freeware, retargettable, optimizingpav2004-05-1011-0/+3637 * - Update to version 8.1.3krion2004-05-102-3/+3 * Define PHP_PORT. This should fix a package building failurethierry2004-05-091-1/+3 * As previously announced, remove these broken or obsolete ports.kris2004-05-0810-175/+0 * - Add sysvmsg extension [1]ale2004-05-0816-54/+126 * icc 8.0.066 now adds "-m elf_i386" in some circumstances. Remove this partnetchild2004-05-072-1/+4 * Use OPTIONS.perky2004-05-0710-117/+127 * - Update to 7.6.6 Releasevanilla2004-05-073-5/+4 * Make portlint happy by replacing space to tabmaho2004-05-072-2/+2 * Remove pike75, we already repocopy it to pike76.vanilla2004-05-066-790/+0 * Connect to pike76.vanilla2004-05-061-1/+1 * Upgrade to 7.6.3.vanilla2004-05-064-91/+21 * - Avoid using command execution to fill variables, they would be executedpav2004-05-051-8/+5 * - Update to 1.5-rc6pav2004-05-053-8/+26 * Remove support for WITH_BOUNDSCHECKING which was broken most of the timegerald2004-05-041-25/+1 * Update lang/ruby18 and the bundled modules to the latest 1.8 branchknu2004-05-035-18/+73 * Update to 8.0.066.netchild2004-04-302-5/+3 * Update to 1.2.3arved2004-04-292-4/+3 * Add libjit 0.0.0f,krion2004-04-299-0/+107 * - Update to version 8.1.2krion2004-04-294-22/+12 * - patch to fix coredumps in make_servicesdinoex2004-04-292-1/+30 * Update to 5.0.0RC2 release (stop packaging customized snapshots,ale2004-04-2913-61/+42 * Fix plist.vs2004-04-291-0/+1 * - Add mirror to fix build for releaseclement2004-04-221-3/+3 * - Fix IGNORE messagekrion2004-04-202-2/+2 * - Mark IGNORE on alphakrion2004-04-201-0/+4 * - Mark IGNORE on alphakrion2004-04-201-0/+4 * BROKEN on amd64: Does not compilekris2004-04-191-1/+7 * These broken ports are scheduled for deletion on June 18 if they arekris2004-04-191-0/+2 * o Update to 1.8.nork2004-04-192-8/+8 * - Update to 1.3.0.20040413pav2004-04-193-9/+7 * Mark DEPRECATED. These ports are quite old and useless in theseperky2004-04-182-0/+2 * Reduce configure warning.perky2004-04-1810-0/+10 * Update lang/ruby16 to the latest snapshot as of 2004-04-16, whichknu2004-04-181-0/+2 * Update to the 2004-04-11 snapshot and a later version of the bounds checkinggerald2004-04-182-15/+18 * Update to the 2004-04-14 snapshot, which should be nearly identical to thegerald2004-04-1826-182/+221 * - Fix plistkrion2004-04-171-0/+2 * - fix typo in condition.dinoex2004-04-161-1/+1 * Update to 4.3.6 release.ale2004-04-163-4/+47 * - backward compatibility option GNUSTEP_WITH_GCC32=yesdinoex2004-04-161-0/+12 * - update to gcc33dinoex2004-04-161-6/+4 * - fix amd64 builddinoex2004-04-161-5/+17 * Add missing manpagekris2004-04-151-1/+1 * Add missing @dirrm and correct syntax errors in the NOPORTDOCS casekris2004-04-152-6/+8 * Mark as deprecated: its dependendencies are broken, and it relies onlinimon2004-04-151-0/+2 * Fixed a bug where the configure script couldn't detect getaddrinfo()perky2004-04-148-7/+41 * Info files cannot be installed in post-installkris2004-04-141-1/+1 * Add missing @dirrmkris2004-04-141-0/+1 * Add missing symlinkkris2004-04-131-0/+1 * slave port of gcc32dinoex2004-04-132-0/+31 * - resurrect from 2003/03/02dinoex2004-04-133-0/+27 * - resurrect from 2003/03/02dinoex2004-04-131-22/+22 * - take maintainershipdinoex2004-04-131-2/+2 * - Update to 1.8.8krion2004-04-132-6/+6 * Install the source instead of the cat-file in ${PREFIX}/man/man1jmz2004-04-132-23/+25 * Add fpc-base 1.0.10, meta package to install all of thethierry2004-04-134-0/+53 * Add fpc-demo 1.0.10, Free Pascal compiler examples.thierry2004-04-135-0/+142 * Per kris' suggestion, mark as deprecated (supplanted by lang/tclX whichlinimon2004-04-121-0/+3 * Per distfile survey, remove mastersite that disappeared in December 2003.linimon2004-04-121-1/+1 * BROKEN on sparc64: Does not buildkris2004-04-121-1/+7 * BROKEN on sparc64: Does not compilekris2004-04-121-1/+7 * BROKEN on sparc64 as wellkris2004-04-121-2/+2 * BROKEN on sparc64: Does not compilekris2004-04-121-1/+7 * Remove duplicate listing of ${MOZART_DOCS} in ${DISTFILES} to unbreak thekris2004-04-122-3/+1 * This old version of GCC really only makes sense on i386 at this point (if atgerald2004-04-111-5/+3 * The tarball of 0.92 has been replaced by 0.92a.thierry2004-04-113-29/+5 * Tidy up whitespace.trevor2004-04-1114-32/+32 * Cram into 80 columns by 24 rows.trevor2004-04-113-53/+35 * Trim whitespace.trevor2004-04-111-1/+0 * - Update to 4.1.1pav2004-04-107-161/+46 * Fix an horrible bug in Gambas.thierry2004-04-102-0/+23 * updated to 8.0.039.p044.1maho2004-04-093-188/+206 * 1) update to 7.1.040maho2004-04-09