aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/comp-util.c8
-rw-r--r--calendar/gui/comp-util.h2
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c33
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.glade137
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.h1
-rw-r--r--calendar/gui/e-cal-model.c6
-rw-r--r--calendar/gui/e-cal-model.h2
-rw-r--r--calendar/gui/e-calendar-view.c25
-rw-r--r--calendar/gui/e-calendar-view.h2
-rw-r--r--calendar/gui/e-day-view-main-item.c35
-rw-r--r--calendar/gui/e-day-view.c7
-rw-r--r--calendar/gui/e-day-view.h1
-rw-r--r--calendar/gui/e-week-view-main-item.c59
-rw-r--r--calendar/gui/e-week-view.c25
-rw-r--r--calendar/gui/e-week-view.h2
-rw-r--r--calendar/gui/gnome-cal.c20
16 files changed, 283 insertions, 82 deletions
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/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index af4c4b8e1a..b7b6e33fcf 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -435,6 +435,18 @@ ba_reminder_units_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
}
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)
{
ESourceList *source_list = prefs->alarms_list;
@@ -550,6 +562,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);
@@ -623,14 +636,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. */
@@ -844,6 +862,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</property>
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="spacing">6</property>
- <child>
- <widget class="GtkHBox" id="hbox24">
- <property name="visible">True</property>
- <child>
- <widget class="GtkLabel" id="label62">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Select the calendars for alarm notification</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkScrolledWindow" id="calendar-source-scrolled-window">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="shadow_type">in</property>
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkLabel" id="label65">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Alarms&lt;/span&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">10</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="notify_with_tray">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Display alarms in _notification area only</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label62">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Select the calendars for alarm notification</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="calendar-source-scrolled-window">
+- <property name="visible">True</property>
+- <property name="can_focus">True</property>
+- <property name="hscrollbar_policy">automatic</property>
+- <property name="vscrollbar_policy">automatic</property>
+- <property name="shadow_type">in</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="position">2</property>
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h
index 397cb35cfa..0889a395bf 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.h
+++ b/calendar/gui/dialogs/cal-prefs-dialog.h
@@ -93,6 +93,7 @@ struct _CalendarPrefsDialog {
GtkWidget *tasks_hide_completed_units;
/* Alarms tab */
+ GtkWidget *notify_with_tray;
GtkWidget *scrolled_window;
ESourceList *alarms_list;
GtkWidget *alarm_list_widget;
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 4af9b88994..672375c5f8 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 03d6e6991f..82b4704da2 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -1873,7 +1873,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);
@@ -2571,3 +2571,26 @@ error_response(GtkWidget *widget, gint response, gpointer data)
else if (response == GTK_RESPONSE_OK)
gtk_widget_destroy(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 8d3ac6f8ac..6dccf98cd1 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -186,6 +186,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 a1ed7c0900..acbc192218 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -177,9 +177,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);
@@ -199,6 +200,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)));
@@ -218,8 +222,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);
@@ -613,12 +626,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;
@@ -694,10 +707,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;
@@ -892,8 +908,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) {
@@ -1034,7 +1049,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 173fa054a6..9d6bc2df3a 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -1194,6 +1194,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];
@@ -4687,6 +4688,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) {
@@ -4841,7 +4846,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-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 bfc95ebe2e..3ea3e2e63b 100644
--- a/calendar/gui/e-week-view-main-item.c
+++ b/calendar/gui/e-week-view-main-item.c
@@ -29,7 +29,8 @@
#include <glib.h>
#include <glib/gi18n.h>
#include "e-week-view-main-item.h"
-/*#include "a11y/ea-calendar.h"*/ /* KILL-BONOBO */
+/*#include "ea-calendar.h"*/ /* KILL-BONOBO */
+#include "calendar-config.h"
static void e_week_view_main_item_set_property (GObject *object,
guint property_id,
@@ -191,6 +192,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,
@@ -207,7 +225,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;
@@ -215,6 +233,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);
@@ -232,6 +251,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 +
@@ -239,12 +259,29 @@ 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
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 (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];
else
bg_color = &week_view->colors[E_WEEK_VIEW_COLOR_ODD_MONTHS];
@@ -355,21 +392,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 1e84aeaea3..6397ce94d1 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -741,6 +741,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)
{
@@ -755,6 +776,8 @@ 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);
}
static void
@@ -4061,7 +4084,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/e-week-view.h b/calendar/gui/e-week-view.h
index 513dae247b..eff5466895 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -105,6 +105,8 @@ 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
} EWeekViewColors;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 8fe302293f..25b0336d16 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1178,6 +1178,7 @@ static gboolean
update_marcus_bains_line_cb (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
+ time_t now, day_begin;
priv = gcal->priv;
@@ -1186,6 +1187,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;
}
@@ -2744,7 +2762,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);