d9e13ed064
GitOrigin-RevId: a930f7da84786807bb105df40e76b541604c3e72
162 lines
6.3 KiB
Diff
162 lines
6.3 KiB
Diff
From 5d3f20b49a89b55e39339a0f90ae7f846356b0e1 Mon Sep 17 00:00:00 2001
|
|
From: Bobby Rong <rjl931189261@126.com>
|
|
Date: Wed, 22 Sep 2021 11:54:24 +0800
|
|
Subject: [PATCH 1/2] Drop PackageKitBackend and UbuntuDriversBackend
|
|
|
|
---
|
|
src/Application.vala | 14 ---------
|
|
src/Core/BackendAggregator.vala | 2 --
|
|
src/Core/UpdateManager.vala | 56 ---------------------------------
|
|
src/MainWindow.vala | 17 ----------
|
|
4 files changed, 89 deletions(-)
|
|
|
|
diff --git a/src/Application.vala b/src/Application.vala
|
|
index 65fae5aa..9d42b14f 100644
|
|
--- a/src/Application.vala
|
|
+++ b/src/Application.vala
|
|
@@ -167,10 +167,6 @@ public class AppCenter.App : Gtk.Application {
|
|
|
|
var client = AppCenterCore.Client.get_default ();
|
|
|
|
- if (fake_update_packages != null) {
|
|
- AppCenterCore.PackageKitBackend.get_default ().fake_packages = fake_update_packages;
|
|
- }
|
|
-
|
|
if (silent) {
|
|
NetworkMonitor.get_default ().network_changed.connect ((available) => {
|
|
schedule_cache_update (!available);
|
|
@@ -183,16 +179,6 @@ public class AppCenter.App : Gtk.Application {
|
|
return;
|
|
}
|
|
|
|
- if (local_path != null) {
|
|
- var file = File.new_for_commandline_arg (local_path);
|
|
-
|
|
- try {
|
|
- local_package = AppCenterCore.PackageKitBackend.get_default ().add_local_component_file (file);
|
|
- } catch (Error e) {
|
|
- warning ("Failed to load local AppStream XML file: %s", e.message);
|
|
- }
|
|
- }
|
|
-
|
|
if (main_window == null) {
|
|
main_window = new MainWindow (this);
|
|
|
|
diff --git a/src/Core/BackendAggregator.vala b/src/Core/BackendAggregator.vala
|
|
index 2f8bdedf..b705ca87 100644
|
|
--- a/src/Core/BackendAggregator.vala
|
|
+++ b/src/Core/BackendAggregator.vala
|
|
@@ -26,8 +26,6 @@ public class AppCenterCore.BackendAggregator : Backend, Object {
|
|
|
|
construct {
|
|
backends = new Gee.ArrayList<unowned Backend> ();
|
|
- backends.add (PackageKitBackend.get_default ());
|
|
- backends.add (UbuntuDriversBackend.get_default ());
|
|
backends.add (FlatpakBackend.get_default ());
|
|
|
|
unowned Gtk.Application app = (Gtk.Application) GLib.Application.get_default ();
|
|
diff --git a/src/Core/UpdateManager.vala b/src/Core/UpdateManager.vala
|
|
index 29fa397a..ce42dd57 100644
|
|
--- a/src/Core/UpdateManager.vala
|
|
+++ b/src/Core/UpdateManager.vala
|
|
@@ -53,42 +53,9 @@ public class AppCenterCore.UpdateManager : Object {
|
|
installed_package.update_state ();
|
|
}
|
|
|
|
- Pk.Results pk_updates;
|
|
- unowned PackageKitBackend client = PackageKitBackend.get_default ();
|
|
- try {
|
|
- pk_updates = yield client.get_updates (cancellable);
|
|
- } catch (Error e) {
|
|
- warning ("Unable to get updates from PackageKit backend: %s", e.message);
|
|
- return 0;
|
|
- }
|
|
-
|
|
uint os_count = 0;
|
|
string os_desc = "";
|
|
|
|
- var package_array = pk_updates.get_package_array ();
|
|
- debug ("PackageKit backend reports %d updates", package_array.length);
|
|
-
|
|
- package_array.foreach ((pk_package) => {
|
|
- var pkg_name = pk_package.get_name ();
|
|
- var appcenter_package = client.lookup_package_by_id (pkg_name);
|
|
- if (appcenter_package != null) {
|
|
- debug ("Added %s to app updates", pkg_name);
|
|
- apps_with_updates.add (appcenter_package);
|
|
- appcenter_package.latest_version = pk_package.get_version ();
|
|
- } else {
|
|
- debug ("Added %s to OS updates", pkg_name);
|
|
- os_count++;
|
|
- unowned string pkg_summary = pk_package.get_summary ();
|
|
- unowned string pkg_version = pk_package.get_version ();
|
|
- os_desc += Markup.printf_escaped (
|
|
- "<li>%s\n\t%s\n\t%s</li>\n",
|
|
- pkg_name,
|
|
- pkg_summary,
|
|
- _("Version: %s").printf (pkg_version)
|
|
- );
|
|
- }
|
|
- });
|
|
-
|
|
os_updates.component.set_pkgnames ({});
|
|
os_updates.change_information.clear_update_info ();
|
|
|
|
@@ -160,29 +127,6 @@ public class AppCenterCore.UpdateManager : Object {
|
|
count += 1;
|
|
}
|
|
|
|
- pk_updates.get_details_array ().foreach ((pk_detail) => {
|
|
- var pk_package = new Pk.Package ();
|
|
- try {
|
|
- pk_package.set_id (pk_detail.get_package_id ());
|
|
- var pkg_name = pk_package.get_name ();
|
|
- var appcenter_package = client.lookup_package_by_id (pkg_name);
|
|
- if (appcenter_package != null) {
|
|
- appcenter_package.change_information.updatable_packages.@set (client, pk_package.get_id ());
|
|
- appcenter_package.change_information.size += pk_detail.size;
|
|
- appcenter_package.update_state ();
|
|
- } else {
|
|
- var pkgnames = os_updates.component.pkgnames;
|
|
- pkgnames += pkg_name;
|
|
- os_updates.component.pkgnames = pkgnames;
|
|
-
|
|
- os_updates.change_information.updatable_packages.@set (client, pk_package.get_id ());
|
|
- os_updates.change_information.size += pk_detail.size;
|
|
- }
|
|
- } catch (Error e) {
|
|
- critical (e.message);
|
|
- }
|
|
- });
|
|
-
|
|
os_updates.update_state ();
|
|
return count;
|
|
}
|
|
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
|
|
index a32ce47b..b9f8594a 100644
|
|
--- a/src/MainWindow.vala
|
|
+++ b/src/MainWindow.vala
|
|
@@ -292,23 +292,6 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow {
|
|
}
|
|
|
|
public override bool delete_event (Gdk.EventAny event) {
|
|
- unowned AppCenterCore.PackageKitBackend client = AppCenterCore.PackageKitBackend.get_default ();
|
|
- if (client.working) {
|
|
- if (task_finished_connection != 0U) {
|
|
- client.disconnect (task_finished_connection);
|
|
- }
|
|
-
|
|
- hide ();
|
|
- task_finished_connection = client.notify["working"].connect (() => {
|
|
- if (!visible && !client.working) {
|
|
- destroy ();
|
|
- }
|
|
- });
|
|
-
|
|
- AppCenterCore.Client.get_default ().cancel_updates (false); //Timeouts keep running
|
|
- return true;
|
|
- }
|
|
-
|
|
return false;
|
|
}
|
|
|