From d06ca412e46d6b4fc2ecd3e1e956b1e8970c8867 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 27 Apr 2001 20:14:17 +0000 Subject: remove hardcoded values (edit_attendee): ditto, and there are only 4 roles 2001-04-27 JP Rosevear * gui/e-meeting-edit.c (put_property_in_list): remove hardcoded values (edit_attendee): ditto, and there are only 4 roles now * gui/e-meeting-dialog.glade: tweak * gui/itip-utils.c: There shouldn't be an "other" role svn path=/trunk/; revision=9616 --- calendar/gui/e-meeting-edit.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'calendar/gui/e-meeting-edit.c') diff --git a/calendar/gui/e-meeting-edit.c b/calendar/gui/e-meeting-edit.c index 9aac1f6b83..4cf0296954 100644 --- a/calendar/gui/e-meeting-edit.c +++ b/calendar/gui/e-meeting-edit.c @@ -156,7 +156,8 @@ put_property_in_list (icalproperty *prop, gint rownum, gpointer data) gchar *text, *new_text; icalparameter *param; icalvalue *value; - gint enumval; + icalparameter_role role_val; + icalparameter_partstat part_val; gint cntr; EMeetingEditorPrivate *priv; @@ -185,15 +186,14 @@ put_property_in_list (icalproperty *prop, gint rownum, gpointer data) icalproperty_add_parameter (prop, param); } - enumval = icalparameter_get_role (param); - if (enumval < 0 || enumval > 4) - enumval = 4; - - row_text[ROLE_COL] = role_values [enumval]; + role_val = icalparameter_get_role (param); + if (role_val < ICAL_ROLE_CHAIR || role_val > ICAL_ROLE_NONPARTICIPANT) + role_val = ICAL_ROLE_REQPARTICIPANT; + row_text[ROLE_COL] = role_values[role_val - ICAL_ROLE_CHAIR]; param = get_icalparam_by_type (prop, ICAL_RSVP_PARAMETER); if (param == NULL) { - param = icalparameter_new_rsvp (TRUE); + param = icalparameter_new_rsvp (ICAL_RSVP_TRUE); icalproperty_add_parameter (prop, param); } @@ -208,12 +208,10 @@ put_property_in_list (icalproperty *prop, gint rownum, gpointer data) icalproperty_add_parameter (prop, param); } - enumval = icalparameter_get_partstat (param); - if (enumval < 0 || enumval > 7) { - enumval = 7; - } - - row_text[STATUS_COL] = partstat_values [enumval]; + part_val = icalparameter_get_partstat (param); + if (part_val < ICAL_PARTSTAT_NEEDSACTION || part_val > ICAL_PARTSTAT_INPROCESS) + part_val = ICAL_PARTSTAT_NEEDSACTION; + row_text[STATUS_COL] = partstat_values [part_val - ICAL_PARTSTAT_NEEDSACTION]; if (rownum < 0) { gtk_clist_append (GTK_CLIST (priv->attendee_list), row_text); @@ -252,7 +250,7 @@ edit_attendee (icalproperty *prop, gpointer data) icalvalue *value; gchar buffer[200]; gint cntr; - gint enumval; + icalparameter_role role_val; gboolean retval; priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv; @@ -296,11 +294,11 @@ edit_attendee (icalproperty *prop, gpointer data) param = get_icalparam_by_type (prop, ICAL_ROLE_PARAMETER); - enumval = icalparameter_get_role (param); - if (enumval < 0 || enumval > 4) - enumval = 4; + role_val = icalparameter_get_role (param); + if (role_val < ICAL_ROLE_CHAIR || role_val > ICAL_ROLE_NONPARTICIPANT) + role_val = ICAL_ROLE_REQPARTICIPANT; - text = role_values [enumval]; + text = role_values [role_val - ICAL_ROLE_CHAIR]; gtk_entry_set_text (GTK_ENTRY (priv->role_entry), text); param = get_icalparam_by_type (prop, ICAL_RSVP_PARAMETER); @@ -325,7 +323,7 @@ edit_attendee (icalproperty *prop, gpointer data) param = NULL; text = gtk_entry_get_text (GTK_ENTRY(priv->role_entry)); - for (cntr = 0; cntr < 5; cntr++) { + for (cntr = 0; cntr < 4; cntr++) { if (strncmp (text, role_values[cntr], 3) == 0) { param = icalparameter_new_role (ICAL_ROLE_CHAIR + cntr); break; @@ -343,8 +341,10 @@ edit_attendee (icalproperty *prop, gpointer data) /* 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))); + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->rsvp_check))) + param = icalparameter_new_rsvp (ICAL_RSVP_TRUE); + else + param = icalparameter_new_rsvp (ICAL_RSVP_FALSE); icalproperty_add_parameter (prop, param); retval = TRUE; -- cgit