"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/modules/calendar/e-cal-shell-content.c" between
evolution-3.32.4.tar.xz and evolution-3.34.0.tar.xz

About: Evolution is a personal information management application that provides integrated mail, calendaring and address book functionality (GNOME desktop).

e-cal-shell-content.c  (evolution-3.32.4.tar.xz):e-cal-shell-content.c  (evolution-3.34.0.tar.xz)
skipping to change at line 73 skipping to change at line 73
ECalViewKind current_view; ECalViewKind current_view;
ECalendarView *views[E_CAL_VIEW_KIND_LAST]; ECalendarView *views[E_CAL_VIEW_KIND_LAST];
GDate view_start, view_end; GDate view_start, view_end;
guint32 view_start_range_day_offset; guint32 view_start_range_day_offset;
GDate last_range_start; /* because "date-range-changed" can be emit with no real change */ GDate last_range_start; /* because "date-range-changed" can be emit with no real change */
time_t previous_selected_start_time; time_t previous_selected_start_time;
time_t previous_selected_end_time; time_t previous_selected_end_time;
gulong current_view_id_changed_id; gulong current_view_id_changed_id;
gboolean initialized;
}; };
enum { enum {
PROP_0, PROP_0,
PROP_CALENDAR_NOTEBOOK, PROP_CALENDAR_NOTEBOOK,
PROP_MEMO_TABLE, PROP_MEMO_TABLE,
PROP_TASK_TABLE, PROP_TASK_TABLE,
PROP_CURRENT_VIEW_ID, PROP_CURRENT_VIEW_ID,
PROP_CURRENT_VIEW PROP_CURRENT_VIEW
}; };
skipping to change at line 96 skipping to change at line 98
FOCUS_CALENDAR_NOTEBOOK, FOCUS_CALENDAR_NOTEBOOK,
FOCUS_MEMO_TABLE, FOCUS_MEMO_TABLE,
FOCUS_TASK_TABLE, FOCUS_TASK_TABLE,
FOCUS_OTHER FOCUS_OTHER
} FocusLocation; } FocusLocation;
G_DEFINE_DYNAMIC_TYPE (ECalShellContent, e_cal_shell_content, E_TYPE_CAL_BASE_SH ELL_CONTENT) G_DEFINE_DYNAMIC_TYPE (ECalShellContent, e_cal_shell_content, E_TYPE_CAL_BASE_SH ELL_CONTENT)
static time_t static time_t
convert_to_local_zone (time_t tm, convert_to_local_zone (time_t tm,
icaltimezone *from_zone) ICalTimezone *from_zone)
{ {
struct icaltimetype tt; ICalTime *itt;
time_t tt;
itt = i_cal_time_new_from_timet_with_zone (tm, FALSE, from_zone);
tt = i_cal_time_as_timet (itt);
g_clear_object (&itt);
tt = icaltime_from_timet_with_zone (tm, FALSE, from_zone); return tt;
return icaltime_as_timet (tt);
} }
static void static void
cal_shell_content_update_model_and_current_view_times (ECalShellContent *cal_she ll_content, cal_shell_content_update_model_and_current_view_times (ECalShellContent *cal_she ll_content,
ECalModel *model, ECalModel *model,
ECalendarItem *calitem, ECalendarItem *calitem,
time_t view_start_tt, time_t view_start_tt,
time_t view_end_tt, time_t view_end_tt,
const GDate *view_start, const GDate *view_start,
const GDate *view_end) const GDate *view_end)
{ {
ECalendarView *current_view; ECalendarView *current_view;
EDayView *day_view = NULL; EDayView *day_view = NULL;
gint day_view_selection_start_day = -1, day_view_selection_end_day = -1; gint day_view_selection_start_day = -1, day_view_selection_end_day = -1;
gint day_view_selection_start_row = -1, day_view_selection_end_row = -1; gint day_view_selection_start_row = -1, day_view_selection_end_row = -1;
gdouble day_view_scrollbar_position = 0.0; gdouble day_view_scrollbar_position = 0.0;
gint syy, smm, sdd, eyy, emm, edd; gint syy, smm, sdd, eyy, emm, edd;
time_t visible_range_start, visible_range_end; time_t visible_range_start, visible_range_end;
gboolean filters_updated = FALSE; gboolean filters_updated = FALSE;
icaltimezone *zone; ICalTimezone *zone;
gchar *cal_filter; gchar *cal_filter;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content)); g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
g_return_if_fail (E_IS_CAL_MODEL (model)); g_return_if_fail (E_IS_CAL_MODEL (model));
g_return_if_fail (E_IS_CALENDAR_ITEM (calitem)); g_return_if_fail (E_IS_CALENDAR_ITEM (calitem));
current_view = e_cal_shell_content_get_current_calendar_view (cal_shell_c ontent); current_view = e_cal_shell_content_get_current_calendar_view (cal_shell_c ontent);
g_return_if_fail (current_view != NULL); g_return_if_fail (current_view != NULL);
zone = e_cal_model_get_timezone (model); zone = e_cal_model_get_timezone (model);
skipping to change at line 232 skipping to change at line 238
e_cal_shell_content_change_view (ECalShellContent *cal_shell_content, e_cal_shell_content_change_view (ECalShellContent *cal_shell_content,
ECalViewKind to_view, ECalViewKind to_view,
const GDate *view_start, const GDate *view_start,
const GDate *view_end, const GDate *view_end,
gboolean force_change) gboolean force_change)
{ {
EShellSidebar *shell_sidebar; EShellSidebar *shell_sidebar;
EShellView *shell_view; EShellView *shell_view;
ECalendar *calendar; ECalendar *calendar;
ECalModel *model; ECalModel *model;
icaltimezone *zone; ICalTimezone *zone;
time_t view_start_tt, view_end_tt; time_t view_start_tt, view_end_tt;
gboolean view_changed = FALSE; gboolean view_changed = FALSE;
gint selected_days; gint selected_days;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content)); g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
g_return_if_fail (to_view >= E_CAL_VIEW_KIND_DAY && to_view < E_CAL_VIEW_ KIND_LAST); g_return_if_fail (to_view >= E_CAL_VIEW_KIND_DAY && to_view < E_CAL_VIEW_ KIND_LAST);
g_return_if_fail (view_start != NULL); g_return_if_fail (view_start != NULL);
g_return_if_fail (g_date_valid (view_start)); g_return_if_fail (g_date_valid (view_start));
g_return_if_fail (view_end != NULL); g_return_if_fail (view_end != NULL);
g_return_if_fail (g_date_valid (view_end)); g_return_if_fail (g_date_valid (view_end));
skipping to change at line 377 skipping to change at line 383
start_wday = e_weekday_get_next (start_wday); start_wday = e_weekday_get_next (start_wday);
} }
return FALSE; return FALSE;
} }
static void static void
cal_shell_content_change_selection_in_current_view (ECalShellContent *cal_shell_ content, cal_shell_content_change_selection_in_current_view (ECalShellContent *cal_shell_ content,
time_t sel_start_tt, time_t sel_start_tt,
time_t sel_end_tt, time_t sel_end_tt,
icaltimezone *zone) ICalTimezone *zone)
{ {
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content)); g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
if (cal_shell_content->priv->current_view >= E_CAL_VIEW_KIND_DAY && if (cal_shell_content->priv->current_view >= E_CAL_VIEW_KIND_DAY &&
cal_shell_content->priv->current_view < E_CAL_VIEW_KIND_LAST) { cal_shell_content->priv->current_view < E_CAL_VIEW_KIND_LAST) {
ECalendarView *view; ECalendarView *view;
view = cal_shell_content->priv->views[cal_shell_content->priv->cu rrent_view]; view = cal_shell_content->priv->views[cal_shell_content->priv->cu rrent_view];
/* Preserve selected time (change only date) for these views */ /* Preserve selected time (change only date) for these views */
if (cal_shell_content->priv->current_view == E_CAL_VIEW_KIND_DAY || if (cal_shell_content->priv->current_view == E_CAL_VIEW_KIND_DAY ||
cal_shell_content->priv->current_view == E_CAL_VIEW_KIND_WORK WEEK) { cal_shell_content->priv->current_view == E_CAL_VIEW_KIND_WORK WEEK) {
time_t current_sel_start = (time_t) -1, current_sel_end = (time_t) -1; time_t current_sel_start = (time_t) -1, current_sel_end = (time_t) -1;
if (e_calendar_view_get_selected_time_range (view, &curre nt_sel_start, &current_sel_end)) { if (e_calendar_view_get_selected_time_range (view, &curre nt_sel_start, &current_sel_end)) {
current_sel_start = icaltime_as_timet_with_zone ( ICalTime *itt;
icaltime_from_timet_with_zone (current_sel_start, 0, zone), NULL);
current_sel_end = icaltime_as_timet_with_zone (ic itt = i_cal_time_new_from_timet_with_zone (curren
altime_from_timet_with_zone (current_sel_end, 0, zone), NULL); t_sel_start, 0, zone);
current_sel_start = i_cal_time_as_timet_with_zone
(itt, NULL);
g_clear_object (&itt);
itt = i_cal_time_new_from_timet_with_zone (curren
t_sel_end, 0, zone);
current_sel_end = i_cal_time_as_timet_with_zone (
itt, NULL);
g_clear_object (&itt);
sel_start_tt += current_sel_start % (24 * 60 * 60 ); sel_start_tt += current_sel_start % (24 * 60 * 60 );
sel_end_tt += current_sel_end % (24 * 60 * 60); sel_end_tt += current_sel_end % (24 * 60 * 60);
} }
} }
e_calendar_view_set_selected_time_range (view, sel_start_tt, sel_ end_tt); e_calendar_view_set_selected_time_range (view, sel_start_tt, sel_ end_tt);
} }
} }
static void static void
cal_shell_content_datepicker_selection_changed_cb (ECalendarItem *calitem, cal_shell_content_datepicker_selection_changed_cb (ECalendarItem *calitem,
ECalShellContent *cal_shell_co ntent) ECalShellContent *cal_shell_co ntent)
{ {
GDate sel_start, sel_end; GDate sel_start, sel_end;
guint32 selected_days, start_julian, end_julian; guint32 selected_days, start_julian, end_julian;
icaltimezone *zone; ICalTimezone *zone;
time_t sel_start_tt, sel_end_tt; time_t sel_start_tt, sel_end_tt;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content)); g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
g_return_if_fail (E_IS_CALENDAR_ITEM (calitem)); g_return_if_fail (E_IS_CALENDAR_ITEM (calitem));
g_date_clear (&sel_start, 1); g_date_clear (&sel_start, 1);
g_date_clear (&sel_end, 1); g_date_clear (&sel_end, 1);
e_calendar_item_get_selection (calitem, &sel_start, &sel_end); if (!e_calendar_item_get_selection (calitem, &sel_start, &sel_end))
return;
start_julian = g_date_get_julian (&sel_start); start_julian = g_date_get_julian (&sel_start);
end_julian = g_date_get_julian (&sel_end); end_julian = g_date_get_julian (&sel_end);
g_return_if_fail (start_julian <= end_julian); g_return_if_fail (start_julian <= end_julian);
if (g_date_compare (&cal_shell_content->priv->view_start, &sel_start) == 0 && if (g_date_compare (&cal_shell_content->priv->view_start, &sel_start) == 0 &&
g_date_compare (&cal_shell_content->priv->view_end, &sel_end) == 0) { g_date_compare (&cal_shell_content->priv->view_end, &sel_end) == 0) {
/* No change in the selection range */ /* No change in the selection range */
return; return;
skipping to change at line 614 skipping to change at line 628
/* Do that only if the double-click was above a day cell */ /* Do that only if the double-click was above a day cell */
if (!gdk_event_get_coords (event, &xwin, &ywin) || if (!gdk_event_get_coords (event, &xwin, &ywin) ||
!e_calendar_item_convert_position_to_date (calitem, xwin, ywi n, &sel_start)) { !e_calendar_item_convert_position_to_date (calitem, xwin, ywi n, &sel_start)) {
return FALSE; return FALSE;
} }
g_date_clear (&sel_start, 1); g_date_clear (&sel_start, 1);
g_date_clear (&sel_end, 1); g_date_clear (&sel_end, 1);
e_calendar_item_get_selection (calitem, &sel_start, &sel_end); if (!e_calendar_item_get_selection (calitem, &sel_start, &sel_end
))
return FALSE;
/* Switch to a day view on a double-click */ /* Switch to a day view on a double-click */
e_cal_shell_content_change_view (cal_shell_content, E_CAL_VIEW_KI ND_DAY, &sel_start, &sel_start, FALSE); e_cal_shell_content_change_view (cal_shell_content, E_CAL_VIEW_KI ND_DAY, &sel_start, &sel_start, FALSE);
} }
return FALSE; return FALSE;
} }
static void static void
cal_shell_content_current_view_id_changed_cb (ECalShellContent *cal_shell_conten t) cal_shell_content_current_view_id_changed_cb (ECalShellContent *cal_shell_conten t)
skipping to change at line 639 skipping to change at line 654
gint ii; gint ii;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content)); g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
model = e_cal_base_shell_content_get_model (E_CAL_BASE_SHELL_CONTENT (cal _shell_content)); model = e_cal_base_shell_content_get_model (E_CAL_BASE_SHELL_CONTENT (cal _shell_content));
work_day_first = e_cal_model_get_work_day_first (model); work_day_first = e_cal_model_get_work_day_first (model);
week_start_day = e_cal_model_get_week_start_day (model); week_start_day = e_cal_model_get_week_start_day (model);
if (cal_shell_content->priv->previous_selected_start_time != -1 && if (cal_shell_content->priv->previous_selected_start_time != -1 &&
cal_shell_content->priv->previous_selected_end_time != -1) { cal_shell_content->priv->previous_selected_end_time != -1) {
icaltimezone *zone; ICalTimezone *zone;
zone = e_cal_model_get_timezone (model); zone = e_cal_model_get_timezone (model);
time_to_gdate_with_zone (&sel_start, cal_shell_content->priv->pre vious_selected_start_time, zone); time_to_gdate_with_zone (&sel_start, cal_shell_content->priv->pre vious_selected_start_time, zone);
time_to_gdate_with_zone (&sel_end, cal_shell_content->priv->previ ous_selected_end_time, zone); time_to_gdate_with_zone (&sel_end, cal_shell_content->priv->previ ous_selected_end_time, zone);
} else { } else {
sel_start = cal_shell_content->priv->view_start; sel_start = cal_shell_content->priv->view_start;
sel_end = cal_shell_content->priv->view_end; sel_end = cal_shell_content->priv->view_end;
} }
switch (cal_shell_content->priv->current_view) { switch (cal_shell_content->priv->current_view) {
skipping to change at line 725 skipping to change at line 740
gal_view_type = G_OBJECT_TYPE (gal_view); gal_view_type = G_OBJECT_TYPE (gal_view);
if (gal_view_type == GAL_TYPE_VIEW_ETABLE) { if (gal_view_type == GAL_TYPE_VIEW_ETABLE) {
ECalendarView *calendar_view; ECalendarView *calendar_view;
view_kind = E_CAL_VIEW_KIND_LIST; view_kind = E_CAL_VIEW_KIND_LIST;
calendar_view = cal_shell_content->priv->views[view_kind]; calendar_view = cal_shell_content->priv->views[view_kind];
gal_view_etable_attach_table ( gal_view_etable_attach_table (
GAL_VIEW_ETABLE (gal_view), GAL_VIEW_ETABLE (gal_view),
E_CAL_LIST_VIEW (calendar_view)->table); e_cal_list_view_get_table (E_CAL_LIST_VIEW (calendar_view )));
} else if (gal_view_type == GAL_TYPE_VIEW_CALENDAR_DAY) { } else if (gal_view_type == GAL_TYPE_VIEW_CALENDAR_DAY) {
view_kind = E_CAL_VIEW_KIND_DAY; view_kind = E_CAL_VIEW_KIND_DAY;
} else if (gal_view_type == GAL_TYPE_VIEW_CALENDAR_WORK_WEEK) { } else if (gal_view_type == GAL_TYPE_VIEW_CALENDAR_WORK_WEEK) {
view_kind = E_CAL_VIEW_KIND_WORKWEEK; view_kind = E_CAL_VIEW_KIND_WORKWEEK;
} else if (gal_view_type == GAL_TYPE_VIEW_CALENDAR_WEEK) { } else if (gal_view_type == GAL_TYPE_VIEW_CALENDAR_WEEK) {
view_kind = E_CAL_VIEW_KIND_WEEK; view_kind = E_CAL_VIEW_KIND_WEEK;
skipping to change at line 855 skipping to change at line 870
{ {
gchar *filename; gchar *filename;
filename = cal_shell_content_get_pad_state_filename (shell_content, table ); filename = cal_shell_content_get_pad_state_filename (shell_content, table );
g_return_if_fail (filename != NULL); g_return_if_fail (filename != NULL);
e_table_load_state (table, filename); e_table_load_state (table, filename);
g_free (filename); g_free (filename);
} }
static icalproperty * static ICalProperty *
cal_shell_content_get_attendee_prop (icalcomponent *icalcomp, cal_shell_content_get_attendee_prop (ICalComponent *icomp,
const gchar *address) const gchar *address)
{ {
icalproperty *prop; ICalProperty *prop;
if (address == NULL || *address == '\0') if (address == NULL || *address == '\0')
return NULL; return NULL;
prop = icalcomponent_get_first_property ( for (prop = i_cal_component_get_first_property (icomp, I_CAL_ATTENDEE_PRO
icalcomp, ICAL_ATTENDEE_PROPERTY); PERTY);
prop;
while (prop != NULL) { g_object_unref (prop), prop = i_cal_component_get_next_property (ico
mp, I_CAL_ATTENDEE_PROPERTY)) {
const gchar *attendee; const gchar *attendee;
attendee = itip_strip_mailto (icalproperty_get_attendee (prop)); attendee = itip_strip_mailto (i_cal_property_get_attendee (prop)) ;
if (attendee && g_ascii_strcasecmp (attendee, address) == 0) if (attendee && g_ascii_strcasecmp (attendee, address) == 0)
return prop; return prop;
prop = icalcomponent_get_next_property (
icalcomp, ICAL_ATTENDEE_PROPERTY);
} }
return NULL; return NULL;
} }
static gboolean static gboolean
cal_shell_content_icalcomp_is_delegated (icalcomponent *icalcomp, cal_shell_content_icomp_is_delegated (ICalComponent *icomp,
const gchar *user_email) const gchar *user_email)
{ {
icalproperty *prop; ICalProperty *prop;
icalparameter *param; ICalParameter *param;
const gchar *delto = NULL; gchar *delto = NULL;
gboolean is_delegated = FALSE; gboolean is_delegated = FALSE;
prop = cal_shell_content_get_attendee_prop (icalcomp, user_email); prop = cal_shell_content_get_attendee_prop (icomp, user_email);
if (prop != NULL) { if (prop) {
param = icalproperty_get_first_parameter ( param = i_cal_property_get_first_parameter (prop, I_CAL_DELEGATED
prop, ICAL_DELEGATEDTO_PARAMETER); TO_PARAMETER);
if (param != NULL) { if (param) {
delto = icalparameter_get_delegatedto (param); delto = g_strdup (itip_strip_mailto (i_cal_parameter_get_
delto = itip_strip_mailto (delto); delegatedto (param)));
g_object_unref (param);
} }
g_object_unref (prop);
} else } else
return FALSE; return FALSE;
prop = cal_shell_content_get_attendee_prop (icalcomp, delto); prop = cal_shell_content_get_attendee_prop (icomp, delto);
if (prop) {
gchar *delfrom = NULL;
ICalParameterPartstat partstat = I_CAL_PARTSTAT_NONE;
param = i_cal_property_get_first_parameter (prop, I_CAL_DELEGATED
FROM_PARAMETER);
if (param) {
delfrom = g_strdup (itip_strip_mailto (i_cal_parameter_ge
t_delegatedfrom (param)));
g_object_unref (param);
}
if (prop != NULL) { param = i_cal_property_get_first_parameter (prop, I_CAL_PARTSTAT_
const gchar *delfrom = NULL; PARAMETER);
icalparameter_partstat status = ICAL_PARTSTAT_NONE; if (param) {
partstat = i_cal_parameter_get_partstat (param);
param = icalproperty_get_first_parameter ( g_object_unref (param);
prop, ICAL_DELEGATEDFROM_PARAMETER);
if (param != NULL) {
delfrom = icalparameter_get_delegatedfrom (param);
delfrom = itip_strip_mailto (delfrom);
} }
param = icalproperty_get_first_parameter (
prop, ICAL_PARTSTAT_PARAMETER); is_delegated = delfrom && user_email &&
if (param != NULL) partstat != I_CAL_PARTSTAT_DECLINED &&
status = icalparameter_get_partstat (param); g_ascii_strcasecmp (delfrom, user_email) == 0;
is_delegated =
(status != ICAL_PARTSTAT_DECLINED) && g_object_unref (prop);
(g_strcmp0 (delfrom, user_email) == 0); g_free (delfrom);
} }
g_free (delto);
return is_delegated; return is_delegated;
} }
static guint32 static guint32
cal_shell_content_check_state (EShellContent *shell_content) cal_shell_content_check_state (EShellContent *shell_content)
{ {
EShell *shell; EShell *shell;
EShellView *shell_view; EShellView *shell_view;
EShellBackend *shell_backend; EShellBackend *shell_backend;
ESourceRegistry *registry; ESourceRegistry *registry;
skipping to change at line 969 skipping to change at line 988
/* If we have a selection, assume it's /* If we have a selection, assume it's
* editable until we learn otherwise. */ * editable until we learn otherwise. */
if (n_selected > 0) if (n_selected > 0)
selection_is_editable = TRUE; selection_is_editable = TRUE;
for (link = selected; link != NULL; link = g_list_next (link)) { for (link = selected; link != NULL; link = g_list_next (link)) {
ECalendarViewEvent *event = link->data; ECalendarViewEvent *event = link->data;
ECalClient *client; ECalClient *client;
ECalComponent *comp; ECalComponent *comp;
gchar *user_email; gchar *user_email;
icalcomponent *icalcomp; ICalComponent *icomp;
const gchar *capability; const gchar *capability;
gboolean cap_delegate_supported; gboolean cap_delegate_supported;
gboolean cap_delegate_to_many; gboolean cap_delegate_to_many;
gboolean icalcomp_is_delegated; gboolean icomp_is_delegated;
gboolean read_only; gboolean read_only;
if (!is_comp_data_valid (event)) if (!is_comp_data_valid (event))
continue; continue;
client = event->comp_data->client; client = event->comp_data->client;
icalcomp = event->comp_data->icalcomp; icomp = event->comp_data->icalcomp;
read_only = e_client_is_readonly (E_CLIENT (client)); read_only = e_client_is_readonly (E_CLIENT (client));
selection_is_editable &= !read_only; selection_is_editable &= !read_only;
selection_is_instance |= selection_is_instance |=
e_cal_util_component_is_instance (icalcomp); e_cal_util_component_is_instance (icomp);
selection_is_meeting = selection_is_meeting =
(n_selected == 1) && (n_selected == 1) &&
e_cal_util_component_has_attendee (icalcomp); e_cal_util_component_has_attendee (icomp);
selection_is_recurring |= selection_is_recurring |=
e_cal_util_component_is_instance (icalcomp) || e_cal_util_component_is_instance (icomp) ||
e_cal_util_component_has_recurrences (icalcomp); e_cal_util_component_has_recurrences (icomp);
/* XXX The rest of this is rather expensive and /* XXX The rest of this is rather expensive and
* only applies if a single event is selected, * only applies if a single event is selected,
* so continue with the loop iteration if the * so continue with the loop iteration if the
* rest of this is not applicable. */ * rest of this is not applicable. */
if (n_selected > 1) if (n_selected > 1)
continue; continue;
/* XXX This probably belongs in comp-util.c. */ /* XXX This probably belongs in comp-util.c. */
comp = e_cal_component_new (); comp = e_cal_component_new_from_icalcomponent (i_cal_component_cl
e_cal_component_set_icalcomponent ( one (icomp));
comp, icalcomponent_new_clone (icalcomp)); user_email = itip_get_comp_attendee (registry, comp, client);
user_email = itip_get_comp_attendee (
registry, comp, client);
selection_is_organizer = selection_is_organizer =
e_cal_util_component_has_organizer (icalcomp) && e_cal_util_component_has_organizer (icomp) &&
itip_organizer_is_user (registry, comp, client); itip_organizer_is_user (registry, comp, client);
capability = CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED; capability = E_CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED;
cap_delegate_supported = cap_delegate_supported =
e_client_check_capability ( e_client_check_capability (
E_CLIENT (client), capability); E_CLIENT (client), capability);
capability = CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY; capability = E_CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY;
cap_delegate_to_many = cap_delegate_to_many =
e_client_check_capability ( e_client_check_capability (
E_CLIENT (client), capability); E_CLIENT (client), capability);
icalcomp_is_delegated = icomp_is_delegated = user_email != NULL &&
(user_email != NULL) && cal_shell_content_icomp_is_delegated (icomp, user_email);
cal_shell_content_icalcomp_is_delegated (
icalcomp, user_email);
selection_can_delegate = selection_can_delegate =
cap_delegate_supported && cap_delegate_supported &&
(cap_delegate_to_many || (cap_delegate_to_many ||
(!selection_is_organizer && (!selection_is_organizer &&
!icalcomp_is_delegated)); !icomp_is_delegated));
g_free (user_email); g_free (user_email);
g_object_unref (comp); g_object_unref (comp);
} }
g_list_free (selected); g_list_free (selected);
if (n_selected == 1) if (n_selected == 1)
state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_SINGLE; state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_SINGLE;
if (n_selected > 1) if (n_selected > 1)
skipping to change at line 1077 skipping to change at line 1091
calendar_view = e_cal_shell_content_get_current_calendar_view (E_CAL_SHEL L_CONTENT (shell_content)); calendar_view = e_cal_shell_content_get_current_calendar_view (E_CAL_SHEL L_CONTENT (shell_content));
gtk_widget_grab_focus (GTK_WIDGET (calendar_view)); gtk_widget_grab_focus (GTK_WIDGET (calendar_view));
} }
static time_t static time_t
cal_shell_content_get_default_time (ECalModel *model, cal_shell_content_get_default_time (ECalModel *model,
gpointer user_data) gpointer user_data)
{ {
ECalShellContent *cal_shell_content = user_data; ECalShellContent *cal_shell_content = user_data;
icaltimezone *zone; ICalTimezone *zone;
ICalTime *itt;
time_t tt;
g_return_val_if_fail (model != NULL, 0); g_return_val_if_fail (model != NULL, 0);
g_return_val_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content), 0); g_return_val_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content), 0);
if (e_cal_shell_content_get_current_view_id (cal_shell_content) != E_CAL_ VIEW_KIND_LIST) { if (e_cal_shell_content_get_current_view_id (cal_shell_content) != E_CAL_ VIEW_KIND_LIST) {
ECalendarView *cal_view; ECalendarView *cal_view;
time_t selected_start = (time_t) 0, selected_end = (time_t) 0; time_t selected_start = (time_t) 0, selected_end = (time_t) 0;
cal_view = e_cal_shell_content_get_current_calendar_view (cal_she ll_content); cal_view = e_cal_shell_content_get_current_calendar_view (cal_she ll_content);
if (cal_view && e_calendar_view_get_selected_time_range (cal_view , &selected_start, &selected_end)) if (cal_view && e_calendar_view_get_selected_time_range (cal_view , &selected_start, &selected_end))
return selected_start; return selected_start;
} }
zone = e_cal_model_get_timezone (model); zone = e_cal_model_get_timezone (model);
itt = i_cal_time_new_current_with_zone (zone);
tt = i_cal_time_as_timet_with_zone (itt, zone);
g_clear_object (&itt);
return icaltime_as_timet_with_zone (icaltime_current_time_with_zone (zone ), zone); return tt;
} }
static void static void
update_adjustment (ECalShellContent *cal_shell_content, update_adjustment (ECalShellContent *cal_shell_content,
GtkAdjustment *adjustment, GtkAdjustment *adjustment,
EWeekView *week_view, EWeekView *week_view,
gboolean move_by_week) gboolean move_by_week)
{ {
GDate start_date, end_date; GDate start_date, end_date;
GDate first_day_shown; GDate first_day_shown;
ECalModel *model; ECalModel *model;
gint week_offset; gint week_offset;
struct icaltimetype start_tt = icaltime_null_time (); ICalTime *start_tt = NULL;
ICalTimezone *timezone;
time_t lower; time_t lower;
guint32 old_first_day_julian, new_first_day_julian; guint32 old_first_day_julian, new_first_day_julian;
icaltimezone *timezone;
gdouble value; gdouble value;
e_week_view_get_first_day_shown (week_view, &first_day_shown); e_week_view_get_first_day_shown (week_view, &first_day_shown);
/* If we don't have a valid date set yet, just return. */ /* If we don't have a valid date set yet, just return. */
if (!g_date_valid (&first_day_shown)) if (!g_date_valid (&first_day_shown))
return; return;
value = gtk_adjustment_get_value (adjustment); value = gtk_adjustment_get_value (adjustment);
skipping to change at line 1139 skipping to change at line 1158
/* Convert the old & new first days shown to julian values. */ /* Convert the old & new first days shown to julian values. */
old_first_day_julian = g_date_get_julian (&first_day_shown); old_first_day_julian = g_date_get_julian (&first_day_shown);
new_first_day_julian = g_date_get_julian (&start_date); new_first_day_julian = g_date_get_julian (&start_date);
/* If we are already showing the date, just return. */ /* If we are already showing the date, just return. */
if (old_first_day_julian == new_first_day_julian) if (old_first_day_julian == new_first_day_julian)
return; return;
/* Convert it to a time_t. */ /* Convert it to a time_t. */
start_tt.year = g_date_get_year (&start_date); start_tt = i_cal_time_new_null_time ();
start_tt.month = g_date_get_month (&start_date); i_cal_time_set_date (start_tt,
start_tt.day = g_date_get_day (&start_date); g_date_get_year (&start_date),
g_date_get_month (&start_date),
g_date_get_day (&start_date));
model = e_cal_base_shell_content_get_model (E_CAL_BASE_SHELL_CONTENT (cal _shell_content)); model = e_cal_base_shell_content_get_model (E_CAL_BASE_SHELL_CONTENT (cal _shell_content));
timezone = e_cal_model_get_timezone (model); timezone = e_cal_model_get_timezone (model);
lower = icaltime_as_timet_with_zone (start_tt, timezone); lower = i_cal_time_as_timet_with_zone (start_tt, timezone);
g_clear_object (&start_tt);
end_date = start_date; end_date = start_date;
if (move_by_week) { if (move_by_week) {
g_date_add_days (&end_date, 7 - 1); g_date_add_days (&end_date, 7 - 1);
} else { } else {
g_date_add_days (&end_date, 7 * e_week_view_get_weeks_shown (week _view) - 1); g_date_add_days (&end_date, 7 * e_week_view_get_weeks_shown (week _view) - 1);
} }
e_week_view_set_update_base_date (week_view, FALSE); e_week_view_set_update_base_date (week_view, FALSE);
e_cal_shell_content_change_view (cal_shell_content, cal_shell_content->pr iv->current_view, &start_date, &end_date, FALSE); e_cal_shell_content_change_view (cal_shell_content, cal_shell_content->pr iv->current_view, &start_date, &end_date, FALSE);
skipping to change at line 1434 skipping to change at line 1456
model, "notify::work-day-saturday", model, "notify::work-day-saturday",
G_CALLBACK (cal_shell_content_notify_work_day_cb), cal_shell_cont ent); G_CALLBACK (cal_shell_content_notify_work_day_cb), cal_shell_cont ent);
e_signal_connect_notify ( e_signal_connect_notify (
model, "notify::work-day-sunday", model, "notify::work-day-sunday",
G_CALLBACK (cal_shell_content_notify_work_day_cb), cal_shell_cont ent); G_CALLBACK (cal_shell_content_notify_work_day_cb), cal_shell_cont ent);
e_signal_connect_notify ( e_signal_connect_notify (
model, "notify::week-start-day", model, "notify::week-start-day",
G_CALLBACK (cal_shell_content_notify_week_start_day_cb), cal_shel l_content); G_CALLBACK (cal_shell_content_notify_week_start_day_cb), cal_shel l_content);
cal_shell_content->priv->initialized = TRUE;
} }
static void static void
e_cal_shell_content_create_calendar_views (ECalShellContent *cal_shell_content) e_cal_shell_content_create_calendar_views (ECalShellContent *cal_shell_content)
{ {
EShellView *shell_view; EShellView *shell_view;
ECalModel *model; ECalModel *model;
ECalendarView *calendar_view; ECalendarView *calendar_view;
GtkAdjustment *adjustment; GtkAdjustment *adjustment;
time_t today; time_t today;
skipping to change at line 1903 skipping to change at line 1927
g_date_clear (&cal_shell_content->priv->view_end, 1); g_date_clear (&cal_shell_content->priv->view_end, 1);
g_date_clear (&cal_shell_content->priv->last_range_start, 1); g_date_clear (&cal_shell_content->priv->last_range_start, 1);
now = time (NULL); now = time (NULL);
g_date_set_time_t (&cal_shell_content->priv->view_start, now); g_date_set_time_t (&cal_shell_content->priv->view_start, now);
g_date_set_time_t (&cal_shell_content->priv->view_end, now); g_date_set_time_t (&cal_shell_content->priv->view_end, now);
cal_shell_content->priv->view_start_range_day_offset = (guint32) -1; cal_shell_content->priv->view_start_range_day_offset = (guint32) -1;
cal_shell_content->priv->previous_selected_start_time = -1; cal_shell_content->priv->previous_selected_start_time = -1;
cal_shell_content->priv->previous_selected_end_time = -1; cal_shell_content->priv->previous_selected_end_time = -1;
cal_shell_content->priv->initialized = FALSE;
} }
void void
e_cal_shell_content_type_register (GTypeModule *type_module) e_cal_shell_content_type_register (GTypeModule *type_module)
{ {
/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
* function, so we have to wrap it with a public function in * function, so we have to wrap it with a public function in
* order to register types from a separate compilation unit. */ * order to register types from a separate compilation unit. */
e_cal_shell_content_register_type (type_module); e_cal_shell_content_register_type (type_module);
} }
skipping to change at line 1924 skipping to change at line 1949
GtkWidget * GtkWidget *
e_cal_shell_content_new (EShellView *shell_view) e_cal_shell_content_new (EShellView *shell_view)
{ {
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
return g_object_new ( return g_object_new (
E_TYPE_CAL_SHELL_CONTENT, E_TYPE_CAL_SHELL_CONTENT,
"shell-view", shell_view, NULL); "shell-view", shell_view, NULL);
} }
gboolean
e_cal_shell_content_get_initialized (ECalShellContent *cal_shell_content)
{
g_return_val_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content), FALSE);
return cal_shell_content->priv->initialized;
}
GtkNotebook * GtkNotebook *
e_cal_shell_content_get_calendar_notebook (ECalShellContent *cal_shell_content) e_cal_shell_content_get_calendar_notebook (ECalShellContent *cal_shell_content)
{ {
g_return_val_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL); g_return_val_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
return GTK_NOTEBOOK (cal_shell_content->priv->calendar_notebook); return GTK_NOTEBOOK (cal_shell_content->priv->calendar_notebook);
} }
EMemoTable * EMemoTable *
e_cal_shell_content_get_memo_table (ECalShellContent *cal_shell_content) e_cal_shell_content_get_memo_table (ECalShellContent *cal_shell_content)
skipping to change at line 1978 skipping to change at line 2011
ECalDataModel *data_model; ECalDataModel *data_model;
ECalDataModelSubscriber *subscriber; ECalDataModelSubscriber *subscriber;
time_t range_start, range_end; time_t range_start, range_end;
gboolean is_tasks_or_memos; gboolean is_tasks_or_memos;
g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view)); g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
g_return_if_fail (E_IS_CAL_MODEL (model)); g_return_if_fail (E_IS_CAL_MODEL (model));
data_model = e_cal_model_get_data_model (model); data_model = e_cal_model_get_data_model (model);
subscriber = E_CAL_DATA_MODEL_SUBSCRIBER (model); subscriber = E_CAL_DATA_MODEL_SUBSCRIBER (model);
is_tasks_or_memos = e_cal_model_get_component_kind (model) == ICAL_VJOURN is_tasks_or_memos = e_cal_model_get_component_kind (model) == I_CAL_VJOUR
AL_COMPONENT || NAL_COMPONENT ||
e_cal_model_get_component_kind (model) == ICAL_VTODO_COMPONENT; e_cal_model_get_component_kind (model) == I_CAL_VTODO_COMPONENT;
if ((!is_tasks_or_memos && e_calendar_view_get_visible_time_range (cal_vi ew, &range_start, &range_end)) || if ((!is_tasks_or_memos && e_calendar_view_get_visible_time_range (cal_vi ew, &range_start, &range_end)) ||
e_cal_data_model_get_subscriber_range (data_model, subscriber, &range _start, &range_end)) { e_cal_data_model_get_subscriber_range (data_model, subscriber, &range _start, &range_end)) {
e_cal_data_model_unsubscribe (data_model, subscriber); e_cal_data_model_unsubscribe (data_model, subscriber);
e_cal_model_remove_all_objects (model); e_cal_model_remove_all_objects (model);
if (is_tasks_or_memos) if (is_tasks_or_memos)
e_cal_data_model_subscribe (data_model, subscriber, range _start, range_end); e_cal_data_model_subscribe (data_model, subscriber, range _start, range_end);
} }
} }
skipping to change at line 2012 skipping to change at line 2045
return; return;
if (cal_shell_content->priv->current_view >= E_CAL_VIEW_KIND_DAY && if (cal_shell_content->priv->current_view >= E_CAL_VIEW_KIND_DAY &&
cal_shell_content->priv->current_view < E_CAL_VIEW_KIND_LAST) { cal_shell_content->priv->current_view < E_CAL_VIEW_KIND_LAST) {
ECalendarView *cal_view = cal_shell_content->priv->views[cal_shel l_content->priv->current_view]; ECalendarView *cal_view = cal_shell_content->priv->views[cal_shel l_content->priv->current_view];
if (!e_calendar_view_get_selected_time_range (cal_view, &start_ti me, &end_time)) { if (!e_calendar_view_get_selected_time_range (cal_view, &start_ti me, &end_time)) {
start_time = -1; start_time = -1;
end_time = -1; end_time = -1;
} }
e_calendar_view_destroy_tooltip (cal_view);
} }
cal_shell_content->priv->previous_selected_start_time = start_time; cal_shell_content->priv->previous_selected_start_time = start_time;
cal_shell_content->priv->previous_selected_end_time = end_time; cal_shell_content->priv->previous_selected_end_time = end_time;
for (ii = 0; ii < E_CAL_VIEW_KIND_LAST; ii++) { for (ii = 0; ii < E_CAL_VIEW_KIND_LAST; ii++) {
ECalendarView *cal_view = cal_shell_content->priv->views[ii]; ECalendarView *cal_view = cal_shell_content->priv->views[ii];
gboolean in_focus = ii == view_kind; gboolean in_focus = ii == view_kind;
gboolean focus_changed; gboolean focus_changed;
skipping to change at line 2120 skipping to change at line 2155
cal_shell_content_save_table_state ( cal_shell_content_save_table_state (
E_SHELL_CONTENT (cal_shell_content), E_SHELL_CONTENT (cal_shell_content),
E_TABLE (priv->memo_table)); E_TABLE (priv->memo_table));
} }
void void
e_cal_shell_content_get_current_range (ECalShellContent *cal_shell_content, e_cal_shell_content_get_current_range (ECalShellContent *cal_shell_content,
time_t *range_start, time_t *range_start,
time_t *range_end) time_t *range_end)
{ {
icaltimezone *zone; ICalTimezone *zone;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content)); g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
g_return_if_fail (range_start != NULL); g_return_if_fail (range_start != NULL);
g_return_if_fail (range_end != NULL); g_return_if_fail (range_end != NULL);
zone = e_cal_data_model_get_timezone (e_cal_base_shell_content_get_data_m odel ( zone = e_cal_data_model_get_timezone (e_cal_base_shell_content_get_data_m odel (
E_CAL_BASE_SHELL_CONTENT (cal_shell_content))); E_CAL_BASE_SHELL_CONTENT (cal_shell_content)));
*range_start = cal_comp_gdate_to_timet (&(cal_shell_content->priv->view_s tart), zone); *range_start = cal_comp_gdate_to_timet (&(cal_shell_content->priv->view_s tart), zone);
*range_end = cal_comp_gdate_to_timet (&(cal_shell_content->priv->view_end ), zone); *range_end = cal_comp_gdate_to_timet (&(cal_shell_content->priv->view_end ), zone);
skipping to change at line 2208 skipping to change at line 2243
void void
e_cal_shell_content_move_view_range (ECalShellContent *cal_shell_content, e_cal_shell_content_move_view_range (ECalShellContent *cal_shell_content,
ECalendarViewMoveType move_type, ECalendarViewMoveType move_type,
time_t exact_date) time_t exact_date)
{ {
ECalendar *calendar; ECalendar *calendar;
ECalDataModel *data_model; ECalDataModel *data_model;
EShellSidebar *shell_sidebar; EShellSidebar *shell_sidebar;
EShellView *shell_view; EShellView *shell_view;
struct icaltimetype tt; ICalTime *tt;
icaltimezone *zone; ICalTimezone *zone;
GDate date; GDate date;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content)); g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
shell_view = e_shell_content_get_shell_view (E_SHELL_CONTENT (cal_shell_c ontent)); shell_view = e_shell_content_get_shell_view (E_SHELL_CONTENT (cal_shell_c ontent));
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
g_return_if_fail (E_IS_CAL_BASE_SHELL_SIDEBAR (shell_sidebar)); g_return_if_fail (E_IS_CAL_BASE_SHELL_SIDEBAR (shell_sidebar));
calendar = e_cal_base_shell_sidebar_get_date_navigator (E_CAL_BASE_SHELL_ SIDEBAR (shell_sidebar)); calendar = e_cal_base_shell_sidebar_get_date_navigator (E_CAL_BASE_SHELL_ SIDEBAR (shell_sidebar));
g_return_if_fail (E_IS_CALENDAR (calendar)); g_return_if_fail (E_IS_CALENDAR (calendar));
skipping to change at line 2233 skipping to change at line 2268
zone = e_cal_data_model_get_timezone (data_model); zone = e_cal_data_model_get_timezone (data_model);
switch (move_type) { switch (move_type) {
case E_CALENDAR_VIEW_MOVE_PREVIOUS: case E_CALENDAR_VIEW_MOVE_PREVIOUS:
cal_shell_content_move_view_range_relative (cal_shell_con tent, -1); cal_shell_content_move_view_range_relative (cal_shell_con tent, -1);
break; break;
case E_CALENDAR_VIEW_MOVE_NEXT: case E_CALENDAR_VIEW_MOVE_NEXT:
cal_shell_content_move_view_range_relative (cal_shell_con tent, +1); cal_shell_content_move_view_range_relative (cal_shell_con tent, +1);
break; break;
case E_CALENDAR_VIEW_MOVE_TO_TODAY: case E_CALENDAR_VIEW_MOVE_TO_TODAY:
tt = icaltime_current_time_with_zone (zone); tt = i_cal_time_new_current_with_zone (zone);
g_date_set_dmy (&date, tt.day, tt.month, tt.year); g_date_set_dmy (&date, i_cal_time_get_day (tt), i_cal_tim
e_get_month (tt), i_cal_time_get_year (tt));
g_clear_object (&tt);
/* one-day selection takes care of the view range move wi th left view kind */ /* one-day selection takes care of the view range move wi th left view kind */
e_calendar_item_set_selection (e_calendar_get_item (calen dar), &date, &date); e_calendar_item_set_selection (e_calendar_get_item (calen dar), &date, &date);
break; break;
case E_CALENDAR_VIEW_MOVE_TO_EXACT_DAY: case E_CALENDAR_VIEW_MOVE_TO_EXACT_DAY:
time_to_gdate_with_zone (&date, exact_date, zone); time_to_gdate_with_zone (&date, exact_date, zone);
e_cal_shell_content_change_view (cal_shell_content, E_CAL _VIEW_KIND_DAY, &date, &date, FALSE); e_cal_shell_content_change_view (cal_shell_content, E_CAL _VIEW_KIND_DAY, &date, &date, FALSE);
break; break;
} }
} }
skipping to change at line 2359 skipping to change at line 2395
if (cal_shell_content->priv->memo_table) { if (cal_shell_content->priv->memo_table) {
EMemoTable *memo_table; EMemoTable *memo_table;
/* Set the query on the memo pad. */ /* Set the query on the memo pad. */
memo_table = E_MEMO_TABLE (cal_shell_content->priv->memo_table); memo_table = E_MEMO_TABLE (cal_shell_content->priv->memo_table);
model = e_memo_table_get_model (memo_table); model = e_memo_table_get_model (memo_table);
data_model = e_cal_model_get_data_model (model); data_model = e_cal_model_get_data_model (model);
if (start_range != 0 && end_range != 0) { if (start_range != 0 && end_range != 0) {
icaltimezone *zone; ICalTimezone *zone;
const gchar *default_tzloc = NULL; const gchar *default_tzloc = NULL;
time_t end = end_range; time_t end = end_range;
gchar *filter; gchar *filter;
gchar *iso_start; gchar *iso_start;
gchar *iso_end; gchar *iso_end;
zone = e_cal_data_model_get_timezone (data_model); zone = e_cal_data_model_get_timezone (data_model);
if (zone && zone != icaltimezone_get_utc_timezone ()) if (zone && zone != i_cal_timezone_get_utc_timezone ())
default_tzloc = icaltimezone_get_location (zone); default_tzloc = i_cal_timezone_get_location (zone
);
if (!default_tzloc) if (!default_tzloc)
default_tzloc = ""; default_tzloc = "";
if (start_range != (time_t) 0 && end_range != (time_t) 0) { if (start_range != (time_t) 0 && end_range != (time_t) 0) {
end = time_day_end_with_zone (end_range, zone); end = time_day_end_with_zone (end_range, zone);
} }
iso_start = isodate_from_time_t (start_range); iso_start = isodate_from_time_t (start_range);
iso_end = isodate_from_time_t (end); iso_end = isodate_from_time_t (end);
 End of changes. 56 change blocks. 
95 lines changed or deleted 144 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)