Skip to content

Commit d12ad84

Browse files
committed
calendar eventView.js: Try to cancel scroll-to-row callback when
set_events() is called. This prevents some cjs/gobject warnings at startup.
1 parent 6e387ff commit d12ad84

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

files/usr/share/cinnamon/applets/[email protected]/eventView.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ class EventList {
618618
this.selected_date = GLib.DateTime.new_now_local();
619619
this.desktop_settings = desktop_settings;
620620
this._no_events_timeout_id = 0;
621+
this._scroll_to_idle_id = 0;
621622
this._rows = [];
622623
this._current_event_data_list_timestamp = 0;
623624

@@ -740,6 +741,11 @@ class EventList {
740741
}
741742

742743
set_events(event_data_list, delay_no_events_box) {
744+
if (this._scroll_to_idle_id > 0) {
745+
Mainloop.source_remove(this._scroll_to_idle_id);
746+
this._scroll_to_idle_id = 0;
747+
}
748+
743749
if (event_data_list !== null && event_data_list.timestamp === this._current_event_data_list_timestamp) {
744750
this._rows.forEach((row) => {
745751
row.update_variations();
@@ -811,7 +817,11 @@ class EventList {
811817
this._rows.push(row);
812818
}
813819

814-
Mainloop.idle_add(Lang.bind(this, function(row) {
820+
if (scroll_to_row == null) {
821+
return;
822+
}
823+
824+
this._scroll_to_idle_id = Mainloop.idle_add(Lang.bind(this, function(row) {
815825
let vscroll = this.events_scroll_box.get_vscroll_bar();
816826

817827
if (row != null) {
@@ -820,6 +830,9 @@ class EventList {
820830
} else {
821831
vscroll.get_adjustment().set_value(0);
822832
}
833+
834+
this._scroll_to_idle_id = 0;
835+
return GLib.SOURCE_REMOVE;
823836
}, scroll_to_row));
824837
}
825838
}

0 commit comments

Comments
 (0)