aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/ChangeLog12
-rw-r--r--widgets/misc/e-calendar-item.c58
-rw-r--r--widgets/misc/test-calendar.c75
3 files changed, 46 insertions, 99 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 9b02d98ea1..38018ef811 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,15 @@
+2004-12-14 Rodney Dawes <dobey@novell.com>
+
+ * e-calendar-item.c (e_calendar_item_draw): Use gtk_paint_foo instead
+ of the deprecated gtk_draw_foo functions
+ (e_calendar_item_get_day_style): Use colors from the theme for the
+ background and foreground of various items
+
+ * test-calendar.c (main): Don't set a callback for getting the day
+ style, we want the test app to use the widget defaults
+ (get_day_style): Remove all this duplicated code as we want to use
+ the widget default colors for day fg/bg
+
2004-11-26 JP Rosevear <jpr@novell.com>
* test-info-label.c: test prog
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 4765bdb8d5..8e9c42c544 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -940,11 +940,11 @@ e_calendar_item_draw (GnomeCanvasItem *canvas_item,
calitem->y2 - calitem->y1 + 1);
/* Draw the shadow around the entire item. */
- gtk_draw_shadow (style, drawable,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- calitem->x1 - x, calitem->y1 - y,
- calitem->x2 - calitem->x1 + 1,
- calitem->y2 - calitem->y1 + 1);
+ gtk_paint_shadow (style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN,
+ NULL, NULL, "entry",
+ calitem->x1 - x, calitem->y1 - y,
+ calitem->x2 - calitem->x1 + 1,
+ calitem->y2 - calitem->y1 + 1);
row_y = canvas_item->y1 + ythickness;
bar_height = ythickness * 2
@@ -961,24 +961,27 @@ e_calendar_item_draw (GnomeCanvasItem *canvas_item,
- xthickness * 2,
bar_height);
- gtk_draw_shadow (style, drawable,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- calitem->x1 + xthickness - x, row_y - y,
- calitem->x2 - calitem->x1 + 1
- - xthickness * 2,
- bar_height);
+ gtk_paint_shadow (style, drawable,
+ GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+ NULL, NULL, "calendar-header",
+ calitem->x1 + xthickness - x, row_y - y,
+ calitem->x2 - calitem->x1 + 1
+ - xthickness * 2,
+ bar_height);
for (col = 0; col < calitem->cols; col++) {
if (col != 0) {
col_x = calitem->x1 + calitem->x_offset
+ calitem->month_width * col;
- gtk_draw_vline (style, drawable,
- GTK_STATE_NORMAL,
- row_y + ythickness + 1 - y,
- row_y + bar_height
- - ythickness - 2 - y,
- col_x - 1 - x);
+ gtk_paint_vline (style, drawable,
+ GTK_STATE_NORMAL,
+ NULL, NULL,
+ "calendar-separator",
+ row_y + ythickness + 1 - y,
+ row_y + bar_height
+ - ythickness - 2 - y,
+ col_x - 1 - x);
}
@@ -1860,6 +1863,12 @@ e_calendar_item_get_day_style (ECalendarItem *calitem,
GdkColor **box_color,
gboolean *bold)
{
+ GtkWidget *widget;
+ GtkStyle *style;
+
+ widget = GTK_WIDGET (GNOME_CANVAS_ITEM (calitem)->canvas);
+ style = widget->style;
+
*bg_color = NULL;
*fg_color = NULL;
*box_color = NULL;
@@ -1872,15 +1881,16 @@ e_calendar_item_get_day_style (ECalendarItem *calitem,
*box_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX];
if (prev_or_next_month)
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG];
+ *fg_color = &style->mid[GTK_WIDGET_STATE (widget)];
if (selected) {
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG];
- if (has_focus)
- *bg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG_FOCUSED];
- else
- *bg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG];
-
+ if (has_focus) {
+ *fg_color = &style->text[GTK_STATE_SELECTED];
+ *bg_color = &style->base[GTK_STATE_SELECTED];
+ } else {
+ *fg_color = &style->text[GTK_STATE_ACTIVE];
+ *bg_color = &style->base[GTK_STATE_ACTIVE];
+ }
}
}
diff --git a/widgets/misc/test-calendar.c b/widgets/misc/test-calendar.c
index f156e66599..2b017ae6fe 100644
--- a/widgets/misc/test-calendar.c
+++ b/widgets/misc/test-calendar.c
@@ -50,21 +50,6 @@ static guint n_targets = sizeof(target_table) / sizeof(target_table[0]);
static void on_date_range_changed (ECalendarItem *calitem);
static void on_selection_changed (ECalendarItem *calitem);
-static void get_day_style (ECalendarItem *calitem,
- gint year,
- gint month,
- gint day,
- gint day_style,
- gboolean today,
- gboolean prev_or_next_month,
- gboolean selected,
- gboolean has_focus,
- gboolean drop_target,
- GdkColor **bg_color,
- GdkColor **fg_color,
- GdkColor **box_color,
- gboolean *bold,
- gpointer data);
static void
delete_event_cb (GtkWidget *widget,
@@ -96,8 +81,6 @@ main (int argc, char **argv)
e_calendar_set_minimum_size (E_CALENDAR (cal), 1, 1);
calitem = E_CALENDAR (cal)->calitem;
gtk_widget_show (cal);
- e_calendar_item_set_style_callback (calitem, get_day_style,
- NULL, NULL);
g_signal_connect((calitem), "date_range_changed",
G_CALLBACK (on_date_range_changed), NULL);
@@ -161,61 +144,3 @@ on_selection_changed (ECalendarItem *calitem)
g_date_get_month (&end_date),
g_date_get_year (&end_date));
}
-
-
-static void
-get_day_style (ECalendarItem *calitem,
- gint year,
- gint month,
- gint day,
- gint day_style,
- gboolean today,
- gboolean prev_or_next_month,
- gboolean selected,
- gboolean has_focus,
- gboolean drop_target,
- GdkColor **bg_color,
- GdkColor **fg_color,
- GdkColor **box_color,
- gboolean *bold,
- gpointer data)
-{
- *bg_color = NULL;
- *fg_color = NULL;
- *box_color = NULL;
- *bold = FALSE;
-
-#if 1
-
- if (day_style == 1)
- *bold = TRUE;
-
- if (today)
- *box_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX];
-
- if (prev_or_next_month)
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG];
-
- if (selected) {
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG];
- *bg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG];
- }
-
-#else
-
- if (day_style == 1)
- *bold = TRUE;
-
- if (today)
- *box_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG];
-
- if (prev_or_next_month)
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX];
-
- if (selected) {
- *fg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG];
- *bg_color = &calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG];
- }
-
-#endif
-}