aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/e-meeting-dialog.glade123
-rw-r--r--calendar/gui/e-meeting-edit.c512
2 files changed, 500 insertions, 135 deletions
diff --git a/calendar/gui/e-meeting-dialog.glade b/calendar/gui/e-meeting-dialog.glade
index 809eb38f8f..5f52030d71 100644
--- a/calendar/gui/e-meeting-dialog.glade
+++ b/calendar/gui/e-meeting-dialog.glade
@@ -15,7 +15,7 @@
<widget>
<class>GtkWindow</class>
<name>meeting_window</name>
- <width>400</width>
+ <width>486</width>
<height>330</height>
<visible>False</visible>
<title>Meeting Invitations</title>
@@ -114,7 +114,7 @@ Meeting</label>
<name>organizer_entry</name>
<width>252</width>
<can_focus>True</can_focus>
- <editable>False</editable>
+ <editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
@@ -212,10 +212,9 @@ Meeting</label>
<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>
+ <columns>4</columns>
+ <column_widths>145,141,60,80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
@@ -223,9 +222,35 @@ Meeting</label>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
- <name>attendee_label</name>
+ <name>label8</name>
<label>Attendee</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
+ <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>GtkLabel</class>
+ <child_name>CList:title</child_name>
+ <name>label5</name>
+ <label>Role</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>GtkLabel</class>
+ <child_name>CList:title</child_name>
+ <name>label6</name>
+ <label>RSVP</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
@@ -236,7 +261,7 @@ Meeting</label>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
- <name>status_label</name>
+ <name>label7</name>
<label>Status</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
@@ -252,9 +277,9 @@ Meeting</label>
<widget>
<class>GnomeDialog</class>
- <name>add_dialog</name>
+ <name>edit_dialog</name>
<width>344</width>
- <height>115</height>
+ <height>152</height>
<visible>False</visible>
<title>Attendee</title>
<type>GTK_WINDOW_DIALOG</type>
@@ -355,6 +380,84 @@ Meeting</label>
</child>
</widget>
</widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox4</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label9</name>
+ <label>Role</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>5</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCombo</class>
+ <name>role_combo</name>
+ <width>160</width>
+ <value_in_list>False</value_in_list>
+ <ok_if_empty>True</ok_if_empty>
+ <case_sensitive>False</case_sensitive>
+ <use_arrows>True</use_arrows>
+ <use_arrows_always>False</use_arrows_always>
+ <items>Chair
+Required Participant
+Optional Participant
+Non-Participant
+Other
+
+
+</items>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkEntry</class>
+ <child_name>GtkCombo:entry</child_name>
+ <name>role_entry</name>
+ <can_focus>True</can_focus>
+ <editable>False</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text>Required Participant</text>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>rsvp_check</name>
+ <can_focus>True</can_focus>
+ <label>RSVP</label>
+ <active>True</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
</widget>
</widget>
diff --git a/calendar/gui/e-meeting-edit.c b/calendar/gui/e-meeting-edit.c
index 55442b819b..d8df270eff 100644
--- a/calendar/gui/e-meeting-edit.c
+++ b/calendar/gui/e-meeting-edit.c
@@ -38,7 +38,12 @@ struct _EMeetingEditorPrivate {
GtkWidget *meeting_window;
GtkWidget *attendee_list;
GtkWidget *address_entry;
- GtkWidget *add_dialog;
+ GtkWidget *edit_dialog;
+ GtkWidget *organizer_entry;
+ GtkWidget *role_entry;
+ GtkWidget *rsvp_check;
+
+ gint changed_signal_id;
/* Various pieces of information. */
gint selected_row;
@@ -50,6 +55,9 @@ struct _EMeetingEditorPrivate {
gboolean dirty; /* Has anything changed? */
};
+#define NUM_COLUMNS 4 /* The number of columns in our attendee list. */
+
+enum column_names {ADDRESS_COL, ROLE_COL, RSVP_COL, STATUS_COL};
static gchar *partstat_values[] = {
"Needs action",
@@ -62,6 +70,30 @@ static gchar *partstat_values[] = {
"Unknown"
};
+static gchar *role_values[] = {
+ "Chair",
+ "Required Participant",
+ "Optional Participant",
+ "Non-Participant",
+ "Other"
+};
+
+
+/* Note that I have to iterate and check myself because
+ ical_property_get_xxx_parameter doesn't take into account the
+ kind of parameter for which you wish to search! */
+static icalparameter *
+get_icalparam_by_type (icalproperty *prop, icalparameter_kind kind)
+{
+ icalparameter *param;
+
+ for (param = icalproperty_get_first_parameter (prop, ICAL_ANY_PARAMETER);
+ param != NULL && icalparameter_isa (param) != kind;
+ param = icalproperty_get_next_parameter (prop, ICAL_ANY_PARAMETER) );
+
+ return param;
+}
+
static gboolean
window_delete_cb (GtkWidget *widget,
@@ -69,6 +101,7 @@ window_delete_cb (GtkWidget *widget,
gpointer data)
{
EMeetingEditorPrivate *priv;
+ gchar *text;
priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv;
@@ -81,6 +114,28 @@ window_delete_cb (GtkWidget *widget,
For now, I'll just display a dialog box. */
{
GtkWidget *dialog;
+ icalproperty *prop;
+ icalvalue *value;
+
+ /* Save the organizer into the iCAL object. */
+ prop = icalcomponent_get_first_property (priv->vevent, ICAL_ORGANIZER_PROPERTY);
+
+ text = gtk_entry_get_text (GTK_ENTRY (priv->organizer_entry));
+#ifdef E_MEETING_DEBUG
+ g_print ("e-meeting-edit.c: The organizer entry is %s.\n", text);
+#endif
+ if (strlen (text) > 0) {
+ gchar buffer[200];
+ g_snprintf (buffer, 190, "MAILTO:%s", text);
+
+ if (prop == NULL) {
+ /* We need to add an ORGANIZER property. */
+ prop = icalproperty_new (ICAL_ORGANIZER_PROPERTY);
+ icalcomponent_add_property (priv->vevent, prop);
+ }
+ value = icalvalue_new_text (buffer);
+ icalproperty_set_value (prop, value);
+ }
dialog = gnome_warning_dialog_parented ("Note that the meeting has changed,\n"
"and you should save this event.",
@@ -89,7 +144,7 @@ window_delete_cb (GtkWidget *widget,
}
}
-
+ gtk_entry_set_text (GTK_ENTRY (priv->organizer_entry), "");
return (FALSE);
}
@@ -110,70 +165,271 @@ window_destroy_cb (GtkWidget *widget,
return;
}
-static void
-add_button_clicked_cb (GtkWidget *widget, gpointer data)
+/* put_property_in_list() synchronizes the display of row `rownum'
+ in our attendee list to the values of `prop'. If rownum < 0,
+ then put_property_in_list() will append a new row.
+ If the property doesn't contain certain parameters that we deem
+ necessary, it will add them. */
+static void
+put_property_in_list (icalproperty *prop, gint rownum, gpointer data)
{
+ gchar *row_text[NUM_COLUMNS];
+ gchar *text, *new_text;
+ icalparameter *param;
+ icalvalue *value;
+ gint enumval;
+ gint cntr;
+
EMeetingEditorPrivate *priv;
- gint button_num;
- gchar buffer[200];
-#ifdef E_MEETING_DEBUG
- g_printerr ("e-meeting-edit.c: the add button was clicked.\n");
+ priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv;
+
+ value = icalproperty_get_value (prop);
+
+ if (value != NULL) {
+ text = strdup (icalvalue_as_ical_string (value));
+
+ /* Here I strip off the "MAILTO:" if it is present. */
+ new_text = strchr (text, ':');
+ if (new_text != NULL)
+ new_text++;
+ else
+ new_text = text;
+
+ row_text[ADDRESS_COL] = g_strdup (new_text);
+ g_free (text);
+ }
+
+ param = get_icalparam_by_type (prop, ICAL_ROLE_PARAMETER);
+ if (param == NULL) {
+#ifdef E_MEETING_DEBUG
+ g_print ("e-meeting-edit.c: within put_param...(), param is NULL.\n");
+#endif
+ param = icalparameter_new_role (ICAL_ROLE_REQPARTICIPANT);
+ icalproperty_add_parameter (prop, param);
+ }
+
+ enumval = icalparameter_get_role (param);
+ if (enumval < 0 || enumval > 4)
+ enumval = 4;
+#ifdef E_MEETING_DEBUG
+ g_print ("e-meeting-edit.c: the role value is %d.\n", enumval);
+#endif
+
+ row_text[ROLE_COL] = role_values [enumval];
+
+ param = get_icalparam_by_type (prop, ICAL_RSVP_PARAMETER);
+ if (param == NULL) {
+ param = icalparameter_new_rsvp (TRUE);
+ icalproperty_add_parameter (prop, param);
+ }
+
+ if (icalparameter_get_rsvp (param))
+ row_text[RSVP_COL] = "Y";
+ else
+ row_text[RSVP_COL] = "N";
+
+#ifdef E_MEETING_DEBUG
+ g_print ("e-meeting-edit.c: the RSVP is %c.\n", row_text[RSVP_COL][0]);
#endif
+
+ param = get_icalparam_by_type (prop, ICAL_PARTSTAT_PARAMETER);
+ if (param == NULL) {
+ param = icalparameter_new_partstat (ICAL_PARTSTAT_NEEDSACTION);
+ icalproperty_add_parameter (prop, param);
+ }
+
+ enumval = icalparameter_get_partstat (param);
+ if (enumval < 0 || enumval > 7) {
+ enumval = 7;
+ }
+
+ row_text[STATUS_COL] = partstat_values [enumval];
+
+ if (rownum < 0) {
+ 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++;
+ }
+ else {
+ for (cntr = 0; cntr < NUM_COLUMNS; cntr++) {
+ gtk_clist_set_text (GTK_CLIST (priv->attendee_list),
+ rownum,
+ cntr,
+ row_text[cntr]);
+ }
+ }
+
+ g_free (row_text[ADDRESS_COL]);
+}
+
+
+
+/* edit_attendee() performs the GUI manipulation and interaction for
+ editing `prop' and returns TRUE if the user indicated that he wants
+ to save the new property information.
+
+ Note that it is necessary that the property have parameters of the types
+ RSVP, PARTSTAT, and ROLE already when passed into this function. */
+static gboolean
+edit_attendee (icalproperty *prop, gpointer data)
+{
+ EMeetingEditorPrivate *priv;
+ gint button_num;
+ gchar *new_text, *text;
+ icalparameter *param;
+ icalvalue *value;
+ gchar buffer[200];
+ gint cntr;
+ gint enumval;
+ gboolean retval;
+
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");
+ g_return_val_if_fail (prop != NULL, FALSE);
+
+ if (priv->edit_dialog == NULL || priv->address_entry == NULL) {
+ priv->edit_dialog = glade_xml_get_widget (priv->xml, "edit_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),
+ gnome_dialog_set_close (GNOME_DIALOG (priv->edit_dialog), TRUE);
+ gnome_dialog_editable_enters (GNOME_DIALOG (priv->edit_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);
+ gnome_dialog_close_hides (GNOME_DIALOG (priv->edit_dialog), TRUE);
+ gnome_dialog_set_default (GNOME_DIALOG (priv->edit_dialog), 0);
+ }
+
+ g_return_val_if_fail (priv->edit_dialog != NULL, FALSE);
+ g_return_val_if_fail (priv->address_entry != NULL, FALSE);
+
+ gtk_widget_realize (priv->edit_dialog);
+
+ value = icalproperty_get_value (prop);
+
+ if (value != NULL) {
+ text = strdup (icalvalue_as_ical_string (value));
+
+ /* Here I strip off the "MAILTO:" if it is present. */
+ new_text = strchr (text, ':');
+ if (new_text != NULL)
+ new_text++;
+ else
+ new_text = text;
+
+ gtk_entry_set_text (GTK_ENTRY (priv->address_entry), new_text);
+ g_free (text);
+ }
+ else {
+ gtk_entry_set_text (GTK_ENTRY (priv->address_entry), "");
}
+
+
+ param = get_icalparam_by_type (prop, ICAL_ROLE_PARAMETER);
+ enumval = icalparameter_get_role (param);
+ if (enumval < 0 || enumval > 4)
+ enumval = 4;
+
+ text = role_values [enumval];
+ gtk_entry_set_text (GTK_ENTRY (priv->role_entry), text);
- g_return_if_fail (priv->add_dialog != NULL);
- g_return_if_fail (priv->address_entry != NULL);
+ param = get_icalparam_by_type (prop, ICAL_RSVP_PARAMETER);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->rsvp_check),
+ icalparameter_get_rsvp (param));
- gtk_widget_show (priv->add_dialog);
+ gtk_widget_show (priv->edit_dialog);
- button_num = gnome_dialog_run (GNOME_DIALOG (priv->add_dialog));
+ button_num = gnome_dialog_run (GNOME_DIALOG (priv->edit_dialog));
if (button_num == 0) {
- /* The user pressed Okay--let's add it to our list. */
- icalproperty *prop;
- icalparameter *param;
- icalvalue *value;
-
- gchar *address;
- gchar * row_text[2];
+ /* The user pressed the OK button. */
+ new_text = gtk_entry_get_text (GTK_ENTRY (priv->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);
+ g_snprintf (buffer, 190, "MAILTO:%s", new_text);
value = icalvalue_new_text (buffer);
icalproperty_set_value (prop, value);
- param = icalparameter_new_partstat (ICAL_PARTSTAT_PARAMETER);
- icalparameter_set_partstat (param, ICAL_PARTSTAT_NEEDSACTION);
+ /* Take care of the ROLE. */
+ icalproperty_remove_parameter (prop, ICAL_ROLE_PARAMETER);
+
+ param = NULL;
+ text = gtk_entry_get_text (GTK_ENTRY(priv->role_entry));
+#ifdef E_MEETING_DEBUG
+ g_print ("e-meeting-edit.c: the role entry text is %s.\n", text);
+#endif
+
+ for (cntr = 0; cntr < 5; cntr++) {
+ if (strncmp (text, role_values[cntr], 3) == 0) {
+ param = icalparameter_new_role (cntr);
+ break;
+ }
+ }
+
+ if (param == NULL) {
+ g_print ("e-meeting-edit.c: edit_attendee() the ROLE param was null.\n");
+ /* Use this as a default case, if none of the others match. */
+ param = icalparameter_new_role (ICAL_ROLE_REQPARTICIPANT);
+ }
+
icalproperty_add_parameter (prop, param);
+ /* Now the RSVP. */
+ icalproperty_remove_parameter (prop, ICAL_RSVP_PARAMETER);
+
+ param = icalparameter_new_rsvp
+ (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->rsvp_check)));
+ icalproperty_add_parameter (prop, param);
+
+ retval = TRUE;
+ }
+ else /* The user didn't say OK. */
+ retval = FALSE;
+
+ return retval;
+}
+
+
+static void
+add_button_clicked_cb (GtkWidget *widget, gpointer data)
+{
+ EMeetingEditorPrivate *priv;
+ icalproperty *prop;
+ icalparameter *param;
+
+#ifdef E_MEETING_DEBUG
+ g_printerr ("e-meeting-edit.c: the add button was clicked.\n");
+#endif
+
+ priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv;
+
+ prop = icalproperty_new (ICAL_ATTENDEE_PROPERTY);
+ param = icalparameter_new_role (ICAL_ROLE_REQPARTICIPANT);
+ icalproperty_add_parameter (prop, param);
+ param = icalparameter_new_rsvp (TRUE);
+ icalproperty_add_parameter (prop, param);
+ param = icalparameter_new_partstat (ICAL_PARTSTAT_NEEDSACTION);
+ icalproperty_add_parameter (prop, param);
+
+ if (edit_attendee (prop, data) == TRUE) {
+#ifdef E_MEETING_DEBUG
+ g_print ("e-meeting-edit.c: After edit_attendee()");
+#endif
+
+ /* Let's add this property to our component and to the CList. */
icalcomponent_add_property (priv->vevent, prop);
-
- row_text[0] = address;
- row_text[1] = partstat_values[icalparameter_get_partstat (param)];
-
- 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++;
+ /* The -1 indicates that we should add a new row. */
+ put_property_in_list (prop, -1, data);
+
+#ifdef E_MEETING_DEBUG
+ g_print ("e-meeting-edit.c: After put_property_in_list()");
+#endif
+
priv->dirty = TRUE;
}
-
- gtk_entry_set_text (GTK_ENTRY (priv->address_entry), "");
+ else {
+ icalproperty_free (prop);
+ }
}
static void
@@ -223,68 +479,53 @@ edit_button_clicked_cb (GtkWidget *widget, gpointer data)
return;
}
else {
- gchar *text[2];
- gint cntr;
- gint button_num;
-
- for (cntr = 0; cntr < 2; cntr++) {
- gtk_clist_get_text (GTK_CLIST (priv->attendee_list),
- priv->selected_row,
- cntr,
- &text[cntr]);
- }
-
- 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);
- }
+ icalproperty *prop, *new_prop;
+ icalparameter *param, *new_param;
+ icalvalue *value, *new_value;
- gtk_entry_set_text (GTK_ENTRY (priv->address_entry), text[0]);
+ prop = (icalproperty *)gtk_clist_get_row_data (GTK_CLIST (priv->attendee_list),
+ priv->selected_row);
- gtk_widget_show (priv->add_dialog);
+ g_assert (prop != NULL);
- button_num = gnome_dialog_run (GNOME_DIALOG (priv->add_dialog));
+ new_prop = icalproperty_new_clone (prop);
- if (button_num == 0) {
- gchar *new_text;
- icalproperty *prop;
- icalparameter *param;
- icalvalue *value;
- gchar buffer[200];
+ if (edit_attendee (new_prop, data)) {
+ /* The user hit Okay. */
+ /*We need to synchronize the old property with the newly edited one.*/
+ value = icalvalue_new_clone (icalproperty_get_value (new_prop));
+ icalproperty_set_value (prop, value);
- new_text = gtk_entry_get_text (GTK_ENTRY (priv->address_entry));
+ icalproperty_remove_parameter (prop, ICAL_ROLE_PARAMETER);
+ icalproperty_remove_parameter (prop, ICAL_RSVP_PARAMETER);
+ icalproperty_remove_parameter (prop, ICAL_PARTSTAT_PARAMETER);
- gtk_clist_set_text (GTK_CLIST (priv->attendee_list),
- priv->selected_row,
- 0,
- new_text);
+ param = icalparameter_new_clone (get_icalparam_by_type (new_prop, ICAL_ROLE_PARAMETER));
+ g_assert (param != NULL);
+ icalproperty_add_parameter (prop, param);
+ param = icalparameter_new_clone (get_icalparam_by_type (new_prop, ICAL_RSVP_PARAMETER));
+ g_assert (param != NULL);
+ icalproperty_add_parameter (prop, param);
+ param = icalparameter_new_clone (get_icalparam_by_type (new_prop, ICAL_PARTSTAT_PARAMETER));
+ g_assert (param != NULL);
+ icalproperty_add_parameter (prop, param);
- 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);
-
+ put_property_in_list (prop, priv->selected_row, data);
priv->dirty = TRUE;
- }
- gtk_entry_set_text (GTK_ENTRY (priv->address_entry), "");
+ }
+ icalproperty_free (new_prop);
}
}
-static void list_row_select_cb (GtkWidget *widget,
- gint row,
- gint column,
- GdkEventButton *event,
- gpointer data)
+static void
+list_row_select_cb (GtkWidget *widget,
+ gint row,
+ gint column,
+ GdkEventButton *event,
+ gpointer data)
{
EMeetingEditorPrivate *priv;
@@ -292,7 +533,19 @@ static void list_row_select_cb (GtkWidget *widget,
priv->selected_row = row;
}
-
+
+static void
+organizer_changed_cb (GtkWidget *widget, gpointer data)
+{
+ EMeetingEditorPrivate *priv;
+
+ priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv;
+
+ gtk_signal_disconnect (GTK_OBJECT (priv->organizer_entry), priv->changed_signal_id);
+
+ priv->dirty = TRUE;
+}
+
/* ------------------------------------------------------------ */
/* --------------------- Exported Functions ------------------- */
@@ -337,10 +590,8 @@ 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);
@@ -354,8 +605,12 @@ e_meeting_edit (EMeetingEditor *editor)
priv->meeting_window = glade_xml_get_widget (priv->xml, "meeting_window");
priv->attendee_list = glade_xml_get_widget (priv->xml, "attendee_list");
+ priv->role_entry = glade_xml_get_widget (priv->xml, "role_entry");
+ priv->rsvp_check = glade_xml_get_widget (priv->xml, "rsvp_check");
- gtk_clist_set_column_justification (GTK_CLIST (priv->attendee_list), 1, GTK_JUSTIFY_CENTER);
+ gtk_clist_set_column_justification (GTK_CLIST (priv->attendee_list), ROLE_COL, GTK_JUSTIFY_CENTER);
+ gtk_clist_set_column_justification (GTK_CLIST (priv->attendee_list), RSVP_COL, GTK_JUSTIFY_CENTER);
+ gtk_clist_set_column_justification (GTK_CLIST (priv->attendee_list), STATUS_COL, GTK_JUSTIFY_CENTER);
gtk_signal_connect (GTK_OBJECT (priv->meeting_window), "delete_event",
GTK_SIGNAL_FUNC (window_delete_cb), editor);
@@ -382,6 +637,8 @@ e_meeting_edit (EMeetingEditor *editor)
gtk_signal_connect (GTK_OBJECT (edit_button), "clicked",
GTK_SIGNAL_FUNC (edit_button_clicked_cb), editor);
+ priv->organizer_entry = glade_xml_get_widget (priv->xml, "organizer_entry");
+
if (icalcomponent_isa (priv->icalcomp) != ICAL_VEVENT_COMPONENT)
priv->vevent = icalcomponent_get_first_component(priv->icalcomp,ICAL_VEVENT_COMPONENT);
else
@@ -389,43 +646,48 @@ e_meeting_edit (EMeetingEditor *editor)
g_assert (priv->vevent != NULL);
+ /* Let's extract the organizer, if there is one. */
+ prop = icalcomponent_get_first_property (priv->vevent, ICAL_ORGANIZER_PROPERTY);
+
+ if (prop != NULL) {
+ gchar *buffer;
+
+#ifdef E_MEETING_DEBUG
+ g_print ("e-meeting-edit.c: The organizer property is not null.\n");
+#endif
+
+ value = icalproperty_get_value (prop);
+ buffer = g_strdup (icalvalue_as_ical_string (value));
+ if (buffer != NULL) {
+ /* Strip off the MAILTO:, if it is present. */
+ text = strchr (buffer, ':');
+ if (text == NULL)
+ text = buffer;
+ else
+ text++;
+
+ gtk_entry_set_text (GTK_ENTRY (priv->organizer_entry), text);
+ g_free (buffer);
+ }
+
+ }
+#ifdef E_MEETING_DEBUG
+ else {
+ g_print ("e-meeting-edit.c: the organizer property was NULL.\n");
+ }
+#endif
+
+ priv->changed_signal_id = gtk_signal_connect (GTK_OBJECT (priv->organizer_entry), "changed",
+ GTK_SIGNAL_FUNC (organizer_changed_cb), editor);
+
+
/* 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);
+ put_property_in_list (prop, -1, editor);
}
@@ -440,8 +702,8 @@ e_meeting_edit (EMeetingEditor *editor)
if (priv->meeting_window != NULL)
gtk_widget_destroy (priv->meeting_window);
- if (priv->add_dialog != NULL)
- gtk_widget_destroy (priv->add_dialog);
+ if (priv->edit_dialog != NULL)
+ gtk_widget_destroy (priv->edit_dialog);
gtk_object_unref (GTK_OBJECT (priv->xml));
}