@@ -96,6 +96,7 @@ public class AppCenterCore.Package : Object {
9696 public const string LOCAL_ID_SUFFIX = " .appcenter-local" ;
9797 public const string DEFAULT_PRICE_DOLLARS = " 1" ;
9898
99+ public unowned Backend backend { get ; construct; }
99100 public string uid { get ; construct; }
100101
101102 public AppStream . Component component { get ; protected set ; }
@@ -418,8 +419,8 @@ public class AppCenterCore.Package : Object {
418419 change_information = new ChangeInformation ();
419420 }
420421
421- public Package (string uid , AppStream .Component component ) {
422- Object (uid: uid, component: component);
422+ public Package (Backend backend , string uid , AppStream .Component component ) {
423+ Object (backend : backend, uid: uid, component: component);
423424 }
424425
425426 public void replace_component (AppStream .Component component ) {
@@ -455,7 +456,7 @@ public class AppCenterCore.Package : Object {
455456 // Only trigger a notify if the state has changed, quite a lot of things listen to this
456457 if (state != new_state) {
457458 state = new_state;
458- FlatpakBackend . get_default () . notify_package_changed (this );
459+ backend . notify_package_changed (this );
459460 }
460461 }
461462
@@ -502,15 +503,14 @@ public class AppCenterCore.Package : Object {
502503 change_information. start ();
503504 state = performing;
504505
505- unowned var flatpak_backend = AppCenterCore . FlatpakBackend . get_default ();
506- flatpak_backend. notify_package_changed (this );
506+ backend. notify_package_changed (this );
507507
508508 try {
509509 yield perform_package_operation ();
510- flatpak_backend . operation_finished (this , performing, null );
510+ backend . operation_finished (this , performing, null );
511511 } catch (GLib . Error e) {
512512 warning (" Operation failed for package %s - %s " , name, e. message);
513- flatpak_backend . operation_finished (this , performing, e);
513+ backend . operation_finished (this , performing, e);
514514 throw e;
515515 } finally {
516516 change_information. complete ();
@@ -519,8 +519,6 @@ public class AppCenterCore.Package : Object {
519519 }
520520
521521 private async void perform_package_operation () throws GLib .Error {
522- unowned var backend = AppCenterCore . FlatpakBackend . get_default ();
523-
524522 switch (state) {
525523 case State . UPDATING:
526524 yield backend. update_package (this , change_information);
0 commit comments