From afea64785f1fbcb9852fa520f67f3a60f303c372 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 2 Jul 2009 19:31:49 +0200 Subject: Bug #252296 - Do not preset alarm for all day events --- calendar/gui/comp-util.c | 8 ++++---- calendar/gui/comp-util.h | 2 +- calendar/gui/e-cal-model.c | 6 +++--- calendar/gui/e-cal-model.h | 2 +- calendar/gui/e-calendar-view.c | 2 +- calendar/gui/e-day-view.c | 2 +- calendar/gui/e-week-view.c | 2 +- calendar/gui/gnome-cal.c | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c index 62a55d2c30..cb3cf95def 100644 --- a/calendar/gui/comp-util.c +++ b/calendar/gui/comp-util.c @@ -278,12 +278,12 @@ is_icalcomp_on_the_server (icalcomponent *icalcomp, ECal *client) * cal_comp_event_new_with_defaults: * * Creates a new VEVENT component and adds any default alarms to it as set in - * the program's configuration values. + * the program's configuration values, but only if not the all_day event. * * Return value: A newly-created calendar component. **/ ECalComponent * -cal_comp_event_new_with_defaults (ECal *client) +cal_comp_event_new_with_defaults (ECal *client, gboolean all_day) { icalcomponent *icalcomp; ECalComponent *comp; @@ -303,7 +303,7 @@ cal_comp_event_new_with_defaults (ECal *client) e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT); } - if (!calendar_config_get_use_default_reminder ()) + if (all_day || !calendar_config_get_use_default_reminder ()) return comp; interval = calendar_config_get_default_reminder_interval (); @@ -361,7 +361,7 @@ cal_comp_event_new_with_current_time (ECal *client, gboolean all_day) ECalComponentDateTime dt; icaltimezone *zone; - comp = cal_comp_event_new_with_defaults (client); + comp = cal_comp_event_new_with_defaults (client, all_day); g_return_val_if_fail (comp, NULL); diff --git a/calendar/gui/comp-util.h b/calendar/gui/comp-util.h index f6090543a5..de6595672f 100644 --- a/calendar/gui/comp-util.h +++ b/calendar/gui/comp-util.h @@ -46,7 +46,7 @@ gboolean cal_comp_is_on_server (ECalComponent *comp, ECal *client); gboolean is_icalcomp_on_the_server (icalcomponent *icalcomp, ECal *client); -ECalComponent *cal_comp_event_new_with_defaults (ECal *client); +ECalComponent *cal_comp_event_new_with_defaults (ECal *client, gboolean all_day); ECalComponent *cal_comp_event_new_with_current_time (ECal *client, gboolean all_day); ECalComponent *cal_comp_task_new_with_defaults (ECal *client); ECalComponent *cal_comp_memo_new_with_defaults (ECal *client); diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index eec7403ff3..be61d1fd72 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -856,7 +856,7 @@ ecm_append_row (ETableModel *etm, ETableModel *source, gint row) if (!(comp_data.client && e_cal_get_load_state (comp_data.client) == E_CAL_LOAD_LOADED)) return; - comp_data.icalcomp = e_cal_model_create_component_with_defaults (model); + comp_data.icalcomp = e_cal_model_create_component_with_defaults (model, FALSE); /* set values for our fields */ set_categories (&comp_data, e_table_model_value_at (source, E_CAL_MODEL_FIELD_CATEGORIES, row)); @@ -2139,7 +2139,7 @@ e_cal_model_set_search_query_with_time_range (ECalModel *model, const gchar *sex * e_cal_model_create_component_with_defaults */ icalcomponent * -e_cal_model_create_component_with_defaults (ECalModel *model) +e_cal_model_create_component_with_defaults (ECalModel *model, gboolean all_day) { ECalModelPrivate *priv; ECalComponent *comp; @@ -2158,7 +2158,7 @@ e_cal_model_create_component_with_defaults (ECalModel *model) switch (priv->kind) { case ICAL_VEVENT_COMPONENT : - comp = cal_comp_event_new_with_defaults (client); + comp = cal_comp_event_new_with_defaults (client, all_day); break; case ICAL_VTODO_COMPONENT : comp = cal_comp_task_new_with_defaults (client); diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h index 6f3d3637b1..adaf736494 100644 --- a/calendar/gui/e-cal-model.h +++ b/calendar/gui/e-cal-model.h @@ -163,7 +163,7 @@ void e_cal_model_set_time_range (ECalModel const gchar *e_cal_model_get_search_query (ECalModel *model); void e_cal_model_set_search_query (ECalModel *model, const gchar *sexp); -icalcomponent *e_cal_model_create_component_with_defaults (ECalModel *model); +icalcomponent *e_cal_model_create_component_with_defaults (ECalModel *model, gboolean all_day); const gchar *e_cal_model_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data); gboolean e_cal_model_get_rgb_color_for_component (ECalModel *model, diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 2bca3e7ed9..07e067e7f5 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -1970,7 +1970,7 @@ e_calendar_view_new_appointment_for (ECalendarView *cal_view, else dt.tzid = icaltimezone_get_tzid (e_cal_model_get_timezone (cal_view->priv->model)); - icalcomp = e_cal_model_create_component_with_defaults (priv->model); + icalcomp = e_cal_model_create_component_with_defaults (priv->model, all_day); comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomp); diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index a0ac7098e1..ef9e9b1f23 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -4838,7 +4838,7 @@ e_day_view_add_new_event_in_selected_range (EDayView *day_view, GdkEventKey *key if (!e_cal_is_read_only (ecal, &read_only, NULL) || read_only) return FALSE; - icalcomp = e_cal_model_create_component_with_defaults (model); + icalcomp = e_cal_model_create_component_with_defaults (model, day_view->selection_in_top_canvas); if (!icalcomp) return FALSE; diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 839cad6688..7853adda5a 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -4053,7 +4053,7 @@ e_week_view_add_new_event_in_selected_range (EWeekView *week_view, const gchar * return FALSE; /* Add a new event covering the selected range. */ - icalcomp = e_cal_model_create_component_with_defaults (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view))); + icalcomp = e_cal_model_create_component_with_defaults (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)), TRUE); if (!icalcomp) return FALSE; uid = icalcomponent_get_uid (icalcomp); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 1e943eeb14..806f8be698 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -3510,7 +3510,7 @@ gnome_calendar_new_task (GnomeCalendar *gcal, time_t *dtstart, time_t *dtend) flags |= COMP_EDITOR_NEW_ITEM; editor = task_editor_new (ecal, flags); - icalcomp = e_cal_model_create_component_with_defaults (model); + icalcomp = e_cal_model_create_component_with_defaults (model, FALSE); comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomp); -- cgit From 044adbe76a1bf09d83ece2ad7944d1d549fa4f34 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 3 Jul 2009 14:15:16 +0200 Subject: Bug #236996 - Calendar display for weekends in month view --- calendar/gui/e-week-view-main-item.c | 28 ++++++++++++++++++++++++++-- calendar/gui/e-week-view.c | 22 ++++++++++++++++++++++ calendar/gui/e-week-view.h | 1 + 3 files changed, 49 insertions(+), 2 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c index 34bbe0f0c0..35f56f4ca8 100644 --- a/calendar/gui/e-week-view-main-item.c +++ b/calendar/gui/e-week-view-main-item.c @@ -30,6 +30,7 @@ #include #include "e-week-view-main-item.h" #include "ea-calendar.h" +#include "calendar-config.h" static void e_week_view_main_item_set_property (GObject *object, guint property_id, @@ -189,6 +190,23 @@ e_week_view_main_item_draw (GnomeCanvasItem *canvas_item, } } +static gint +gdate_to_cal_weekdays (GDateWeekday wd) +{ + switch (wd) { + case G_DATE_MONDAY: return CAL_MONDAY; + case G_DATE_TUESDAY: return CAL_TUESDAY; + case G_DATE_WEDNESDAY: return CAL_WEDNESDAY; + case G_DATE_THURSDAY: return CAL_THURSDAY; + case G_DATE_FRIDAY: return CAL_FRIDAY; + case G_DATE_SATURDAY: return CAL_SATURDAY; + case G_DATE_SUNDAY: return CAL_SUNDAY; + default: break; + } + + return 0; +} + static void e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, gint day, @@ -205,7 +223,7 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, gint right_edge, bottom_edge, date_width, date_x, line_y; gboolean show_day_name, show_month_name, selected; gchar buffer[128], *format_string; - gint month, day_of_month, max_width; + gint day_of_week, month, day_of_month, max_width; GdkColor *bg_color; PangoFontDescription *font_desc; PangoContext *pango_context; @@ -213,6 +231,7 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, PangoLayout *layout; gboolean today = FALSE; cairo_t *cr; + CalWeekdays working_days; #if 0 g_print ("Drawing Day:%i at %i,%i\n", day, x, y); @@ -230,6 +249,7 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, g_return_if_fail (gc != NULL); + day_of_week = gdate_to_cal_weekdays (g_date_get_weekday (date)); month = g_date_get_month (date); day_of_month = g_date_get_day (date); line_y = y + E_WEEK_VIEW_DATE_T_PAD + @@ -237,12 +257,16 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, PANGO_PIXELS (pango_font_metrics_get_descent (font_metrics)) + E_WEEK_VIEW_DATE_LINE_T_PAD; + working_days = calendar_config_get_working_days (); + /* Draw the background of the day. In the month view odd months are one color and even months another, so you can easily see when each month starts (defaults are white for odd - January, March, ... and light gray for even). In the week view the background is always the same color, the color used for the odd months in the month view. */ - if (week_view->multi_week_view && (month % 2 == 0)) + if ((working_days & day_of_week) == 0) + bg_color = &week_view->colors[E_WEEK_VIEW_COLOR_MONTH_NONWORKING_DAY]; + else if (week_view->multi_week_view && (month % 2 == 0)) bg_color = &week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS]; else bg_color = &week_view->colors[E_WEEK_VIEW_COLOR_ODD_MONTHS]; diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 7853adda5a..3db7e85e06 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -740,6 +740,27 @@ e_week_view_realize (GtkWidget *widget) week_view->meeting_icon = e_icon_factory_get_icon ("stock_people", GTK_ICON_SIZE_MENU); } +static GdkColor +color_inc (GdkColor c, gint amount) +{ + #define dec(x) \ + if (x + amount >= 0 \ + && x + amount <= 0xFFFF) \ + x += amount; \ + else if (amount <= 0) \ + x = 0; \ + else \ + x = 0xFFFF; + + dec (c.red); + dec (c.green); + dec (c.blue); + + #undef dec + + return c; +} + static void e_week_view_set_colors(EWeekView *week_view, GtkWidget *widget) { @@ -754,6 +775,7 @@ e_week_view_set_colors(EWeekView *week_view, GtkWidget *widget) week_view->colors[E_WEEK_VIEW_COLOR_DATES] = widget->style->text[GTK_STATE_NORMAL]; week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED] = widget->style->text[GTK_STATE_SELECTED]; week_view->colors[E_WEEK_VIEW_COLOR_TODAY] = widget->style->base[GTK_STATE_SELECTED]; + week_view->colors[E_WEEK_VIEW_COLOR_MONTH_NONWORKING_DAY] = color_inc (week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS], -0x0A0A); } static void diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h index 513dae247b..9ef7149d61 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -105,6 +105,7 @@ typedef enum E_WEEK_VIEW_COLOR_DATES, E_WEEK_VIEW_COLOR_DATES_SELECTED, E_WEEK_VIEW_COLOR_TODAY, + E_WEEK_VIEW_COLOR_MONTH_NONWORKING_DAY, E_WEEK_VIEW_COLOR_LAST } EWeekViewColors; -- cgit From 266d51479ab6bc1fb2afddf73ef275047e6ced37 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 3 Jul 2009 16:17:28 +0200 Subject: Bug #251694 - Highlight current day in a calendar --- calendar/gui/e-calendar-view.c | 23 +++++++++++++++++++++++ calendar/gui/e-calendar-view.h | 2 ++ calendar/gui/e-day-view-main-item.c | 17 +++++++++++++++-- calendar/gui/e-day-view.c | 1 + calendar/gui/e-day-view.h | 1 + calendar/gui/e-week-view-main-item.c | 31 +++++++++++++++++-------------- calendar/gui/e-week-view.c | 1 + calendar/gui/e-week-view.h | 1 + 8 files changed, 61 insertions(+), 16 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 07e067e7f5..8cab14b861 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -2686,3 +2686,26 @@ e_calendar_utils_show_info_silent (GtkWidget *widget) e_activity_handler_make_error (handler, "calendar", E_LOG_WARNINGS, widget); } + +/* returns either light or dark yellow, based on the base_background, + which is the default background color */ +GdkColor +get_today_background (const GdkColor base_background) +{ + GdkColor res = base_background; + + if (res.red > 0x7FFF) { + /* light yellow for a light theme */ + res.red = 0xFFFF; + res.green = 0xFFFF; + res.blue = 0xC0C0; + } else { + /* dark yellow for a dark theme */ + res.red = 0x3F3F; + res.green = 0x3F3F; + res.blue = 0x0000; + } + + return res; +} + diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h index 57cc811ae7..4d33fcba07 100644 --- a/calendar/gui/e-calendar-view.h +++ b/calendar/gui/e-calendar-view.h @@ -188,6 +188,8 @@ void draw_curved_rectangle (cairo_t *cr, double rect_height, double radius); +GdkColor get_today_background (GdkColor event_background); + G_END_DECLS #endif diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 48830be99f..faed90a795 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -175,9 +175,10 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, gint work_day_start_y, work_day_end_y; gint day_x, day_w, work_day; gint start_row, end_row, rect_x, rect_y, rect_width, rect_height; - struct icaltimetype day_start_tt; + struct icaltimetype day_start_tt, today_tt; gint weekday; cairo_t *cr; + gboolean today = FALSE; cr = gdk_cairo_create (drawable); @@ -197,6 +198,9 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, gc = day_view->main_gc; work_day_end_y = e_day_view_convert_time_to_position (day_view, day_view->work_day_end_hour, day_view->work_day_end_minute) - y; + today_tt = icaltime_from_timet_with_zone (time (NULL), FALSE, + e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view))); + for (day = 0; day < day_view->days_shown; day++) { day_start_tt = icaltime_from_timet_with_zone (day_view->day_starts[day], FALSE, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view))); @@ -216,8 +220,17 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, cairo_fill (cr); cairo_restore (cr); + if (day_view->days_shown > 1) { + /* Check if we are drawing today */ + today = day_start_tt.year == today_tt.year + && day_start_tt.month == today_tt.month + && day_start_tt.day == today_tt.day; + } else { + today = FALSE; + } + cairo_save (cr); - gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING]); + gdk_cairo_set_source_color (cr, &day_view->colors[today ? E_DAY_VIEW_COLOR_BG_MULTIDAY_TODAY : E_DAY_VIEW_COLOR_BG_WORKING]); cairo_rectangle (cr, day_x, work_day_start_y, day_w, work_day_end_y - work_day_start_y); diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index ef9e9b1f23..6099a7df5f 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -1193,6 +1193,7 @@ e_day_view_set_colors(EDayView *day_view, GtkWidget *widget) day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED] = widget->style->base[GTK_STATE_SELECTED]; day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED] = widget->style->bg[GTK_STATE_SELECTED]; day_view->colors[E_DAY_VIEW_COLOR_BG_GRID] = widget->style->dark[GTK_STATE_NORMAL]; + day_view->colors[E_DAY_VIEW_COLOR_BG_MULTIDAY_TODAY] = get_today_background (day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING]); day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS] = widget->style->dark[GTK_STATE_NORMAL]; day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED] = widget->style->bg[GTK_STATE_SELECTED]; day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_GRID] = widget->style->light[GTK_STATE_NORMAL]; diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index 2b3f11e280..31b894919c 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -143,6 +143,7 @@ typedef enum E_DAY_VIEW_COLOR_BG_SELECTED, E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED, E_DAY_VIEW_COLOR_BG_GRID, + E_DAY_VIEW_COLOR_BG_MULTIDAY_TODAY, E_DAY_VIEW_COLOR_BG_TOP_CANVAS, E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED, diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c index 35f56f4ca8..47804cb4fa 100644 --- a/calendar/gui/e-week-view-main-item.c +++ b/calendar/gui/e-week-view-main-item.c @@ -257,6 +257,17 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, PANGO_PIXELS (pango_font_metrics_get_descent (font_metrics)) + E_WEEK_VIEW_DATE_LINE_T_PAD; + if (!today) { + struct icaltimetype tt; + + /* Check if we are drawing today */ + tt = icaltime_from_timet_with_zone (time (NULL), FALSE, + e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view))); + today = g_date_get_year (date) == tt.year + && g_date_get_month (date) == tt.month + && g_date_get_day (date) == tt.day; + } + working_days = calendar_config_get_working_days (); /* Draw the background of the day. In the month view odd months are @@ -264,7 +275,9 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, month starts (defaults are white for odd - January, March, ... and light gray for even). In the week view the background is always the same color, the color used for the odd months in the month view. */ - if ((working_days & day_of_week) == 0) + if (today) + bg_color = &week_view->colors[E_WEEK_VIEW_COLOR_TODAY_BACKGROUND]; + else if ((working_days & day_of_week) == 0) bg_color = &week_view->colors[E_WEEK_VIEW_COLOR_MONTH_NONWORKING_DAY]; else if (week_view->multi_week_view && (month % 2 == 0)) bg_color = &week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS]; @@ -377,21 +390,11 @@ e_week_view_main_item_draw_day (EWeekViewMainItem *wvmitem, if (selected) { gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED]); } else if (week_view->multi_week_view) { - struct icaltimetype tt; - - /* Check if we are drawing today */ - tt = icaltime_from_timet_with_zone (time (NULL), FALSE, - e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view))); - if (g_date_get_year (date) == tt.year - && g_date_get_month (date) == tt.month - && g_date_get_day (date) == tt.day) { + if (today) { gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_TODAY]); - today = TRUE; - } - else { + } else { gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_DATES]); - - } + } } else { gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_DATES]); } diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 3db7e85e06..bcede69a60 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -775,6 +775,7 @@ e_week_view_set_colors(EWeekView *week_view, GtkWidget *widget) week_view->colors[E_WEEK_VIEW_COLOR_DATES] = widget->style->text[GTK_STATE_NORMAL]; week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED] = widget->style->text[GTK_STATE_SELECTED]; week_view->colors[E_WEEK_VIEW_COLOR_TODAY] = widget->style->base[GTK_STATE_SELECTED]; + week_view->colors[E_WEEK_VIEW_COLOR_TODAY_BACKGROUND] = get_today_background (week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND]); week_view->colors[E_WEEK_VIEW_COLOR_MONTH_NONWORKING_DAY] = color_inc (week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS], -0x0A0A); } diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h index 9ef7149d61..eff5466895 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -105,6 +105,7 @@ typedef enum E_WEEK_VIEW_COLOR_DATES, E_WEEK_VIEW_COLOR_DATES_SELECTED, E_WEEK_VIEW_COLOR_TODAY, + E_WEEK_VIEW_COLOR_TODAY_BACKGROUND, E_WEEK_VIEW_COLOR_MONTH_NONWORKING_DAY, E_WEEK_VIEW_COLOR_LAST -- cgit From d11c3c7df839d8bed10c67621fd64613c0b1eb34 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 8 Jul 2009 21:16:33 +0200 Subject: Bug #238058 - Show more from summary for events with icons - do not show icons when editing event summary inline and the text is above them - move text right to icons as before when the text is on the same line as icons are --- calendar/gui/e-day-view-main-item.c | 18 ++++++++++-------- calendar/gui/e-day-view.c | 4 ++++ 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index faed90a795..f8b264f762 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -624,12 +624,12 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, cairo_font_options_t *font_options; guint16 red, green, blue; gint i; - gdouble radius, x0, y0, rect_height, rect_width; + gdouble radius, x0, y0, rect_height, rect_width, text_x_offset = 0.0; gfloat alpha; gboolean gradient; gdouble cc = 65535.0; gdouble date_fraction; - gboolean short_event = FALSE, resize_flag = FALSE; + gboolean short_event = FALSE, resize_flag = FALSE, is_editing; const gchar *end_resize_suffix; gchar *end_regsizeime; gint start_hour, start_display_hour, start_minute, start_suffix_width; @@ -705,10 +705,13 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, } } + is_editing = day_view->editing_event_day == day && day_view->editing_event_num == event_num; + + if (event->canvas_item) + g_object_get (G_OBJECT (event->canvas_item), "x_offset", &text_x_offset, NULL); + /* Draw shadow around the event when selected */ - if (day_view->editing_event_day == day - && day_view->editing_event_num == event_num && (GTK_WIDGET_HAS_FOCUS (day_view->main_canvas))) - { + if (is_editing && (GTK_WIDGET_HAS_FOCUS (day_view->main_canvas))) { /* For embossing Item selection */ item_x -= 1; item_y -= 2; @@ -903,8 +906,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, else short_event = FALSE; - if (day_view->editing_event_day == day - && day_view->editing_event_num == event_num) + if (is_editing) short_event = TRUE; if (gradient) { @@ -1045,7 +1047,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR]); /* Draw the reminder & recurrence icons, if needed. */ - if (!resize_flag) { + if (!resize_flag && (!is_editing || text_x_offset > E_DAY_VIEW_ICON_X_PAD)) { num_icons = 0; draw_reminder_icon = FALSE; draw_recurrence_icon = FALSE; diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 6099a7df5f..bcd6d42c23 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -4685,6 +4685,10 @@ e_day_view_reshape_day_event (EDayView *day_view, if (num_icons > 0) { if (item_h >= (E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD) * num_icons) icons_offset = E_DAY_VIEW_ICON_WIDTH + E_DAY_VIEW_ICON_X_PAD * 2; + else if (item_h <= (E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD) * 2 || num_icons == 1) + icons_offset = (E_DAY_VIEW_ICON_WIDTH + E_DAY_VIEW_ICON_X_PAD) * num_icons + E_DAY_VIEW_ICON_X_PAD; + else + icons_offset = E_DAY_VIEW_ICON_X_PAD; } if (!event->canvas_item) { -- cgit From ded09ddf48c5c9ecda22314247b42ed7b224595f Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 9 Jul 2009 12:05:33 +0200 Subject: Bug #425582 - Calendar Alarm Display is not noticable enough --- calendar/gui/dialogs/cal-prefs-dialog.c | 33 +++++-- calendar/gui/dialogs/cal-prefs-dialog.glade | 137 ++++++++++++++++++++-------- calendar/gui/dialogs/cal-prefs-dialog.h | 1 + 3 files changed, 128 insertions(+), 43 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 96f91c741f..db3a5aef13 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -433,6 +433,18 @@ ba_reminder_units_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) calendar_config_set_ba_reminder (NULL, NULL, &units); } +static void +notify_with_tray_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) +{ + GConfClient *gconf; + + g_return_if_fail (toggle != NULL); + + gconf = gconf_client_get_default (); + gconf_client_set_bool (gconf, "/apps/evolution/calendar/notify/notify_with_tray", gtk_toggle_button_get_active (toggle), NULL); + g_object_unref (gconf); +} + static void alarms_selection_changed (ESourceSelector *selector, CalendarPrefsDialog *prefs) { @@ -557,6 +569,7 @@ setup_changes (CalendarPrefsDialog *prefs) G_CALLBACK (ba_reminder_interval_changed), prefs); g_signal_connect (G_OBJECT (prefs->ba_reminder_units), "changed", G_CALLBACK (ba_reminder_units_changed), prefs); + g_signal_connect (G_OBJECT (prefs->notify_with_tray), "toggled", G_CALLBACK (notify_with_tray_toggled), prefs); g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs); @@ -630,14 +643,19 @@ initialize_selection (ESourceSelector *selector, ESourceList *source_list) static void show_alarms_config (CalendarPrefsDialog *prefs) { - if (!e_cal_get_sources (&prefs->alarms_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) - return; + GConfClient *gconf; + + if (e_cal_get_sources (&prefs->alarms_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) { + prefs->alarm_list_widget = e_source_selector_new (prefs->alarms_list); + atk_object_set_name (gtk_widget_get_accessible (prefs->alarm_list_widget), _("Selected Calendars for Alarms")); + gtk_container_add (GTK_CONTAINER (prefs->scrolled_window), prefs->alarm_list_widget); + gtk_widget_show (prefs->alarm_list_widget); + initialize_selection (E_SOURCE_SELECTOR (prefs->alarm_list_widget), prefs->alarms_list); + } - prefs->alarm_list_widget = e_source_selector_new (prefs->alarms_list); - atk_object_set_name (gtk_widget_get_accessible (prefs->alarm_list_widget), _("Selected Calendars for Alarms")); - gtk_container_add (GTK_CONTAINER (prefs->scrolled_window), prefs->alarm_list_widget); - gtk_widget_show (prefs->alarm_list_widget); - initialize_selection (E_SOURCE_SELECTOR (prefs->alarm_list_widget), prefs->alarms_list); + gconf = gconf_client_get_default (); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->notify_with_tray), gconf_client_get_bool (gconf, "/apps/evolution/calendar/notify/notify_with_tray", NULL)); + g_object_unref (gconf); } /* Shows the current config settings in the dialog. */ @@ -836,6 +854,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) /* Alarms tab */ + prefs->notify_with_tray = glade_xml_get_widget (gui, "notify_with_tray"); prefs->scrolled_window = glade_xml_get_widget (gui, "calendar-source-scrolled-window"); /* Free/Busy tab */ diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index 9f2617db04..63e9e6092f 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -1045,42 +1045,107 @@ Days True 12 6 - - - True - - - True - Select the calendars for alarm notification - - - False - False - 0 - - - - - False - False - 0 - - - - - True - True - automatic - automatic - in - - - - - - 1 - - + + + True + <span weight="bold">Alarms</span> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 10 + 0 + + + + True + True + Display alarms in _notification area only + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + + 0 + False + True + + + + + + True + Select the calendars for alarm notification + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + +- True +- True +- automatic +- automatic +- in + + + + + + + 0 + True + True + + 2 diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 647df417df..611d4aabcc 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -75,6 +75,7 @@ struct _CalendarPrefsDialog { GtkWidget *tasks_hide_completed_units; /* Alarms tab */ + GtkWidget *notify_with_tray; GtkWidget *scrolled_window; ESourceList *alarms_list; GtkWidget *alarm_list_widget; -- cgit From 3facea9518a780f6804a8a22fd3cdbe12cd0f19a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 9 Jul 2009 19:54:18 +0200 Subject: Bug #240605 - auto-select next day at midnight in selected day view --- calendar/gui/gnome-cal.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'calendar/gui') diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 806f8be698..e2fbd0f476 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1437,6 +1437,7 @@ static gboolean update_marcus_bains_line_cb (GnomeCalendar *gcal) { GnomeCalendarPrivate *priv; + time_t now, day_begin; priv = gcal->priv; @@ -1445,6 +1446,23 @@ update_marcus_bains_line_cb (GnomeCalendar *gcal) e_day_view_update_marcus_bains (E_DAY_VIEW (gnome_calendar_get_current_view_widget (gcal))); } + time (&now); + day_begin = time_day_begin (now); + + /* check in the first two minutes */ + if (now >= day_begin && now <= day_begin + 120) { + ECalendarView *view = priv->views[priv->current_view_type]; + time_t start_time = 0, end_time = 0; + + g_return_val_if_fail (view != NULL, TRUE); + + e_calendar_view_get_selected_time_range (view, &start_time, &end_time); + + if (end_time >= time_add_day (day_begin, -1) && start_time <= day_begin) { + gnome_calendar_goto (gcal, now); + } + } + return TRUE; } -- cgit