aboutsummaryrefslogtreecommitdiffstats
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
parentccba1d3a600f88e3a81cfcabf67104c8793a79c0 (diff)
downloadgsoc2013-evolution-eb410c5893a848b913bbf9de266ee79be890f405.tar.gz
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
-rw-r--r--calendar/ChangeLog38
-rw-r--r--calendar/gui/calendar-commands.c14
-rw-r--r--calendar/gui/dialogs/recurrence-page.glade8
-rw-r--r--calendar/gui/e-day-view.c63
-rw-r--r--calendar/gui/e-day-view.h3
-rw-r--r--calendar/gui/e-week-view.c74
-rw-r--r--calendar/gui/e-week-view.h3
-rw-r--r--calendar/gui/print.c4
-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
12 files changed, 231 insertions, 48 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 56fe484855..f443f2c029 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,41 @@
+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.
+
2001-08-09 Rodrigo Moya <rodrigo@ximian.com>
* gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event):
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 8fd3bb038e..12fe653619 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -423,20 +423,24 @@ calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
if (start_tm.tm_year == end_tm.tm_year) {
if (start_tm.tm_mon == end_tm.tm_mon) {
strftime (buffer, sizeof (buffer),
- _("%B %Y"), &start_tm);
+ _("%d"), &start_tm);
+ strftime (end_buffer, sizeof (end_buffer),
+ _("%d %B %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
} else {
strftime (buffer, sizeof (buffer),
- _("%B"), &start_tm);
+ _("%d %B"), &start_tm);
strftime (end_buffer, sizeof (end_buffer),
- _("%B %Y"), &end_tm);
+ _("%d %B %Y"), &end_tm);
strcat (buffer, " - ");
strcat (buffer, end_buffer);
}
} else {
strftime (buffer, sizeof (buffer),
- _("%B %Y"), &start_tm);
+ _("%d %B %Y"), &start_tm);
strftime (end_buffer, sizeof (end_buffer),
- _("%B %Y"), &end_tm);
+ _("%d %B %Y"), &end_tm);
strcat (buffer, " - ");
strcat (buffer, end_buffer);
}
diff --git a/calendar/gui/dialogs/recurrence-page.glade b/calendar/gui/dialogs/recurrence-page.glade
index aaf3f7e05a..747f89bccb 100644
--- a/calendar/gui/dialogs/recurrence-page.glade
+++ b/calendar/gui/dialogs/recurrence-page.glade
@@ -207,7 +207,7 @@
<class>GtkRadioButton</class>
<name>none</name>
<can_focus>True</can_focus>
- <label>No recurrence</label>
+ <label>_No recurrence</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>recurrence-radio</group>
@@ -222,7 +222,7 @@
<class>GtkRadioButton</class>
<name>simple</name>
<can_focus>True</can_focus>
- <label>Simple recurrence</label>
+ <label>_Simple recurrence</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>recurrence-radio</group>
@@ -237,7 +237,7 @@
<class>GtkRadioButton</class>
<name>custom</name>
<can_focus>True</can_focus>
- <label>Custom recurrence</label>
+ <label>_Custom recurrence</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>recurrence-radio</group>
@@ -471,7 +471,7 @@ forever
<class>GtkButton</class>
<name>exception-delete</name>
<can_focus>True</can_focus>
- <label>_Delete</label>
+ <label>_Remove</label>
<child>
<padding>0</padding>
<expand>False</expand>
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 7c3879fc13..7fbe482772 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -92,6 +92,10 @@
pressed, as a fraction of the page size. */
#define E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE 0.25
+/* The timeout before we do a layout, so we don't do a layout for each event
+ we get from the server. */
+#define E_DAY_VIEW_LAYOUT_TIMEOUT 100
+
/* Drag and Drop stuff. */
enum {
@@ -422,6 +426,10 @@ static void selection_get (GtkWidget *invisible,
EDayView *day_view);
static void invisible_destroyed (GtkWidget *invisible, EDayView *day_view);
+static void e_day_view_queue_layout (EDayView *day_view);
+static void e_day_view_cancel_layout (EDayView *day_view);
+static gboolean e_day_view_layout_timeout_cb (gpointer data);
+
static GtkTableClass *parent_class;
static GdkAtom clipboard_atom = GDK_NONE;
@@ -498,6 +506,8 @@ e_day_view_init (EDayView *day_view)
day_view->long_events_need_layout = FALSE;
day_view->long_events_need_reshape = FALSE;
+ day_view->layout_timeout_id = 0;
+
for (day = 0; day < E_DAY_VIEW_MAX_DAYS; day++) {
day_view->events[day] = g_array_new (FALSE, FALSE,
sizeof (EDayViewEvent));
@@ -879,6 +889,8 @@ e_day_view_destroy (GtkObject *object)
day_view = E_DAY_VIEW (object);
+ e_day_view_cancel_layout (day_view);
+
e_day_view_stop_auto_scroll (day_view);
if (day_view->client) {
@@ -915,8 +927,11 @@ e_day_view_destroy (GtkObject *object)
e_day_view_free_events (day_view);
g_array_free (day_view->long_events, TRUE);
- for (day = 0; day < E_DAY_VIEW_MAX_DAYS; day++)
+ day_view->long_events = NULL;
+ for (day = 0; day < E_DAY_VIEW_MAX_DAYS; day++) {
g_array_free (day_view->events[day], TRUE);
+ day_view->events[day] = NULL;
+ }
if (day_view->invisible)
gtk_widget_destroy (day_view->invisible);
@@ -1510,10 +1525,7 @@ query_obj_updated_cb (CalQuery *query, const char *uid,
cal_client_resolve_tzid_cb, day_view->client);
gtk_object_unref (GTK_OBJECT (comp));
- e_day_view_check_layout (day_view);
-
- gtk_widget_queue_draw (day_view->top_canvas);
- gtk_widget_queue_draw (day_view->main_canvas);
+ e_day_view_queue_layout (day_view);
}
/* Callback used when a component is removed from the live query */
@@ -1599,9 +1611,10 @@ update_query (EDayView *day_view)
e_day_view_stop_editing_event (day_view);
- e_day_view_free_events (day_view);
gtk_widget_queue_draw (day_view->top_canvas);
gtk_widget_queue_draw (day_view->main_canvas);
+ e_day_view_free_events (day_view);
+ e_day_view_queue_layout (day_view);
if (!(day_view->client
&& cal_client_get_load_state (day_view->client) == CAL_CLIENT_LOAD_LOADED))
@@ -4376,8 +4389,8 @@ e_day_view_add_event (CalComponent *comp,
event.start_minute = start_tt.hour * 60 + start_tt.minute - offset;
event.end_minute = end_tt.hour * 60 + end_tt.minute - offset;
- event.start_row_or_col = -1;
- event.num_columns = -1;
+ event.start_row_or_col = 0;
+ event.num_columns = 0;
event.different_timezone = FALSE;
if (!cal_comp_util_compare_event_timezones (comp, day_view->client,
@@ -6834,3 +6847,37 @@ e_day_view_get_visible_time_range (EDayView *day_view,
return TRUE;
}
+
+/* Queues a layout, unless one is already queued. */
+static void
+e_day_view_queue_layout (EDayView *day_view)
+{
+ if (day_view->layout_timeout_id == 0) {
+ day_view->layout_timeout_id = g_timeout_add (E_DAY_VIEW_LAYOUT_TIMEOUT, e_day_view_layout_timeout_cb, day_view);
+ }
+}
+
+
+/* Removes any queued layout. */
+static void
+e_day_view_cancel_layout (EDayView *day_view)
+{
+ if (day_view->layout_timeout_id != 0) {
+ gtk_timeout_remove (day_view->layout_timeout_id);
+ day_view->layout_timeout_id = 0;
+ }
+}
+
+
+static gboolean
+e_day_view_layout_timeout_cb (gpointer data)
+{
+ EDayView *day_view = E_DAY_VIEW (data);
+
+ gtk_widget_queue_draw (day_view->top_canvas);
+ gtk_widget_queue_draw (day_view->main_canvas);
+ e_day_view_check_layout (day_view);
+
+ day_view->layout_timeout_id = 0;
+ return FALSE;
+}
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index d8a5372c8c..d260f33980 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -280,6 +280,9 @@ struct _EDayView
gboolean long_events_need_reshape;
gboolean need_reshape[E_DAY_VIEW_MAX_DAYS];
+ /* The ID of the timeout function for doing a new layout. */
+ gint layout_timeout_id;
+
/* The number of minutes per row. 5, 10, 15, 30 or 60. */
gint mins_per_row;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 0fa54c75b5..094e0b4776 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -39,6 +39,7 @@
#include <gtk/gtksignal.h>
#include <gtk/gtkvscrollbar.h>
#include <gtk/gtkwindow.h>
+#include <gtk/gtkmain.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -74,6 +75,11 @@
#define E_WEEK_VIEW_JUMP_BUTTON_X_PAD 3
#define E_WEEK_VIEW_JUMP_BUTTON_Y_PAD 3
+/* The timeout before we do a layout, so we don't do a layout for each event
+ we get from the server. */
+#define E_WEEK_VIEW_LAYOUT_TIMEOUT 100
+
+
static void e_week_view_class_init (EWeekViewClass *class);
static void e_week_view_init (EWeekView *week_view);
static void e_week_view_destroy (GtkObject *object);
@@ -192,6 +198,11 @@ static void selection_received (GtkWidget *invisible,
guint time,
EWeekView *week_view);
+static void e_week_view_queue_layout (EWeekView *week_view);
+static void e_week_view_cancel_layout (EWeekView *week_view);
+static gboolean e_week_view_layout_timeout_cb (gpointer data);
+
+
static GtkTableClass *parent_class;
static GdkAtom clipboard_atom = GDK_NONE;
@@ -271,6 +282,8 @@ e_week_view_init (EWeekView *week_view)
week_view->events_need_layout = FALSE;
week_view->events_need_reshape = FALSE;
+ week_view->layout_timeout_id = 0;
+
week_view->spans = NULL;
week_view->zone = NULL;
@@ -446,7 +459,11 @@ e_week_view_destroy (GtkObject *object)
week_view = E_WEEK_VIEW (object);
+ e_week_view_cancel_layout (week_view);
+
e_week_view_free_events (week_view);
+ g_array_free (week_view->events, TRUE);
+ week_view->events = NULL;
if (week_view->client) {
gtk_signal_disconnect_by_data (GTK_OBJECT (week_view->client), week_view);
@@ -1006,9 +1023,7 @@ query_obj_updated_cb (CalQuery *query, const char *uid,
gtk_object_unref (GTK_OBJECT (comp));
- e_week_view_check_layout (week_view);
-
- gtk_widget_queue_draw (week_view->main_canvas);
+ e_week_view_queue_layout (week_view);
}
/* Callback used when a component is removed from the live query */
@@ -1022,8 +1037,8 @@ query_obj_removed_cb (CalClient *client, const char *uid, gpointer data)
e_week_view_foreach_event_with_uid (week_view, uid,
e_week_view_remove_event_cb, NULL);
- e_week_view_check_layout (week_view);
gtk_widget_queue_draw (week_view->main_canvas);
+ e_week_view_check_layout (week_view);
}
/* Callback used when a query ends */
@@ -1038,6 +1053,8 @@ query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *err
if (status != CAL_QUERY_DONE_SUCCESS)
fprintf (stderr, "query done: %s\n", error_str);
+
+ gtk_widget_queue_draw (week_view->main_canvas);
}
/* Callback used when an evaluation error occurs when running a query */
@@ -1051,6 +1068,8 @@ query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data)
/* FIXME */
fprintf (stderr, "eval error: %s\n", error_str);
+
+ gtk_widget_queue_draw (week_view->main_canvas);
}
/* Builds a complete query sexp for the week view by adding the predicates to
@@ -1092,8 +1111,9 @@ update_query (EWeekView *week_view)
CalQuery *old_query;
char *real_sexp;
- e_week_view_free_events (week_view);
gtk_widget_queue_draw (week_view->main_canvas);
+ e_week_view_free_events (week_view);
+ e_week_view_queue_layout (week_view);
if (!(week_view->client
&& cal_client_get_load_state (week_view->client) == CAL_CLIENT_LOAD_LOADED))
@@ -1110,8 +1130,9 @@ update_query (EWeekView *week_view)
g_assert (week_view->sexp != NULL);
real_sexp = adjust_query_sexp (week_view, week_view->sexp);
- if (!real_sexp)
+ if (!real_sexp) {
return; /* No time range is set, so don't start a query */
+ }
week_view->query = cal_client_get_query (week_view->client, real_sexp);
g_free (real_sexp);
@@ -2265,6 +2286,11 @@ e_week_view_free_events (EWeekView *week_view)
for (day = 0; day <= num_days; day++) {
week_view->rows_per_day[day] = 0;
}
+
+ /* Hide all the jump buttons. */
+ for (day = 0; day < E_WEEK_VIEW_MAX_WEEKS * 7; day++) {
+ gnome_canvas_item_hide (week_view->jump_buttons[day]);
+ }
}
@@ -2726,8 +2752,6 @@ e_week_view_on_adjustment_changed (GtkAdjustment *adjustment,
if (week_view->calendar)
gnome_calendar_set_selected_time_range (week_view->calendar, start, end);
}
-
- gtk_widget_queue_draw (week_view->main_canvas);
}
@@ -3747,3 +3771,37 @@ e_week_view_get_visible_time_range (EWeekView *week_view,
return TRUE;
}
+
+
+/* Queues a layout, unless one is already queued. */
+static void
+e_week_view_queue_layout (EWeekView *week_view)
+{
+ if (week_view->layout_timeout_id == 0) {
+ week_view->layout_timeout_id = g_timeout_add (E_WEEK_VIEW_LAYOUT_TIMEOUT, e_week_view_layout_timeout_cb, week_view);
+ }
+}
+
+
+/* Removes any queued layout. */
+static void
+e_week_view_cancel_layout (EWeekView *week_view)
+{
+ if (week_view->layout_timeout_id != 0) {
+ gtk_timeout_remove (week_view->layout_timeout_id);
+ week_view->layout_timeout_id = 0;
+ }
+}
+
+
+static gboolean
+e_week_view_layout_timeout_cb (gpointer data)
+{
+ EWeekView *week_view = E_WEEK_VIEW (data);
+
+ gtk_widget_queue_draw (week_view->main_canvas);
+ e_week_view_check_layout (week_view);
+
+ week_view->layout_timeout_id = 0;
+ return FALSE;
+}
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index 7060d97bf7..84e113b1b5 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -205,6 +205,9 @@ struct _EWeekView
gboolean events_need_layout;
gboolean events_need_reshape;
+ /* The ID of the timeout function for doing a new layout. */
+ gint layout_timeout_id;
+
/* An array of EWeekViewEventSpan elements. Each event has its own
space within this array, and uses the spans_index and num_spans
fields of the EWeekViewEvent struct to access it. */
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index aa8fb92432..e1bae904ff 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -839,8 +839,8 @@ print_day_add_event (CalComponent *comp,
event.start_minute = start_tt.hour * 60 + start_tt.minute - offset;
event.end_minute = end_tt.hour * 60 + end_tt.minute - offset;
- event.start_row_or_col = -1;
- event.num_columns = -1;
+ event.start_row_or_col = 0;
+ event.num_columns = 0;
/* Find out which array to add the event to. */
for (day = 0; day < days_shown; day++) {
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 */