testTool: Add case simulating lots of icon and labe updates
Simulate cases similar to discord application, that it sends lots updates
at a very high rate.
With this code gnome-shell currently hangs totally, becoming unusable.
Related to #226 and #236
Marco Trevisan (TreviƱo)
3 years ago
196 | 196 | item = new Gtk.SeparatorMenuItem(); |
197 | 197 | menu.append(item); |
198 | 198 | |
199 | /* Simulate similar behavior of #226 and #236 */ | |
200 | item = Gtk.CheckMenuItem.new_with_label('Crazy icons updates'); | |
201 | item.connect('activate', (item) => { | |
202 | if (item.get_active()) { | |
203 | item._timeoutID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 16, () => { | |
204 | setRandomIconPath(); | |
205 | indicator.set_label(`${new Date().getSeconds()}`, ''); | |
206 | return GLib.SOURCE_CONTINUE; | |
207 | }); | |
208 | } else { | |
209 | GLib.source_remove(item._timeoutID); | |
210 | delete item._timeoutID; | |
211 | } | |
212 | }); | |
213 | menu.append(item); | |
214 | ||
199 | 215 | item = Gtk.MenuItem.new_with_label("Hide for some time"); |
200 | 216 | item.connect('activate', () => { |
201 | 217 | indicator.set_status(AppIndicator.IndicatorStatus.PASSIVE); |