Top | ![]() |
![]() |
![]() |
![]() |
MrpCalendar * | mrp_calendar_new () |
void | mrp_calendar_add () |
MrpCalendar * | mrp_calendar_copy () |
MrpCalendar * | mrp_calendar_derive () |
void | mrp_calendar_reparent () |
void | mrp_calendar_remove () |
const gchar * | mrp_calendar_get_name () |
void | mrp_calendar_set_name () |
void | mrp_calendar_day_set_intervals () |
GList * | mrp_calendar_day_get_intervals () |
gint | mrp_calendar_day_get_total_work () |
MrpDay * | mrp_calendar_get_day () |
MrpDay * | mrp_calendar_get_default_day () |
void | mrp_calendar_set_default_days () |
void | mrp_calendar_set_days () |
MrpCalendar * | mrp_calendar_get_parent () |
GList * | mrp_calendar_get_children () |
GList * | mrp_calendar_get_overridden_days () |
GList * | mrp_calendar_get_all_overridden_dates () |
MrpInterval * | mrp_interval_new () |
MrpInterval * | mrp_interval_copy () |
MrpInterval * | mrp_interval_ref () |
void | mrp_interval_unref () |
void | mrp_interval_get_absolute () |
void | mrp_interval_set_absolute () |
A calendar contains the information on working/nonworking time for resources. A calendar has a default week, specifying the day types (MrpDay) used for each day of the week by default.
Day types can be overriden so that a working day has another set of working time intervals per calendar. Certain dates can be overridden to use another day type as well.
MrpCalendar * mrp_calendar_new (const gchar *name
,MrpProject *project
);
Creates a new MrpCalendar. The calendar will be empty so you need to set the
default week and/or override days, see mrp_calendar_set_default_days()
and
mrp_calendar_set_days()
.
void mrp_calendar_add (MrpCalendar *calendar
,MrpCalendar *parent
);
Add calendar
to the project
MrpCalendar * mrp_calendar_copy (const gchar *name
,MrpCalendar *calendar
);
Copies calendar
, making the new calendar a base calendar, that does not have
a parent.
MrpCalendar * mrp_calendar_derive (const gchar *name
,MrpCalendar *parent
);
Derives a new calendar from parent
. The new calendar will inherit all
properties from parent
, so if no days are overridden, the calendars will be
identical.
void mrp_calendar_reparent (MrpCalendar *new_parent
,MrpCalendar *child
);
Changes the parent of child
so that it inherits new_parent
, instead of
its old parent.
void
mrp_calendar_remove (MrpCalendar *calendar
);
Removes calendar
from the project. If the calendar is used by the project, a
new calendar is set for the project. If the calendar has a parent, the parent
is used, otherwise the first child of the root is used. For resources, the
calendar is exchanged for the parent if one exists, otherwise the resource
calendar is unset, so that the project default will be used.
const gchar *
mrp_calendar_get_name (MrpCalendar *calendar
);
Retrieves the name of the calendar.
void mrp_calendar_set_name (MrpCalendar *calendar
,const gchar *name
);
Sets the name of the calendar.
void mrp_calendar_day_set_intervals (MrpCalendar *calendar
,MrpDay *day
,GList *intervals
);
Overrides the working time for the day type day
when used in calendar
.
calendar |
an MrpCalendar |
|
day |
an MrpDay |
|
intervals |
list of MrpInterval to set for the specified day |
GList * mrp_calendar_day_get_intervals (MrpCalendar *calendar
,MrpDay *day
,gboolean check_ancestors
);
Retrieves the working time for the given day/calendar combination. If
check_ancestors
is TRUE
, the calendar hierarchy is searched until a
calendar that has set the working time for this day type is found. If FALSE
,
the returned list will be empty if there is no explicit working time set for
calendar
.
calendar |
an MrpCalendar |
|
day |
an MrpDay |
|
check_ancestors |
specifies if the whole calendar hierarchy should be checked |
gint mrp_calendar_day_get_total_work (MrpCalendar *calendar
,MrpDay *day
);
Calculates the total amount of work for day
in calendar
.
MrpDay * mrp_calendar_get_day (MrpCalendar *calendar
,mrptime date
,gboolean check_ancestors
);
Retrieves the day type for the given date and calendar. If check_ancestors
is TRUE
, the parent and grandparent, and so on, is searched if calendar
does not have an overridden day type for the specified date.
calendar |
an MrpCalendar |
|
date |
an mrptime |
|
check_ancestors |
specifies if the whole calendar hierarchy should be checked |
MrpDay * mrp_calendar_get_default_day (MrpCalendar *calendar
,gint week_day
);
Retrieves the default day for calendar
.
void mrp_calendar_set_default_days (MrpCalendar *calendar
,gint week_day
,...
);
Sets days in the default week for calendar
. Those are the days that are used
as fallback is a date is not overridden.
calendar |
an MrpCalendar |
|
week_day |
integer in the range 0 - 6, where 0 is Sunday |
|
... |
MrpDay followed by more week day/MrpDay pairs, terminated by -1 |
void mrp_calendar_set_days (MrpCalendar *calendar
,mrptime date
,...
);
Overrides specific dates in calendar
, setting the type of day to use for
those dates.
calendar |
an MrpCalendar |
|
date |
an mrptime |
|
... |
MrpDay followed by more mrptime/MrpDay pairs, terminated by -1 |
MrpCalendar *
mrp_calendar_get_parent (MrpCalendar *calendar
);
Retrieves the parent calendar of calendar
. The parent is the calendar that a
calendar falls back to if a date or day type is not overridden.
GList *
mrp_calendar_get_children (MrpCalendar *calendar
);
Retrieves a list of the children, i.e. the calendars that are immediately
derived from calendar
.
GList *
mrp_calendar_get_overridden_days (MrpCalendar *calendar
);
Retrieves the days that are overridden in this calendar, and the intervals that they are overridden with. This is mainly used when saving calendar data.
GList *
mrp_calendar_get_all_overridden_dates (MrpCalendar *calendar
);
Retrieves the overridden dates of calendar
, i.e. the specific dates that
differ from the parent calendar.
MrpInterval * mrp_interval_new (mrptime start
,mrptime end
);
Creates a new MrpInterval ranging from start
to end
.
MrpInterval *
mrp_interval_ref (MrpInterval *interval
);
Increases the reference count on interval
.
void
mrp_interval_unref (MrpInterval *interval
);
Decreases the reference count on interval
. When the count goes to 0, the
interval is freed.
void mrp_interval_get_absolute (MrpInterval *interval
,mrptime offset
,mrptime *start
,mrptime *end
);
Retrieves the start and end time of interval, with an optional offset
.
interval |
an MrpInterval |
|
offset |
the offset to add to start and end |
|
start |
location to store start time, or |
|
end |
location to store end time, or |
void mrp_interval_set_absolute (MrpInterval *interval
,mrptime offset
,mrptime start
,mrptime end
);
Set the start and end time of interval, with an optional offset
.
interval |
an MrpInterval |
|
offset |
the offset to subtract to start and end |
|
start |
value of start time |
|
end |
value of end time |
typedef struct { MrpDay *day; GList *intervals; } MrpDayWithIntervals;
Used for saving calendar data.
Associate a day
type and time intervals
.
A day type is composed of working periods.
typedef struct { mrptime date; MrpDay *day; } MrpDateWithDay;
Associate a date
and a day
type.
Certain dates can have a peculiar day type.
“name”
property “name” char *
The name of the calendar.
Owner: MrpCalendar
Flags: Read / Write
Default value: "empty"
“calendar-changed”
signalvoid user_function (MrpCalendar *calendar, gpointer user_data)
emitted when calendar
changes.
calendar |
the object which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last