date-chooser: support hovering days
Another fixup in order to make the current date chooser more streamlined with GNOME Shell's calendar.
This commit is contained in:
@@ -316,8 +316,16 @@ datechooser day.other-month {
|
|||||||
color: @theme_insensitive_fg_color;
|
color: @theme_insensitive_fg_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
datechooser day:hover,
|
||||||
|
datechooser day:selected {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
datechooser day:hover {
|
||||||
|
background-color: alpha(@theme_fg_color, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
datechooser day:selected {
|
datechooser day:selected {
|
||||||
color: @theme_selected_fg_color;
|
color: @theme_selected_fg_color;
|
||||||
background-color: @theme_selected_bg_color;
|
background-color: @theme_selected_bg_color;
|
||||||
border-radius: 50%;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,7 +167,9 @@ gcal_date_chooser_day_realize (GtkWidget *widget)
|
|||||||
attributes.event_mask = gtk_widget_get_events (widget);
|
attributes.event_mask = gtk_widget_get_events (widget);
|
||||||
attributes.event_mask |= GDK_BUTTON_PRESS_MASK
|
attributes.event_mask |= GDK_BUTTON_PRESS_MASK
|
||||||
| GDK_BUTTON_RELEASE_MASK
|
| GDK_BUTTON_RELEASE_MASK
|
||||||
| GDK_TOUCH_MASK;
|
| GDK_TOUCH_MASK
|
||||||
|
| GDK_ENTER_NOTIFY_MASK
|
||||||
|
| GDK_LEAVE_NOTIFY_MASK;
|
||||||
|
|
||||||
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
||||||
|
|
||||||
@@ -301,6 +303,36 @@ gcal_date_chooser_day_get_preferred_height (GtkWidget *widget,
|
|||||||
*natural = MAX (nat, min_height);
|
*natural = MAX (nat, min_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gcal_date_chooser_day_enter_notify_event (GtkWidget *widget,
|
||||||
|
GdkEventCrossing *event)
|
||||||
|
{
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkStateFlags state;
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
state = gtk_style_context_get_state (context);
|
||||||
|
|
||||||
|
gtk_style_context_set_state (context, state | GTK_STATE_FLAG_PRELIGHT);
|
||||||
|
|
||||||
|
return GDK_EVENT_PROPAGATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gcal_date_chooser_day_leave_notify_event (GtkWidget *widget,
|
||||||
|
GdkEventCrossing *event)
|
||||||
|
{
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkStateFlags state;
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
state = gtk_style_context_get_state (context);
|
||||||
|
|
||||||
|
gtk_style_context_set_state (context, state & ~GTK_STATE_FLAG_PRELIGHT);
|
||||||
|
|
||||||
|
return GDK_EVENT_PROPAGATE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gcal_date_chooser_day_class_init (GcalDateChooserDayClass *class)
|
gcal_date_chooser_day_class_init (GcalDateChooserDayClass *class)
|
||||||
{
|
{
|
||||||
@@ -319,6 +351,8 @@ gcal_date_chooser_day_class_init (GcalDateChooserDayClass *class)
|
|||||||
widget_class->drag_data_get = gcal_date_chooser_day_drag_data_get;
|
widget_class->drag_data_get = gcal_date_chooser_day_drag_data_get;
|
||||||
widget_class->get_preferred_width = gcal_date_chooser_day_get_preferred_width;
|
widget_class->get_preferred_width = gcal_date_chooser_day_get_preferred_width;
|
||||||
widget_class->get_preferred_height = gcal_date_chooser_day_get_preferred_height;
|
widget_class->get_preferred_height = gcal_date_chooser_day_get_preferred_height;
|
||||||
|
widget_class->enter_notify_event = gcal_date_chooser_day_enter_notify_event;
|
||||||
|
widget_class->leave_notify_event = gcal_date_chooser_day_leave_notify_event;
|
||||||
|
|
||||||
signals[SELECTED] = g_signal_new ("selected",
|
signals[SELECTED] = g_signal_new ("selected",
|
||||||
GCAL_TYPE_DATE_CHOOSER_DAY,
|
GCAL_TYPE_DATE_CHOOSER_DAY,
|
||||||
|
|||||||
Reference in New Issue
Block a user