Skip to content

Commit

Permalink
Hide apps from the Ubuntu repos (#1492)
Browse files Browse the repository at this point in the history
* Hide apps from the Ubuntu repos

* Update logic to hide apps from Ubuntu repos

* Add meson option to decide if apps from the Ubuntu repos should be hidden

* Update wording

* Update wording

Co-authored-by: Cassidy James Blaede <cassidy@elementary.io>
  • Loading branch information
meisenzahl and cassidyjames authored Apr 2, 2021
1 parent 42320e9 commit 40fd578
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ option('name', type : 'string', value : 'AppCenter', description : 'The name of
option('payments', type : 'boolean', value : true, description : 'Enable payment features and display paid apps')
option('sharing', type : 'boolean', value : true, description : 'Display sharing features, i.e. copyable URLs to apps')
option('api_url', type : 'string', value : 'https://developer.elementary.io/api', description : 'The base URL of the API to get app lists for the homepage banners')
option('hide_upstream_distro_apps', type : 'boolean', value : true, description : 'Used for hiding Ubuntu apps on elementary')
11 changes: 11 additions & 0 deletions src/Core/PackageKitBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,17 @@ public class AppCenterCore.PackageKitBackend : Backend, Object {

package_list = new Gee.HashMap<string, AppCenterCore.Package> (null, null);
appstream_pool = new AppStream.Pool ();

#if HIDE_UPSTREAM_DISTRO_APPS
// Only use a user cache, the system cache probably contains all the Ubuntu components
appstream_pool.set_cache_flags (AppStream.CacheFlags.USE_USER);

// Clear out the default set of metadata locations and only use the folder that gets populated
// with elementary's AppStream data.
appstream_pool.clear_metadata_locations ();
appstream_pool.add_metadata_location ("/usr/share/app-info");
#endif

// We don't want to show installed desktop files here
appstream_pool.set_flags (appstream_pool.get_flags () & ~AppStream.PoolFlags.READ_DESKTOP_FILES);

Expand Down
4 changes: 4 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ if get_option('sharing')
args += '--define=SHARING'
endif

if get_option('hide_upstream_distro_apps')
args += '--define=HIDE_UPSTREAM_DISTRO_APPS'
endif

executable(
meson.project_name(),
appcenter_files,
Expand Down

0 comments on commit 40fd578

Please sign in to comment.