[Evolution-hackers] The calendar appears to be using hard-coded colours



Hi,

The attachment is a patch for bugzilla #6767.

http://bugzilla.ximian.com/show_bug.cgi?id=6767

But it is for evolution1.4 now. Could you give me some advice about the
patch? If there aren't any better way, I will try to port it to
evolution 1.5.

Thanks,
Li


Index: calendar/gui/e-day-view-main-item.c
===================================================================
RCS file: /export/src/cvs/evolution/calendar/gui/e-day-view-main-item.c,v
retrieving revision 1.2
diff -u -r1.2 e-day-view-main-item.c
--- calendar/gui/e-day-view-main-item.c	2003/10/17 02:04:59	1.2
+++ calendar/gui/e-day-view-main-item.c	2004/09/16 08:49:29
@@ -490,20 +490,22 @@
 	   column of the day, we might not want to paint over the vertical bar,
 	   since that is used for multiple events. But then you can't see
 	   where the event in the first column finishes. */
+	gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND]);
 #if 1
 	if (event->start_row_or_col == 0)
-		gdk_draw_rectangle (drawable, style->white_gc, TRUE,
+		gdk_draw_rectangle (drawable, gc, TRUE,
 				    item_x + E_DAY_VIEW_BAR_WIDTH, item_y + 1,
 				    MAX (item_w - E_DAY_VIEW_BAR_WIDTH - 1, 0),
 				    item_h - 2);
 	else
 #endif
-		gdk_draw_rectangle (drawable, style->white_gc, TRUE,
+		gdk_draw_rectangle (drawable, gc, TRUE,
 				    item_x + 1, item_y + 1,
 				    MAX (item_w - 2, 0), item_h - 2);
 
 	/* Draw the right edge of the vertical bar. */
-	gdk_draw_line (drawable, style->black_gc,
+	gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER]);
+	gdk_draw_line (drawable, gc,
 		       item_x + E_DAY_VIEW_BAR_WIDTH - 1,
 		       item_y + 1,
 		       item_x + E_DAY_VIEW_BAR_WIDTH - 1,
@@ -527,6 +529,7 @@
 	/* Only fill it in if the event isn't TRANSPARENT. */
 	cal_component_get_transparency (event->comp, &transparency);
 	if (transparency != CAL_COMPONENT_TRANSP_TRANSPARENT) {
+		gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR]);
 		gdk_draw_rectangle (drawable, gc, TRUE,
 				    item_x + 1, bar_y1,
 				    E_DAY_VIEW_BAR_WIDTH - 2, bar_y2 - bar_y1);
@@ -535,8 +538,10 @@
 	/* Draw the box around the entire event. Do this after drawing
 	   the colored bar so we don't have to worry about being 1
 	   pixel out. */
-	gdk_draw_rectangle (drawable, style->black_gc, FALSE,
+	gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER]);
+	gdk_draw_rectangle (drawable, gc, FALSE,
 			    item_x, item_y, MAX (item_w - 1, 0), item_h - 1);
+	gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR]);
 
 #if 0
 	/* Draw the horizontal bars above and beneath the event if it
Index: calendar/gui/e-day-view.c
===================================================================
RCS file: /export/src/cvs/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.13
diff -u -r1.13 e-day-view.c
--- calendar/gui/e-day-view.c	2004/08/18 10:56:03	1.13
+++ calendar/gui/e-day-view.c	2004/09/16 08:49:29
@@ -130,6 +130,7 @@
 static void e_day_view_init (EDayView *day_view);
 static void e_day_view_destroy (GtkObject *object);
 static void e_day_view_realize (GtkWidget *widget);
+static void e_day_view_set_colors(EDayView *day_view, GtkWidget *widget);
 static void e_day_view_unrealize (GtkWidget *widget);
 static void e_day_view_style_set (GtkWidget *widget,
 				  GtkStyle  *previous_style);
@@ -998,65 +999,8 @@
 	colormap = gtk_widget_get_colormap (widget);
 
 	/* Allocate the colors. */
