pantheon.appcenter: drop downstream patch

This commit is contained in:
Bobby Rong 2021-10-28 23:01:23 +08:00
parent ea8d53ed16
commit 829e92098e
No known key found for this signature in database
GPG Key ID: ED07364437C91161
3 changed files with 0 additions and 405 deletions

View File

@ -39,15 +39,6 @@ stdenv.mkDerivation rec {
sha256 = "sha256-d7DGyAC8itBxTfuabDPN16W4S4d42s5UPp8AusZfy5k=";
};
patches = [
# Try to remove other backends to make flatpak backend work.
# https://github.com/NixOS/nixpkgs/issues/70214
./flatpak-only.patch
# The homepage banner does not show up on first run,
# has issues with app icon and mouse scrolling.
./drop-homepage-banner.patch
];
passthru = {
updateScript = nix-update-script {
attrPath = "pantheon.${pname}";

View File

@ -1,234 +0,0 @@
From c1916699cd388cc8d9968127e43ba955471623bf Mon Sep 17 00:00:00 2001
From: Bobby Rong <rjl931189261@126.com>
Date: Wed, 27 Oct 2021 09:33:15 +0800
Subject: [PATCH 2/2] Drop homepage banner
---
src/Views/Homepage.vala | 181 +---------------------------------------
1 file changed, 1 insertion(+), 180 deletions(-)
diff --git a/src/Views/Homepage.vala b/src/Views/Homepage.vala
index 52cb36cc..80a1d221 100644
--- a/src/Views/Homepage.vala
+++ b/src/Views/Homepage.vala
@@ -31,67 +31,12 @@ public class AppCenter.Homepage : AbstractView {
public bool viewing_package { get; private set; default = false; }
public AppStream.Category currently_viewed_category;
- private Hdy.Carousel banner_carousel;
- private Gtk.Revealer banner_revealer;
- private Gtk.FlowBox recently_updated_carousel;
- private Gtk.Revealer recently_updated_revealer;
-
- private uint banner_timeout_id;
construct {
- banner_carousel = new Hdy.Carousel () {
- allow_long_swipes = true
- };
-
- var banner_event_box = new Gtk.EventBox ();
- banner_event_box.events |= Gdk.EventMask.ENTER_NOTIFY_MASK;
- banner_event_box.events |= Gdk.EventMask.LEAVE_NOTIFY_MASK;
- banner_event_box.add (banner_carousel);
-
- var banner_dots = new Hdy.CarouselIndicatorDots () {
- carousel = banner_carousel
- };
-
- var banner_grid = new Gtk.Grid () {
- orientation = Gtk.Orientation.VERTICAL
- };
- banner_grid.add (banner_event_box);
- banner_grid.add (banner_dots);
-
- banner_revealer = new Gtk.Revealer ();
- banner_revealer.add (banner_grid);
-
- var recently_updated_label = new Granite.HeaderLabel (_("Recently Updated")) {
- margin_start = 12
- };
-
- recently_updated_carousel = new Gtk.FlowBox () {
- activate_on_single_click = true,
- column_spacing = 12,
- row_spacing = 12,
- homogeneous = true,
- max_children_per_line = 5,
- min_children_per_line = 3
- };
-
- var recently_updated_grid = new Gtk.Grid () {
- margin_end = 12,
- margin_start = 12
- };
- recently_updated_grid.attach (recently_updated_label, 0, 0);
- recently_updated_grid.attach (recently_updated_carousel, 0, 1);
-
- recently_updated_revealer = new Gtk.Revealer ();
- recently_updated_revealer.add (recently_updated_grid );
-
- var categories_label = new Granite.HeaderLabel (_("Categories")) {
- margin_start = 24,
- margin_top = 24
- };
-
category_flow = new Widgets.CategoryFlowBox () {
margin_start = 12,
margin_end =12,
+ margin_top = 12,
valign = Gtk.Align.START
};
@@ -99,9 +44,6 @@ public class AppCenter.Homepage : AbstractView {
column_spacing = 24,
orientation = Gtk.Orientation.VERTICAL
};
- grid.add (banner_revealer);
- grid.add (recently_updated_revealer);
- grid.add (categories_label);
grid.add (category_flow);
scrolled_window = new Gtk.ScrolledWindow (null, null) {
@@ -111,19 +53,6 @@ public class AppCenter.Homepage : AbstractView {
add (scrolled_window);
- var local_package = App.local_package;
- if (local_package != null) {
- var banner = new Widgets.Banner (local_package);
-
- banner_carousel.prepend (banner);
-
- banner.clicked.connect (() => {
- show_package (local_package);
- });
- }
-
- load_banners_and_carousels.begin ();
-
category_flow.child_activated.connect ((child) => {
var item = child as Widgets.CategoryItem;
if (item != null) {
@@ -159,94 +88,8 @@ public class AppCenter.Homepage : AbstractView {
}
}
}
-
- return GLib.Source.REMOVE;
});
});
-
- banner_event_box.enter_notify_event.connect (() => {
- banner_timeout_stop ();
- });
-
- banner_event_box.leave_notify_event.connect (() => {
- banner_timeout_start ();
- });
-
- recently_updated_carousel.child_activated.connect ((child) => {
- var package_row_grid = (AppCenter.Widgets.ListPackageRowGrid) child.get_child ();
-
- show_package (package_row_grid.package);
- });
- }
-
- private async void load_banners_and_carousels () {
- unowned var fp_client = AppCenterCore.FlatpakBackend.get_default ();
- var packages_by_release_date = fp_client.get_featured_packages_by_release_date ();
- var packages_in_banner = new Gee.LinkedList<AppCenterCore.Package> ();
-
- int package_count = 0;
- foreach (var package in packages_by_release_date) {
- if (package_count >= MAX_PACKAGES_IN_BANNER) {
- break;
- }
-
- var installed = false;
- foreach (var origin_package in package.origin_packages) {
- try {
- if (yield origin_package.backend.is_package_installed (origin_package)) {
- installed = true;
- break;
- }
- } catch (Error e) {
- continue;
- }
- }
-
- if (!installed) {
- packages_in_banner.add (package);
- package_count++;
- }
- }
-
- foreach (var package in packages_in_banner) {
- var banner = new Widgets.Banner (package);
- banner.clicked.connect (() => {
- show_package (package);
- });
-
- banner_carousel.add (banner);
- }
-
- banner_carousel.show_all ();
- banner_revealer.reveal_child = true;
- banner_timeout_start ();
-
- foreach (var package in packages_by_release_date) {
- if (recently_updated_carousel.get_children ().length () >= MAX_PACKAGES_IN_CAROUSEL) {
- break;
- }
-
- var installed = false;
- foreach (var origin_package in package.origin_packages) {
- try {
- if (yield origin_package.backend.is_package_installed (origin_package)) {
- installed = true;
- break;
- }
- } catch (Error e) {
- continue;
- }
- }
-
- if (!installed && !(package in packages_in_banner)) {
- var package_row = new AppCenter.Widgets.ListPackageRowGrid (package);
- recently_updated_carousel.add (package_row);
- }
- }
- recently_updated_carousel.show_all ();
- recently_updated_revealer.reveal_child = recently_updated_carousel.get_children ().length () > 0;
-
- page_loaded ();
}
public override void show_package (
@@ -307,26 +150,4 @@ public class AppCenter.Homepage : AbstractView {
var apps = client.get_applications_for_category (category);
app_list_view.add_packages (apps);
}
-
- private void banner_timeout_start () {
- banner_timeout_id = Timeout.add (MILLISECONDS_BETWEEN_BANNER_ITEMS, () => {
- var new_index = (uint) banner_carousel.position + 1;
- var max_index = banner_carousel.n_pages - 1; // 0-based index
-
- if (banner_carousel.position >= max_index) {
- new_index = 0;
- }
-
- banner_carousel.switch_child (new_index, Granite.TRANSITION_DURATION_OPEN);
-
- return Source.CONTINUE;
- });
- }
-
- private void banner_timeout_stop () {
- if (banner_timeout_id != 0) {
- Source.remove (banner_timeout_id);
- banner_timeout_id = 0;
- }
- }
}

View File

@ -1,162 +0,0 @@
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;
}