pantheon.appcenter: 3.7.1 -> 3.8.0

This commit is contained in:
Bobby Rong 2021-09-22 08:57:19 +08:00
parent 8617d457a8
commit 97567fcbdc
No known key found for this signature in database
GPG key ID: ED07364437C91161
3 changed files with 243 additions and 41 deletions

View file

@ -30,19 +30,22 @@
stdenv.mkDerivation rec {
pname = "appcenter";
version = "3.7.1";
version = "3.8.0";
src = fetchFromGitHub {
owner = "elementary";
repo = pname;
rev = version;
sha256 = "1llkc0p47jcx992lkwics86vv622dmmvm5hxrdsq26j9crcd5dam";
sha256 = "07lkdpnjj9pxbq8h794qjiidvnysvzx0132w98r1wg9k7ca170bj";
};
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 = {
@ -82,7 +85,6 @@ stdenv.mkDerivation rec {
];
mesonFlags = [
"-Dhomepage=false"
"-Dpayments=false"
"-Dcurated=false"
];

View file

@ -0,0 +1,234 @@
From b1e09653d755ca6ffd03a1e3e67750e6bcc2bc6f Mon Sep 17 00:00:00 2001
From: Bobby Rong <rjl931189261@126.com>
Date: Wed, 22 Sep 2021 11:54:48 +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 576fc02c..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) && !package.is_explicit) {
- 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,15 +1,14 @@
From 63594caa1da772de504ab1d93b69aae148f29f64 Mon Sep 17 00:00:00 2001
From 5d3f20b49a89b55e39339a0f90ae7f846356b0e1 Mon Sep 17 00:00:00 2001
From: Bobby Rong <rjl931189261@126.com>
Date: Wed, 1 Sep 2021 12:25:09 +0800
Subject: [PATCH] Drop PackageKitBackend and UbuntuDriversBackend
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 ----------
src/Views/Homepage.vala | 15 ---------
5 files changed, 104 deletions(-)
4 files changed, 89 deletions(-)
diff --git a/src/Application.vala b/src/Application.vala
index 65fae5aa..9d42b14f 100644
@ -161,36 +160,3 @@ index a32ce47b..b9f8594a 100644
return false;
}
diff --git a/src/Views/Homepage.vala b/src/Views/Homepage.vala
index 67d1e208..48af8f61 100644
--- a/src/Views/Homepage.vala
+++ b/src/Views/Homepage.vala
@@ -212,7 +212,6 @@ public class AppCenter.Homepage : AbstractView {
recently_updated_revealer.reveal_child = recently_updated_carousel.get_children ().length () > 0;
var houston = AppCenterCore.Houston.get_default ();
- var pk_client = AppCenterCore.PackageKitBackend.get_default ();
var packages_for_banner = new Gee.LinkedList<AppCenterCore.Package> ();
var newest_ids = yield houston.get_app_ids ("/newest/project");
@@ -220,20 +219,6 @@ public class AppCenter.Homepage : AbstractView {
Utils.shuffle_array (trending_ids);
var packages = new Gee.HashMap<string, AppCenterCore.Package> ();
- packages.set_all (pk_client.get_packages_for_component_ids (newest_ids));
- packages.set_all (pk_client.get_packages_for_component_ids (trending_ids));
-
- if (!AppCenterCore.PackageKitBackend.supports_parallel_package_queries) {
- foreach (var package in packages.values) {
- package.update_state ();
- }
- } else {
- try {
- yield pk_client.update_multiple_package_state (packages.values);
- } catch (Error e) {
- warning ("Error while getting installed state of banner packages: %s", e.message);
- }
- }
foreach (var package in newest_ids) {
if (packages_for_banner.size >= NUM_PACKAGES_IN_BANNER) {