[evolution-patches] patch for #272301 (Add Marcus Bains Line to Calendar)



This is a patch to add a Marcus Bains Line to the Calendar.  I think
I've addressed all the comments and suggestions from the discussion on
evolution-hackers.

Thouis Jones
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2714
diff -c -r1.2714 ChangeLog
*** calendar/ChangeLog	18 Apr 2005 14:32:16 -0000	1.2714
--- calendar/ChangeLog	28 Apr 2005 17:35:02 -0000
***************
*** 1,3 ****
--- 1,24 ----
+ 2005-04-28  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-04-18  Chenthill Palanisamy  <pchenthill novell com>
  
  	Fixes #274476
Index: calendar/gui/apps_evolution_calendar.schemas.in.in
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/apps_evolution_calendar.schemas.in.in,v
retrieving revision 1.7
diff -c -r1.7 apps_evolution_calendar.schemas.in.in
*** calendar/gui/apps_evolution_calendar.schemas.in.in	8 Feb 2005 00:35:55 -0000	1.7
--- calendar/gui/apps_evolution_calendar.schemas.in.in	28 Apr 2005 17:35:02 -0000
***************
*** 195,200 ****
--- 195,236 ----
        </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>
Index: calendar/gui/calendar-config-keys.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config-keys.h,v
retrieving revision 1.6
diff -c -r1.6 calendar-config-keys.h
*** calendar/gui/calendar-config-keys.h	18 Dec 2004 13:01:17 -0000	1.6
--- calendar/gui/calendar-config-keys.h	28 Apr 2005 17:35:03 -0000
***************
*** 39,44 ****
--- 39,47 ----
  #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"
Index: calendar/gui/calendar-config.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.c,v
retrieving revision 1.72
diff -c -r1.72 calendar-config.c
*** calendar/gui/calendar-config.c	31 Dec 2004 16:59:18 -0000	1.72
--- calendar/gui/calendar-config.c	28 Apr 2005 17:35:03 -0000
***************
*** 444,449 ****
--- 444,477 ----
  	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)
Index: calendar/gui/calendar-config.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.h,v
retrieving revision 1.36
diff -c -r1.36 calendar-config.h
*** calendar/gui/calendar-config.h	31 Dec 2004 16:59:18 -0000	1.36
--- calendar/gui/calendar-config.h	28 Apr 2005 17:35:03 -0000
***************
*** 117,122 ****
--- 117,126 ----
  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);
Index: calendar/gui/e-day-view-config.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view-config.c,v
retrieving revision 1.7
diff -c -r1.7 e-day-view-config.c
*** calendar/gui/e-day-view-config.c	2 Nov 2004 19:25:47 -0000	1.7
--- calendar/gui/e-day-view-config.c	28 Apr 2005 17:35:03 -0000
***************
*** 355,360 ****
--- 355,382 ----
  }
  
  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,385 ****
  e_day_view_config_set_view (EDayViewConfig *view_config, EDayView *day_view) 
  {
  	EDayViewConfigPrivate *priv;
! 	guint not;
  	GList *l;
  	
  	g_return_if_fail (view_config != NULL);
--- 401,407 ----
  e_day_view_config_set_view (EDayViewConfig *view_config, EDayView *day_view) 
  {
  	EDayViewConfigPrivate *priv;
! 	guint not, not_1, not_2;
  	GList *l;
  	
  	g_return_if_fail (view_config != NULL);
***************
*** 457,462 ****
--- 479,492 ----
  
  	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, &not, &not_1, &not_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);
Index: calendar/gui/e-day-view-main-item.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view-main-item.c,v
retrieving revision 1.40
diff -c -r1.40 e-day-view-main-item.c
*** calendar/gui/e-day-view-main-item.c	8 Jan 2005 10:53:52 -0000	1.40
--- calendar/gui/e-day-view-main-item.c	28 Apr 2005 17:35:03 -0000
***************
*** 35,40 ****
--- 35,41 ----
  #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,304 ****
--- 300,343 ----
  						      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);
+ 			}
+ 		}
+ 	}
+ 
+ 
  }
  
  
Index: calendar/gui/e-day-view-time-item.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view-time-item.c,v
retrieving revision 1.29
diff -c -r1.29 e-day-view-time-item.c
*** calendar/gui/e-day-view-time-item.c	14 Oct 2004 14:44:41 -0000	1.29
--- calendar/gui/e-day-view-time-item.c	28 Apr 2005 17:35:03 -0000
***************
*** 40,45 ****
--- 40,46 ----
  #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,258 ****
  	EDayView *day_view;
  	EDayViewTimeItem *dvtmitem;
  	GtkStyle *style;
! 	GdkGC *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;
--- 253,259 ----
  	EDayView *day_view;
  	EDayViewTimeItem *dvtmitem;
  	GtkStyle *style;
! 	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,283 ****
--- 279,285 ----
  	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,336 ****
--- 333,362 ----
  			    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;
***************
*** 613,619 ****
  
  	dvtmitem->dragging_selection = FALSE;
  }
- 
  
  static void
  e_day_view_time_item_on_motion_notify (EDayViewTimeItem *dvtmitem,
--- 639,644 ----
Index: calendar/gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.270
diff -c -r1.270 e-day-view.c
*** calendar/gui/e-day-view.c	21 Mar 2005 14:29:16 -0000	1.270
--- calendar/gui/e-day-view.c	28 Apr 2005 17:35:05 -0000
***************
*** 716,721 ****
--- 716,725 ----
  	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,1166 ****
--- 1165,1171 ----
  	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
***************
*** 2467,2472 ****
--- 2472,2530 ----
  
  	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
Index: calendar/gui/e-day-view.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.h,v
retrieving revision 1.63
diff -c -r1.63 e-day-view.h
*** calendar/gui/e-day-view.h	8 Jan 2005 10:53:53 -0000	1.63
--- calendar/gui/e-day-view.h	28 Apr 2005 17:35:05 -0000
***************
*** 153,158 ****
--- 153,160 ----
  	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,283 ****
--- 280,290 ----
  	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,498 ****
--- 500,512 ----
  						 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,
***************
*** 572,577 ****
--- 586,593 ----
  				     gint start_row,
  				     gint end_row);
  
+ 
+ void e_day_view_update_marcus_bains (EDayView *day_view);
  
  G_END_DECLS
  
Index: calendar/gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.372
diff -c -r1.372 gnome-cal.c
*** calendar/gui/gnome-cal.c	7 Apr 2005 18:12:50 -0000	1.372
--- calendar/gui/gnome-cal.c	28 Apr 2005 17:35:06 -0000
***************
*** 138,143 ****
--- 138,144 ----
  	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,1092 ****
--- 1088,1108 ----
  	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,1324 ****
--- 1335,1343 ----
  	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);
***************
*** 1518,1523 ****
--- 1537,1547 ----
  		if (priv->view_instance) {
  			g_object_unref (priv->view_instance);
  			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) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]