Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
meisenzahl committed Dec 22, 2022
1 parent 2bcba47 commit 94e2327
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 122 deletions.
16 changes: 0 additions & 16 deletions src/Core/BackendAggregator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,6 @@ public class AppCenterCore.BackendAggregator : Backend, Object {
set { }
}

public async Gee.Collection<PackageDetails> get_prepared_applications (Cancellable? cancellable = null) {
var apps = new Gee.TreeSet<PackageDetails> ();
foreach (var backend in backends) {
if (cancellable.is_cancelled ()) {
break;
}

var prepared = yield backend.get_prepared_applications (cancellable);
if (prepared != null) {
apps.add_all (prepared);
}
}

return apps;
}

public async Gee.Collection<Package> get_installed_applications (Cancellable? cancellable = null) {
var apps = new Gee.TreeSet<Package> ();
foreach (var backend in backends) {
Expand Down
1 change: 0 additions & 1 deletion src/Core/BackendInterface.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public interface AppCenterCore.Backend : Object {
public abstract Job.Type job_type { get; protected set; }
public abstract bool working { public get; protected set; }

public abstract async Gee.Collection<PackageDetails> get_prepared_applications (Cancellable? cancellable = null);
public abstract async Gee.Collection<Package> get_installed_applications (Cancellable? cancellable = null);
public abstract Gee.Collection<Package> get_applications_for_category (AppStream.Category category);
public abstract Gee.Collection<Package> search_applications (string query, AppStream.Category? category);
Expand Down
4 changes: 0 additions & 4 deletions src/Core/Client.vala
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ public class AppCenterCore.Client : Object {
last_cache_update = new DateTime.from_unix_utc (AppCenter.App.settings.get_int64 ("last-refresh-time"));
}

public async Gee.Collection<AppCenterCore.PackageDetails> get_prepared_applications (Cancellable? cancellable = null) {
return yield BackendAggregator.get_default ().get_prepared_applications (cancellable);
}

public async Gee.Collection<AppCenterCore.Package> get_installed_applications (Cancellable? cancellable = null) {
return yield BackendAggregator.get_default ().get_installed_applications (cancellable);
}
Expand Down
6 changes: 0 additions & 6 deletions src/Core/FlatpakBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,6 @@ public class AppCenterCore.FlatpakBackend : Backend, Object {
return job;
}

public async Gee.Collection<PackageDetails> get_prepared_applications (Cancellable? cancellable = null) {
var prepared_apps = new Gee.HashSet<PackageDetails> ();

return prepared_apps;
}

public async Gee.Collection<Package> get_installed_applications (Cancellable? cancellable = null) {
var installed_apps = new Gee.HashSet<Package> ();

Expand Down
7 changes: 1 addition & 6 deletions src/Core/Job.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public class AppCenterCore.Job : Object {
REMOVE_PACKAGE,
IS_PACKAGE_INSTALLED,
GET_PACKAGE_DETAILS,
GET_PACKAGE_DEPENDENCIES,
GET_PREPARED_PACKAGES
GET_PACKAGE_DEPENDENCIES
}

public Job (Type type) {
Expand All @@ -48,10 +47,6 @@ public class AppCenterCore.Job : Object {

public abstract class AppCenterCore.JobArgs { }

public class AppCenterCore.GetPreparedPackagesArgs : JobArgs {
public Cancellable? cancellable;
}

public class AppCenterCore.GetInstalledPackagesArgs : JobArgs {
public Cancellable? cancellable;
}
Expand Down
80 changes: 0 additions & 80 deletions src/Core/PackageKitBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ public class AppCenterCore.PackageKitBackend : Backend, Object {
job_type = job.operation;
working = true;
switch (job.operation) {
case Job.Type.GET_PREPARED_PACKAGES:
get_prepared_packages_internal (job);
break;
case Job.Type.GET_INSTALLED_PACKAGES:
get_installed_packages_internal (job);
break;
Expand Down Expand Up @@ -330,27 +327,6 @@ public class AppCenterCore.PackageKitBackend : Backend, Object {
return null;
}

public async Gee.Collection<AppCenterCore.PackageDetails> get_prepared_applications (Cancellable? cancellable = null) {
var packages = new Gee.TreeSet<AppCenterCore.PackageDetails> ();

var pk_prepared = yield get_prepared_packages ();
var package_array = pk_prepared.get_package_array ();
foreach (var pk_package in package_array) {
packages.add (new PackageDetails () {
name = pk_package.get_name (),
description = pk_package.description,
summary = pk_package.get_summary (),
version = pk_package.get_version ()
});
}

if (package_array.length > 0) {
updates_changed_callback ();
}

return packages;
}

public async Gee.Collection<AppCenterCore.Package> get_installed_applications (Cancellable? cancellable = null) {
var packages = new Gee.TreeSet<AppCenterCore.Package> ();
var installed = yield get_installed_packages (cancellable);
Expand Down Expand Up @@ -505,62 +481,6 @@ public class AppCenterCore.PackageKitBackend : Backend, Object {
return job;
}

private void get_prepared_packages_internal (Job job) {
var args = (GetPreparedPackagesArgs)job.args;
var cancellable = args.cancellable;

Pk.Results? results = null;
try {
results = client.get_updates (0, cancellable, (t, p) => { });
} catch (Error e) {
job.error = e;
job.results_ready ();
return;
}

string[] package_ids = {};
var downloaded_updates = get_downloaded_updates ();
results.get_package_array ().foreach ((pk_package) => {
if (downloaded_updates.contains (pk_package.get_id ())) {
package_ids += pk_package.get_id ();
}
});

if (package_ids.length == 0) {
job.result = Value (typeof (Object));
job.result.take_object (new Pk.Results ());
job.results_ready ();
return;
}

package_ids += null;

Pk.Results details;
try {
details = client.get_details (package_ids, cancellable, (p, t) => {});
} catch (Error e) {
job.error = e;
job.results_ready ();
return;
}

details.get_details_array ().foreach ((details) => {
results.add_details (details);
});

job.result = Value (typeof (Object));
job.result.take_object ((owned) results);
job.results_ready ();
}

public async Pk.Results get_prepared_packages (Cancellable? cancellable = null) {
var job_args = new GetPreparedPackagesArgs ();
job_args.cancellable = cancellable;

var job = yield launch_job (Job.Type.GET_PREPARED_PACKAGES, job_args);
return (Pk.Results)job.result.get_object ();
}

private void get_installed_packages_internal (Job job) {
unowned var args = (GetInstalledPackagesArgs)job.args;
unowned var cancellable = args.cancellable;
Expand Down
6 changes: 0 additions & 6 deletions src/Core/UbuntuDriversBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ public class AppCenterCore.UbuntuDriversBackend : Backend, Object {
return command.get_exit_status () == 0;
}

public async Gee.Collection<PackageDetails> get_prepared_applications (Cancellable? cancellable = null) {
var prepared_packages = new Gee.HashSet<PackageDetails> ();

return prepared_packages;
}

public async Gee.Collection<Package> get_installed_applications (Cancellable? cancellable = null) {
if (cached_packages != null) {
return cached_packages;
Expand Down
1 change: 0 additions & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow {
case GET_DOWNLOAD_SIZE:
overlaybar.label = _("Getting download size…");
break;
case GET_PREPARED_PACKAGES:
case GET_INSTALLED_PACKAGES:
case GET_UPDATES:
case REFRESH_CACHE:
Expand Down
2 changes: 0 additions & 2 deletions src/Views/AppListUpdateView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ namespace AppCenter.Views {
add_packages (installed_apps);
}

yield client.get_prepared_applications (refresh_cancellable);

refresh_cancellable = null;
refresh_mutex.unlock ();
}
Expand Down

0 comments on commit 94e2327

Please sign in to comment.