diff options
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 21 | ||||
-rw-r--r-- | calendar/gui/apps_evolution_calendar.schemas.in.in | 36 | ||||
-rw-r--r-- | calendar/gui/calendar-config-keys.h | 3 | ||||
-rw-r--r-- | calendar/gui/calendar-config.c | 28 | ||||
-rw-r--r-- | calendar/gui/calendar-config.h | 4 | ||||
-rw-r--r-- | calendar/gui/e-day-view-config.c | 32 | ||||
-rw-r--r-- | calendar/gui/e-day-view-main-item.c | 39 | ||||
-rw-r--r-- | calendar/gui/e-day-view-time-item.c | 29 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 58 | ||||
-rw-r--r-- | calendar/gui/e-day-view.h | 16 | ||||
-rw-r--r-- | calendar/gui/e-meeting-store.c | 2 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 24 |
12 files changed, 288 insertions, 4 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index be26b7455e..11584e4d49 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,24 @@ +2005-05-13 Thouis R. Jones <thouis@csail.mit.edu> + + Fixes #272301 + + * gui/apps_evolution_calendar.schemas.in.in: + * gui/calendar-config-keys.h: + * gui/calendar-config.c: (calendar_config_get_marcus_bains, + calendar_config_add_notification_marcus_bains): + * gui/calendar-config.h: + * gui/e-day-view-config.c: (set_marcus_bains, + marcus_bains_changed_cb, e_day_view_config_set_view): + * gui/e-day-view-main-item.c: (e_day_view_main_item_draw): + * gui/e-day-view-time-item.c: (e_day_view_time_item_draw): + * gui/e-day-view.c: (e_day_view_init, e_day_view_set_colors, + e_day_view_get_show_marcus_bains, e_day_view_set_marcus_bains, + e_day_view_update_marcus_bains): + * gui/e-day-view.h: + * gui/gnome-cal.c: (update_marcus_bains_line_cb, setup_widgets, + gnome_calendar_destroy): Added Marcus Bains Line to main item + view and time bar. + 2005-05-13 Sushma Rai <rsushma@novell.com> * gui/dialogs/recurrence-page.c (make_ending_until_special): Setting diff --git a/calendar/gui/apps_evolution_calendar.schemas.in.in b/calendar/gui/apps_evolution_calendar.schemas.in.in index 6fbb4cfa60..8348e47aab 100644 --- a/calendar/gui/apps_evolution_calendar.schemas.in.in +++ b/calendar/gui/apps_evolution_calendar.schemas.in.in @@ -195,6 +195,42 @@ </locale> </schema> + <schema> + <key>/schemas/apps/evolution/calendar/display/marcus_bains_line</key> + <applyto>/apps/evolution/calendar/display/marcus_bains_line</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Marcus Bains Line</short> + <long>Whether to draw the Marcus Bains Line (line at current time) in the calendar.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/marcus_bains_color_dayview</key> + <applyto>/apps/evolution/calendar/display/marcus_bains_color_dayview</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <default>#ff0000</default> + <locale name="C"> + <short>Marcus Bains Line Color - Day View</short> + <long>Color to draw the Marcus Bains line in the Day View.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/marcus_bains_color_timebar</key> + <applyto>/apps/evolution/calendar/display/marcus_bains_color_timebar</applyto> + <owner>evolution-calendar</owner> + <type>string</type> + <default>#ff0000</default> + <locale name="C"> + <short>Marcus Bains Line Color - Time bar</short> + <long>Color to draw the Marcus Bains Line in the Time bar (empty for default).</long> + </locale> + </schema> + <!-- Tasks --> <schema> diff --git a/calendar/gui/calendar-config-keys.h b/calendar/gui/calendar-config-keys.h index d3be9673e5..bb07640b2f 100644 --- a/calendar/gui/calendar-config-keys.h +++ b/calendar/gui/calendar-config-keys.h @@ -39,6 +39,9 @@ G_BEGIN_DECLS #define CALENDAR_CONFIG_DAY_END_MINUTE CALENDAR_CONFIG_PREFIX "/display/day_end_minute" #define CALENDAR_CONFIG_TIME_DIVISIONS CALENDAR_CONFIG_PREFIX "/display/time_divisions" #define CALENDAR_CONFIG_TIME_DIVISIONS CALENDAR_CONFIG_PREFIX "/display/time_divisions" +#define CALENDAR_CONFIG_MARCUS_BAINS_LINE CALENDAR_CONFIG_PREFIX "/display/marcus_bains_line" +#define CALENDAR_CONFIG_MARCUS_BAINS_COLOR_DAYVIEW CALENDAR_CONFIG_PREFIX "/display/marcus_bains_color_dayview" +#define CALENDAR_CONFIG_MARCUS_BAINS_COLOR_TIMEBAR CALENDAR_CONFIG_PREFIX "/display/marcus_bains_color_timebar" #define CALENDAR_CONFIG_DEFAULT_VIEW CALENDAR_CONFIG_PREFIX "/display/default_view" #define CALENDAR_CONFIG_HPANE_POS CALENDAR_CONFIG_PREFIX "/display/hpane_position" #define CALENDAR_CONFIG_VPANE_POS CALENDAR_CONFIG_PREFIX "/display/vpane_position" diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index c31bdca261..cab9ee58ff 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -444,6 +444,34 @@ calendar_config_add_notification_time_divisions (GConfClientNotifyFunc func, gpo return id; } +/* Whether we show the Marcus Bains Line (current time), and in what colors. */ +void +calendar_config_get_marcus_bains (gboolean *show_line, const char **dayview_color, const char **timebar_color) +{ + static char *dcolor = NULL, *tcolor = NULL; + + if (dcolor) + g_free (dcolor); + if (tcolor) + g_free (tcolor); + + dcolor = gconf_client_get_string (config, CALENDAR_CONFIG_MARCUS_BAINS_COLOR_DAYVIEW, NULL); + tcolor = gconf_client_get_string (config, CALENDAR_CONFIG_MARCUS_BAINS_COLOR_TIMEBAR, NULL); + + *show_line = gconf_client_get_bool (config, CALENDAR_CONFIG_MARCUS_BAINS_LINE, NULL); + *dayview_color = dcolor; + *timebar_color = tcolor; +} + + +void +calendar_config_add_notification_marcus_bains (GConfClientNotifyFunc func, gpointer data, gint *not_show, gint *not_dcolor, gint *not_tcolor) +{ + *not_show = gconf_client_notify_add (config, CALENDAR_CONFIG_MARCUS_BAINS_LINE, func, data, NULL, NULL); + *not_dcolor = gconf_client_notify_add (config, CALENDAR_CONFIG_MARCUS_BAINS_COLOR_DAYVIEW, func, data, NULL, NULL); + *not_tcolor = gconf_client_notify_add (config, CALENDAR_CONFIG_MARCUS_BAINS_COLOR_TIMEBAR, func, data, NULL, NULL); +} + /* Whether we show week numbers in the Date Navigator. */ gboolean calendar_config_get_dnav_show_week_no (void) diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index 414e52b14f..3d3840a911 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -117,6 +117,10 @@ gint calendar_config_get_time_divisions (void); void calendar_config_set_time_divisions (gint divisions); guint calendar_config_add_notification_time_divisions (GConfClientNotifyFunc func, gpointer data); +/* Whether we show the Marcus Bains Line, and in what colors. */ +void calendar_config_get_marcus_bains (gboolean *show_line, const char **dayview_color, const char **timebar_color); +void calendar_config_add_notification_marcus_bains (GConfClientNotifyFunc func, gpointer data, gint *not_show, gint *not_dcolor, gint *not_tcolor); + /* Whether we show event end times. */ gboolean calendar_config_get_show_event_end (void); void calendar_config_set_show_event_end (gboolean show_end); diff --git a/calendar/gui/e-day-view-config.c b/calendar/gui/e-day-view-config.c index 50d4d8eeea..b65d236bd1 100644 --- a/calendar/gui/e-day-view-config.c +++ b/calendar/gui/e-day-view-config.c @@ -355,6 +355,28 @@ time_divisions_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpo } static void +set_marcus_bains (EDayView *day_view) +{ + gboolean show_marcus_bains_line; + const char *dayview_color, *timebar_color; + + calendar_config_get_marcus_bains (&show_marcus_bains_line, &dayview_color, &timebar_color); + + e_day_view_set_marcus_bains (day_view, show_marcus_bains_line, dayview_color, timebar_color); +} + +static void +marcus_bains_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) +{ + EDayViewConfig *view_config = data; + EDayViewConfigPrivate *priv; + + priv = view_config->priv; + + set_marcus_bains (priv->view); +} + +static void set_show_event_end (EDayView *day_view) { gboolean show_event_end; @@ -379,7 +401,7 @@ void e_day_view_config_set_view (EDayViewConfig *view_config, EDayView *day_view) { EDayViewConfigPrivate *priv; - guint not; + guint not, not_1, not_2; GList *l; g_return_if_fail (view_config != NULL); @@ -458,6 +480,14 @@ e_day_view_config_set_view (EDayViewConfig *view_config, EDayView *day_view) not = calendar_config_add_notification_time_divisions (time_divisions_changed_cb, view_config); priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not)); + /* Showing Marcus Bains Line */ + set_marcus_bains (day_view); + + calendar_config_add_notification_marcus_bains (marcus_bains_changed_cb, view_config, ¬, ¬_1, ¬_2); + priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not)); + priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not_1)); + priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not_2)); + /* Showing event end */ set_show_event_end (day_view); diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index c936342f74..6203e264e8 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -35,6 +35,7 @@ #include "e-day-view-layout.h" #include "e-day-view-main-item.h" #include "ea-calendar.h" +#include <libecal/e-cal-time-util.h> static void e_day_view_main_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); @@ -299,6 +300,44 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, x, y, width, height, day); } + + + if (e_day_view_get_show_marcus_bains (day_view)) { + icaltimezone *zone; + struct icaltimetype time_now, day_start; + int marcus_bains_y; + GdkColor mb_color; + + gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_MARCUS_BAINS_LINE]); + + if (day_view->marcus_bains_day_view_color && gdk_color_parse (day_view->marcus_bains_day_view_color, &mb_color)) { + GdkColormap *colormap; + + colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view)); + if (gdk_colormap_alloc_color (colormap, &mb_color, TRUE, TRUE)) { + gdk_gc_set_foreground (gc, &mb_color); + } + } + + zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view)); + time_now = icaltime_current_time_with_zone (zone); + + for (day = 0; day < day_view->days_shown; day++) { + day_start = icaltime_from_timet_with_zone (day_view->day_starts[day], FALSE, zone); + + if ((day_start.year == time_now.year) && + (day_start.month == time_now.month) && + (day_start.day == time_now.day)) { + + grid_x1 = day_view->day_offsets[day] - x + E_DAY_VIEW_BAR_WIDTH; + grid_x2 = day_view->day_offsets[day + 1] - x - 1; + marcus_bains_y = (time_now.hour * 60 + time_now.minute) * day_view->row_height / day_view->mins_per_row - y; + gdk_draw_line (drawable, gc, grid_x1, marcus_bains_y, grid_x2, marcus_bains_y); + } + } + } + + } diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c index db4b66e54b..ae57439a10 100644 --- a/calendar/gui/e-day-view-time-item.c +++ b/calendar/gui/e-day-view-time-item.c @@ -40,6 +40,7 @@ #include <gal/widgets/e-gui-utils.h> #include "e-day-view-time-item.h" #include "calendar-config.h" +#include <libecal/e-cal-time-util.h> /* The spacing between items in the time column. GRID_X_PAD is the space down @@ -252,7 +253,7 @@ e_day_view_time_item_draw (GnomeCanvasItem *canvas_item, EDayView *day_view; EDayViewTimeItem *dvtmitem; GtkStyle *style; - GdkGC *fg_gc, *dark_gc; + GdkGC *gc, *fg_gc, *dark_gc; gchar buffer[64], *suffix; gint hour, display_hour, minute, row; gint row_y, start_y, large_hour_y_offset, small_font_y_offset; @@ -278,6 +279,7 @@ e_day_view_time_item_draw (GnomeCanvasItem *canvas_item, small_font_metrics = pango_context_get_metrics (context, small_font_desc, pango_context_get_language (context)); + gc = day_view->main_gc; fg_gc = style->fg_gc[GTK_STATE_NORMAL]; dark_gc = style->dark_gc[GTK_STATE_NORMAL]; @@ -331,6 +333,30 @@ e_day_view_time_item_draw (GnomeCanvasItem *canvas_item, pango_font_metrics_get_descent (large_font_metrics)) / PANGO_SCALE + E_DVTMI_LARGE_HOUR_Y_PAD); + /* Draw the Marcus Bains Line first, so it appears under other elements. */ + if (e_day_view_get_show_marcus_bains (day_view)) { + struct icaltimetype time_now; + int marcus_bains_y; + GdkColor mb_color; + + gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_MARCUS_BAINS_LINE]); + + if (day_view->marcus_bains_time_bar_color && gdk_color_parse (day_view->marcus_bains_time_bar_color, &mb_color)) { + GdkColormap *colormap; + + colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view)); + if (gdk_colormap_alloc_color (colormap, &mb_color, TRUE, TRUE)) { + gdk_gc_set_foreground (gc, &mb_color); + } + } + + time_now = icaltime_current_time_with_zone (e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view))); + marcus_bains_y = (time_now.hour * 60 + time_now.minute) * day_view->row_height / day_view->mins_per_row - y; + gdk_draw_line (drawable, gc, + long_line_x1, marcus_bains_y, + long_line_x2, marcus_bains_y); + } + /* Step through each row, drawing the times and the horizontal lines between them. */ for (row = 0, row_y = 0 - y; @@ -614,7 +640,6 @@ e_day_view_time_item_on_button_release (EDayViewTimeItem *dvtmitem, dvtmitem->dragging_selection = FALSE; } - static void e_day_view_time_item_on_motion_notify (EDayViewTimeItem *dvtmitem, GdkEvent *event) diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index e7c924fb01..1bee23f573 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -716,6 +716,10 @@ e_day_view_init (EDayView *day_view) day_view->week_start_day = 0; day_view->scroll_to_work_day = TRUE; + day_view->show_marcus_bains_line = TRUE; + day_view->marcus_bains_day_view_color = NULL; + day_view->marcus_bains_time_bar_color = NULL; + day_view->editing_event_day = -1; day_view->editing_event_num = -1; @@ -1161,6 +1165,7 @@ e_day_view_set_colors(EDayView *day_view, GtkWidget *widget) day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER] = widget->style->dark[GTK_STATE_NORMAL]; day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND] = widget->style->bg[GTK_STATE_ACTIVE]; day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER] = widget->style->dark[GTK_STATE_NORMAL]; + day_view->colors[E_DAY_VIEW_COLOR_MARCUS_BAINS_LINE] = widget->style->dark[GTK_STATE_PRELIGHT]; } static void @@ -2468,6 +2473,59 @@ e_day_view_set_working_day (EDayView *day_view, gtk_widget_queue_draw (day_view->main_canvas); } + +/* Whether we display the Marcus Bains Line in the main canvas and time canvas. */ +gboolean +e_day_view_get_show_marcus_bains (EDayView *day_view) +{ + g_return_val_if_fail (E_IS_DAY_VIEW (day_view), TRUE); + return day_view->show_marcus_bains_line; +} + +/* Force a redraw of the Marcus Bains Lines */ +void +e_day_view_update_marcus_bains (EDayView *day_view) +{ + g_return_if_fail (E_IS_DAY_VIEW (day_view)); + gtk_widget_queue_draw (day_view->main_canvas); + gtk_widget_queue_draw (day_view->time_canvas); +} + + +/* Update the variables controlling the Marcus Bains Line (display toggle, and colors). */ +void +e_day_view_set_marcus_bains (EDayView *day_view, + gboolean show_line, + const char *dayview_color, + const char *timebar_color) +{ + g_return_if_fail (E_IS_DAY_VIEW (day_view)); + + if ((day_view->show_marcus_bains_line != show_line) | + (day_view->marcus_bains_day_view_color != dayview_color) | + (day_view->marcus_bains_time_bar_color != timebar_color)) { + + if (day_view->marcus_bains_day_view_color) + g_free (day_view->marcus_bains_day_view_color); + if (day_view->marcus_bains_time_bar_color) + g_free (day_view->marcus_bains_time_bar_color); + + day_view->show_marcus_bains_line = show_line; + if (dayview_color) + day_view->marcus_bains_day_view_color = g_strdup (dayview_color); + else + day_view->marcus_bains_day_view_color = NULL; + + if (timebar_color) + day_view->marcus_bains_time_bar_color = g_strdup (timebar_color); + else + day_view->marcus_bains_time_bar_color = NULL; + + e_day_view_update_marcus_bains (day_view); + } +} + + /* Whether we display event end times in the main canvas. */ gboolean e_day_view_get_show_event_end_times (EDayView *day_view) diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index 4c563e4dbd..d137332a88 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -153,6 +153,8 @@ typedef enum E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND, E_DAY_VIEW_COLOR_LONG_EVENT_BORDER, + E_DAY_VIEW_COLOR_MARCUS_BAINS_LINE, + E_DAY_VIEW_COLOR_LAST } EDayViewColors; @@ -278,6 +280,11 @@ struct _EDayView gint work_day_end_hour; gint work_day_end_minute; + /* Whether we show the Marcus Bains Line in the main canvas and time canvas. */ + gboolean show_marcus_bains_line; + char *marcus_bains_day_view_color; + char *marcus_bains_time_bar_color; + /* Whether we use show event end times in the main canvas. */ gboolean show_event_end_times; @@ -493,6 +500,13 @@ void e_day_view_set_working_day (EDayView *day_view, gint end_hour, gint end_minute); +/* Whether we display the Marcus Bains Line in the main canvas and time canvas. */ +gboolean e_day_view_get_show_marcus_bains (EDayView *day_view); +void e_day_view_set_marcus_bains (EDayView *day_view, + gboolean show_line, + const char *dayview_color, + const char *timebar_color); + /* Whether we display event end times in the main canvas. */ gboolean e_day_view_get_show_event_end_times (EDayView *day_view); void e_day_view_set_show_event_end_times (EDayView *day_view, @@ -573,6 +587,8 @@ void e_day_view_ensure_rows_visible (EDayView *day_view, gint end_row); +void e_day_view_update_marcus_bains (EDayView *day_view); + G_END_DECLS #endif /* _E_DAY_VIEW_H_ */ diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c index 7cbfbe2b79..22242755b2 100644 --- a/calendar/gui/e-meeting-store.c +++ b/calendar/gui/e-meeting-store.c @@ -1046,7 +1046,7 @@ process_free_busy_comp (EMeetingAttendee *attendee, icalcomponent *tz_top_level) { icalproperty *ip; - + ip = icalcomponent_get_first_property (fb_comp, ICAL_DTSTART_PROPERTY); if (ip != NULL) { struct icaltimetype dtstart; diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index cf129a5bf4..960f22aa63 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -138,6 +138,7 @@ struct _GnomeCalendarPrivate { char *sexp; char *todo_sexp; guint update_timeout; + guint update_marcus_bains_line_timeout; /* This is the view currently shown. We use it to keep track of the positions of the panes. range_selected is TRUE if a range of dates @@ -1087,6 +1088,21 @@ update_todo_view_cb (GnomeCalendar *gcal) return TRUE; } +static gboolean +update_marcus_bains_line_cb (GnomeCalendar *gcal) +{ + GnomeCalendarPrivate *priv; + + priv = gcal->priv; + + if ((priv->current_view_type == GNOME_CAL_DAY_VIEW) || + (priv->current_view_type == GNOME_CAL_WORK_WEEK_VIEW)) { + e_day_view_update_marcus_bains (E_DAY_VIEW (gnome_calendar_get_current_view_widget (gcal))); + } + + return TRUE; +} + static void config_hide_completed_tasks_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) { @@ -1319,6 +1335,9 @@ setup_widgets (GnomeCalendar *gcal) e_calendar_view_set_timezone (E_CALENDAR_VIEW (priv->work_week_view), priv->zone); connect_day_view_focus (gcal, E_DAY_VIEW (priv->work_week_view)); + /* The Marcus Bains line */ + priv->update_marcus_bains_line_timeout = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_marcus_bains_line_cb, gcal, NULL); + /* The Week View. */ priv->week_view = e_week_view_new (); e_calendar_view_set_calendar (E_CALENDAR_VIEW (priv->week_view), gcal); @@ -1520,6 +1539,11 @@ gnome_calendar_destroy (GtkObject *object) priv->view_instance = NULL; } + if (priv->update_marcus_bains_line_timeout) { + g_source_remove (priv->update_marcus_bains_line_timeout); + priv->update_marcus_bains_line_timeout = 0; + } + if (priv->view_menus) { g_object_unref (priv->view_menus); priv->view_menus = NULL; |