[gnome-calendar/gnome-3-22] multi-choice: Fix endless timeout



commit 27598a02e573ce9fc86345518766849b6472449f
Author: Isaque Galdino <igaldino gmail com>
Date:   Thu Feb 23 12:50:09 2017 -0300

    multi-choice: Fix endless timeout
    
    There are two mapped events for each back/forward buttons in this
    widget: button-press and button-release.
    
    When you reach the limits like January and December, button-release is
    lost, and you don't get it anymore. That caused button_timeout function
    to not be disable anymore, so it's kept in loop forever.
    
    This code fix checks in button_timeout function if any of the back/
    forward buttons are still mapped. If not, it prevents from calling
    button_timout, stopping the loop.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776459

 src/gcal-multi-choice.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-multi-choice.c b/src/gcal-multi-choice.c
index bfcb19e..6b0ac0e 100644
--- a/src/gcal-multi-choice.c
+++ b/src/gcal-multi-choice.c
@@ -187,6 +187,15 @@ button_timeout (gpointer user_data)
   if (self->click_id == 0)
     return G_SOURCE_REMOVE;
 
+  if (!gtk_widget_get_mapped (self->down_button) && !gtk_widget_get_mapped (self->up_button))
+    {
+      if (self->click_id)
+        g_source_remove (self->click_id);
+      self->click_id = 0;
+      self->active = NULL;
+      return G_SOURCE_REMOVE;
+    }
+
   res = button_activate (self, self->active);
   if (!res)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]