-	day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING].red   = 247 * 257;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING].green = 247 * 257;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING].blue  = 244 * 257;
-
-	day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING].red   = 216 * 257;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING].green = 216 * 257;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING].blue  = 214 * 257;
-
-	day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED].red   = 0 * 257;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED].green = 0 * 257;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED].blue  = 156 * 257;
-
-	day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED].red   = 16 * 257;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED].green = 78 * 257;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED].blue  = 139 * 257;
-
-	day_view->colors[E_DAY_VIEW_COLOR_BG_GRID].red   = 0x8000;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_GRID].green = 0x8000;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_GRID].blue  = 0x8000;
-
-	day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS].red   = 0x8000;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS].green = 0x8000;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS].blue  = 0x8000;
-
-	day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED].red   = 65535;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED].green = 65535;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED].blue  = 65535;
-
-	day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_GRID].red   = 0;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_GRID].green = 0;
-	day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_GRID].blue  = 0;
-
-	day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR].red   = 0;
-	day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR].green = 0;
-	day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR].blue  = 65535;
-
-	day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND].red   = 65535;
-	day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND].green = 65535;
-	day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND].blue  = 65535;
-
-	day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER].red   = 0;
-	day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER].green = 0;
-	day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER].blue  = 0;
-
-	day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].red   = 213 * 257;
-	day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].green = 213 * 257;
-	day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].blue  = 213 * 257;
-
-	day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER].red   = 0;
-	day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER].green = 0;
-	day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER].blue  = 0;
-
-	nfailed = gdk_colormap_alloc_colors (colormap, day_view->colors,
-					     E_DAY_VIEW_COLOR_LAST, FALSE,
-					     TRUE, success);
-	if (nfailed)
-		g_warning ("Failed to allocate all colors");
+	e_day_view_set_colors(day_view, widget);
 
-
 	/* Create the pixmaps. */
 	day_view->reminder_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &day_view->reminder_mask, NULL, bell_xpm);
 	day_view->recurrence_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &day_view->recurrence_mask, NULL, recur_xpm);
@@ -1111,6 +1055,25 @@
 
 
 static void
+e_day_view_set_colors(EDayView *day_view, GtkWidget *widget)
+{
+	day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING] = widget->style->base[GTK_STATE_NORMAL];
+        day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING] = widget->style->bg[GTK_STATE_ACTIVE];
+	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->fg[GTK_STATE_INSENSITIVE];
+        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->fg[GTK_STATE_INSENSITIVE];
+        day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR] = widget->style->base[GTK_STATE_SELECTED];
+        day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND] = widget->style->base[GTK_STATE_NORMAL];
+        day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER] = widget->style->fg[GTK_STATE_INSENSITIVE];
+        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->fg[GTK_STATE_INSENSITIVE];
+}
+
+
+static void
 e_day_view_unrealize (GtkWidget *widget)
 {
 	EDayView *day_view;
@@ -1152,11 +1115,40 @@
 	PangoContext *pango_context;
 	PangoFontMetrics *font_metrics;
 	PangoLayout *layout;
+	gint week_day, event_num;
+	EDayViewEvent *event;
 
 	if (GTK_WIDGET_CLASS (parent_class)->style_set)
 		(*GTK_WIDGET_CLASS (parent_class)->style_set)(widget, previous_style);
 
 	day_view = E_DAY_VIEW (widget);
+	e_day_view_set_colors(day_view, widget);
+	
+	for (week_day = 0; week_day < E_DAY_VIEW_MAX_DAYS; week_day++){
+		for (event_num = 0; event_num < day_view->events[week_day]->len; event_num++) {
+        		event = &g_array_index (day_view->events[week_day], EDayViewEvent, event_num);
+	                if (event->canvas_item)
+				gnome_canvas_item_set (event->canvas_item,
+                                                       "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
+                                                       NULL);
+	        }
+	}
+	for (event_num = 0; event_num < day_view->long_events->len; event_num++) {
+		event = &g_array_index (day_view->long_events, EDayViewEvent, event_num);
+		if (event->canvas_item)
+			gnome_canvas_item_set (event->canvas_item,
+					       "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
+					       NULL);
+	}
+	gnome_canvas_item_set (day_view->main_canvas_top_resize_bar_item,
+                               "fill_color_gdk", &day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR],
+                               "outline_color_gdk", &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER],
+                               NULL);
+
+        gnome_canvas_item_set (day_view->main_canvas_bottom_resize_bar_item,
+                               "fill_color_gdk", &day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR],
+                               "outline_color_gdk", &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER],
+                               NULL);
 
 	/* Set up Pango prerequisites */
 	font_desc = gtk_widget_get_style (widget)->font_desc;
