aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-09-01 10:55:13 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-09-01 10:55:13 +0800
commit3441e17ab919b707fea1920feef7cc43874fec2e (patch)
treee75bf13fd2bd4d403d7db77aa34f17b6958adecb
parente60c558b2552803e624a5cef4fccdd645f2021e0 (diff)
downloadgsoc2013-evolution-3441e17ab919b707fea1920feef7cc43874fec2e.tar
gsoc2013-evolution-3441e17ab919b707fea1920feef7cc43874fec2e.tar.gz
gsoc2013-evolution-3441e17ab919b707fea1920feef7cc43874fec2e.tar.bz2
gsoc2013-evolution-3441e17ab919b707fea1920feef7cc43874fec2e.tar.lz
gsoc2013-evolution-3441e17ab919b707fea1920feef7cc43874fec2e.tar.xz
gsoc2013-evolution-3441e17ab919b707fea1920feef7cc43874fec2e.tar.zst
gsoc2013-evolution-3441e17ab919b707fea1920feef7cc43874fec2e.zip
No need to spit a warning if removal fails. (event_editor_destroy): Free
2000-08-31 Federico Mena Quintero <federico@helixcode.com> * gui/event-editor.c (file_delete_cb): No need to spit a warning if removal fails. (event_editor_destroy): Free the exception clist data. Unref the calendar client here. (close_dialog): Just call gtk_object_destroy() on the event editor; the destroy handler will free everything else. * cal-client/cal-client.c (cal_client_object_exists): Removed function; this is not useful because we operate asynchronously. * gui/e-day-view.c (e_day_view_on_delete_appointment): No need to spit a warning if removal fails. * gui/e-week-view.c (e_week_view_on_delete_appointment): Likewise. * gui/calendar-model.c (calendar_model_delete_task): Likewise. svn path=/trunk/; revision=5155
-rw-r--r--calendar/ChangeLog19
-rw-r--r--calendar/cal-client/cal-client.c31
-rw-r--r--calendar/cal-client/cal-client.h1
-rw-r--r--calendar/gui/calendar-model.c6
-rw-r--r--calendar/gui/e-day-view.c7
-rw-r--r--calendar/gui/e-week-view.c71
-rw-r--r--calendar/gui/event-editor.c67
7 files changed, 95 insertions, 107 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index e7a2c75733..b9e445c2ec 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,22 @@
+2000-08-31 Federico Mena Quintero <federico@helixcode.com>
+
+ * gui/event-editor.c (file_delete_cb): No need to spit a warning
+ if removal fails.
+ (event_editor_destroy): Free the exception clist data. Unref the
+ calendar client here.
+ (close_dialog): Just call gtk_object_destroy() on the event
+ editor; the destroy handler will free everything else.
+
+ * cal-client/cal-client.c (cal_client_object_exists): Removed
+ function; this is not useful because we operate asynchronously.
+
+ * gui/e-day-view.c (e_day_view_on_delete_appointment): No need to
+ spit a warning if removal fails.
+
+ * gui/e-week-view.c (e_week_view_on_delete_appointment): Likewise.
+
+ * gui/calendar-model.c (calendar_model_delete_task): Likewise.
+
2000-08-31 JP Rosevear <jpr@helixcode.com>
* gui/event-editor.c (file_delete_cb): Implement delete option
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index d64026d6b2..65c0c4aea4 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -605,37 +605,6 @@ cal_client_get_n_objects (CalClient *client, CalObjType type)
}
/**
- * cal_client_object_exists:
- * @client: A calendar client
- * @uid: Unique identifier for a calendar component
- *
- * Checks to see if a uid exists in the backend
- *
- * Return value: True or false if uid exists and can be obtained
- **/
-gboolean
-cal_client_object_exists (CalClient *client, const char *uid)
-{
- CalComponent *comp;
- CalClientGetStatus status;
-
- status = cal_client_get_object (client, uid, &comp);
-
- switch (status) {
- case CAL_CLIENT_GET_SUCCESS:
- gtk_object_unref (GTK_OBJECT (comp));
- return TRUE;
-
- case CAL_CLIENT_GET_SYNTAX_ERROR:
- case CAL_CLIENT_GET_NOT_FOUND:
- return FALSE;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-/**
* cal_client_get_object:
* @client: A calendar client.
* @uid: Unique identifier for a calendar component.
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
index bc08b2497a..6747c7488e 100644
--- a/calendar/cal-client/cal-client.h
+++ b/calendar/cal-client/cal-client.h
@@ -88,7 +88,6 @@ gboolean cal_client_is_loaded (CalClient *client);
int cal_client_get_n_objects (CalClient *client, CalObjType type);
-gboolean cal_client_object_exists (CalClient *client, const char *uid);
CalClientGetStatus cal_client_get_object (CalClient *client,
const char *uid,
CalComponent **comp);
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 8a6eae5445..51f2c28a35 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -1763,8 +1763,10 @@ calendar_model_delete_task (CalendarModel *model,
cal_component_get_uid (comp, &uid);
- if (!cal_client_remove_object (priv->client, uid))
- g_message ("calendar_model_delete_task(): Could not remove the object!");
+ /* We don't check the return value; FALSE can mean the object was not in
+ * the server anyways.
+ */
+ cal_client_remove_object (priv->client, uid);
}
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 32d9380bb5..6377779497 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -2670,8 +2670,11 @@ e_day_view_on_delete_appointment (GtkWidget *widget, gpointer data)
e_day_view_stop_editing_event (day_view);
cal_component_get_uid (event->comp, &uid);
- if (!cal_client_remove_object (day_view->client, uid))
- g_message ("e_day_view_on_delete_appointment(): Could not remove the object!");
+
+ /* We don't check the return value; FALSE can mean the object was not in
+ * the server anyways.
+ */
+ cal_client_remove_object (day_view->client, uid);
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 04da509a92..a3a3e684d8 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -1,13 +1,13 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Author :
+/*
+ * Author :
* Damon Chaplin <damon@helixcode.com>
*
* Copyright 1999, Helix Code, Inc.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
@@ -522,7 +522,7 @@ e_week_view_style_set (GtkWidget *widget,
day_width = gdk_string_width (font, buffer);
week_view->day_widths[day] = day_width;
max_day_width = MAX (max_day_width, day_width);
-
+
g_date_strftime (buffer, 128, "%a", &date);
day_width = gdk_string_width (font, buffer);
week_view->abbr_day_widths[day] = day_width;
@@ -540,7 +540,7 @@ e_week_view_style_set (GtkWidget *widget,
month_width = gdk_string_width (font, buffer);
week_view->month_widths[month] = month_width;
max_month_width = MAX (max_month_width, month_width);
-
+
g_date_strftime (buffer, 128, "%b", &date);
month_width = gdk_string_width (font, buffer);
week_view->abbr_month_widths[month] = month_width;
@@ -904,7 +904,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
/* Add the occurrences of the event. */
num_days = week_view->multi_week_view ? week_view->weeks_shown * 7 : 7;
- cal_recur_generate_instances (comp,
+ cal_recur_generate_instances (comp,
week_view->day_starts[0],
week_view->day_starts[num_days],
e_week_view_add_event,
@@ -937,7 +937,7 @@ obj_removed_cb (CalClient *client, const char *uid, gpointer data)
* e_week_view_set_cal_client:
* @week_view: A week view.
* @client: A calendar client interface object.
- *
+ *
* Sets the calendar client interface object that a week view will monitor.
**/
void
@@ -1348,13 +1348,13 @@ e_week_view_update_event_cb (EWeekView *week_view,
if (span->text_item) {
CalComponentText t;
-
+
cal_component_get_summary (event->comp, &t);
text = (char*) t.value;
gnome_canvas_item_set (span->text_item,
"text", text ? text : "",
NULL);
-
+
e_week_view_reshape_event_span (week_view, event_num,
span_num);
}
@@ -1376,7 +1376,7 @@ e_week_view_foreach_event_with_uid (EWeekView *week_view,
{
EWeekViewEvent *event;
gint event_num;
-
+
for (event_num = week_view->events->len - 1;
event_num >= 0;
event_num--) {
@@ -1384,7 +1384,7 @@ e_week_view_foreach_event_with_uid (EWeekView *week_view,
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
-
+
cal_component_get_uid (event->comp, &u);
if (u && !strcmp (uid, u)) {
if (!(*callback) (week_view, event_num, data))
@@ -1409,7 +1409,7 @@ e_week_view_remove_event_cb (EWeekView *week_view,
on_editing_stopped doesn't try to update the event. */
if (week_view->editing_event_num == event_num)
week_view->editing_event_num = -1;
-
+
/* We leave the span elements in the array, but set the canvas item
pointers to NULL. */
for (span_num = 0; span_num < event->num_spans; span_num++) {
@@ -1835,7 +1835,7 @@ e_week_view_reload_events (EWeekView *week_view)
&& g_date_valid (&week_view->first_day_shown)) {
num_days = week_view->multi_week_view
? week_view->weeks_shown * 7 : 7;
-
+
cal_client_generate_instances (week_view->client,
CALOBJ_TYPE_EVENT,
week_view->day_starts[0],
@@ -2264,7 +2264,7 @@ e_week_view_reshape_event_span (EWeekView *week_view,
/* Create the text item if necessary. */
if (!span->text_item) {
CalComponentText text;
-
+
cal_component_get_summary (comp, &text);
span->text_item =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (week_view->main_canvas)->root),
@@ -2433,7 +2433,7 @@ e_week_view_find_day (EWeekView *week_view,
/* This returns the last day in the same span as the given day. A span is all
- the days which are displayed next to each other from left to right.
+ the days which are displayed next to each other from left to right.
In the week view all spans are only 1 day, since Tuesday is below Monday
rather than beside it etc. In the month view, if the weekends are not
compressed then each week is a span, otherwise Monday to Saturday of each
@@ -2711,7 +2711,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
gchar *text = NULL;
CalComponentText summary;
const char *uid;
-
+
/* Note: the item we are passed here isn't reliable, so we just stop
the edit of whatever item was being edited. We also receive this
event twice for some reason. */
@@ -2752,7 +2752,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
summary.value = text;
cal_component_set_summary (event->comp, &summary);
g_free (text);
-
+
if (!cal_client_update_object (week_view->client, event->comp))
g_message ("e_week_view_on_editing_stopped(): Could not update the object!");
}
@@ -2805,7 +2805,7 @@ e_week_view_find_event_from_uid (EWeekView *week_view,
num_events = week_view->events->len;
for (event_num = 0; event_num < num_events; event_num++) {
const char *u;
-
+
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
@@ -2858,7 +2858,7 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
struct icaltimetype itt;
time_t dtstart, dtend;
const char *uid;
-
+
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (E_IS_WEEK_VIEW (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@@ -2896,7 +2896,7 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT);
dtstart = week_view->day_starts[week_view->selection_start_day];
dtend = week_view->day_starts[week_view->selection_end_day + 1];
-
+
date.value = &itt;
date.tzid = NULL;
@@ -2908,7 +2908,7 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
/* We add the event locally and start editing it. When we get the
"update_event" callback from the server, we basically ignore it.
If we were to wait for the "update_event" callback it wouldn't be
- as responsive and we may lose a few keystrokes. */
+ as responsive and we may lose a few keystrokes. */
e_week_view_add_event (comp, dtstart, dtend, week_view);
e_week_view_check_layout (week_view);
gtk_widget_queue_draw (week_view->main_canvas);
@@ -2976,7 +2976,7 @@ e_week_view_show_popup_menu (EWeekView *week_view,
We could possibly set up another method of checking it. */
not_being_edited = TRUE;
- if (cal_component_has_rrules (event->comp)
+ if (cal_component_has_rrules (event->comp)
|| cal_component_has_rdates (event->comp)) {
num_items = 6;
context_menu = &recur_child_items[0];
@@ -3010,7 +3010,7 @@ e_week_view_on_new_appointment (GtkWidget *widget, gpointer data)
CalComponentDateTime date;
struct icaltimetype itt;
time_t dt;
-
+
week_view = E_WEEK_VIEW (data);
comp = cal_component_new ();
@@ -3060,7 +3060,7 @@ e_week_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
CalComponent *comp;
CalComponentDateTime *date=NULL;
GSList *list;
-
+
week_view = E_WEEK_VIEW (data);
if (week_view->popup_event_num == -1)
@@ -3071,7 +3071,7 @@ e_week_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
/* We must duplicate the CalComponent, or we won't know it has changed
when we get the "update_event" callback. */
-
+
comp = cal_component_clone (event->comp);
cal_component_get_exdate_list (comp, &list);
list = g_slist_append (list, date);
@@ -3094,7 +3094,7 @@ e_week_view_on_delete_appointment (GtkWidget *widget, gpointer data)
EWeekView *week_view;
EWeekViewEvent *event;
const char *uid;
-
+
week_view = E_WEEK_VIEW (data);
if (week_view->popup_event_num == -1)
@@ -3102,10 +3102,13 @@ e_week_view_on_delete_appointment (GtkWidget *widget, gpointer data)
event = &g_array_index (week_view->events, EWeekViewEvent,
week_view->popup_event_num);
-
+
cal_component_get_uid (event->comp, &uid);
- if (!cal_client_remove_object (week_view->client, uid))
- g_message ("e_week_view_on_delete_appointment(): Could not remove the object!");
+
+ /* We don't check the return value; FALSE can mean the object was not in
+ * the server anyways.
+ */
+ cal_client_remove_object (week_view->client, uid);
}
@@ -3120,15 +3123,15 @@ e_week_view_on_unrecur_appointment (GtkWidget *widget, gpointer data)
GSList *list;
week_view = E_WEEK_VIEW (data);
-
+
if (week_view->popup_event_num == -1)
return;
event = &g_array_index (week_view->events, EWeekViewEvent,
week_view->popup_event_num);
-
+
date.value = &itt;
- date.tzid = NULL;
+ date.tzid = NULL;
/* For the recurring object, we add a exception to get rid of the
instance. */
@@ -3153,7 +3156,7 @@ e_week_view_on_unrecur_appointment (GtkWidget *widget, gpointer data)
cal_component_set_dtstart (new_comp, &date);
*date.value = icaltime_from_timet (event->end, TRUE, FALSE);
cal_component_set_dtend (new_comp, &date);
-
+
/* Now update both CalComponents. Note that we do this last since at
present the updates happen synchronously so our event may disappear.
*/
diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c
index 615395fdc1..b0202493f2 100644
--- a/calendar/gui/event-editor.c
+++ b/calendar/gui/event-editor.c
@@ -198,6 +198,23 @@ event_editor_init (EventEditor *ee)
ee->priv = priv;
}
+/* Frees the rows and the row data in the recurrence exceptions GtkCList */
+static void
+free_exception_clist_data (GtkCList *clist)
+{
+ int i;
+
+ for (i = 0; i < clist->rows; i++) {
+ gpointer data;
+
+ data = gtk_clist_get_row_data (clist, i);
+ g_free (data);
+ gtk_clist_set_row_data (clist, i, NULL);
+ }
+
+ gtk_clist_clear (clist);
+}
+
/* Destroy handler for the event editor */
static void
event_editor_destroy (GtkObject *object)
@@ -216,6 +233,8 @@ event_editor_destroy (GtkObject *object)
priv->uih = NULL;
}
+ free_exception_clist_data (GTK_CLIST (priv->recurrence_exceptions_list));
+
if (priv->app) {
gtk_signal_disconnect_by_data (GTK_OBJECT (priv->app), ee);
gtk_widget_destroy (priv->app);
@@ -227,6 +246,12 @@ event_editor_destroy (GtkObject *object)
priv->comp = NULL;
}
+ if (priv->client) {
+ gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), ee);
+ gtk_object_unref (GTK_OBJECT (priv->client));
+ priv->client = NULL;
+ }
+
if (priv->xml) {
gtk_object_unref (GTK_OBJECT (priv->xml));
priv->xml = NULL;
@@ -455,23 +480,6 @@ recur_options_get (GtkWidget *widget)
static const int month_pos_map[] = { 0, 1, 2, 3, 4, -1 };
static const int weekday_map[] = { 0, 1, 2, 3, 4, 5, 6, -1 };
-/* Frees the rows and the row data in the recurrence exceptions GtkCList */
-static void
-free_exception_clist_data (GtkCList *clist)
-{
- int i;
-
- for (i = 0; i < clist->rows; i++) {
- gpointer data;
-
- data = gtk_clist_get_row_data (clist, i);
- g_free (data);
- gtk_clist_set_row_data (clist, i, NULL);
- }
-
- gtk_clist_clear (clist);
-}
-
/* Hooks the widget signals */
static void
init_widgets (EventEditor *ee)
@@ -1084,23 +1092,6 @@ close_dialog (EventEditor *ee)
g_assert (priv->app != NULL);
- free_exception_clist_data (GTK_CLIST (priv->recurrence_exceptions_list));
-
- gtk_widget_destroy (priv->app);
- priv->app = NULL;
-
- if (priv->comp) {
- gtk_object_unref (GTK_OBJECT (priv->comp));
- priv->comp = NULL;
- }
-
- if (priv->client) {
- gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), ee);
- gtk_object_unref (GTK_OBJECT (priv->client));
- priv->client = NULL;
- }
-
-
gtk_object_destroy (GTK_OBJECT (ee));
}
@@ -1133,9 +1124,11 @@ file_delete_cb (GtkWidget *widget, gpointer data)
g_return_if_fail (priv->comp);
cal_component_get_uid (priv->comp, &uid);
- if (cal_client_object_exists (priv->client, uid))
- if (!cal_client_remove_object (priv->client, uid))
- g_message ("file_delete_cb (): Could not remove the object!");
+
+ /* We don't check the return value; FALSE can mean the object was not in
+ * the server anyways.
+ */
+ cal_client_remove_object (priv->client, uid);
close_dialog (ee);
}