[evolution-data-server] Added couple of Apis for getting/settting percent as int.
- From: Chenthill Palanisamy <pchen src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution-data-server] Added couple of Apis for getting/settting percent as int.
- Date: Tue, 26 May 2009 05:04:59 -0400 (EDT)
commit 0291228ad5b429204232875243ece76268c83d14
Author: Chenthill Palanisamy <pchenthill novell com>
Date: Tue May 26 14:28:15 2009 +0530
Added couple of Apis for getting/settting percent as int.
Used for bindings in evolution-sharp.
---
calendar/libecal/e-cal-component.c | 50 ++++++++++++++++++++++++++++++++++++
calendar/libecal/e-cal-component.h | 3 ++
2 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/calendar/libecal/e-cal-component.c b/calendar/libecal/e-cal-component.c
index dcb53fb..c307d4d 100644
--- a/calendar/libecal/e-cal-component.c
+++ b/calendar/libecal/e-cal-component.c
@@ -3434,6 +3434,56 @@ e_cal_component_get_percent (ECalComponent *comp, int **percent)
*percent = NULL;
}
+void
+e_cal_component_set_percent_as_int (ECalComponent *comp, int percent)
+{
+ ECalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (E_IS_CAL_COMPONENT (comp));
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ if (percent == -1) {
+ if (priv->percent) {
+ icalcomponent_remove_property (priv->icalcomp, priv->percent);
+ icalproperty_free (priv->percent);
+ priv->percent = NULL;
+ }
+
+ return;
+ }
+
+ g_return_if_fail (percent >= 0 && percent <= 100);
+
+ if (priv->percent)
+ icalproperty_set_percentcomplete (priv->percent, percent);
+ else {
+ priv->percent = icalproperty_new_percentcomplete (percent);
+ icalcomponent_add_property (priv->icalcomp, priv->percent);
+ }
+
+
+}
+
+int
+e_cal_component_get_percent_as_int (ECalComponent *comp)
+{
+ ECalComponentPrivate *priv;
+ int percent;
+
+ priv = comp->priv;
+ g_return_val_if_fail (priv->icalcomp != NULL, -1);
+
+ if (priv->percent) {
+ percent = icalproperty_get_percentcomplete (priv->percent);
+ } else
+ percent = -1;
+
+ return percent;
+}
+
/**
* e_cal_component_set_percent:
* @comp: A calendar component object.
diff --git a/calendar/libecal/e-cal-component.h b/calendar/libecal/e-cal-component.h
index 52a8fdb..4bf5c7f 100644
--- a/calendar/libecal/e-cal-component.h
+++ b/calendar/libecal/e-cal-component.h
@@ -283,6 +283,9 @@ void e_cal_component_get_organizer (ECalComponent *comp, ECalComponentOrganizer
void e_cal_component_set_organizer (ECalComponent *comp, ECalComponentOrganizer *organizer);
gboolean e_cal_component_has_organizer (ECalComponent *comp);
+int e_cal_component_get_percent_as_int (ECalComponent *comp);
+void e_cal_component_set_percent_as_int (ECalComponent *comp, int percent);
+
void e_cal_component_get_percent (ECalComponent *comp, int **percent);
void e_cal_component_set_percent (ECalComponent *comp, int *percent);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]