@@ -5263,6 +5255,9 @@
 	}
 
 	if (!event->canvas_item) {
+		GtkWidget *widget;
+
+		widget = (GtkWidget *)day_view;
 		event->canvas_item =
 			gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->top_canvas)->root),
 					       e_text_get_type (),
@@ -5272,7 +5267,7 @@
 					       "editable", TRUE,
 					       "use_ellipsis", TRUE,
 					       "draw_background", FALSE,
-					       "fill_color_rgba", GNOME_CANVAS_COLOR(0, 0, 0),
+					       "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
 					       "im_context", E_CANVAS (day_view->top_canvas)->im_context,
 					       NULL);
 		g_signal_connect (event->canvas_item, "event",
@@ -5435,6 +5430,9 @@
 		}
 
 		if (!event->canvas_item) {
+			GtkWidget *widget;
+
+			widget = (GtkWidget *)day_view;
 			event->canvas_item =
 				gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->main_canvas)->root),
 						       e_text_get_type (),
@@ -5444,7 +5442,7 @@
 						       "clip", TRUE,
 						       "use_ellipsis", TRUE,
 						       "draw_background", FALSE,
-						       "fill_color_rgba", GNOME_CANVAS_COLOR(0, 0, 0),
+						       "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
 						       "im_context", E_CANVAS (day_view->main_canvas)->im_context,
 						       NULL);
 			g_signal_connect (event->canvas_item, "event",
Index: calendar/gui/e-week-view.c
===================================================================
RCS file: /export/src/cvs/evolution/calendar/gui/e-week-view.c,v
retrieving revision 1.15
diff -u -r1.15 e-week-view.c
--- calendar/gui/e-week-view.c	2004/08/18 10:56:03	1.15
+++ calendar/gui/e-week-view.c	2004/09/16 08:49:29
@@ -99,6 +99,7 @@
 static void e_week_view_init (EWeekView *week_view);
 static void e_week_view_destroy (GtkObject *object);
 static void e_week_view_realize (GtkWidget *widget);
+static void e_week_view_set_colors(EWeekView *week_view, GtkWidget *widget);
 static void e_week_view_unrealize (GtkWidget *widget);
 static void e_week_view_style_set (GtkWidget *widget,
 				   GtkStyle  *previous_style);
@@ -564,57 +565,8 @@
 	colormap = gtk_widget_get_colormap (widget);
 
 	/* Allocate the colors. */
-	week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS].red   = 0xe0e0;
-	week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS].green = 0xe0e0;
-	week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS].blue  = 0xe0e0;
-
-	week_view->colors[E_WEEK_VIEW_COLOR_ODD_MONTHS].red   = 65535;
-	week_view->colors[E_WEEK_VIEW_COLOR_ODD_MONTHS].green = 65535;
-	week_view->colors[E_WEEK_VIEW_COLOR_ODD_MONTHS].blue  = 65535;
-
-	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND].red   = 213 * 257;
-	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND].green = 213 * 257;
-	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND].blue  = 213 * 257;
-
-	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER].red   = 0;
-	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER].green = 0;
-	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER].blue  = 0;
-
-	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_TEXT].red   = 0;
-	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_TEXT].green = 0;
-	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_TEXT].blue  = 0;
-
-	week_view->colors[E_WEEK_VIEW_COLOR_GRID].red   = 0 * 257;
-	week_view->colors[E_WEEK_VIEW_COLOR_GRID].green = 0 * 257;
-	week_view->colors[E_WEEK_VIEW_COLOR_GRID].blue  = 0 * 257;
-
-	week_view->colors[E_WEEK_VIEW_COLOR_SELECTED].red   = 0 * 257;
-	week_view->colors[E_WEEK_VIEW_COLOR_SELECTED].green = 0 * 257;
-	week_view->colors[E_WEEK_VIEW_COLOR_SELECTED].blue  = 156 * 257;
-
-	week_view->colors[E_WEEK_VIEW_COLOR_SELECTED_UNFOCUSSED].red   = 16 * 257;
-	week_view->colors[E_WEEK_VIEW_COLOR_SELECTED_UNFOCUSSED].green = 78 * 257;
-	week_view->colors[E_WEEK_VIEW_COLOR_SELECTED_UNFOCUSSED].blue  = 139 * 257;
-
-	week_view->colors[E_WEEK_VIEW_COLOR_DATES].red   = 0 * 257;
-	week_view->colors[E_WEEK_VIEW_COLOR_DATES].green = 0 * 257;
-	week_view->colors[E_WEEK_VIEW_COLOR_DATES].blue  = 0 * 257;
-
-	week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED].red   = 65535;
-	week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED].green = 65535;
-	week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED].blue  = 65535;
-
-	week_view->colors[E_WEEK_VIEW_COLOR_TODAY].red   = 65535;
-	week_view->colors[E_WEEK_VIEW_COLOR_TODAY].green = 0;
-	week_view->colors[E_WEEK_VIEW_COLOR_TODAY].blue  = 0;
-
-	nfailed = gdk_colormap_alloc_colors (colormap, week_view->colors,
-					     E_WEEK_VIEW_COLOR_LAST, FALSE,
-					     TRUE, success);
-	if (nfailed)
-		g_warning ("Failed to allocate all colors");
+	e_week_view_set_colors(week_view, widget);
 
