[evolution/gtk3: 23/47] Avoid using deprecated GdkColormap API



commit bb0c13806bd9521dddfd31fa5ab02991673fa0e3
Author: Vibha Yadav <yvibha novell com>
Date:   Mon Dec 13 14:08:28 2010 +0530

    Avoid using deprecated GdkColormap API
    
    No need to allocate color anymore. GdkColormap API's are deprecated
    gtk+-3.0 onwards

 calendar/gui/e-day-view-main-item.c   |   31 ++++++-------------------------
 calendar/gui/e-day-view-time-item.c   |   13 ++-----------
 calendar/gui/e-day-view-top-item.c    |   26 ++++----------------------
 calendar/gui/e-day-view.c             |   10 +++-------
 calendar/gui/e-meeting-time-sel.c     |    8 ++------
 calendar/gui/e-week-view-event-item.c |   22 ++--------------------
 calendar/gui/e-week-view.c            |   10 +++-------
 7 files changed, 22 insertions(+), 98 deletions(-)
---
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 061224b..335185d 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -158,12 +158,7 @@ day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *main_item,
 					first = FALSE;
 
 					if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), event->comp_data), &bg_color)) {
-						GdkColormap *colormap;
-
-						colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view));
-						if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) {
-							gdk_cairo_set_source_color (cr, &bg_color);
-						}
+						gdk_cairo_set_source_color (cr, &bg_color);
 					}
 				}
 
@@ -278,14 +273,9 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
 
 	if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), event->comp_data),
 			     &bg_color)) {
-		GdkColormap *colormap;
-
-		colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view));
-		if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) {
-			red = bg_color.red;
-			green = bg_color.green;
-			blue = bg_color.blue;
-			}
+		red = bg_color.red;
+		green = bg_color.green;
+		blue = bg_color.blue;
 	}
 
 	is_editing = day_view->editing_event_day == day && day_view->editing_event_num == event_num;
@@ -911,12 +901,7 @@ day_view_main_item_draw_events_in_vbars (EDayViewMainItem *main_item,
 		}
 
 		if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), event->comp_data), &bg_color)) {
-			GdkColormap *colormap;
-
-			colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view));
-			if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) {
-				gdk_cairo_set_source_color (cr, &bg_color);
-			}
+			gdk_cairo_set_source_color (cr, &bg_color);
 		}
 
 		cairo_rectangle (cr, grid_x, bar_y, E_DAY_VIEW_BAR_WIDTH - 2, bar_h);
@@ -1226,11 +1211,7 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
 				&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_cairo_set_source_color (cr, &mb_color);
+			gdk_cairo_set_source_color (cr, &mb_color);
 		}
 		zone = e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view));
 		time_now = icaltime_current_time_with_zone (zone);
diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c
index 35a8e3e..19f776e 100644
--- a/calendar/gui/e-day-view-time-item.c
+++ b/calendar/gui/e-day-view-time-item.c
@@ -431,12 +431,8 @@ edvti_draw_zone (GnomeCanvasItem   *canvas_item,
 		gdk_cairo_set_source_color (cr, &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_cairo_set_source_color (cr, &mb_color);
-			}
+			gdk_cairo_set_source_color (cr, &mb_color);
 		} else
 			mb_color = day_view->colors[E_DAY_VIEW_COLOR_MARCUS_BAINS_LINE];
 
