update deprecated code

This commit is contained in:
2019-07-06 20:28:51 -04:00
parent d7cf388ece
commit 3b66f68b2c
38 changed files with 592 additions and 361 deletions

View File

@@ -1,7 +1,7 @@
/*
* pamac-vala
*
* Copyright (C) 2017 Chris Cromer <cromer@cromnix.org>
* Copyright (C) 2017-2019 Chris Cromer <cromer@cromnix.org>
* Copyright (C) 2014-2017 Guillaume Benoit <guillaume@manjaro.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -19,82 +19,85 @@
*/
//using Math
//using Vte
//using Posix
namespace Pamac {
[DBus (name = "org.pamac.user")]
interface UserDaemon : Object {
public abstract void refresh_handle () throws IOError;
public abstract AlpmPackage get_installed_pkg (string pkgname) throws IOError;
public abstract bool get_checkspace () throws IOError;
public abstract string[] get_ignorepkgs () throws IOError;
public abstract bool should_hold (string pkgname) throws IOError;
public abstract uint get_pkg_reason (string pkgname) throws IOError;
public abstract uint get_pkg_origin (string pkgname) throws IOError;
public abstract async AlpmPackage[] get_installed_pkgs () throws IOError;
public abstract async AlpmPackage[] get_explicitly_installed_pkgs () throws IOError;
public abstract async AlpmPackage[] get_foreign_pkgs () throws IOError;
public abstract async AlpmPackage[] get_orphans () throws IOError;
public abstract AlpmPackage find_installed_satisfier (string depstring) throws IOError;
public abstract AlpmPackage get_sync_pkg (string pkgname) throws IOError;
public abstract AlpmPackage find_sync_satisfier (string depstring) throws IOError;
public abstract async AlpmPackage[] search_pkgs (string search_string) throws IOError;
public abstract void refresh_handle () throws DBusError, IOError;
public abstract AlpmPackage get_installed_pkg (string pkgname) throws DBusError, IOError;
public abstract bool get_checkspace () throws DBusError, IOError;
public abstract string[] get_ignorepkgs () throws DBusError, IOError;
public abstract bool should_hold (string pkgname) throws DBusError, IOError;
public abstract uint get_pkg_reason (string pkgname) throws DBusError, IOError;
public abstract uint get_pkg_origin (string pkgname) throws DBusError, IOError;
public abstract async AlpmPackage[] get_installed_pkgs () throws DBusError, IOError;
public abstract async AlpmPackage[] get_explicitly_installed_pkgs () throws DBusError, IOError;
public abstract async AlpmPackage[] get_foreign_pkgs () throws DBusError, IOError;
public abstract async AlpmPackage[] get_orphans () throws DBusError, IOError;
public abstract AlpmPackage find_installed_satisfier (string depstring) throws DBusError, IOError;
public abstract AlpmPackage get_sync_pkg (string pkgname) throws DBusError, IOError;
public abstract AlpmPackage find_sync_satisfier (string depstring) throws DBusError, IOError;
public abstract async AlpmPackage[] search_pkgs (string search_string) throws DBusError, IOError;
#if DISABLE_AUR
#else
public abstract async AURPackage[] search_in_aur (string search_string) throws IOError;
public abstract async AURPackage[] search_in_aur (string search_string) throws DBusError, IOError;
#endif
public abstract string[] get_repos_names () throws IOError;
public abstract async AlpmPackage[] get_repo_pkgs (string repo) throws IOError;
public abstract string[] get_groups_names () throws IOError;
public abstract async AlpmPackage[] get_group_pkgs (string groupname) throws IOError;
public abstract AlpmPackageDetails get_pkg_details (string pkgname) throws IOError;
public abstract string[] get_pkg_files (string pkgname) throws IOError;
public abstract string[] get_repos_names () throws DBusError, IOError;
public abstract async AlpmPackage[] get_repo_pkgs (string repo) throws DBusError, IOError;
public abstract string[] get_groups_names () throws DBusError, IOError;
public abstract async AlpmPackage[] get_group_pkgs (string groupname) throws DBusError, IOError;
public abstract AlpmPackageDetails get_pkg_details (string pkgname) throws DBusError, IOError;
public abstract string[] get_pkg_files (string pkgname) throws DBusError, IOError;
#if DISABLE_AUR
#else
public abstract async AURPackageDetails get_aur_details (string pkgname) throws IOError;
public abstract async AURPackageDetails get_aur_details (string pkgname) throws DBusError, IOError;
#endif
public abstract string[] get_pkg_uninstalled_optdeps (string pkgname) throws IOError;
public abstract string[] get_pkg_uninstalled_optdeps (string pkgname) throws DBusError, IOError;
#if DISABLE_AUR
public abstract void start_get_updates () throws IOError;
public abstract void start_get_updates () throws DBusError, IOError;
#else
public abstract void start_get_updates (bool check_aur_updates) throws IOError;
public abstract void start_get_updates (bool check_aur_updates) throws DBusError, IOError;
#endif
[DBus (no_reply = true)]
public abstract void quit () throws IOError;
public abstract void quit () throws DBusError, IOError;
public signal void get_updates_finished (Updates updates);
}
[DBus (name = "org.pamac.system")]
interface SystemDaemon : Object {
public abstract void set_environment_variables (HashTable<string,string> variables) throws IOError;
public abstract string[] get_mirrors_countries () throws IOError;
public abstract ErrorInfos get_current_error () throws IOError;
public abstract bool get_lock () throws IOError;
public abstract bool unlock () throws IOError;
public abstract void start_get_authorization () throws IOError;
public abstract void start_save_pamac_config () throws IOError;
public abstract void start_write_alpm_config (HashTable<string,Variant> new_alpm_conf) throws IOError;
public abstract void start_write_mirrors_config (HashTable<string,Variant> new_mirrors_conf) throws IOError;
public abstract void start_generate_mirrors_list () throws IOError;
public abstract void clean_cache (uint64 keep_nb, bool only_uninstalled) throws IOError;
public abstract void start_set_pkgreason (string pkgname, uint reason) throws IOError;
public abstract void start_refresh (bool force) throws IOError;
public abstract void start_sysupgrade_prepare (bool enable_downgrade, string[] temporary_ignorepkgs) throws IOError;
public abstract void set_environment_variables (HashTable<string,string> variables) throws DBusError, IOError;
public abstract string[] get_mirrors_countries () throws DBusError, IOError;
public abstract ErrorInfos get_current_error () throws DBusError, IOError;
public abstract bool get_lock () throws DBusError, IOError;
public abstract bool unlock () throws DBusError, IOError;
public abstract void start_get_authorization () throws DBusError, IOError;
public abstract void start_save_pamac_config () throws DBusError, IOError;
public abstract void start_write_alpm_config (HashTable<string,Variant> new_alpm_conf) throws DBusError, IOError;
public abstract void start_write_mirrors_config (HashTable<string,Variant> new_mirrors_conf) throws DBusError, IOError;
public abstract void start_generate_mirrors_list () throws DBusError, IOError;
public abstract void clean_cache (uint64 keep_nb, bool only_uninstalled) throws DBusError, IOError;
public abstract void start_set_pkgreason (string pkgname, uint reason) throws DBusError, IOError;
public abstract void start_refresh (bool force) throws DBusError, IOError;
public abstract void start_sysupgrade_prepare (bool enable_downgrade, string[] temporary_ignorepkgs) throws DBusError, IOError;
#if DISABLE_AUR
public abstract void start_trans_prepare (int transflags, string[] to_install, string[] to_remove, string[] to_load) throws IOError;
public abstract void start_trans_prepare (int transflags, string[] to_install, string[] to_remove, string[] to_load) throws DBusError, IOError;
#else
public abstract void start_trans_prepare (int transflags, string[] to_install, string[] to_remove, string[] to_load, string[] to_build) throws IOError;
public abstract void start_trans_prepare (int transflags, string[] to_install, string[] to_remove, string[] to_load, string[] to_build) throws DBusError, IOError;
#endif
public abstract void choose_provider (int provider) throws IOError;
public abstract TransactionSummary get_transaction_summary () throws IOError;
public abstract void start_trans_commit () throws IOError;
public abstract void trans_release () throws IOError;
public abstract void trans_cancel () throws IOError;
public abstract void choose_provider (int provider) throws DBusError, IOError;
public abstract TransactionSummary get_transaction_summary () throws DBusError, IOError;
public abstract void start_trans_commit () throws DBusError, IOError;
public abstract void trans_release () throws DBusError, IOError;
public abstract void trans_cancel () throws DBusError, IOError;
#if DISABLE_AUR
public abstract void start_get_updates () throws IOError;
public abstract void start_get_updates () throws DBusError, IOError;
#else
public abstract void start_get_updates (bool check_aur_updates) throws IOError;
public abstract void start_get_updates (bool check_aur_updates) throws DBusError, IOError;
#endif
[DBus (no_reply = true)]
public abstract void quit () throws IOError;
public abstract void quit () throws DBusError, IOError;
public signal void get_updates_finished (Updates updates);
public signal void emit_event (uint primary_event, uint secondary_event, string[] details);
public signal void emit_providers (string depend, string[] providers);
@@ -344,6 +347,9 @@ namespace Pamac {
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
return ErrorInfos ();
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
return ErrorInfos ();
}
}
@@ -354,6 +360,8 @@ namespace Pamac {
countries = system_daemon.get_mirrors_countries ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return countries;
}
@@ -365,6 +373,8 @@ namespace Pamac {
locked = system_daemon.get_lock ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return locked;
}
@@ -375,6 +385,8 @@ namespace Pamac {
unlocked = system_daemon.unlock ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return unlocked;
}
@@ -390,6 +402,8 @@ namespace Pamac {
system_daemon.start_get_authorization ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
yield;
system_daemon.disconnect (handler_id);
@@ -403,6 +417,9 @@ namespace Pamac {
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
system_daemon.save_pamac_config_finished.disconnect (on_save_pamac_config_finished);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
system_daemon.save_pamac_config_finished.disconnect (on_save_pamac_config_finished);
}
}
@@ -413,6 +430,9 @@ namespace Pamac {
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
system_daemon.write_alpm_config_finished.disconnect (on_write_alpm_config_finished);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
system_daemon.write_alpm_config_finished.disconnect (on_write_alpm_config_finished);
}
}
@@ -423,6 +443,9 @@ namespace Pamac {
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
system_daemon.write_mirrors_config_finished.disconnect (on_write_mirrors_config_finished);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
system_daemon.write_mirrors_config_finished.disconnect (on_write_mirrors_config_finished);
}
}
@@ -435,7 +458,7 @@ namespace Pamac {
copy_item.activate.connect (() => {term.copy_clipboard ();});
right_click_menu.append (copy_item);
right_click_menu.show_all ();
right_click_menu.popup (null, null, null, event.button, event.time);
right_click_menu.popup_at_pointer (event);
return true;
}
}
@@ -480,8 +503,8 @@ namespace Pamac {
}
} catch (Error e) {
// cancelled
process.send_signal (Posix.SIGINT);
process.send_signal (Posix.SIGKILL);
process.send_signal (Posix.Signal.INT);
process.send_signal (Posix.Signal.KILL);
}
Idle.add ((owned) callback);
});
@@ -529,6 +552,11 @@ namespace Pamac {
stop_progressbar_pulse ();
system_daemon.generate_mirrors_list_data.disconnect (on_generate_mirrors_list_data);
system_daemon.generate_mirrors_list_finished.disconnect (on_generate_mirrors_list_finished);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
stop_progressbar_pulse ();
system_daemon.generate_mirrors_list_data.disconnect (on_generate_mirrors_list_data);
system_daemon.generate_mirrors_list_finished.disconnect (on_generate_mirrors_list_finished);
}
}
@@ -537,6 +565,8 @@ namespace Pamac {
system_daemon.clean_cache (keep_nb, only_uninstalled);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
}
@@ -547,6 +577,9 @@ namespace Pamac {
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
system_daemon.set_pkgreason_finished.disconnect (on_set_pkgreason_finished);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
system_daemon.set_pkgreason_finished.disconnect (on_set_pkgreason_finished);
}
}
@@ -566,6 +599,11 @@ namespace Pamac {
system_daemon.refresh_finished.disconnect (on_refresh_finished);
success = false;
finish_transaction ();
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
system_daemon.refresh_finished.disconnect (on_refresh_finished);
success = false;
finish_transaction ();
}
} else {
success = false;
@@ -579,6 +617,8 @@ namespace Pamac {
user_daemon.refresh_handle ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
}
@@ -588,6 +628,8 @@ namespace Pamac {
checkspace = user_daemon.get_checkspace ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return checkspace;
}
@@ -598,6 +640,8 @@ namespace Pamac {
ignorepkgs = user_daemon.get_ignorepkgs ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return ignorepkgs;
}
@@ -613,6 +657,14 @@ namespace Pamac {
desc = "",
repo = ""
};
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
return AlpmPackage () {
name = "",
version = "",
desc = "",
repo = ""
};
}
}
@@ -627,6 +679,14 @@ namespace Pamac {
desc = "",
repo = ""
};
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
return AlpmPackage () {
name = "",
version = "",
desc = "",
repo = ""
};
}
}
@@ -636,6 +696,8 @@ namespace Pamac {
should_hold = user_daemon.should_hold (pkgname);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return should_hold;
}
@@ -646,6 +708,8 @@ namespace Pamac {
reason = user_daemon.get_pkg_reason (pkgname);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return reason;
}
@@ -656,6 +720,8 @@ namespace Pamac {
origin = user_daemon.get_pkg_origin (pkgname);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return origin;
}
@@ -666,6 +732,8 @@ namespace Pamac {
pkgs = yield user_daemon.get_installed_pkgs ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return pkgs;
}
@@ -676,6 +744,8 @@ namespace Pamac {
pkgs = yield user_daemon.get_explicitly_installed_pkgs ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return pkgs;
}
@@ -686,6 +756,8 @@ namespace Pamac {
pkgs = yield user_daemon.get_foreign_pkgs ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return pkgs;
}
@@ -696,6 +768,8 @@ namespace Pamac {
pkgs = yield user_daemon.get_orphans ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return pkgs;
}
@@ -711,6 +785,14 @@ namespace Pamac {
desc = "",
repo = ""
};
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
return AlpmPackage () {
name = "",
version = "",
desc = "",
repo = ""
};
}
}
@@ -725,6 +807,14 @@ namespace Pamac {
desc = "",
repo = ""
};
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
return AlpmPackage () {
name = "",
version = "",
desc = "",
repo = ""
};
}
}
@@ -734,6 +824,8 @@ namespace Pamac {
pkgs = yield user_daemon.search_pkgs (search_string);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return pkgs;
}
@@ -746,6 +838,8 @@ namespace Pamac {
pkgs = yield user_daemon.search_in_aur (search_string);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return pkgs;
}
@@ -757,6 +851,8 @@ namespace Pamac {
repos_names = user_daemon.get_repos_names ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return repos_names;
}
@@ -767,6 +863,8 @@ namespace Pamac {
pkgs = yield user_daemon.get_repo_pkgs (repo);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return pkgs;
}
@@ -777,6 +875,8 @@ namespace Pamac {
groups_names = user_daemon.get_groups_names ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return groups_names;
}
@@ -787,6 +887,8 @@ namespace Pamac {
pkgs = yield user_daemon.get_group_pkgs (group_name);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return pkgs;
}
@@ -797,6 +899,8 @@ namespace Pamac {
optdeps = user_daemon.get_pkg_uninstalled_optdeps (pkgname);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return optdeps;
}
@@ -820,6 +924,22 @@ namespace Pamac {
downloadsize = "",
installsize = ""
};
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
return AlpmPackageDetails () {
name = "",
version = "",
desc = "",
repo = "",
url = "",
packager = "",
builddate = "",
installdate = "",
reason = "",
has_signature = "",
downloadsize = "",
installsize = ""
};
}
}
@@ -829,6 +949,9 @@ namespace Pamac {
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
return {};
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
return {};
}
}
@@ -847,6 +970,8 @@ namespace Pamac {
pkg = yield user_daemon.get_aur_details (pkgname);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
return pkg;
}
@@ -864,6 +989,10 @@ namespace Pamac {
stderr.printf ("IOError: %s\n", e.message);
success = false;
finish_transaction ();
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
success = false;
finish_transaction ();
}
}
@@ -879,6 +1008,10 @@ namespace Pamac {
stderr.printf ("IOError: %s\n", e.message);
success = false;
finish_transaction ();
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
success = false;
finish_transaction ();
}
}
@@ -897,6 +1030,10 @@ namespace Pamac {
stderr.printf ("IOError: %s\n", e.message);
success = false;
finish_transaction ();
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
success = false;
finish_transaction ();
}
}
@@ -989,6 +1126,11 @@ namespace Pamac {
stop_progressbar_pulse ();
success = false;
finish_transaction ();
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
stop_progressbar_pulse ();
success = false;
finish_transaction ();
}
}
@@ -1056,6 +1198,8 @@ namespace Pamac {
system_daemon.choose_provider (index);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
}
index++;
@@ -1077,6 +1221,8 @@ namespace Pamac {
summary = system_daemon.get_transaction_summary ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
var iter = Gtk.TreeIter ();
if (summary.to_remove.length > 0) {
@@ -1206,6 +1352,10 @@ namespace Pamac {
stderr.printf ("IOError: %s\n", e.message);
success = false;
finish_transaction ();
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
success = false;
finish_transaction ();
}
}
@@ -1297,6 +1447,8 @@ namespace Pamac {
system_daemon.trans_cancel ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
#if DISABLE_AUR
#else
@@ -1312,6 +1464,8 @@ namespace Pamac {
system_daemon.trans_release ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
warning_textbuffer = new StringBuilder ();
}
@@ -1324,6 +1478,8 @@ namespace Pamac {
}
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
}
@@ -1982,6 +2138,8 @@ namespace Pamac {
system_daemon.set_environment_variables (pamac_config.environment_variables);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
} catch (DBusError e) {
stderr.printf ("DBusError: %s\n", e.message);
}
}