diff options
author | JP Rosevear <jpr@ximian.com> | 2001-07-18 06:03:51 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-07-18 06:03:51 +0800 |
commit | 05475e093830d72354f8974fe7473e31c2e2bfcc (patch) | |
tree | 6fff6d167a7291255b73348eddc116ccd5ff2b98 /calendar/gui/e-itip-control.c | |
parent | e8298df5894f24577acbc1c4d9241d49ba2a2c63 (diff) | |
download | gsoc2013-evolution-05475e093830d72354f8974fe7473e31c2e2bfcc.tar.gz gsoc2013-evolution-05475e093830d72354f8974fe7473e31c2e2bfcc.tar.zst gsoc2013-evolution-05475e093830d72354f8974fe7473e31c2e2bfcc.zip |
find the next displayable component (get_prev): find the previous
2001-07-17 JP Rosevear <jpr@ximian.com>
* gui/e-itip-control.c (get_next): find the next displayable
component
(get_prev): find the previous displayable component
(e_itip_control_set_data): use above
(prev_clicked_cb): ditto
(next_clicked_cb): ditto
svn path=/trunk/; revision=11184
Diffstat (limited to 'calendar/gui/e-itip-control.c')
-rw-r--r-- | calendar/gui/e-itip-control.c | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 8a919cb97c..7872536f11 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -736,6 +736,40 @@ show_current_freebusy (EItipControl *itip) } } +static icalcomponent * +get_next (icalcompiter *iter) +{ + icalcomponent *ret = NULL; + icalcomponent_kind kind = ICAL_NO_COMPONENT; + + while (kind != ICAL_VEVENT_COMPONENT + && kind != ICAL_VTODO_COMPONENT + && kind != ICAL_VFREEBUSY_COMPONENT) { + icalcompiter_next (iter); + ret = icalcompiter_deref (iter); + kind = icalcomponent_isa (ret); + } + + return ret; +} + +static icalcomponent * +get_prev (icalcompiter *iter) +{ + icalcomponent *ret = NULL; + icalcomponent_kind kind = ICAL_NO_COMPONENT; + + while (kind != ICAL_VEVENT_COMPONENT + && kind != ICAL_VTODO_COMPONENT + && kind != ICAL_VFREEBUSY_COMPONENT) { + icalcompiter_prior (iter); + ret = icalcompiter_deref (iter); + kind = icalcomponent_isa (ret); + } + + return ret; +} + static void show_current (EItipControl *itip) { @@ -782,7 +816,8 @@ e_itip_control_set_data (EItipControl *itip, const gchar *text) { EItipControlPrivate *priv; icalproperty *prop; - + icalcomponent_kind kind = ICAL_NO_COMPONENT; + priv = itip->priv; priv->vcalendar = g_strdup (text); @@ -802,6 +837,11 @@ e_itip_control_set_data (EItipControl *itip, const gchar *text) priv->iter = icalcomponent_begin_component (priv->main_comp, ICAL_ANY_COMPONENT); priv->ical_comp = icalcompiter_deref (&priv->iter); + kind = icalcomponent_isa (priv->ical_comp); + if (kind != ICAL_VEVENT_COMPONENT + && kind != ICAL_VTODO_COMPONENT + && kind != ICAL_VFREEBUSY_COMPONENT) + priv->ical_comp = get_next (&priv->iter); priv->total = icalcomponent_count_components (priv->main_comp, ICAL_VEVENT_COMPONENT); priv->total += icalcomponent_count_components (priv->main_comp, ICAL_VTODO_COMPONENT); @@ -958,7 +998,7 @@ prev_clicked_cb (GtkWidget *widget, gpointer data) priv = itip->priv; priv->current--; - priv->ical_comp = icalcompiter_prior (&priv->iter); + priv->ical_comp = get_prev (&priv->iter); show_current (itip); } @@ -972,7 +1012,7 @@ next_clicked_cb (GtkWidget *widget, gpointer data) priv = itip->priv; priv->current++; - priv->ical_comp = icalcompiter_next (&priv->iter); + priv->ical_comp = get_next (&priv->iter); show_current (itip); } |