@@ -451,12 +447,7 @@ edvti_draw_zone (GnomeCanvasItem   *canvas_item,
 		mb_color = 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_cairo_set_source_color (cr, &mb_color);
-			}
+			gdk_cairo_set_source_color (cr, &mb_color);
 		}
 	}
 
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index e517e75..9fb81b2 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -107,16 +107,7 @@ day_view_top_item_draw_triangle (EDayViewTopItem *top_item,
 		e_cal_model_get_color_for_component (
 		e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)),
 		event->comp_data), &bg_color)) {
-		GdkColormap *colormap;
-
-		colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view));
-		if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) {
-			gdk_cairo_set_source_color (cr, &bg_color);
-		} else {
-			gdk_cairo_set_source_color (
-				cr, &day_view->colors
-				[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND]);
-		}
+		gdk_cairo_set_source_color (cr, &bg_color);
 	} else {
 		gdk_cairo_set_source_color (
 			cr, &day_view->colors
@@ -210,18 +201,9 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
 		e_cal_model_get_color_for_component (
 		e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)),
 		event->comp_data), &bg_color)) {
-		GdkColormap *colormap;
-
-		colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view));
-		if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) {
-			red = bg_color.red;
-			green = bg_color.green;
-			blue = bg_color.blue;
-		} else {
-			red = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].red;
-			green = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].green;
-			blue = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].blue;
-		}
+		red = bg_color.red;
+		green = bg_color.green;
+		blue = bg_color.blue;
 	} else {
 		red = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].red;
 		green = day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND].green;
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index ea4aad4..286c3d6 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -1440,13 +1440,9 @@ e_day_view_get_text_color (EDayView *day_view, EDayViewEvent *event, GtkWidget *
 
 	if (is_comp_data_valid (event) && gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), event->comp_data),
 	     &bg_color)) {
-                GdkColormap *colormap;
-		colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view));
-		if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) {
-			red = bg_color.red;
-			green = bg_color.green;
-			blue = bg_color.blue;
-                }
+		red = bg_color.red;
+		green = bg_color.green;
+		blue = bg_color.blue;
 	}
 
 	style = gtk_widget_get_style (widget);
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index f1ba207..f774a1d 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -936,15 +936,11 @@ static void
 e_meeting_time_selector_alloc_named_color (EMeetingTimeSelector * mts,
 					   const gchar *name, GdkColor *c)
 {
-	GdkColormap *colormap;
-
 	g_return_if_fail (name != NULL);
 	g_return_if_fail (c != NULL);
 
-	gdk_color_parse (name, c);
-	colormap = gtk_widget_get_colormap (GTK_WIDGET (mts));
-	if (!gdk_colormap_alloc_color (colormap, c, TRUE, TRUE))
-		g_warning ("Failed to allocate color: %s\n", name);
+	if ( !gdk_color_parse (name, c))
+		g_warning ("Failed to parse color: %s\n", name);
 }
 
 static void
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 68884cc..cb35dfb 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -559,20 +559,7 @@ week_view_event_item_draw_triangle (EWeekViewEventItem *event_item,
 		e_cal_model_get_color_for_component (model, event->comp_data);
 
 	if (gdk_color_parse (color_spec, &bg_color)) {
-		GdkColormap *colormap;
-
-		colormap = gtk_widget_get_colormap (GTK_WIDGET (week_view));
-		if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) {
-			gdk_cairo_set_source_color (cr, &bg_color);
-		} else {
-			EWeekViewColors wvc;
-			GdkColor *color;
-
-			wvc = E_WEEK_VIEW_COLOR_EVENT_BACKGROUND;
-			color = &week_view->colors[wvc];
-
-			gdk_cairo_set_source_color (cr, color);
-		}
+		gdk_cairo_set_source_color (cr, &bg_color);
 	} else {
 		EWeekViewColors wvc;
 		GdkColor *color;
@@ -813,12 +800,7 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
 
 	bg_color = week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND];
 	if (gdk_color_parse (color_spec, &bg_color)) {
-		GdkColormap *colormap;
-
-		colormap = gtk_widget_get_colormap (GTK_WIDGET (week_view));
-		if (!gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) {
-			bg_color = week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND];
-		}
+		bg_color = week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND];
 	}
 
 	red = bg_color.red;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 8e1b974..4137d99 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -1045,13 +1045,9 @@ e_week_view_get_text_color (EWeekView *week_view, EWeekViewEvent *event, GtkWidg
 
 	if (is_comp_data_valid (event) && gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)), event->comp_data),
 	     &bg_color)) {
-                GdkColormap *colormap;
-		colormap = gtk_widget_get_colormap (GTK_WIDGET (week_view));
-		if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) {
-			red = bg_color.red;
-			green = bg_color.green;
-			blue = bg_color.blue;
-                }
+		red = bg_color.red;
+		green = bg_color.green;
+		blue = bg_color.blue;
 	}
 
 	style = gtk_widget_get_style (widget);



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