diff options
author | Li Yuan <li.yuan@sun.com> | 2005-04-28 16:03:47 +0800 |
---|---|---|
committer | Harry Lu <haip@src.gnome.org> | 2005-04-28 16:03:47 +0800 |
commit | f4a4681685477573943f2de5340dfade7e441702 (patch) | |
tree | 2f7decb256b17984f907cf8fdad1caa52c8baab8 /widgets/misc | |
parent | 1cf6d50548e119712555080316946d74071a5992 (diff) | |
download | gsoc2013-evolution-f4a4681685477573943f2de5340dfade7e441702.tar.gz gsoc2013-evolution-f4a4681685477573943f2de5340dfade7e441702.tar.zst gsoc2013-evolution-f4a4681685477573943f2de5340dfade7e441702.zip |
use widget->style instead of hard code colors.
2005-04-28 Li Yuan <li.yuan@sun.com>
* misc/e-calendar-item.c: (e_calendar_item_realize),
(e_calendar_item_set_selection_if_emission),
(e_calendar_item_style_set):
use widget->style instead of hard code colors.
* misc/e-calendar-item.h:
* misc/e-calendar.c: (e_calendar_style_set):
call e_calendar_item_style_set when style changes.
Fixes #6767.
svn path=/trunk/; revision=29234
Diffstat (limited to 'widgets/misc')
-rw-r--r-- | widgets/misc/e-calendar-item.c | 36 | ||||
-rw-r--r-- | widgets/misc/e-calendar-item.h | 1 | ||||
-rw-r--r-- | widgets/misc/e-calendar.c | 4 |
3 files changed, 16 insertions, 25 deletions
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index 8e9c42c544..c3134c07fe 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -691,31 +691,7 @@ e_calendar_item_realize (GnomeCanvasItem *item) 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); } @@ -2974,6 +2950,16 @@ e_calendar_item_set_selection_if_emission (ECalendarItem *calitem, 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 e_calendar_item_set_selection (ECalendarItem *calitem, GDate *start_date, diff --git a/widgets/misc/e-calendar-item.h b/widgets/misc/e-calendar-item.h index d67d71d5cc..4de82cd62c 100644 --- a/widgets/misc/e-calendar-item.h +++ b/widgets/misc/e-calendar-item.h @@ -370,6 +370,7 @@ gint e_calendar_item_get_week_number (ECalendarItem *calitem, gint day, gint month, gint year); +void e_calendar_item_style_set (GtkWidget *widget, ECalendarItem *calitem); #ifdef __cplusplus diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c index c8798b5cfa..e410054ef1 100644 --- a/widgets/misc/e-calendar.c +++ b/widgets/misc/e-calendar.c @@ -265,6 +265,9 @@ static void e_calendar_style_set (GtkWidget *widget, GtkStyle *previous_style) { + ECalendar *e_calendar; + + e_calendar = E_CALENDAR(widget); if (GTK_WIDGET_CLASS (e_calendar_parent_class)->style_set) (*GTK_WIDGET_CLASS (e_calendar_parent_class)->style_set) (widget, previous_style); @@ -274,6 +277,7 @@ e_calendar_style_set (GtkWidget *widget, 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); } |