[gnome-calendar] month-view: preserve hovered cell on popover show
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] month-view: preserve hovered cell on popover show
- Date: Sat, 20 Dec 2014 14:14:07 +0000 (UTC)
commit 7a00364efb94a93c2419cb6b8a8387114fb998c5
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Fri Dec 19 18:29:37 2014 -0500
month-view: preserve hovered cell on popover show
The hovered cell is the indicator to draw the background and the
coloring of the overflow indicator. Preserve its value as long as the
overflow is shown.
src/gcal-month-view.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index a614334..1a68c9e 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -471,6 +471,16 @@ rebuild_popover_for_day (GcalMonthView *view,
gtk_widget_set_size_request (child_widget, cell_width, -1);
}
+static void
+overflow_popover_hide (GtkWidget *widget,
+ gpointer user_data)
+{
+ GcalMonthViewPrivate *priv;
+
+ priv = gcal_month_view_get_instance_private (GCAL_MONTH_VIEW (user_data));
+ priv->hovered_overflow_indicator = -1;
+
+ gtk_widget_queue_draw (GTK_WIDGET (user_data));
}
static void
@@ -541,6 +551,7 @@ gcal_month_view_init (GcalMonthView *self)
priv->k = 1;
priv->overflow_popover = gtk_popover_new (GTK_WIDGET (self));
+ g_signal_connect (priv->overflow_popover, "hide", G_CALLBACK (overflow_popover_hide), self);
grid = gtk_grid_new ();
g_object_set (grid, "margin", 6, "row-spacing", 6, "orientation", GTK_ORIENTATION_VERTICAL, NULL);
@@ -1385,6 +1396,8 @@ gcal_month_view_motion_notify_event (GtkWidget *widget,
{
if (j > priv->days_delay && j <= days)
{
+ if (priv->end_mark_cell != priv->start_mark_cell)
+ priv->hovered_overflow_indicator = -1;
if (priv->end_mark_cell != new_end_cell)
gtk_widget_queue_draw (widget);
@@ -1395,6 +1408,9 @@ gcal_month_view_motion_notify_event (GtkWidget *widget,
}
else
{
+ if (gtk_widget_is_visible (priv->overflow_popover))
+ return FALSE;
+
if (hovered_indicator)
new_hovered_cell = new_end_cell;
else
@@ -1456,7 +1472,9 @@ gcal_month_view_button_release (GtkWidget *widget,
if (priv->pressed_overflow_indicator != -1 && priv->start_mark_cell == priv->end_mark_cell)
{
- rebuild_popover_for_cell (GCAL_MONTH_VIEW (widget));
+ priv->hovered_overflow_indicator = priv->pressed_overflow_indicator;
+
+ rebuild_popover_for_day (GCAL_MONTH_VIEW (widget), j - priv->days_delay);
gtk_widget_show_all (priv->overflow_popover);
priv->clicked_cell = -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]