aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-04-12 07:05:56 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-04-12 07:05:56 +0800
commit045c2a07b9516383deb591fb1e68b2b48ea1bd14 (patch)
treea787d6db99f83915c5eec5cb67260c085b61c0ea
parent48182f64e86638a5420b3768c13a8ae4d0dbd249 (diff)
downloadgsoc2013-evolution-045c2a07b9516383deb591fb1e68b2b48ea1bd14.tar
gsoc2013-evolution-045c2a07b9516383deb591fb1e68b2b48ea1bd14.tar.gz
gsoc2013-evolution-045c2a07b9516383deb591fb1e68b2b48ea1bd14.tar.bz2
gsoc2013-evolution-045c2a07b9516383deb591fb1e68b2b48ea1bd14.tar.lz
gsoc2013-evolution-045c2a07b9516383deb591fb1e68b2b48ea1bd14.tar.xz
gsoc2013-evolution-045c2a07b9516383deb591fb1e68b2b48ea1bd14.tar.zst
gsoc2013-evolution-045c2a07b9516383deb591fb1e68b2b48ea1bd14.zip
new method.
2002-04-05 Rodrigo Moya <rodrigo@ximian.com> * pcs/cal-backend.[ch] (cal_backend_get_query): new method. * pcs/cal-backend-file.c (cal_backend_file_get_query): new method. * pcs/cal.c (impl_Cal_get_query): call the CalBackend's implementation instead of calling query_new directly. * pcs/query.[ch]: fixed headers. svn path=/trunk/; revision=16443
-rw-r--r--calendar/ChangeLog11
-rw-r--r--calendar/pcs/cal-backend-file.c17
-rw-r--r--calendar/pcs/cal-backend.c27
-rw-r--r--calendar/pcs/cal-backend.h9
-rw-r--r--calendar/pcs/cal.c3
-rw-r--r--calendar/pcs/query.c1
-rw-r--r--calendar/pcs/query.h3
7 files changed, 69 insertions, 2 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index a8b39328d9..40bf1f972d 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,14 @@
+2002-04-05 Rodrigo Moya <rodrigo@ximian.com>
+
+ * pcs/cal-backend.[ch] (cal_backend_get_query): new method.
+
+ * pcs/cal-backend-file.c (cal_backend_file_get_query): new method.
+
+ * pcs/cal.c (impl_Cal_get_query): call the CalBackend's implementation
+ instead of calling query_new directly.
+
+ * pcs/query.[ch]: fixed headers.
+
2002-04-10 Dan Winship <danw@ximian.com>
* gui/gnome-cal.c (gnome_calendar_open): Fix this: Rodrigo's patch
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 424912e87b..5ca5a06f0e 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -95,6 +95,9 @@ static CalBackendOpenStatus cal_backend_file_open (CalBackend *backend,
const char *uristr,
gboolean only_if_exists);
static gboolean cal_backend_file_is_loaded (CalBackend *backend);
+static Query *cal_backend_file_get_query (CalBackend *backend,
+ GNOME_Evolution_Calendar_QueryListener ql,
+ const char *sexp);
static CalMode cal_backend_file_get_mode (CalBackend *backend);
static void cal_backend_file_set_mode (CalBackend *backend, CalMode mode);
@@ -180,6 +183,7 @@ cal_backend_file_class_init (CalBackendFileClass *class)
backend_class->get_uri = cal_backend_file_get_uri;
backend_class->open = cal_backend_file_open;
backend_class->is_loaded = cal_backend_file_is_loaded;
+ backend_class->get_query = cal_backend_file_get_query;
backend_class->get_mode = cal_backend_file_get_mode;
backend_class->set_mode = cal_backend_file_set_mode;
backend_class->get_n_objects = cal_backend_file_get_n_objects;
@@ -910,6 +914,19 @@ cal_backend_file_is_loaded (CalBackend *backend)
return (priv->icalcomp != NULL);
}
+/* get_query handler for the file backend */
+static Query *
+cal_backend_file_get_query (CalBackend *backend,
+ GNOME_Evolution_Calendar_QueryListener ql,
+ const char *sexp)
+{
+ CalBackendFile *cbfile;
+
+ cbfile = CAL_BACKEND_FILE (backend);
+
+ return query_new (backend, ql, sexp);
+}
+
/* is_remote handler for the file backend */
static CalMode
cal_backend_file_get_mode (CalBackend *backend)
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index e0dd3a713b..95dc9957e6 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -143,6 +143,7 @@ cal_backend_class_init (CalBackendClass *class)
class->get_uri = NULL;
class->open = NULL;
class->is_loaded = NULL;
+ class->get_query = NULL;
class->get_mode = NULL;
class->set_mode = NULL;
class->get_n_objects = NULL;
@@ -297,6 +298,32 @@ cal_backend_is_loaded (CalBackend *backend)
}
/**
+ * cal_backend_get_query:
+ * @backend: A calendar backend.
+ * @ql: The query listener.
+ * @sexp: Search expression.
+ *
+ * Create a query object for this backend.
+ */
+Query *
+cal_backend_get_query (CalBackend *backend,
+ GNOME_Evolution_Calendar_QueryListener ql,
+ const char *sexp)
+{
+ Query *result;
+
+ g_return_val_if_fail (backend != NULL, FALSE);
+ g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE);
+
+ if (CLASS (backend)->get_query != NULL)
+ result = (* CLASS (backend)->get_query) (backend, ql, sexp);
+ else
+ result = query_new (backend, ql, sexp);
+
+ return result;
+}
+
+/**
* cal_backend_get_mode:
* @backend: A calendar backend.
*
diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h
index e5f10842b4..4fd0a42bd0 100644
--- a/calendar/pcs/cal-backend.h
+++ b/calendar/pcs/cal-backend.h
@@ -30,6 +30,7 @@
#include "evolution-calendar.h"
#include "cal-common.h"
#include "cal.h"
+#include "query.h"
BEGIN_GNOME_DECLS
@@ -80,6 +81,10 @@ struct _CalBackendClass {
gboolean (* is_loaded) (CalBackend *backend);
+ Query *(* get_query) (CalBackend *backend,
+ GNOME_Evolution_Calendar_QueryListener ql,
+ const char *sexp);
+
/* Mode relate virtual methods */
CalMode (* get_mode) (CalBackend *backend);
void (* set_mode) (CalBackend *backend, CalMode mode);
@@ -127,6 +132,10 @@ CalBackendOpenStatus cal_backend_open (CalBackend *backend, const char *uristr,
gboolean cal_backend_is_loaded (CalBackend *backend);
+Query *cal_backend_get_query (CalBackend *backend,
+ GNOME_Evolution_Calendar_QueryListener ql,
+ const char *sexp);
+
CalMode cal_backend_get_mode (CalBackend *backend);
void cal_backend_set_mode (CalBackend *backend, CalMode mode);
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index 9409d20120..2944563163 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -24,6 +24,7 @@
#include <ical.h>
#include <bonobo/bonobo-exception.h>
#include "cal.h"
+#include "cal-backend.h"
#include "query.h"
#include "wombat.h"
@@ -427,7 +428,7 @@ impl_Cal_get_query (PortableServer_Servant servant,
cal = CAL (bonobo_object_from_servant (servant));
priv = cal->priv;
- query = query_new (priv->backend, ql, sexp);
+ query = cal_backend_get_query (priv->backend, ql, sexp);
if (!query) {
bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_CouldNotCreate);
return CORBA_OBJECT_NIL;
diff --git a/calendar/pcs/query.c b/calendar/pcs/query.c
index bf008ab655..d3fc773ff9 100644
--- a/calendar/pcs/query.c
+++ b/calendar/pcs/query.c
@@ -32,6 +32,7 @@
#include <e-util/e-sexp.h>
#include <cal-util/cal-recur.h>
#include <cal-util/timeutil.h>
+#include "cal-backend.h"
#include "query.h"
diff --git a/calendar/pcs/query.h b/calendar/pcs/query.h
index 71f289906e..80b17983a6 100644
--- a/calendar/pcs/query.h
+++ b/calendar/pcs/query.h
@@ -23,7 +23,8 @@
#include <libgnome/gnome-defs.h>
#include <bonobo/bonobo-xobject.h>
-#include "cal-backend.h"
+#include "cal-common.h"
+#include "evolution-calendar.h"
BEGIN_GNOME_DECLS