diff options
author | Jesse Pavel <jpavel@src.gnome.org> | 2000-10-03 00:17:04 +0800 |
---|---|---|
committer | Jesse Pavel <jpavel@src.gnome.org> | 2000-10-03 00:17:04 +0800 |
commit | 4ba91933ab9ba3c23fd75d113efd7844a879c60b (patch) | |
tree | 651c0a60a100f4e96a631ba684adb0b73ca25286 /calendar | |
parent | e062edf57318b368b82862dc40c17bcd4be86661 (diff) | |
download | gsoc2013-evolution-4ba91933ab9ba3c23fd75d113efd7844a879c60b.tar gsoc2013-evolution-4ba91933ab9ba3c23fd75d113efd7844a879c60b.tar.gz gsoc2013-evolution-4ba91933ab9ba3c23fd75d113efd7844a879c60b.tar.bz2 gsoc2013-evolution-4ba91933ab9ba3c23fd75d113efd7844a879c60b.tar.lz gsoc2013-evolution-4ba91933ab9ba3c23fd75d113efd7844a879c60b.tar.xz gsoc2013-evolution-4ba91933ab9ba3c23fd75d113efd7844a879c60b.tar.zst gsoc2013-evolution-4ba91933ab9ba3c23fd75d113efd7844a879c60b.zip |
*** empty log message ***
svn path=/trunk/; revision=5658
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 8 | ||||
-rw-r--r-- | calendar/gui/e-meeting-dialog.glade | 157 | ||||
-rw-r--r-- | calendar/gui/e-meeting-edit.c | 370 | ||||
-rw-r--r-- | calendar/gui/e-meeting-edit.h | 11 | ||||
-rw-r--r-- | calendar/gui/event-editor.c | 5 |
5 files changed, 411 insertions, 140 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index ef896182e1..925cada41a 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,11 @@ +2000-09-29 Jesse Pavel <jpavel@helixcode.com> + + * gui/e-meeting-edit.c: added code that makes changes to the underlying + iCAL structure of an event, when the user changes meeting information. + + * gui/e-meeting-dialog.glade: this is the Glade UI for the meeting dialog + and accoutrements. + 2000-09-29 Damon Chaplin <damon@helixcode.com> * cal-util/cal-recur.c: updated to support RDATE end times or diff --git a/calendar/gui/e-meeting-dialog.glade b/calendar/gui/e-meeting-dialog.glade index 7dee1b9166..809eb38f8f 100644 --- a/calendar/gui/e-meeting-dialog.glade +++ b/calendar/gui/e-meeting-dialog.glade @@ -16,7 +16,7 @@ <class>GtkWindow</class> <name>meeting_window</name> <width>400</width> - <height>300</height> + <height>330</height> <visible>False</visible> <title>Meeting Invitations</title> <type>GTK_WINDOW_DIALOG</type> @@ -38,7 +38,7 @@ <orientation>GTK_ORIENTATION_HORIZONTAL</orientation> <type>GTK_TOOLBAR_BOTH</type> <space_size>5</space_size> - <space_style>GTK_TOOLBAR_SPACE_EMPTY</space_style> + <space_style>GTK_TOOLBAR_SPACE_LINE</space_style> <relief>GTK_RELIEF_NORMAL</relief> <tooltips>True</tooltips> <child> @@ -51,69 +51,78 @@ <class>GtkButton</class> <child_name>Toolbar:button</child_name> <name>send_button</name> - <width>64</width> - <label>Send</label> + <label>Send +Updates</label> <stock_pixmap>GNOME_STOCK_PIXMAP_MAIL_SND</stock_pixmap> </widget> <widget> + <class>GtkVSeparator</class> + <name>vseparator1</name> + <width>13</width> + <height>58</height> + </widget> + + <widget> <class>GtkButton</class> <child_name>Toolbar:button</child_name> - <name>cancel_button</name> - <label>Cancel</label> + <name>button4</name> + <label>Cancel +Meeting</label> <stock_pixmap>GNOME_STOCK_PIXMAP_CLOSE</stock_pixmap> </widget> + + <widget> + <class>GtkVSeparator</class> + <name>vseparator2</name> + <width>12</width> + <height>58</height> + </widget> </widget> <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <class>GtkHBox</class> + <name>hbox3</name> + <border_width>3</border_width> + <homogeneous>False</homogeneous> + <spacing>0</spacing> <child> - <padding>0</padding> - <expand>True</expand> + <padding>4</padding> + <expand>False</expand> <fill>True</fill> </child> <widget> - <class>GtkCList</class> - <name>attendee_list</name> - <border_width>3</border_width> - <can_focus>True</can_focus> - <columns>2</columns> - <column_widths>222,80</column_widths> - <selection_mode>GTK_SELECTION_SINGLE</selection_mode> - <show_titles>True</show_titles> - <shadow_type>GTK_SHADOW_IN</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>attendee_label</name> - <label>Attendee</label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> + <class>GtkLabel</class> + <name>label3</name> + <label>Organizer: </label> + <justify>GTK_JUSTIFY_RIGHT</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>3</xpad> + <ypad>0</ypad> + <child> + <padding>1</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>status_label</name> - <label>Status</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> + <widget> + <class>GtkEntry</class> + <name>organizer_entry</name> + <width>252</width> + <can_focus>True</can_focus> + <editable>False</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + </child> </widget> </widget> @@ -186,6 +195,58 @@ </widget> </widget> </widget> + + <widget> + <class>GtkScrolledWindow</class> + <name>scrolledwindow1</name> + <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkCList</class> + <name>attendee_list</name> + <border_width>3</border_width> + <can_focus>True</can_focus> + <columns>2</columns> + <column_widths>222,80</column_widths> + <selection_mode>GTK_SELECTION_SINGLE</selection_mode> + <show_titles>True</show_titles> + <shadow_type>GTK_SHADOW_IN</shadow_type> + + <widget> + <class>GtkLabel</class> + <child_name>CList:title</child_name> + <name>attendee_label</name> + <label>Attendee</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>CList:title</child_name> + <name>status_label</name> + <label>Status</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + </widget> + </widget> </widget> </widget> diff --git a/calendar/gui/e-meeting-edit.c b/calendar/gui/e-meeting-edit.c index 4b0499542a..55442b819b 100644 --- a/calendar/gui/e-meeting-edit.c +++ b/calendar/gui/e-meeting-edit.c @@ -23,19 +23,44 @@ #include <gnome.h> #include <glade/glade.h> #include <icaltypes.h> +#include <ical.h> #include "e-meeting-edit.h" #define E_MEETING_GLADE_XML "e-meeting-dialog.glade" #define E_MEETING_DEBUG -/* These are the widgets to be used in the GUI. */ -static GladeXML *xml; -static GtkWidget *meeting_window; -static GtkWidget *attendee_list; -static GtkWidget *address_entry; -static GtkWidget *add_dialog; -static gint selected_row; +typedef struct _EMeetingEditorPrivate EMeetingEditorPrivate; + +struct _EMeetingEditorPrivate { + /* These are the widgets to be used in the GUI. */ + GladeXML *xml; + GtkWidget *meeting_window; + GtkWidget *attendee_list; + GtkWidget *address_entry; + GtkWidget *add_dialog; + + /* Various pieces of information. */ + gint selected_row; + CalComponent *comp; + CalClient *client; + icalcomponent *icalcomp, *vevent; + + gint numentries; /* How many attendees are there? */ + gboolean dirty; /* Has anything changed? */ +}; + + +static gchar *partstat_values[] = { + "Needs action", + "Accepted", + "Declined", + "Tentative", + "Delegated", + "Completed", + "In Progress", + "Unknown" +}; static gboolean @@ -43,10 +68,28 @@ window_delete_cb (GtkWidget *widget, GdkEvent *event, gpointer data) { + EMeetingEditorPrivate *priv; + + priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv; #ifdef E_MEETING_DEBUG - g_print ("e-meeting-edit.c: The main window received a delete event.\n"); + g_printerr ("e-meeting-edit.c: The main window received a delete event.\n"); #endif + + if (priv->dirty == TRUE) { + /* FIXME: notify the event editor that our data has changed. + For now, I'll just display a dialog box. */ + { + GtkWidget *dialog; + + dialog = gnome_warning_dialog_parented ("Note that the meeting has changed,\n" + "and you should save this event.", + GTK_WINDOW (priv->meeting_window)); + gnome_dialog_run (GNOME_DIALOG(dialog)); + } + } + + return (FALSE); } @@ -55,9 +98,14 @@ static void window_destroy_cb (GtkWidget *widget, gpointer data) { + EMeetingEditorPrivate *priv; + #ifdef E_MEETING_DEBUG - g_print ("e-meeting-edit.c: The main window received a destroy event.\n"); + g_printerr ("e-meeting-edit.c: The main window received a destroy event.\n"); #endif + + priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv; + gtk_main_quit (); return; } @@ -65,68 +113,112 @@ window_destroy_cb (GtkWidget *widget, static void add_button_clicked_cb (GtkWidget *widget, gpointer data) { + EMeetingEditorPrivate *priv; gint button_num; + gchar buffer[200]; #ifdef E_MEETING_DEBUG - g_print ("e-meeting-edit.c: the add button was clicked.\n"); + g_printerr ("e-meeting-edit.c: the add button was clicked.\n"); #endif - if (add_dialog == NULL || address_entry == NULL) { - add_dialog = glade_xml_get_widget (xml, "add_dialog"); - address_entry = glade_xml_get_widget (xml, "address_entry"); - - gnome_dialog_set_close (GNOME_DIALOG (add_dialog), TRUE); - gnome_dialog_editable_enters (GNOME_DIALOG (add_dialog), GTK_EDITABLE (address_entry)); - gnome_dialog_close_hides (GNOME_DIALOG (add_dialog), TRUE); - gnome_dialog_set_default (GNOME_DIALOG (add_dialog), 0); + + priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv; + + if (priv->add_dialog == NULL || priv->address_entry == NULL) { + priv->add_dialog = glade_xml_get_widget (priv->xml, "add_dialog"); + priv->address_entry = glade_xml_get_widget (priv->xml, "address_entry"); + + gnome_dialog_set_close (GNOME_DIALOG (priv->add_dialog), TRUE); + gnome_dialog_editable_enters (GNOME_DIALOG (priv->add_dialog), + GTK_EDITABLE (priv->address_entry)); + gnome_dialog_close_hides (GNOME_DIALOG (priv->add_dialog), TRUE); + gnome_dialog_set_default (GNOME_DIALOG (priv->add_dialog), 0); } - g_return_if_fail (add_dialog != NULL); - g_return_if_fail (address_entry != NULL); + g_return_if_fail (priv->add_dialog != NULL); + g_return_if_fail (priv->address_entry != NULL); - gtk_widget_show (add_dialog); + gtk_widget_show (priv->add_dialog); - button_num = gnome_dialog_run (GNOME_DIALOG (add_dialog)); + button_num = gnome_dialog_run (GNOME_DIALOG (priv->add_dialog)); if (button_num == 0) { /* The user pressed Okay--let's add it to our list. */ - gchar temp_stat[] = "Needs action"; + icalproperty *prop; + icalparameter *param; + icalvalue *value; + gchar *address; gchar * row_text[2]; - address = gtk_entry_get_text (GTK_ENTRY (address_entry)); + address = gtk_entry_get_text (GTK_ENTRY (priv->address_entry)); + + prop = icalproperty_new (ICAL_ATTENDEE_PROPERTY); + g_snprintf (buffer, 190, "MAILTO:%s", address); + value = icalvalue_new_text (buffer); + icalproperty_set_value (prop, value); + + param = icalparameter_new_partstat (ICAL_PARTSTAT_PARAMETER); + icalparameter_set_partstat (param, ICAL_PARTSTAT_NEEDSACTION); + icalproperty_add_parameter (prop, param); + + icalcomponent_add_property (priv->vevent, prop); + row_text[0] = address; - row_text[1] = temp_stat; + row_text[1] = partstat_values[icalparameter_get_partstat (param)]; - gtk_clist_append (GTK_CLIST (attendee_list), row_text); + gtk_clist_append (GTK_CLIST (priv->attendee_list), row_text); + gtk_clist_set_row_data (GTK_CLIST (priv->attendee_list), priv->numentries, prop); + + priv->numentries++; + priv->dirty = TRUE; } - gtk_entry_set_text (GTK_ENTRY (address_entry), ""); + gtk_entry_set_text (GTK_ENTRY (priv->address_entry), ""); } static void delete_button_clicked_cb (GtkWidget *widget, gpointer data) { - if (selected_row < 0) { + EMeetingEditorPrivate *priv; + + priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv; + + if (priv->selected_row < 0) { GtkWidget *dialog; dialog = gnome_warning_dialog_parented ("You must select an entry to delete.", - GTK_WINDOW (add_dialog)); + GTK_WINDOW (priv->meeting_window)); gnome_dialog_run (GNOME_DIALOG(dialog)); } else { - gtk_clist_remove (GTK_CLIST (attendee_list), selected_row); - selected_row = -1; + /* Delete the associated property from the iCAL object. */ + icalproperty *prop; + + prop = (icalproperty *)gtk_clist_get_row_data (GTK_CLIST (priv->attendee_list), + priv->selected_row); + icalcomponent_remove_property (priv->vevent, prop); + icalproperty_free (prop); + + gtk_clist_remove (GTK_CLIST (priv->attendee_list), priv->selected_row); + priv->selected_row = -1; + priv->numentries--; + priv->dirty = TRUE; } } static void edit_button_clicked_cb (GtkWidget *widget, gpointer data) { - if (selected_row < 0) { + EMeetingEditorPrivate *priv; + + priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv; + + + if (priv->selected_row < 0) { GtkWidget *dialog; dialog = gnome_warning_dialog_parented ("You must select an entry to edit.", - GTK_WINDOW (add_dialog)); + GTK_WINDOW (priv->meeting_window)); gnome_dialog_run (GNOME_DIALOG(dialog)); return; } @@ -136,122 +228,220 @@ edit_button_clicked_cb (GtkWidget *widget, gpointer data) gint button_num; for (cntr = 0; cntr < 2; cntr++) { - gtk_clist_get_text (GTK_CLIST (attendee_list), - selected_row, + gtk_clist_get_text (GTK_CLIST (priv->attendee_list), + priv->selected_row, cntr, &text[cntr]); } - if (add_dialog == NULL || address_entry == NULL) { - add_dialog = glade_xml_get_widget (xml, "add_dialog"); - address_entry = glade_xml_get_widget (xml, "address_entry"); + if (priv->add_dialog == NULL || priv->address_entry == NULL) { + priv->add_dialog = glade_xml_get_widget (priv->xml, "add_dialog"); + priv->address_entry = glade_xml_get_widget (priv->xml, "address_entry"); - gnome_dialog_set_close (GNOME_DIALOG (add_dialog), TRUE); - gnome_dialog_editable_enters (GNOME_DIALOG (add_dialog), GTK_EDITABLE (address_entry)); - gnome_dialog_close_hides (GNOME_DIALOG (add_dialog), TRUE); - gnome_dialog_set_default (GNOME_DIALOG (add_dialog), 0); + gnome_dialog_set_close (GNOME_DIALOG (priv->add_dialog), TRUE); + gnome_dialog_editable_enters (GNOME_DIALOG (priv->add_dialog), + GTK_EDITABLE (priv->address_entry)); + gnome_dialog_close_hides (GNOME_DIALOG (priv->add_dialog), TRUE); + gnome_dialog_set_default (GNOME_DIALOG (priv->add_dialog), 0); } - gtk_entry_set_text (GTK_ENTRY (address_entry), text[0]); + gtk_entry_set_text (GTK_ENTRY (priv->address_entry), text[0]); - gtk_widget_show (add_dialog); + gtk_widget_show (priv->add_dialog); - button_num = gnome_dialog_run (GNOME_DIALOG (add_dialog)); + button_num = gnome_dialog_run (GNOME_DIALOG (priv->add_dialog)); if (button_num == 0) { gchar *new_text; + icalproperty *prop; + icalparameter *param; + icalvalue *value; + gchar buffer[200]; - new_text = gtk_entry_get_text (GTK_ENTRY (address_entry)); + new_text = gtk_entry_get_text (GTK_ENTRY (priv->address_entry)); - gtk_clist_set_text (GTK_CLIST (attendee_list), - selected_row, + gtk_clist_set_text (GTK_CLIST (priv->attendee_list), + priv->selected_row, 0, new_text); + + prop = (icalproperty *)gtk_clist_get_row_data (GTK_CLIST (priv->attendee_list), + priv->selected_row); + g_snprintf (buffer, 190, "MAILTO:%s", new_text); + value = icalvalue_new_text (buffer); + icalproperty_set_value (prop, value); + + priv->dirty = TRUE; } - gtk_entry_set_text (GTK_ENTRY (address_entry), ""); + gtk_entry_set_text (GTK_ENTRY (priv->address_entry), ""); } } - - - static void list_row_select_cb (GtkWidget *widget, gint row, gint column, GdkEventButton *event, gpointer data) { - selected_row = row; + EMeetingEditorPrivate *priv; + + priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv; + + priv->selected_row = row; } -static void -reset_widgets (void) + +/* ------------------------------------------------------------ */ +/* --------------------- Exported Functions ------------------- */ +/* ------------------------------------------------------------ */ + +EMeetingEditor * +e_meeting_editor_new (CalComponent *comp, CalClient *client) +{ + EMeetingEditor *object; + EMeetingEditorPrivate *priv; + + object = (EMeetingEditor *)g_new(EMeetingEditor, 1); + + priv = (EMeetingEditorPrivate *) g_new0(EMeetingEditorPrivate, 1); + priv->selected_row = -1; + priv->comp = comp; + priv->client = client; + priv->icalcomp = cal_component_get_icalcomponent (comp); + + object->priv = priv; + + return object; +} + +void +e_meeting_editor_free (EMeetingEditor *editor) { - xml = NULL; - meeting_window = NULL; - attendee_list = NULL; - address_entry = NULL; - add_dialog = NULL; - selected_row = -1; + if (editor == NULL) + return; + + if (editor->priv != NULL) + g_free (editor->priv); + + g_free (editor); } + + void -e_meeting_edit (CalComponent *comp, CalClient *client) +e_meeting_edit (EMeetingEditor *editor) { + EMeetingEditorPrivate *priv; GtkWidget *add_button, *delete_button, *edit_button; + icalproperty *prop; + icalparameter *param; + icalvalue *value; + gchar *text; + gchar *row_text[2]; + + + g_return_if_fail (editor != NULL); - reset_widgets (); + priv = (EMeetingEditorPrivate *)editor->priv; - xml = glade_xml_new (EVOLUTION_GLADEDIR "/" E_MEETING_GLADE_XML, NULL); + g_return_if_fail (priv != NULL); + + + priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/" E_MEETING_GLADE_XML, NULL); - meeting_window = glade_xml_get_widget (xml, "meeting_window"); - attendee_list = glade_xml_get_widget (xml, "attendee_list"); + priv->meeting_window = glade_xml_get_widget (priv->xml, "meeting_window"); + priv->attendee_list = glade_xml_get_widget (priv->xml, "attendee_list"); - gtk_clist_set_column_justification (GTK_CLIST (attendee_list), 1, GTK_JUSTIFY_CENTER); + gtk_clist_set_column_justification (GTK_CLIST (priv->attendee_list), 1, GTK_JUSTIFY_CENTER); - gtk_signal_connect (GTK_OBJECT (meeting_window), "delete_event", - GTK_SIGNAL_FUNC (window_delete_cb), NULL); + gtk_signal_connect (GTK_OBJECT (priv->meeting_window), "delete_event", + GTK_SIGNAL_FUNC (window_delete_cb), editor); - gtk_signal_connect_after (GTK_OBJECT (meeting_window), "delete_event", - GTK_SIGNAL_FUNC (window_destroy_cb), NULL); + gtk_signal_connect_after (GTK_OBJECT (priv->meeting_window), "delete_event", + GTK_SIGNAL_FUNC (window_destroy_cb), editor); - gtk_signal_connect (GTK_OBJECT (meeting_window), "destroy_event", - GTK_SIGNAL_FUNC (window_destroy_cb), NULL); + gtk_signal_connect (GTK_OBJECT (priv->meeting_window), "destroy_event", + GTK_SIGNAL_FUNC (window_destroy_cb), editor); - gtk_signal_connect (GTK_OBJECT (attendee_list), "select_row", - GTK_SIGNAL_FUNC (list_row_select_cb), NULL); + gtk_signal_connect (GTK_OBJECT (priv->attendee_list), "select_row", + GTK_SIGNAL_FUNC (list_row_select_cb), editor); - add_button = glade_xml_get_widget (xml, "add_button"); - delete_button = glade_xml_get_widget (xml, "delete_button"); - edit_button = glade_xml_get_widget (xml, "edit_button"); + add_button = glade_xml_get_widget (priv->xml, "add_button"); + delete_button = glade_xml_get_widget (priv->xml, "delete_button"); + edit_button = glade_xml_get_widget (priv->xml, "edit_button"); gtk_signal_connect (GTK_OBJECT (add_button), "clicked", - GTK_SIGNAL_FUNC (add_button_clicked_cb), NULL); + GTK_SIGNAL_FUNC (add_button_clicked_cb), editor); gtk_signal_connect (GTK_OBJECT (delete_button), "clicked", - GTK_SIGNAL_FUNC (delete_button_clicked_cb), NULL); + GTK_SIGNAL_FUNC (delete_button_clicked_cb), editor); gtk_signal_connect (GTK_OBJECT (edit_button), "clicked", - GTK_SIGNAL_FUNC (edit_button_clicked_cb), NULL); + GTK_SIGNAL_FUNC (edit_button_clicked_cb), editor); + + if (icalcomponent_isa (priv->icalcomp) != ICAL_VEVENT_COMPONENT) + priv->vevent = icalcomponent_get_first_component(priv->icalcomp,ICAL_VEVENT_COMPONENT); + else + priv->vevent = priv->icalcomp; + + g_assert (priv->vevent != NULL); + + /* Let's go through the iCAL object, and create a list entry + for each ATTENDEE property. */ + for (prop = icalcomponent_get_first_property (priv->vevent, ICAL_ATTENDEE_PROPERTY); + prop != NULL; + prop = icalcomponent_get_next_property (priv->vevent, ICAL_ATTENDEE_PROPERTY)) + { + value = icalproperty_get_value (prop); + text = g_strdup (icalvalue_as_ical_string (value)); + + /* Strip off the MAILTO: from the property value. */ + row_text[0] = strchr (text, ':'); + if (row_text[0] != NULL) + row_text[0]++; + else + row_text[0] = text; + + for (param = icalproperty_get_first_parameter (prop, ICAL_ANY_PARAMETER); + param != NULL && icalparameter_isa (param) != ICAL_PARTSTAT_PARAMETER; + param = icalproperty_get_next_parameter (prop, ICAL_ANY_PARAMETER) ); + + if (param == NULL) { + /* We need to add a PARTSTAT parameter to this property. */ + param = icalparameter_new_partstat (ICAL_PARTSTAT_PARAMETER); + icalparameter_set_partstat (param, ICAL_PARTSTAT_NEEDSACTION); + icalproperty_add_parameter (prop, param); + } + + /* row_text[1] corresponds to the `Status' column in the CList. */ + row_text[1] = partstat_values[icalparameter_get_partstat (param)]; + gtk_clist_append (GTK_CLIST (priv->attendee_list), row_text); + + /* The property to which each row in the list refers will be stored + as the data for that row. */ + gtk_clist_set_row_data (GTK_CLIST (priv->attendee_list), priv->numentries, prop); + priv->numentries++; + + g_free (text); + } + - gtk_widget_show (meeting_window); + gtk_widget_show (priv->meeting_window); gtk_main (); #ifdef E_MEETING_DEBUG - g_print ("e-meeting-edit.c: We've terminated the subsidiary gtk_main().\n"); + g_printerr ("e-meeting-edit.c: We've terminated the subsidiary gtk_main().\n"); #endif - if (meeting_window != NULL) - gtk_widget_destroy (meeting_window); - - if (add_dialog != NULL) - gtk_widget_destroy (add_dialog); - + if (priv->meeting_window != NULL) + gtk_widget_destroy (priv->meeting_window); + if (priv->add_dialog != NULL) + gtk_widget_destroy (priv->add_dialog); - gtk_object_destroy (GTK_OBJECT (xml)); + gtk_object_unref (GTK_OBJECT (priv->xml)); } diff --git a/calendar/gui/e-meeting-edit.h b/calendar/gui/e-meeting-edit.h index 82b2af9288..783a9c6b34 100644 --- a/calendar/gui/e-meeting-edit.h +++ b/calendar/gui/e-meeting-edit.h @@ -28,7 +28,16 @@ #include <cal-util/cal-component.h> #include <cal-client/cal-client.h> -void e_meeting_edit (CalComponent *comp, CalClient *client); +typedef struct _EMeetingEditor EMeetingEditor; + +struct _EMeetingEditor { + gpointer priv; +}; + + +EMeetingEditor * e_meeting_editor_new (CalComponent *comp, CalClient *client); +void e_meeting_edit (EMeetingEditor *editor); +void e_meeting_editor_free (EMeetingEditor *editor); #endif /* __E_MEETING_EDIT_H__ */ diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index 5f7b693be3..7575e1f34d 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -1153,6 +1153,7 @@ schedule_meeting_cb (GtkWidget *widget, gpointer data) { EventEditor *ee; EventEditorPrivate *priv; + EMeetingEditor *editor; ee = EVENT_EDITOR (data); @@ -1160,7 +1161,9 @@ schedule_meeting_cb (GtkWidget *widget, gpointer data) priv = (EventEditorPrivate *)ee->priv; - e_meeting_edit (priv->comp, priv->client); + editor = e_meeting_editor_new (priv->comp, priv->client); + e_meeting_edit (editor); + e_meeting_editor_free (editor); } |