Merge lp:~larsu/gtk/calendar-day-selected into lp:~ubuntu-desktop/gtk/ubuntugtk3

Proposed by Lars Karlitski on 2015-10-01
Status: Merged
Merged at revision: 464
Proposed branch: lp:~larsu/gtk/calendar-day-selected
Merge into: lp:~ubuntu-desktop/gtk/ubuntugtk3
Diff against target: 226 lines (+206/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/calendar-always-emit-day-selected-once.patch (+198/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~larsu/gtk/calendar-day-selected
Reviewer Review Type Date Requested Status
Ubuntu Desktop 2015-10-01 Pending
VCS imports 2015-10-01 Pending
Review via email: mp+273070@code.launchpad.net

Commit message

Add debian/patches/calendar-always-emit-day-selected-once.patch:
Fixes infintite loop between indicator-datetime and the panel (LP: #1480387)

Description of the change

Add debian/patches/calendar-always-emit-day-selected-once.patch:
Fixes infintite loop between indicator-datetime and the panel (LP: #1480387)

To post a comment you must log in.
Iain Lane (laney) wrote :

Cheers, I'd ideally like to wait a couple of days (say until Monday) for upstream to get back to you, before we distro patch.

I set a calendar reminder to look again Monday afternoon.

Iain Lane (laney) wrote :

maybe ping upstream? or set a reminder to do so after an appropriate period? :)

/me closes this tab so will probably forget now

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-09-22 15:33:00 +0000
3+++ debian/changelog 2015-10-01 13:57:23 +0000
4@@ -1,3 +1,10 @@
5+gtk+3.0 (3.16.7-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * Add debian/patches/calendar-always-emit-day-selected-once.patch:
8+ Fixes infintite loop between indicator-datetime and the panel (LP: #1480387)
9+
10+ -- Lars Uebernickel <lars.uebernickel@ubuntu.com> Thu, 01 Oct 2015 15:51:33 +0200
11+
12 gtk+3.0 (3.16.7-0ubuntu1) wily; urgency=medium
13
14 [ Lars Uebernickel ]
15
16=== added file 'debian/patches/calendar-always-emit-day-selected-once.patch'
17--- debian/patches/calendar-always-emit-day-selected-once.patch 1970-01-01 00:00:00 +0000
18+++ debian/patches/calendar-always-emit-day-selected-once.patch 2015-10-01 13:57:23 +0000
19@@ -0,0 +1,198 @@
20+From 01d3ae030937b024bba63445cefd5050be4b2c8e Mon Sep 17 00:00:00 2001
21+From: Lars Uebernickel <lars.uebernickel@canonical.com>
22+Date: Thu, 1 Oct 2015 15:35:09 +0200
23+Subject: [PATCH] calendar: always emit "day-selected" once
24+
25+"day-selected" was emitted twice when clicking on a day of the previous
26+or next month. This was because calendar_set_month{next,prev}() always
27+selected the first (or last) day of the newly focussed month. Callers
28+that wanted a different day to be selected had to do so after calling
29+one of those functions.
30+
31+Fix this by passing the desired day into those functions directly.
32+
33+https://bugzilla.gnome.org/show_bug.cgi?id=755941
34+---
35+ gtk/gtkcalendar.c | 72 +++++++++++++++++++++++++++++++++----------------------
36+ 1 file changed, 43 insertions(+), 29 deletions(-)
37+
38+diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
39+index b4ef543..2d338ef 100644
40+--- a/gtk/gtkcalendar.c
41++++ b/gtk/gtkcalendar.c
42+@@ -876,11 +876,15 @@ calendar_queue_refresh (GtkCalendar *calendar)
43+ }
44+
45+ static void
46+-calendar_set_month_next (GtkCalendar *calendar)
47++calendar_set_month_next (GtkCalendar *calendar,
48++ gint day)
49+ {
50+ gint month_len;
51+ GtkCalendarPrivate *priv = calendar->priv;
52+
53++ if (day < 0)
54++ day = priv->selected_day;
55++
56+ if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
57+ return;
58+
59+@@ -902,13 +906,13 @@ calendar_set_month_next (GtkCalendar *calendar)
60+
61+ month_len = month_length[leap (priv->year)][priv->month + 1];
62+
63+- if (month_len < priv->selected_day)
64++ if (month_len < day)
65+ {
66+ priv->selected_day = 0;
67+ gtk_calendar_select_day (calendar, month_len);
68+ }
69+ else
70+- gtk_calendar_select_day (calendar, priv->selected_day);
71++ gtk_calendar_select_day (calendar, day);
72+
73+ calendar_queue_refresh (calendar);
74+ }
75+@@ -1298,11 +1302,15 @@ calendar_day_rectangle (GtkCalendar *calendar,
76+ }
77+
78+ static void
79+-calendar_set_month_prev (GtkCalendar *calendar)
80++calendar_set_month_prev (GtkCalendar *calendar,
81++ gint day)
82+ {
83+ GtkCalendarPrivate *priv = calendar->priv;
84+ gint month_len;
85+
86++ if (day < 0)
87++ day = priv->selected_day;
88++
89+ if (priv->display_flags & GTK_CALENDAR_NO_MONTH_CHANGE)
90+ return;
91+
92+@@ -1325,16 +1333,16 @@ calendar_set_month_prev (GtkCalendar *calendar)
93+ gtk_calendar_signals[MONTH_CHANGED_SIGNAL],
94+ 0);
95+
96+- if (month_len < priv->selected_day)
97++ if (month_len < day)
98+ {
99+ priv->selected_day = 0;
100+ gtk_calendar_select_day (calendar, month_len);
101+ }
102+ else
103+ {
104+- if (priv->selected_day < 0)
105+- priv->selected_day = priv->selected_day + 1 + month_length[leap (priv->year)][priv->month + 1];
106+- gtk_calendar_select_day (calendar, priv->selected_day);
107++ if (day < 0)
108++ day = day + 1 + month_length[leap (priv->year)][priv->month + 1];
109++ gtk_calendar_select_day (calendar, day);
110+ }
111+
112+ calendar_queue_refresh (calendar);
113+@@ -2811,10 +2819,10 @@ calendar_arrow_action (GtkCalendar *calendar,
114+ calendar_set_year_next (calendar);
115+ break;
116+ case ARROW_MONTH_LEFT:
117+- calendar_set_month_prev (calendar);
118++ calendar_set_month_prev (calendar, -1);
119+ break;
120+ case ARROW_MONTH_RIGHT:
121+- calendar_set_month_next (calendar);
122++ calendar_set_month_next (calendar, -1);
123+ break;
124+ default:;
125+ /* do nothing */
126+@@ -2913,21 +2921,27 @@ calendar_main_button_press (GtkCalendar *calendar,
127+ day = priv->day[row][col];
128+
129+ if (day_month == MONTH_PREV)
130+- calendar_set_month_prev (calendar);
131++ {
132++ calendar_set_month_prev (calendar, day);
133++ }
134+ else if (day_month == MONTH_NEXT)
135+- calendar_set_month_next (calendar);
136+-
137+- if (!gtk_widget_has_focus (widget))
138+- gtk_widget_grab_focus (widget);
139+-
140+- if (event->button == GDK_BUTTON_PRIMARY)
141+ {
142+- priv->in_drag = 1;
143+- priv->drag_start_x = x;
144+- priv->drag_start_y = y;
145++ calendar_set_month_next (calendar, day);
146+ }
147++ else
148++ {
149++ if (!gtk_widget_has_focus (widget))
150++ gtk_widget_grab_focus (widget);
151++
152++ if (event->button == GDK_BUTTON_PRIMARY)
153++ {
154++ priv->in_drag = 1;
155++ priv->drag_start_x = x;
156++ priv->drag_start_y = y;
157++ }
158+
159+- calendar_select_and_focus_day (calendar, day);
160++ calendar_select_and_focus_day (calendar, day);
161++ }
162+ }
163+ else if (event->type == GDK_2BUTTON_PRESS)
164+ {
165+@@ -3098,13 +3112,13 @@ gtk_calendar_scroll (GtkWidget *widget,
166+ {
167+ if (!gtk_widget_has_focus (widget))
168+ gtk_widget_grab_focus (widget);
169+- calendar_set_month_prev (calendar);
170++ calendar_set_month_prev (calendar, -1);
171+ }
172+ else if (event->direction == GDK_SCROLL_DOWN)
173+ {
174+ if (!gtk_widget_has_focus (widget))
175+ gtk_widget_grab_focus (widget);
176+- calendar_set_month_next (calendar);
177++ calendar_set_month_next (calendar, -1);
178+ }
179+ else
180+ return FALSE;
181+@@ -3179,7 +3193,7 @@ gtk_calendar_key_press (GtkWidget *widget,
182+ case GDK_KEY_Left:
183+ return_val = TRUE;
184+ if (event->state & GDK_CONTROL_MASK)
185+- calendar_set_month_prev (calendar);
186++ calendar_set_month_prev (calendar, -1);
187+ else
188+ {
189+ move_focus (calendar, -1);
190+@@ -3192,7 +3206,7 @@ gtk_calendar_key_press (GtkWidget *widget,
191+ case GDK_KEY_Right:
192+ return_val = TRUE;
193+ if (event->state & GDK_CONTROL_MASK)
194+- calendar_set_month_next (calendar);
195++ calendar_set_month_next (calendar, -1);
196+ else
197+ {
198+ move_focus (calendar, 1);
199+@@ -3246,11 +3260,11 @@ gtk_calendar_key_press (GtkWidget *widget,
200+
201+ day = priv->day[row][col];
202+ if (priv->day_month[row][col] == MONTH_PREV)
203+- calendar_set_month_prev (calendar);
204++ calendar_set_month_prev (calendar, day);
205+ else if (priv->day_month[row][col] == MONTH_NEXT)
206+- calendar_set_month_next (calendar);
207+-
208+- calendar_select_and_focus_day (calendar, day);
209++ calendar_set_month_next (calendar, day);
210++ else
211++ calendar_select_and_focus_day (calendar, day);
212+ }
213+ }
214+
215+--
216+2.5.0
217+
218
219=== modified file 'debian/patches/series'
220--- debian/patches/series 2015-07-14 13:19:07 +0000
221+++ debian/patches/series 2015-10-01 13:57:23 +0000
222@@ -21,3 +21,4 @@
223 restore_filechooser_typeaheadfind
224 0001-backport-mir-patches-from-upstream-master.patch
225 0001-GtkButtonBox-remove-spacing-when-buttons-are-linked.patch
226+calendar-always-emit-day-selected-once.patch

Subscribers

People subscribed via source and target branches

to all changes: