calendar: Use the widget state flags as a base for drawing days
Instead of building a set of state flags specifically for drawing days, base it on the underlying widget state flags.
This commit is contained in:
@ -2590,6 +2590,7 @@ calendar_paint_day (GtkCalendar *calendar,
|
|||||||
g_return_if_fail (col < 7);
|
g_return_if_fail (col < 7);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
state = gtk_widget_get_state_flags (widget);
|
||||||
|
|
||||||
day = priv->day[row][col];
|
day = priv->day[row][col];
|
||||||
show_details = (priv->display_flags & GTK_CALENDAR_SHOW_DETAILS);
|
show_details = (priv->display_flags & GTK_CALENDAR_SHOW_DETAILS);
|
||||||
@ -2598,12 +2599,7 @@ calendar_paint_day (GtkCalendar *calendar,
|
|||||||
|
|
||||||
gtk_style_context_save (context);
|
gtk_style_context_save (context);
|
||||||
|
|
||||||
if (!gtk_widget_get_sensitive (widget))
|
state &= ~(GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_SELECTED);
|
||||||
state |= GTK_STATE_FLAG_INSENSITIVE;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (gtk_widget_has_focus (widget))
|
|
||||||
state |= GTK_STATE_FLAG_FOCUSED;
|
|
||||||
|
|
||||||
if (priv->day_month[row][col] == MONTH_PREV ||
|
if (priv->day_month[row][col] == MONTH_PREV ||
|
||||||
priv->day_month[row][col] == MONTH_NEXT)
|
priv->day_month[row][col] == MONTH_NEXT)
|
||||||
@ -2623,7 +2619,6 @@ calendar_paint_day (GtkCalendar *calendar,
|
|||||||
day_rect.width, day_rect.height);
|
day_rect.width, day_rect.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
gtk_style_context_set_state (context, state);
|
gtk_style_context_set_state (context, state);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user