-
 	/* Create the pixmaps. */
 	week_view->reminder_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &week_view->reminder_mask, NULL, bell_xpm);
 	week_view->recurrence_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &week_view->recurrence_mask, NULL, recur_xpm);
@@ -622,6 +574,23 @@
 }
 
 
+static void 
+e_week_view_set_colors(EWeekView *week_view, GtkWidget *widget)
+{
+	week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS] = widget->style->base[GTK_STATE_INSENSITIVE]; 
+	week_view->colors[E_WEEK_VIEW_COLOR_ODD_MONTHS] = widget->style->base[GTK_STATE_NORMAL];
+	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND] = widget->style->base[GTK_STATE_NORMAL];
+	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER] = widget->style->fg[GTK_STATE_INSENSITIVE];
+	week_view->colors[E_WEEK_VIEW_COLOR_EVENT_TEXT] = widget->style->text[GTK_STATE_NORMAL];
+	week_view->colors[E_WEEK_VIEW_COLOR_GRID] = widget->style->fg[GTK_STATE_INSENSITIVE];
+	week_view->colors[E_WEEK_VIEW_COLOR_SELECTED] = widget->style->base[GTK_STATE_SELECTED]; 
+	week_view->colors[E_WEEK_VIEW_COLOR_SELECTED_UNFOCUSSED] = widget->style->bg[GTK_STATE_SELECTED];
+	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];
+}	
+
+
 static void
 e_week_view_unrealize (GtkWidget *widget)
 {
@@ -687,12 +656,14 @@
 	GtkStyle *style;
 	gint day, day_width, max_day_width, max_abbr_day_width;
 	gint month, month_width, max_month_width, max_abbr_month_width;
+	gint span_num;
 	GDate date;
 	gchar buffer[128];
 	PangoFontDescription *font_desc;
 	PangoContext *pango_context;
 	PangoFontMetrics *font_metrics;
 	PangoLayout *layout;
+	EWeekViewEventSpan *span;
 
 	if (GTK_WIDGET_CLASS (parent_class)->style_set)
 		(*GTK_WIDGET_CLASS (parent_class)->style_set)(widget, previous_style);
@@ -700,6 +671,20 @@
 	week_view = E_WEEK_VIEW (widget);
 	style = gtk_widget_get_style (widget);
 
+	e_week_view_set_colors(week_view, widget);
+        if (week_view->spans) {
+		for (span_num = 0; span_num < week_view->spans->len;
+             	     span_num++) {
+        		span = &g_array_index (week_view->spans,
+	                               	       EWeekViewEventSpan, span_num);
+	        	if (span->text_item){
+				gnome_canvas_item_set (span->text_item,
+	                        	               "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
+		                        	       NULL);
+	            	}
+		}
+	}
+	
 	/* Set up Pango prerequisites */
 	font_desc = style->font_desc;
 	pango_context = gtk_widget_get_pango_context (widget);
@@ -2913,7 +2898,9 @@
 	/* Create the text item if necessary. */
 	if (!span->text_item) {
 		CalComponentText text;
-
+		GtkWidget *widget;
+	
+		widget = (GtkWidget *)week_view;
 		cal_component_get_summary (comp, &text);
 		span->text_item =
 			gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (week_view->main_canvas)->root),
@@ -2924,7 +2911,7 @@
 					       "editable", TRUE,
 					       "text", text.value ? text.value : "",
 					       "use_ellipsis", TRUE,
-					       "fill_color_rgba", GNOME_CANVAS_COLOR(0, 0, 0),
+					       "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
 					       "im_context", E_CANVAS (week_view->main_canvas)->im_context,
 					       NULL);
 		g_signal_connect (span->text_item, "event",
Index: widgets/misc/e-calendar-item.c
===================================================================
RCS file: /export/src/cvs/evolution/widgets/misc/e-calendar-item.c,v
retrieving revision 1.6
diff -u -r1.6 e-calendar-item.c
--- widgets/misc/e-calendar-item.c	2004/08/19 12:59:54	1.6
+++ widgets/misc/e-calendar-item.c	2004/09/16 08:49:31
@@ -700,31 +700,7 @@
 
 	colormap = gtk_widget_get_colormap (GTK_WIDGET (item->canvas));
 
-	calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX].red   = 65535;
-	calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX].green = 0;
-	calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX].blue  = 0;
-
-	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG].red   = 65535;
-	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG].green = 65535;
-	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG].blue  = 65535;
-
-	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG_FOCUSED].red   = 4700;
-	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG_FOCUSED].green = 4700;
-	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG_FOCUSED].blue  = 65535;
-
-	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG].red   = 47000;
-	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG].green = 47000;
-	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG].blue  = 48000;
-
-	calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG].red   = 47000;
-	calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG].green = 47000;
-	calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG].blue  = 48000;
-
-	nfailed = gdk_colormap_alloc_colors (colormap, calitem->colors,
-					     E_CALENDAR_ITEM_COLOR_LAST, FALSE,
-					     TRUE, success);
-	if (nfailed)
-		g_warning ("Failed to allocate all colors");
+	e_calendar_item_style_set (GTK_WIDGET(item->canvas), calitem);
 }
 
 
