From 51857b1153f08c6fb2dd3fbd4d36e63aeac385bb Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 6 Sep 2000 10:42:49 +0000 Subject: Use new cal_component_has_recurrences convenience function 2000-09-06 JP Rosevear * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): Use new cal_component_has_recurrences convenience function * gui/e-week-view.c (e_week_view_show_popup_menu): ditto * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons): ditto * gui/calendar-model.c (calendar_model_value_at): ditto (calendar_model_value_at): ditto * gui/e-day-view.c (e_day_view_on_event_click): ditto (e_day_view_on_event_right_click): ditto (e_day_view_on_top_canvas_motion): ditto (e_day_view_on_top_canvas_motion): ditto (e_day_view_on_main_canvas_motion): ditto (e_day_view_on_main_canvas_motion): ditto (e_day_view_reshape_day_event): ditto * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): ditto * gui/e-day-view.c (e_day_view_on_long_event_click): ditto svn path=/trunk/; revision=5220 --- calendar/gui/calendar-model.c | 11 ++-------- calendar/gui/e-day-view-main-item.c | 3 +-- calendar/gui/e-day-view-top-item.c | 3 +-- calendar/gui/e-day-view.c | 38 +++++++++++++++-------------------- calendar/gui/e-week-view-event-item.c | 3 +-- calendar/gui/e-week-view.c | 3 +-- 6 files changed, 22 insertions(+), 39 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c index 51f2c28a35..9abfded4a2 100644 --- a/calendar/gui/calendar-model.c +++ b/calendar/gui/calendar-model.c @@ -536,13 +536,6 @@ get_has_alarms (CalComponent *comp) return retval; } -/* Returns whether the component has any recurrences defined for it */ -static gboolean -get_has_recurrences (CalComponent *comp) -{ - return cal_component_has_rdates (comp) || cal_component_has_rrules (comp); -} - /* Returns whether the completion date has been set on a component */ static gboolean get_is_complete (CalComponent *comp) @@ -674,7 +667,7 @@ calendar_model_value_at (ETableModel *etm, int col, int row) case CAL_COMPONENT_FIELD_ICON: /* FIXME: Also support 'Assigned to me' & 'Assigned to someone else'. */ - if (get_has_recurrences (comp)) + if (cal_component_has_recurrences (comp)) return GINT_TO_POINTER (1); else return GINT_TO_POINTER (0); @@ -683,7 +676,7 @@ calendar_model_value_at (ETableModel *etm, int col, int row) return GINT_TO_POINTER (get_is_complete (comp)); case CAL_COMPONENT_FIELD_RECURRING: - return GINT_TO_POINTER (get_has_recurrences (comp)); + return GINT_TO_POINTER (cal_component_has_recurrences (comp)); case CAL_COMPONENT_FIELD_OVERDUE: return GINT_TO_POINTER (get_is_overdue (comp)); diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 7b2449b7bf..304a07854e 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -571,8 +571,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, } #endif - if (cal_component_has_rrules (comp) - || cal_component_has_rdates (comp)) { + if (cal_component_has_recurrences (comp)) { draw_recurrence_icon = TRUE; num_icons++; } diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c index 88e30885ca..b6b8a565b5 100644 --- a/calendar/gui/e-day-view-top-item.c +++ b/calendar/gui/e-day-view-top-item.c @@ -430,8 +430,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, icon_x = text_x - icon_x_inc - x; icon_y = item_y + 1 + E_DAY_VIEW_ICON_Y_PAD - y; - if (cal_component_has_rrules (comp) - || cal_component_has_rdates (comp)) { + if (cal_component_has_recurrences (comp)) { gdk_gc_set_clip_origin (gc, icon_x, icon_y); gdk_gc_set_clip_mask (gc, day_view->recurrence_mask); gdk_draw_pixmap (drawable, gc, diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 9e6db8151f..f1a8af615a 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -2277,8 +2277,7 @@ e_day_view_on_long_event_click (EDayView *day_view, && E_TEXT (event->canvas_item)->editing) return; - if (!(cal_component_has_rrules (event->comp) - && cal_component_has_rdates (event->comp)) + if (!(cal_component_has_recurrences (event->comp)) && (pos == E_DAY_VIEW_POS_LEFT_EDGE || pos == E_DAY_VIEW_POS_RIGHT_EDGE)) { if (!e_day_view_find_long_event_days (day_view, event, @@ -2350,8 +2349,7 @@ e_day_view_on_event_click (EDayView *day_view, && E_TEXT (event->canvas_item)->editing) return; - if (!(cal_component_has_rrules (event->comp) - && cal_component_has_rdates (event->comp)) + if (!(cal_component_has_recurrences (event->comp)) && (pos == E_DAY_VIEW_POS_TOP_EDGE || pos == E_DAY_VIEW_POS_BOTTOM_EDGE)) { /* Grab the keyboard focus, so the event being edited is saved @@ -2546,8 +2544,7 @@ e_day_view_on_event_right_click (EDayView *day_view, We could possibly set up another method of checking it. */ not_being_edited = TRUE; - if (cal_component_has_rrules (event->comp) - || cal_component_has_rdates (event->comp)) { + if (cal_component_has_recurrences (event->comp)) { items = 6; context_menu = &recur_child_items[0]; context_menu[0].sensitive = not_being_edited; @@ -2862,10 +2859,11 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget, event = &g_array_index (day_view->long_events, EDayViewEvent, day_view->pressed_event_num); - if (!(cal_component_has_rdates (event->comp) - && cal_component_has_rrules (event->comp)) - && (abs (canvas_x - day_view->drag_event_x) > E_DAY_VIEW_DRAG_START_OFFSET - || abs (canvas_y - day_view->drag_event_y) > E_DAY_VIEW_DRAG_START_OFFSET)) { + if (!(cal_component_has_recurrences (event->comp)) + && (abs (canvas_x - day_view->drag_event_x) + > E_DAY_VIEW_DRAG_START_OFFSET + || abs (canvas_y - day_view->drag_event_y) + > E_DAY_VIEW_DRAG_START_OFFSET)) { day_view->drag_event_day = day_view->pressed_event_day; day_view->drag_event_num = day_view->pressed_event_num; day_view->pressed_event_day = -1; @@ -2889,9 +2887,7 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget, cursor = day_view->normal_cursor; /* Recurring events can't be resized. */ - if (event && - !(cal_component_has_rrules (event->comp) - && cal_component_has_rdates (event->comp))) { + if (event && !cal_component_has_recurrences (event->comp)) { switch (pos) { case E_DAY_VIEW_POS_LEFT_EDGE: case E_DAY_VIEW_POS_RIGHT_EDGE: @@ -2969,10 +2965,11 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget, event = &g_array_index (day_view->events[day_view->pressed_event_day], EDayViewEvent, day_view->pressed_event_num); - if (!(cal_component_has_rrules (event->comp) - && cal_component_has_rdates (event->comp)) - && (abs (canvas_x - day_view->drag_event_x) > E_DAY_VIEW_DRAG_START_OFFSET - || abs (canvas_y - day_view->drag_event_y) > E_DAY_VIEW_DRAG_START_OFFSET)) { + if (!cal_component_has_recurrences (event->comp) + && (abs (canvas_x - day_view->drag_event_x) + > E_DAY_VIEW_DRAG_START_OFFSET + || abs (canvas_y - day_view->drag_event_y) + > E_DAY_VIEW_DRAG_START_OFFSET)) { day_view->drag_event_day = day_view->pressed_event_day; day_view->drag_event_num = day_view->pressed_event_num; day_view->pressed_event_day = -1; @@ -2996,9 +2993,7 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget, cursor = day_view->normal_cursor; /* Recurring events can't be resized. */ - if (event && - !(cal_component_has_rrules (event->comp) - && cal_component_has_rdates (event->comp))) { + if (event && !cal_component_has_recurrences (event->comp)) { switch (pos) { case E_DAY_VIEW_POS_LEFT_EDGE: cursor = day_view->move_cursor; @@ -4078,8 +4073,7 @@ e_day_view_reshape_day_event (EDayView *day_view, || ico->palarm.enabled || ico->aalarm.enabled) num_icons++; #endif - if (cal_component_has_rrules (comp) - || cal_component_has_rdates (comp)) + if (cal_component_has_recurrences (comp)) num_icons++; } diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c index 6924dc705c..c4e3eb4c7d 100644 --- a/calendar/gui/e-week-view-event-item.c +++ b/calendar/gui/e-week-view-event-item.c @@ -515,8 +515,7 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem, } #endif - if (cal_component_has_rdates (comp) - || cal_component_has_rrules (comp)) { + if (cal_component_has_recurrences (comp)) { draw_recurrence_icon = TRUE; num_icons++; } diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index c9caeff732..096c3882d5 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -2990,8 +2990,7 @@ e_week_view_show_popup_menu (EWeekView *week_view, We could possibly set up another method of checking it. */ not_being_edited = TRUE; - if (cal_component_has_rrules (event->comp) - || cal_component_has_rdates (event->comp)) { + if (cal_component_has_recurrences (event->comp)) { num_items = 6; context_menu = &recur_child_items[0]; context_menu[0].sensitive = not_being_edited; -- cgit v1.2.3