aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-08-09 06:16:08 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-08-09 06:16:08 +0800
commitec730bb5f70e7600085befbd3bf9cc334187973e (patch)
treed216848c8661ba84e221ead9f0ef59711c275465 /calendar
parente239e423ddddf3a5e0613f03aef8e8381e6f753c (diff)
downloadgsoc2013-evolution-ec730bb5f70e7600085befbd3bf9cc334187973e.tar
gsoc2013-evolution-ec730bb5f70e7600085befbd3bf9cc334187973e.tar.gz
gsoc2013-evolution-ec730bb5f70e7600085befbd3bf9cc334187973e.tar.bz2
gsoc2013-evolution-ec730bb5f70e7600085befbd3bf9cc334187973e.tar.lz
gsoc2013-evolution-ec730bb5f70e7600085befbd3bf9cc334187973e.tar.xz
gsoc2013-evolution-ec730bb5f70e7600085befbd3bf9cc334187973e.tar.zst
gsoc2013-evolution-ec730bb5f70e7600085befbd3bf9cc334187973e.zip
set the attendees of a component (meeting_page_fill_component): use above
2001-08-08 JP Rosevear <jpr@ximian.com> * gui/dialogs/meeting-page.c (set_attendees): set the attendees of a component (meeting_page_fill_component): use above (meeting_page_get_cancel_comp): return a comp with the attendees to be cancelled * gui/dialogs/meeting-page.h: get a component that will be sent as a cancellation * gui/dialogs/event-editor.c (event_editor_class_init): override send_comp class method (event_editor_send_comp): send cancellation notices to deleted attendees (refresh_meeting_cmd): save before send (forward_cmd): ditto * gui/dialogs/comp-editor.c (comp_editor_class_init): set default send_comp method (real_send_comp): do the real work (comp_editor_send_comp): call class method (save_comp): don't do any sending (save_comp_with_send): save and send here (prompt_to_save_changes): use above (save_close_cmd): ditto * gui/dialogs/comp-editor.h: add virtual function svn path=/trunk/; revision=11803
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog40
-rw-r--r--calendar/gui/dialogs/comp-editor.c55
-rw-r--r--calendar/gui/dialogs/comp-editor.h1
-rw-r--r--calendar/gui/dialogs/event-editor.c29
-rw-r--r--calendar/gui/dialogs/meeting-page.c105
-rw-r--r--calendar/gui/dialogs/meeting-page.h1
6 files changed, 185 insertions, 46 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 6cc877cb78..cd4841c411 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,11 +1,43 @@
+2001-08-08 JP Rosevear <jpr@ximian.com>
+
+ * gui/dialogs/meeting-page.c (set_attendees): set the attendees of
+ a component
+ (meeting_page_fill_component): use above
+ (meeting_page_get_cancel_comp): return a comp with the attendees
+ to be cancelled
+
+ * gui/dialogs/meeting-page.h: get a component that will be sent as
+ a cancellation
+
+ * gui/dialogs/event-editor.c (event_editor_class_init): override
+ send_comp class method
+ (event_editor_send_comp): send cancellation notices to deleted
+ attendees
+ (refresh_meeting_cmd): save before send
+ (forward_cmd): ditto
+
+ * gui/dialogs/comp-editor.c (comp_editor_class_init): set default
+ send_comp method
+ (real_send_comp): do the real work
+ (comp_editor_send_comp): call class method
+ (save_comp): don't do any sending
+ (save_comp_with_send): save and send here
+ (prompt_to_save_changes): use above
+ (save_close_cmd): ditto
+
+ * gui/dialogs/comp-editor.h: add virtual function
+
2001-08-08 Rodrigo Moya <rodrigo@ximian.com>
- * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons):
- don't use a NULL mask in the call to gdk_gc_set_clip_mask
+ * gui/e-week-view-event-item.c
+ (e_week_view_event_item_draw_icons): don't use a NULL mask in the
+ call to gdk_gc_set_clip_mask
- * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): ditto
+ * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event):
+ ditto
- * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): ditto
+ * gui/e-day-view-main-item.c
+ (e_day_view_main_item_draw_day_event): ditto
2001-08-08 JP Rosevear <jpr@ximian.com>
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 6023e80295..ba0ed77ec6 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -77,7 +77,9 @@ static void comp_editor_init (CompEditor *editor);
static void comp_editor_destroy (GtkObject *object);
static void real_edit_comp (CompEditor *editor, CalComponent *comp);
+static void real_send_comp (CompEditor *editor, CalComponentItipMethod method);
static void save_comp (CompEditor *editor);
+static void save_comp_with_send (CompEditor *editor);
static void delete_comp (CompEditor *editor);
static void close_dialog (CompEditor *editor);
@@ -163,6 +165,7 @@ comp_editor_class_init (CompEditorClass *klass)
parent_class = gtk_type_class (GTK_TYPE_OBJECT);
klass->edit_comp = real_edit_comp;
+ klass->send_comp = real_send_comp;
object_class->destroy = comp_editor_destroy;
}
@@ -523,6 +526,20 @@ real_edit_comp (CompEditor *editor, CalComponent *comp)
fill_widgets (editor);
}
+
+static void
+real_send_comp (CompEditor *editor, CalComponentItipMethod method)
+{
+ CompEditorPrivate *priv;
+
+ g_return_if_fail (editor != NULL);
+ g_return_if_fail (IS_COMP_EDITOR (editor));
+
+ priv = editor->priv;
+
+ itip_send_comp (method, priv->comp);
+}
+
/**
* comp_editor_edit_comp:
@@ -600,14 +617,15 @@ comp_editor_delete_comp (CompEditor *editor)
void
comp_editor_send_comp (CompEditor *editor, CalComponentItipMethod method)
{
- CalComponent *comp;
-
- comp = comp_editor_get_current_comp (editor);
-
- cal_component_commit_sequence (comp);
- itip_send_comp (method, comp);
+ CompEditorClass *klass;
+
+ g_return_if_fail (editor != NULL);
+ g_return_if_fail (IS_COMP_EDITOR (editor));
- gtk_object_unref (GTK_OBJECT (comp));
+ klass = COMP_EDITOR_CLASS (GTK_OBJECT (editor)->klass);
+
+ if (klass->send_comp)
+ klass->send_comp (editor, method);
}
/**
@@ -704,11 +722,7 @@ save_comp (CompEditor *editor)
for (l = priv->pages; l != NULL; l = l->next)
comp_editor_page_fill_component (l->data, priv->comp);
-
- if (priv->needs_send && send_component_dialog (priv->comp)) {
- cal_component_commit_sequence (priv->comp);
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, priv->comp);
- }
+ cal_component_commit_sequence (priv->comp);
priv->updating = TRUE;
@@ -721,6 +735,19 @@ save_comp (CompEditor *editor)
}
static void
+save_comp_with_send (CompEditor *editor)
+{
+ CompEditorPrivate *priv;
+
+ priv = editor->priv;
+
+ save_comp (editor);
+
+ if (priv->needs_send && send_component_dialog (priv->comp))
+ comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST);
+}
+
+static void
delete_comp (CompEditor *editor)
{
CompEditorPrivate *priv;
@@ -749,7 +776,7 @@ prompt_to_save_changes (CompEditor *editor)
case 0: /* Save */
/* FIXME: If an error occurs here, we should popup a dialog
and then return FALSE. */
- save_comp (editor);
+ save_comp_with_send (editor);
return TRUE;
case 1: /* Discard */
return TRUE;
@@ -782,7 +809,7 @@ save_close_cmd (GtkWidget *widget, gpointer data)
{
CompEditor *editor = COMP_EDITOR (data);
- save_comp (editor);
+ save_comp_with_send (editor);
close_dialog (editor);
}
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 12cfa64031..a8a459e008 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -53,6 +53,7 @@ typedef struct {
/* Virtual functions */
void (* edit_comp) (CompEditor *page, CalComponent *comp);
+ void (* send_comp) (CompEditor *page, CalComponentItipMethod method);
} CompEditorClass;
GtkType comp_editor_get_type (void);
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 59c587b18b..a58d1d4b82 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -52,6 +52,7 @@ struct _EventEditorPrivate {
static void event_editor_class_init (EventEditorClass *class);
static void event_editor_init (EventEditor *ee);
static void event_editor_edit_comp (CompEditor *editor, CalComponent *comp);
+static void event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method);
static void event_editor_destroy (GtkObject *object);
static void schedule_meeting_cmd (GtkWidget *widget, gpointer data);
@@ -117,6 +118,7 @@ event_editor_class_init (EventEditorClass *klass)
parent_class = gtk_type_class (TYPE_COMP_EDITOR);
editor_class->edit_comp = event_editor_edit_comp;
+ editor_class->send_comp = event_editor_send_comp;
object_class->destroy = event_editor_destroy;
}
@@ -198,6 +200,29 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
parent_class->edit_comp (editor, comp);
}
+static void
+event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method)
+{
+ EventEditor *ee = EVENT_EDITOR (editor);
+ EventEditorPrivate *priv;
+ CalComponent *comp = NULL;
+
+ priv = ee->priv;
+
+ /* Don't cancel more than once */
+ if (method == CAL_COMPONENT_METHOD_CANCEL)
+ return;
+
+ comp = meeting_page_get_cancel_comp (priv->meet_page);
+ if (comp != NULL) {
+ itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp);
+ gtk_object_unref (GTK_OBJECT (comp));
+ }
+
+ if (parent_class->send_comp)
+ parent_class->send_comp (editor, method);
+}
+
/* Destroy handler for the event editor */
static void
event_editor_destroy (GtkObject *object)
@@ -258,7 +283,8 @@ static void
refresh_meeting_cmd (GtkWidget *widget, gpointer data)
{
EventEditor *ee = EVENT_EDITOR (data);
-
+
+ comp_editor_save_comp (COMP_EDITOR (ee));
comp_editor_send_comp (COMP_EDITOR (ee), CAL_COMPONENT_METHOD_REFRESH);
}
@@ -280,6 +306,7 @@ forward_cmd (GtkWidget *widget, gpointer data)
{
EventEditor *ee = EVENT_EDITOR (data);
+ comp_editor_save_comp (COMP_EDITOR (ee));
comp_editor_send_comp (COMP_EDITOR (ee), CAL_COMPONENT_METHOD_PUBLISH);
}
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index 4e88d4194a..161ae07255 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -95,6 +95,9 @@ struct _MeetingPagePrivate {
/* Lists of attendees */
GSList *attendees;
GSList *deleted_attendees;
+
+ /* To use in case of cancellation */
+ CalComponent *comp;
/* List of identities */
GList *addresses;
@@ -214,8 +217,12 @@ meeting_page_init (MeetingPage *mpage)
priv = g_new0 (MeetingPagePrivate, 1);
mpage->priv = priv;
- priv->xml = NULL;
+ priv->attendees = NULL;
+ priv->deleted_attendees = NULL;
+ priv->comp = NULL;
+
+ priv->xml = NULL;
priv->main = NULL;
priv->invite = NULL;
@@ -226,6 +233,37 @@ meeting_page_init (MeetingPage *mpage)
}
static void
+set_attendees (CalComponent *comp, GSList *attendees)
+{
+ GSList *comp_attendees = NULL;
+ GSList *l;
+
+ for (l = attendees; l != NULL; l = l->next) {
+ struct attendee *attendee = l->data;
+ CalComponentAttendee *att = g_new0 (CalComponentAttendee, 1);
+
+
+ att->value = attendee->address;
+ att->member = (attendee->member && *attendee->member) ? attendee->member : NULL;
+ att->cutype= attendee->cutype;
+ att->role = attendee->role;
+ att->status = attendee->status;
+ att->rsvp = attendee->rsvp;
+ att->delto = (attendee->delto && *attendee->delto) ? attendee->delto : NULL;
+ att->delfrom = (attendee->delfrom && *attendee->delfrom) ? attendee->delfrom : NULL;
+ att->sentby = (attendee->sentby && *attendee->sentby) ? attendee->sentby : NULL;
+ att->cn = (attendee->cn && *attendee->cn) ? attendee->cn : NULL;
+ att->language = (attendee->language && *attendee->language) ? attendee->language : NULL;
+
+ comp_attendees = g_slist_prepend (comp_attendees, att);
+
+ }
+ comp_attendees = g_slist_reverse (comp_attendees);
+ cal_component_set_attendee_list (comp, comp_attendees);
+ g_slist_free (comp_attendees);
+}
+
+static void
cleanup_attendees (GSList *attendees)
{
GSList *l;
@@ -262,6 +300,9 @@ meeting_page_destroy (GtkObject *object)
mpage = MEETING_PAGE (object);
priv = mpage->priv;
+ if (priv->comp != NULL)
+ gtk_object_unref (GTK_OBJECT (priv->comp));
+
cleanup_attendees (priv->attendees);
cleanup_attendees (priv->deleted_attendees);
@@ -352,6 +393,10 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
priv->updating = TRUE;
/* Clean out old data */
+ if (priv->comp != NULL)
+ gtk_object_unref (GTK_OBJECT (priv->comp));
+ priv->comp = NULL;
+
cleanup_attendees (priv->attendees);
cleanup_attendees (priv->deleted_attendees);
priv->attendees = NULL;
@@ -360,6 +405,9 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* Clean the screen */
clear_widgets (mpage);
+ /* Component for cancellation */
+ priv->comp = cal_component_clone (comp);
+
/* Organizer */
cal_component_get_organizer (comp, &organizer);
priv->addresses = itip_addresses_get ();
@@ -432,7 +480,6 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp)
MeetingPage *mpage;
MeetingPagePrivate *priv;
CalComponentOrganizer organizer = {NULL, NULL, NULL, NULL};
- GSList *attendees = NULL, *l;
mpage = MEETING_PAGE (page);
priv = mpage->priv;
@@ -474,30 +521,8 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp)
g_free (addr);
g_free (cn);
}
-
- for (l = priv->attendees; l != NULL; l = l->next) {
- struct attendee *attendee = l->data;
- CalComponentAttendee *att = g_new0 (CalComponentAttendee, 1);
-
-
- att->value = attendee->address;
- att->member = (attendee->member && *attendee->member) ? attendee->member : NULL;
- att->cutype= attendee->cutype;
- att->role = attendee->role;
- att->status = attendee->status;
- att->rsvp = attendee->rsvp;
- att->delto = (attendee->delto && *attendee->delto) ? attendee->delto : NULL;
- att->delfrom = (attendee->delfrom && *attendee->delfrom) ? attendee->delfrom : NULL;
- att->sentby = (attendee->sentby && *attendee->sentby) ? attendee->sentby : NULL;
- att->cn = (attendee->cn && *attendee->cn) ? attendee->cn : NULL;
- att->language = (attendee->language && *attendee->language) ? attendee->language : NULL;
-
- attendees = g_slist_prepend (attendees, att);
-
- }
- attendees = g_slist_reverse (attendees);
- cal_component_set_attendee_list (comp, attendees);
- g_slist_free (attendees);
+
+ set_attendees (comp, priv->attendees);
}
@@ -1403,7 +1428,7 @@ popup_delete_cb (GtkWidget *widget, gpointer data)
a = g_slist_nth_data (priv->attendees, priv->row);
/* If this was a delegatee, no longer delegate */
- if (a->delfrom != NULL) {
+ if (a->delfrom != NULL && *a->delfrom != '\0') {
struct attendee *b;
b = find_match (mpage, a->delfrom, &pos);
@@ -1537,3 +1562,29 @@ meeting_page_new (void)
return mpage;
}
+/**
+ * meeting_page_get_cancel_comp:
+ * @mpage:
+ *
+ *
+ *
+ * Return value:
+ **/
+CalComponent *
+meeting_page_get_cancel_comp (MeetingPage *mpage)
+{
+ MeetingPagePrivate *priv;
+
+ g_return_val_if_fail (mpage != NULL, NULL);
+ g_return_val_if_fail (IS_MEETING_PAGE (mpage), NULL);
+
+ priv = mpage->priv;
+
+ if (priv->deleted_attendees == NULL)
+ return NULL;
+
+ set_attendees (priv->comp, priv->deleted_attendees);
+
+ return cal_component_clone (priv->comp);
+}
+
diff --git a/calendar/gui/dialogs/meeting-page.h b/calendar/gui/dialogs/meeting-page.h
index d04c1b110f..ba8a6d18b4 100644
--- a/calendar/gui/dialogs/meeting-page.h
+++ b/calendar/gui/dialogs/meeting-page.h
@@ -54,6 +54,7 @@ typedef struct {
GtkType meeting_page_get_type (void);
MeetingPage *meeting_page_construct (MeetingPage *mpage);
MeetingPage *meeting_page_new (void);
+CalComponent *meeting_page_get_cancel_comp (MeetingPage *mpage);