@@ -2920,6 +2896,15 @@
 
 	if (need_update)
 		gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
+}
+
+void e_calendar_item_style_set (GtkWidget *widget, ECalendarItem *calitem)
+{
+	calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX] = widget->style->bg[GTK_STATE_SELECTED];
+	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG] = widget->style->base[GTK_STATE_NORMAL];
+	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG_FOCUSED] = widget->style->bg[GTK_STATE_SELECTED];
+	calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG] = widget->style->fg[GTK_STATE_INSENSITIVE];
+	calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG] = widget->style->fg[GTK_STATE_INSENSITIVE];
 }
 
 void
Index: widgets/misc/e-calendar-item.h
===================================================================
RCS file: /export/src/cvs/evolution/widgets/misc/e-calendar-item.h,v
retrieving revision 1.3
diff -u -r1.3 e-calendar-item.h
--- widgets/misc/e-calendar-item.h	2003/10/21 09:04:01	1.3
+++ widgets/misc/e-calendar-item.h	2004/09/16 08:49:31
@@ -371,6 +371,8 @@
 					 gint		month,
 					 gint		year);
 
+void e_calendar_item_style_set (GtkWidget *widget, ECalendarItem *calitem);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
Index: widgets/misc/e-calendar.c
===================================================================
RCS file: /export/src/cvs/evolution/widgets/misc/e-calendar.c,v
retrieving revision 1.5
diff -u -r1.5 e-calendar.c
--- widgets/misc/e-calendar.c	2004/08/19 12:59:54	1.5
+++ widgets/misc/e-calendar.c	2004/09/16 08:49:31
@@ -280,6 +280,9 @@
 e_calendar_style_set		(GtkWidget	*widget,
 				 GtkStyle	*previous_style)
 {
+	ECalendar *e_calendar;
+
+	e_calendar = E_CALENDAR(widget);
 	if (GTK_WIDGET_CLASS (parent_class)->style_set)
 		(*GTK_WIDGET_CLASS (parent_class)->style_set) (widget,
 							       previous_style);
@@ -289,6 +292,7 @@
 	if (GTK_WIDGET_REALIZED (widget->parent))
 		gdk_window_set_background (GTK_LAYOUT (widget)->bin_window,
 					   &widget->style->bg[GTK_STATE_NORMAL]);
+	e_calendar_item_style_set (widget, e_calendar->calitem);
 }
 
 


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