[gnome-calendar] month-view: always update month cells in idle
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] month-view: always update month cells in idle
- Date: Sun, 29 Oct 2017 21:06:39 +0000 (UTC)
commit 523609f2c01c8cdf088608f1a99582b04eedecf0
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Oct 29 19:05:42 2017 -0200
month-view: always update month cells in idle
This way, we can schedule the multiple resizing queueing
operations to after the size-allocate phase is over.
src/views/gcal-month-view.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/views/gcal-month-view.c b/src/views/gcal-month-view.c
index 4840af7..e2a013a 100644
--- a/src/views/gcal-month-view.c
+++ b/src/views/gcal-month-view.c
@@ -131,6 +131,8 @@ struct _GcalMonthView
/* Storage for the accumulated scrolling */
gdouble scroll_value;
+ guint update_grid_id;
+
/* property */
icaltimetype *date;
GcalManager *manager;
@@ -471,8 +473,8 @@ setup_month_grid (GcalMonthView *self,
}
}
-static void
-update_month_cells (GcalMonthView *self)
+static gboolean
+update_month_cells_in_idle_cb (GcalMonthView *self)
{
g_autoptr (GDateTime) dt;
guint row, col;
@@ -550,6 +552,19 @@ update_month_cells (GcalMonthView *self)
gtk_widget_queue_draw (GTK_WIDGET (cell));
}
}
+
+ self->update_grid_id = 0;
+
+ return G_SOURCE_REMOVE;
+}
+
+static void
+update_month_cells (GcalMonthView *self)
+{
+ if (self->update_grid_id > 0)
+ g_source_remove (self->update_grid_id);
+
+ self->update_grid_id = g_idle_add ((GSourceFunc) update_month_cells_in_idle_cb, self);
}
static void
@@ -1300,6 +1315,12 @@ gcal_month_view_finalize (GObject *object)
g_clear_object (&self->manager);
+ if (self->update_grid_id > 0)
+ {
+ g_source_remove (self->update_grid_id);
+ self->update_grid_id = 0;
+ }
+
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (gcal_month_view_parent_class)->finalize (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]