aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-08-10 10:12:57 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-08-10 10:12:57 +0800
commiteb410c5893a848b913bbf9de266ee79be890f405 (patch)
tree7833e4a1a7eddf4ccf8a925e119705d959e20ddf /calendar/pcs
parentccba1d3a600f88e3a81cfcabf67104c8793a79c0 (diff)
downloadgsoc2013-evolution-eb410c5893a848b913bbf9de266ee79be890f405.tar
gsoc2013-evolution-eb410c5893a848b913bbf9de266ee79be890f405.tar.gz
gsoc2013-evolution-eb410c5893a848b913bbf9de266ee79be890f405.tar.bz2
gsoc2013-evolution-eb410c5893a848b913bbf9de266ee79be890f405.tar.lz
gsoc2013-evolution-eb410c5893a848b913bbf9de266ee79be890f405.tar.xz
gsoc2013-evolution-eb410c5893a848b913bbf9de266ee79be890f405.tar.zst
gsoc2013-evolution-eb410c5893a848b913bbf9de266ee79be890f405.zip
added new backend method to get the component given a UID.
2001-08-09 Damon Chaplin <damon@ximian.com> * pcs/cal-backend.c (cal_backend_get_object_component): added new backend method to get the component given a UID. * pcs/cal-backend-file.c (cal_backend_file_get_object_component): added implementation of above virtual method. * pcs/query.c (match_component): use the new backend function to get the CalComponent rather than the string. This avoids converting all the calendar components to strings and parsing them back into components for every query! (That wasn't a good idea, was it ;) * gui/e-week-view.c: * gui/e-day-view.c: use a timeout handler to layout the events, to avoid doing a layout for each event we get from a query. * gui/print.c (print_day_add_event): * gui/e-day-view.c (e_day_view_add_event): set start_row_or_col and num_columns to 0. They are guint8's. * gui/e-week-view.c (e_week_view_free_events): hide all the jump buttons. Fixes bug #5946. * gui/calendar-commands.c (calendar_set_folder_bar_label): added the day numbers for the month view. * gui/dialogs/recurrence-page.glade: changed "_Delete" to "_Remove", since it clashed with "_Add". Also added underlined accelerators for the recurrence radio buttons. Note that none of these accelerators actually work at present, due to the way we are using .glade files for each notebook page. I need to add a bug about this. Also, the "_Action" menu doesn't popup when I press Alt+A, even though the "_File" menu does popup when I press Alt+F. Strange. * pcs/cal-backend-file.c (cal_backend_file_get_timezone_object): removed debug msgs. svn path=/trunk/; revision=11866
Diffstat (limited to 'calendar/pcs')
-rw-r--r--calendar/pcs/cal-backend-file.c25
-rw-r--r--calendar/pcs/cal-backend.c27
-rw-r--r--calendar/pcs/cal-backend.h3
-rw-r--r--calendar/pcs/query.c17
4 files changed, 51 insertions, 21 deletions
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index bda5f5f825..9e090a6781 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -86,6 +86,7 @@ static gboolean cal_backend_file_is_loaded (CalBackend *backend);
static int cal_backend_file_get_n_objects (CalBackend *backend, CalObjType type);
static char *cal_backend_file_get_object (CalBackend *backend, const char *uid);
+static CalComponent *cal_backend_file_get_object_component (CalBackend *backend, const char *uid);
static char *cal_backend_file_get_timezone_object (CalBackend *backend, const char *tzid);
static CalObjType cal_backend_file_get_type_by_uid (CalBackend *backend, const char *uid);
static GList *cal_backend_file_get_uids (CalBackend *backend, CalObjType type);
@@ -163,6 +164,7 @@ cal_backend_file_class_init (CalBackendFileClass *class)
backend_class->is_loaded = cal_backend_file_is_loaded;
backend_class->get_n_objects = cal_backend_file_get_n_objects;
backend_class->get_object = cal_backend_file_get_object;
+ backend_class->get_object_component = cal_backend_file_get_object_component;
backend_class->get_timezone_object = cal_backend_file_get_timezone_object;
backend_class->get_type_by_uid = cal_backend_file_get_type_by_uid;
backend_class->get_uids = cal_backend_file_get_uids;
@@ -941,6 +943,24 @@ cal_backend_file_get_object (CalBackend *backend, const char *uid)
}
/* Get_object handler for the file backend */
+static CalComponent *
+cal_backend_file_get_object_component (CalBackend *backend, const char *uid)
+{
+ CalBackendFile *cbfile;
+ CalBackendFilePrivate *priv;
+
+ cbfile = CAL_BACKEND_FILE (backend);
+ priv = cbfile->priv;
+
+ g_return_val_if_fail (uid != NULL, NULL);
+
+ g_return_val_if_fail (priv->icalcomp != NULL, NULL);
+ g_assert (priv->comp_uid_hash != NULL);
+
+ return lookup_component (cbfile, uid);
+}
+
+/* Get_object handler for the file backend */
static char *
cal_backend_file_get_timezone_object (CalBackend *backend, const char *tzid)
{
@@ -953,24 +973,19 @@ cal_backend_file_get_timezone_object (CalBackend *backend, const char *tzid)
cbfile = CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
- g_print ("In cal_backend_file_get_timezone_object: %s\n", tzid);
-
g_return_val_if_fail (tzid != NULL, NULL);
g_return_val_if_fail (priv->icalcomp != NULL, NULL);
g_assert (priv->comp_uid_hash != NULL);
- g_print (" getting icaltz\n");
icaltz = icalcomponent_get_timezone (priv->icalcomp, tzid);
if (!icaltz)
return NULL;
- g_print (" getting icalcomp\n");
icalcomp = icaltimezone_get_component (icaltz);
if (!icalcomp)
return NULL;
- g_print (" getting ical_string\n");
ical_string = icalcomponent_as_ical_string (icalcomp);
/* We dup the string; libical owns that memory. */
if (ical_string)
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index ad56462565..b67fce3b9a 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -138,6 +138,7 @@ cal_backend_class_init (CalBackendClass *class)
class->is_loaded = NULL;
class->get_n_objects = NULL;
class->get_object = NULL;
+ class->get_object_component = NULL;
class->get_timezone_object = NULL;
class->get_type_by_uid = NULL;
class->get_uids = NULL;
@@ -267,8 +268,7 @@ cal_backend_get_n_objects (CalBackend *backend, CalObjType type)
* identifier.
*
* Return value: The string representation of a complete calendar wrapping the
- * the sought object, or NULL if no object had the specified UID. A complete
- * calendar is returned because you also need the timezone data.
+ * the sought object, or NULL if no object had the specified UID.
**/
char *
cal_backend_get_object (CalBackend *backend, const char *uid)
@@ -282,6 +282,29 @@ cal_backend_get_object (CalBackend *backend, const char *uid)
}
/**
+ * cal_backend_get_object_component:
+ * @backend: A calendar backend.
+ * @uid: Unique identifier for a calendar object.
+ *
+ * Queries a calendar backend for a calendar object based on its unique
+ * identifier. It returns the CalComponent rather than the string
+ * representation.
+ *
+ * Return value: The CalComponent of the sought object, or NULL if no object
+ * had the specified UID.
+ **/
+CalComponent *
+cal_backend_get_object_component (CalBackend *backend, const char *uid)
+{
+ g_return_val_if_fail (backend != NULL, NULL);
+ g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL);
+ g_return_val_if_fail (uid != NULL, NULL);
+
+ g_assert (CLASS (backend)->get_object_component != NULL);
+ return (* CLASS (backend)->get_object_component) (backend, uid);
+}
+
+/**
* cal_backend_get_timezone_object:
* @backend: A calendar backend.
* @tzid: Unique identifier for a calendar VTIMEZONE object.
diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h
index a1ba2af4c2..4af8befa84 100644
--- a/calendar/pcs/cal-backend.h
+++ b/calendar/pcs/cal-backend.h
@@ -84,6 +84,7 @@ struct _CalBackendClass {
/* General object acquirement and information related virtual methods */
int (* get_n_objects) (CalBackend *backend, CalObjType type);
char *(* get_object) (CalBackend *backend, const char *uid);
+ CalComponent *(* get_object_component) (CalBackend *backend, const char *uid);
char *(* get_timezone_object) (CalBackend *backend, const char *tzid);
CalObjType(* get_type_by_uid) (CalBackend *backend, const char *uid);
GList *(* get_uids) (CalBackend *backend, CalObjType type);
@@ -126,6 +127,8 @@ int cal_backend_get_n_objects (CalBackend *backend, CalObjType type);
char *cal_backend_get_object (CalBackend *backend, const char *uid);
+CalComponent *cal_backend_get_object_component (CalBackend *backend, const char *uid);
+
char *cal_backend_get_timezone_object (CalBackend *backend, const char *tzid);
GList *cal_backend_get_uids (CalBackend *backend, CalObjType type);
diff --git a/calendar/pcs/query.c b/calendar/pcs/query.c
index 94a998aa44..7e9a712825 100644
--- a/calendar/pcs/query.c
+++ b/calendar/pcs/query.c
@@ -921,25 +921,14 @@ match_component (Query *query, const char *uid,
gboolean query_in_progress, int n_scanned, int total)
{
QueryPrivate *priv;
- char *comp_str;
CalComponent *comp;
- icalcomponent *icalcomp;
- gboolean set_succeeded;
ESExpResult *result;
priv = query->priv;
- comp_str = cal_backend_get_object (priv->backend, uid);
- g_assert (comp_str != NULL);
-
- icalcomp = icalparser_parse_string (comp_str);
- g_assert (icalcomp != NULL);
-
- g_free (comp_str);
-
- comp = cal_component_new ();
- set_succeeded = cal_component_set_icalcomponent (comp, icalcomp);
- g_assert (set_succeeded);
+ comp = cal_backend_get_object_component (priv->backend, uid);
+ g_assert (comp != NULL);
+ gtk_object_ref (GTK_OBJECT (comp));
/* Eval the sexp */