@@ -29,18 +29,6 @@ public class AppCenterCore.ChangeInformation : Object {
2929 FINISHED
3030 }
3131
32- /**
33- * This signal is likely to be fired from a non-main thread. Ensure any UI
34- * logic driven from this runs on the GTK thread
35- */
36- public signal void status_changed ();
37-
38- /**
39- * This signal is likely to be fired from a non-main thread. Ensure any UI
40- * logic driven from this runs on the GTK thread
41- */
42- public signal void progress_changed ();
43-
4432 public Gee . ArrayList<string> updatable_packages { get ; private set ; }
4533
4634 public ActionGroup action_group { get ; private set ; }
@@ -75,15 +63,12 @@ public class AppCenterCore.ChangeInformation : Object {
7563 progress = 0.0f ;
7664 status = Status . WAITING ;
7765 status_description = _(" Waiting" );
78- status_changed ();
79- progress_changed ();
8066 }
8167
8268 public void complete () {
8369 cancel_action. set_enabled (false );
8470 status = Status . FINISHED ;
8571 status_description = _(" Finished" );
86- status_changed ();
8772 reset_progress ();
8873 }
8974
@@ -92,7 +77,6 @@ public class AppCenterCore.ChangeInformation : Object {
9277 cancel_action. set_enabled (false );
9378 status = Status . CANCELLED ;
9479 status_description = _(" Cancelling" );
95- status_changed ();
9680 }
9781
9882 public void clear_update_info () {
@@ -106,16 +90,21 @@ public class AppCenterCore.ChangeInformation : Object {
10690 progress = 0.0f ;
10791 }
10892
93+ /**
94+ * This method is thread safe. It will queue any updates on the main thread.
95+ */
10996 public void callback (string status_description , double progress , Status status ) {
110- if (this . status_description != status_description || this . status != status) {
111- this . status_description = status_description;
112- this . status = status;
113- status_changed ();
114- }
115-
116- if (this . progress != progress) {
117- this . progress = progress;
118- progress_changed ();
119- }
97+ Idle . add (() = > {
98+ if (this . status_description != status_description || this . status != status) {
99+ this . status_description = status_description;
100+ this . status = status;
101+ }
102+
103+ if (this . progress != progress) {
104+ this . progress = progress;
105+ }
106+
107+ return Source . REMOVE ;
108+ });
120109 }
121110}
0 commit comments