2014-10-22 13:44:02 -03:00
|
|
|
/*
|
|
|
|
* pamac-vala
|
|
|
|
*
|
2016-02-14 10:41:42 -03:00
|
|
|
* Copyright (C) 2014-2016 Guillaume Benoit <guillaume@manjaro.org>
|
2014-10-22 13:44:02 -03:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a get of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Pamac {
|
|
|
|
[DBus (name = "org.manjaro.pamac")]
|
2016-02-26 06:37:26 -03:00
|
|
|
interface Daemon : Object {
|
2016-02-02 05:28:07 -03:00
|
|
|
public abstract void set_environment_variables (HashTable<string,string> variables) throws IOError;
|
|
|
|
public abstract ErrorInfos get_current_error () throws IOError;
|
2015-08-20 10:11:18 -03:00
|
|
|
public abstract void start_get_authorization () throws IOError;
|
2015-03-04 11:55:36 -03:00
|
|
|
public abstract void start_write_pamac_config (HashTable<string,Variant> new_pamac_conf) 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;
|
2015-08-20 10:11:18 -03:00
|
|
|
public abstract void start_generate_mirrors_list () throws IOError;
|
2015-03-04 11:55:36 -03:00
|
|
|
public abstract void start_set_pkgreason (string pkgname, uint reason) throws IOError;
|
2016-02-02 05:28:07 -03:00
|
|
|
public abstract PackageInfos get_installed_pkg (string pkgname) throws IOError;
|
|
|
|
public abstract void start_refresh (bool force) throws IOError;
|
2015-04-11 13:00:49 -03:00
|
|
|
public abstract void add_ignorepkg (string pkgname) throws IOError;
|
|
|
|
public abstract void remove_ignorepkg (string pkgname) throws IOError;
|
2016-02-02 05:28:07 -03:00
|
|
|
public abstract void start_get_updates (bool check_aur_updates) throws IOError;
|
|
|
|
public abstract bool trans_init (Alpm.TransFlag transflags) throws IOError;
|
|
|
|
public abstract bool trans_sysupgrade (bool enable_downgrade) throws IOError;
|
|
|
|
public abstract bool trans_add_pkg (string pkgname) throws IOError;
|
|
|
|
public abstract bool trans_remove_pkg (string pkgname) throws IOError;
|
|
|
|
public abstract bool trans_load_pkg (string pkgpath) throws IOError;
|
2015-03-04 11:55:36 -03:00
|
|
|
public abstract void start_trans_prepare () throws IOError;
|
2014-10-22 13:44:02 -03:00
|
|
|
public abstract void choose_provider (int provider) throws IOError;
|
2016-02-02 05:28:07 -03:00
|
|
|
public abstract PackageInfos[] trans_to_add () throws IOError;
|
|
|
|
public abstract PackageInfos[] trans_to_remove () throws IOError;
|
2015-03-04 11:55:36 -03:00
|
|
|
public abstract void start_trans_commit () throws IOError;
|
2016-02-02 05:28:07 -03:00
|
|
|
public abstract void trans_release () throws IOError;
|
|
|
|
[DBus (no_reply = true)]
|
2014-10-22 13:44:02 -03:00
|
|
|
public abstract void trans_cancel () throws IOError;
|
|
|
|
[DBus (no_reply = true)]
|
|
|
|
public abstract void quit () throws IOError;
|
2014-12-03 12:02:14 -03:00
|
|
|
public signal void emit_event (uint primary_event, uint secondary_event, string[] details);
|
2014-10-22 13:44:02 -03:00
|
|
|
public signal void emit_providers (string depend, string[] providers);
|
2016-02-02 05:28:07 -03:00
|
|
|
public signal void emit_progress (uint progress, string pkgname, uint percent, uint n_targets, uint current_target);
|
2014-10-22 13:44:02 -03:00
|
|
|
public signal void emit_download (string filename, uint64 xfered, uint64 total);
|
|
|
|
public signal void emit_totaldownload (uint64 total);
|
|
|
|
public signal void emit_log (uint level, string msg);
|
2015-03-04 11:55:36 -03:00
|
|
|
public signal void set_pkgreason_finished ();
|
2016-02-02 05:28:07 -03:00
|
|
|
public signal void refresh_finished (bool success);
|
|
|
|
public signal void get_updates_finished (Updates updates);
|
|
|
|
public signal void trans_prepare_finished (bool success);
|
|
|
|
public signal void trans_commit_finished (bool success);
|
2015-08-20 10:11:18 -03:00
|
|
|
public signal void get_authorization_finished (bool authorized);
|
2016-02-02 05:28:07 -03:00
|
|
|
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
|
2015-08-24 11:13:18 -03:00
|
|
|
bool enable_aur, bool search_aur, bool check_aur_updates,
|
2015-08-20 10:11:18 -03:00
|
|
|
bool no_confirm_build);
|
|
|
|
public signal void write_alpm_config_finished (bool checkspace);
|
|
|
|
public signal void write_mirrors_config_finished (string choosen_country, string choosen_generation_method);
|
|
|
|
public signal void generate_mirrors_list_data (string line);
|
|
|
|
public signal void generate_mirrors_list_finished ();
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
2016-02-02 05:28:07 -03:00
|
|
|
public enum Mode {
|
|
|
|
MANAGER,
|
|
|
|
UPDATER
|
|
|
|
}
|
|
|
|
|
2014-10-22 13:44:02 -03:00
|
|
|
public class Transaction: Object {
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
enum Type {
|
|
|
|
STANDARD = (1 << 0),
|
|
|
|
UPDATE = (1 << 1),
|
|
|
|
BUILD = (1 << 2)
|
|
|
|
}
|
|
|
|
|
|
|
|
Daemon daemon;
|
|
|
|
|
2016-03-01 11:04:02 -03:00
|
|
|
public AlpmUtils alpm_utils;
|
2016-02-02 05:28:07 -03:00
|
|
|
public Pamac.Config pamac_config;
|
|
|
|
|
2014-10-30 10:44:09 -03:00
|
|
|
public Alpm.TransFlag flags;
|
2016-02-02 05:28:07 -03:00
|
|
|
|
2015-04-11 13:00:49 -03:00
|
|
|
public GenericSet<string?> to_add;
|
|
|
|
public GenericSet<string?> to_remove;
|
|
|
|
public GenericSet<string?> to_load;
|
|
|
|
public GenericSet<string?> to_build;
|
2016-02-26 06:37:26 -03:00
|
|
|
public GenericSet<string?> temporary_ignorepkgs;
|
|
|
|
|
|
|
|
HashTable<string,Json.Object> aur_infos;
|
2014-10-30 10:44:09 -03:00
|
|
|
|
2014-10-22 13:44:02 -03:00
|
|
|
public Mode mode;
|
|
|
|
|
|
|
|
uint64 total_download;
|
|
|
|
uint64 already_downloaded;
|
|
|
|
string previous_label;
|
|
|
|
string previous_textbar;
|
2016-02-02 05:28:07 -03:00
|
|
|
float previous_percent;
|
2014-10-22 13:44:02 -03:00
|
|
|
string previous_filename;
|
2014-12-30 11:04:40 -03:00
|
|
|
uint pulse_timeout_id;
|
2014-10-22 13:44:02 -03:00
|
|
|
bool sysupgrade_after_trans;
|
2016-02-02 05:28:07 -03:00
|
|
|
bool enable_downgrade;
|
|
|
|
uint64 previous_xfered;
|
|
|
|
uint64 download_rate;
|
|
|
|
uint64 rates_nb;
|
|
|
|
Timer timer;
|
2016-02-27 06:11:04 -03:00
|
|
|
bool database_modified;
|
2016-03-01 11:04:02 -03:00
|
|
|
bool success;
|
2014-10-22 13:44:02 -03:00
|
|
|
|
|
|
|
//dialogs
|
|
|
|
TransactionSumDialog transaction_sum_dialog;
|
|
|
|
TransactionInfoDialog transaction_info_dialog;
|
2014-10-30 10:44:09 -03:00
|
|
|
ProgressDialog progress_dialog;
|
2014-10-22 13:44:02 -03:00
|
|
|
//parent window
|
2016-02-26 06:37:26 -03:00
|
|
|
public Gtk.ApplicationWindow? application_window;
|
2014-10-22 13:44:02 -03:00
|
|
|
|
2016-03-01 11:04:02 -03:00
|
|
|
public signal void finished (bool success);
|
2016-02-26 06:37:26 -03:00
|
|
|
public signal void set_pkgreason_finished ();
|
|
|
|
public signal void get_updates_finished (Updates updates);
|
|
|
|
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
|
|
|
|
bool enable_aur, bool search_aur, bool check_aur_updates,
|
|
|
|
bool no_confirm_build);
|
|
|
|
public signal void write_alpm_config_finished (bool checkspace);
|
|
|
|
public signal void write_mirrors_config_finished (string choosen_country, string choosen_generation_method);
|
2014-10-22 13:44:02 -03:00
|
|
|
|
2016-02-02 05:28:07 -03:00
|
|
|
public Transaction (Gtk.ApplicationWindow? application_window) {
|
2016-03-01 11:04:02 -03:00
|
|
|
alpm_utils = new AlpmUtils ("/etc/pacman.conf");
|
2016-02-02 05:28:07 -03:00
|
|
|
pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
2014-10-30 10:44:09 -03:00
|
|
|
flags = Alpm.TransFlag.CASCADE;
|
2016-02-02 05:28:07 -03:00
|
|
|
if (pamac_config.recurse) {
|
|
|
|
flags |= Alpm.TransFlag.RECURSE;
|
|
|
|
}
|
2016-02-26 06:37:26 -03:00
|
|
|
|
2015-04-11 13:00:49 -03:00
|
|
|
to_add = new GenericSet<string?> (str_hash, str_equal);
|
|
|
|
to_remove = new GenericSet<string?> (str_hash, str_equal);
|
|
|
|
to_load = new GenericSet<string?> (str_hash, str_equal);
|
|
|
|
to_build = new GenericSet<string?> (str_hash, str_equal);
|
2016-02-26 06:37:26 -03:00
|
|
|
temporary_ignorepkgs = new GenericSet<string?> (str_hash, str_equal);
|
|
|
|
aur_infos = new HashTable<string,Json.Object> (str_hash, str_equal);
|
2014-10-22 13:44:02 -03:00
|
|
|
connecting_dbus_signals ();
|
|
|
|
//creating dialogs
|
2016-02-02 05:28:07 -03:00
|
|
|
this.application_window = application_window;
|
|
|
|
transaction_sum_dialog = new TransactionSumDialog (application_window);
|
|
|
|
transaction_info_dialog = new TransactionInfoDialog (application_window);
|
|
|
|
progress_dialog = new ProgressDialog (application_window);
|
2016-02-27 06:11:04 -03:00
|
|
|
progress_dialog.close_button.clicked.connect (on_progress_dialog_close_button_clicked);
|
|
|
|
progress_dialog.cancel_button.clicked.connect (on_progress_dialog_cancel_button_clicked);
|
2014-10-24 10:29:39 -03:00
|
|
|
// connect to child_exited signal which will only be emit after a call to watch_child
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.term.child_exited.connect (on_term_child_exited);
|
2014-10-22 13:44:02 -03:00
|
|
|
// progress data
|
|
|
|
previous_label = "";
|
|
|
|
previous_textbar = "";
|
|
|
|
previous_filename = "";
|
|
|
|
sysupgrade_after_trans = false;
|
2016-02-02 05:28:07 -03:00
|
|
|
timer = new Timer ();
|
2016-02-27 06:11:04 -03:00
|
|
|
database_modified = false;
|
2016-03-01 11:04:02 -03:00
|
|
|
success = false;
|
2016-02-02 05:28:07 -03:00
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
public async void run_preferences_dialog () {
|
|
|
|
SourceFunc callback = run_preferences_dialog.callback;
|
|
|
|
ulong handler_id = daemon.get_authorization_finished.connect ((authorized) => {
|
|
|
|
if (authorized) {
|
|
|
|
var preferences_dialog = new PreferencesDialog (this);
|
|
|
|
preferences_dialog.run ();
|
|
|
|
preferences_dialog.destroy ();
|
|
|
|
while (Gtk.events_pending ()) {
|
|
|
|
Gtk.main_iteration ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Idle.add((owned) callback);
|
|
|
|
});
|
|
|
|
start_get_authorization ();
|
|
|
|
yield;
|
|
|
|
daemon.disconnect (handler_id);
|
|
|
|
}
|
|
|
|
|
2016-02-02 05:28:07 -03:00
|
|
|
public ErrorInfos get_current_error () {
|
|
|
|
try {
|
|
|
|
return daemon.get_current_error ();
|
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
return ErrorInfos ();
|
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
2015-08-20 10:11:18 -03:00
|
|
|
public void start_get_authorization () {
|
|
|
|
try {
|
|
|
|
daemon.start_get_authorization ();
|
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-04 11:55:36 -03:00
|
|
|
public void start_write_pamac_config (HashTable<string,Variant> new_pamac_conf) {
|
2014-10-22 13:44:02 -03:00
|
|
|
try {
|
2015-03-04 11:55:36 -03:00
|
|
|
daemon.start_write_pamac_config (new_pamac_conf);
|
2014-12-30 11:04:40 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-04 11:55:36 -03:00
|
|
|
public void start_write_alpm_config (HashTable<string,Variant> new_alpm_conf) {
|
2014-12-30 11:04:40 -03:00
|
|
|
try {
|
2015-03-04 11:55:36 -03:00
|
|
|
daemon.start_write_alpm_config (new_alpm_conf);
|
2014-12-30 11:04:40 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-04 11:55:36 -03:00
|
|
|
public void start_write_mirrors_config (HashTable<string,Variant> new_mirrors_conf) {
|
2014-12-30 11:04:40 -03:00
|
|
|
try {
|
2015-03-04 11:55:36 -03:00
|
|
|
daemon.start_write_mirrors_config (new_mirrors_conf);
|
2014-11-08 13:50:35 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-20 10:11:18 -03:00
|
|
|
public void start_generate_mirrors_list () {
|
|
|
|
string action = dgettext (null, "Refreshing mirrors list") + "...";
|
|
|
|
progress_dialog.spawn_in_term ({"echo", action});
|
|
|
|
progress_dialog.action_label.set_text (action);
|
|
|
|
progress_dialog.progressbar.set_fraction (0);
|
|
|
|
progress_dialog.progressbar.set_text ("");
|
|
|
|
progress_dialog.cancel_button.set_visible (false);
|
|
|
|
progress_dialog.close_button.set_visible (false);
|
|
|
|
progress_dialog.expander.set_expanded (true);
|
|
|
|
progress_dialog.width_request = 700;
|
|
|
|
pulse_timeout_id = Timeout.add (500, (GLib.SourceFunc) progress_dialog.progressbar.pulse);
|
|
|
|
progress_dialog.show ();
|
|
|
|
while (Gtk.events_pending ()) {
|
|
|
|
Gtk.main_iteration ();
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
daemon.start_generate_mirrors_list ();
|
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
2016-02-02 05:28:07 -03:00
|
|
|
Source.remove (pulse_timeout_id);
|
2015-08-20 10:11:18 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-04 11:55:36 -03:00
|
|
|
public void start_set_pkgreason (string pkgname, Alpm.Package.Reason reason) {
|
2014-11-08 13:50:35 -03:00
|
|
|
try {
|
2015-03-04 11:55:36 -03:00
|
|
|
daemon.start_set_pkgreason (pkgname, (uint) reason);
|
2014-10-22 13:44:02 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-02 05:28:07 -03:00
|
|
|
public void start_refresh (bool force) {
|
2014-10-26 08:30:04 -03:00
|
|
|
string action = dgettext (null, "Synchronizing package databases") + "...";
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", action});
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (action);
|
|
|
|
progress_dialog.progressbar.set_fraction (0);
|
|
|
|
progress_dialog.progressbar.set_text ("");
|
|
|
|
progress_dialog.cancel_button.set_visible (true);
|
|
|
|
progress_dialog.close_button.set_visible (false);
|
|
|
|
progress_dialog.show ();
|
2015-03-04 11:55:36 -03:00
|
|
|
while (Gtk.events_pending ()) {
|
2014-11-08 13:50:35 -03:00
|
|
|
Gtk.main_iteration ();
|
2015-03-04 11:55:36 -03:00
|
|
|
}
|
|
|
|
try {
|
2015-08-20 10:11:18 -03:00
|
|
|
daemon.refresh_finished.connect (on_refresh_finished);
|
2015-04-11 13:00:49 -03:00
|
|
|
daemon.start_refresh (force);
|
2015-03-04 11:55:36 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
2015-08-20 10:11:18 -03:00
|
|
|
daemon.refresh_finished.disconnect (on_refresh_finished);
|
2016-02-27 06:11:04 -03:00
|
|
|
database_modified = true;
|
2016-03-01 11:04:02 -03:00
|
|
|
success = false;
|
2016-02-27 06:11:04 -03:00
|
|
|
finish_transaction ();
|
2015-03-04 11:55:36 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-02 05:28:07 -03:00
|
|
|
public void start_get_updates () {
|
2016-03-01 11:04:02 -03:00
|
|
|
daemon.get_updates_finished.connect (on_get_updates_finished);
|
|
|
|
try {
|
|
|
|
daemon.start_get_updates (pamac_config.enable_aur && pamac_config.check_aur_updates);
|
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
success = false;
|
|
|
|
finish_transaction ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void start_get_updates_for_sysupgrade () {
|
|
|
|
daemon.get_updates_finished.connect (on_get_updates_for_sysupgrade_finished);
|
2015-03-04 11:55:36 -03:00
|
|
|
try {
|
2016-02-02 05:28:07 -03:00
|
|
|
daemon.start_get_updates (pamac_config.enable_aur && pamac_config.check_aur_updates);
|
2015-03-04 11:55:36 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
2016-03-01 11:04:02 -03:00
|
|
|
success = false;
|
2016-02-27 06:11:04 -03:00
|
|
|
finish_transaction ();
|
2015-03-04 11:55:36 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-11 13:00:49 -03:00
|
|
|
public void add_ignorepkg (string pkgname) {
|
|
|
|
try {
|
|
|
|
daemon.add_ignorepkg (pkgname);
|
2016-02-26 06:37:26 -03:00
|
|
|
//temporary_ignorepkgs.add (pkgname);
|
2015-04-11 13:00:49 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void remove_ignorepkg (string pkgname) {
|
|
|
|
try {
|
|
|
|
daemon.remove_ignorepkg (pkgname);
|
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-02 05:28:07 -03:00
|
|
|
public bool init (Alpm.TransFlag flags) {
|
2016-02-26 06:37:26 -03:00
|
|
|
foreach (unowned string pkgname in temporary_ignorepkgs) {
|
2015-04-11 13:00:49 -03:00
|
|
|
add_ignorepkg (pkgname);
|
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
try {
|
2016-02-02 05:28:07 -03:00
|
|
|
return daemon.trans_init (flags);
|
2014-10-22 13:44:02 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
2016-02-02 05:28:07 -03:00
|
|
|
return false;
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2015-04-11 13:00:49 -03:00
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
void sysupgrade_simple (bool enable_downgrade) {
|
2015-04-11 13:00:49 -03:00
|
|
|
progress_dialog.progressbar.set_fraction (0);
|
|
|
|
progress_dialog.cancel_button.set_visible (true);
|
2016-03-01 11:04:02 -03:00
|
|
|
success = init (0);
|
2016-02-02 05:28:07 -03:00
|
|
|
if (success) {
|
2014-10-22 13:44:02 -03:00
|
|
|
try {
|
2016-02-02 05:28:07 -03:00
|
|
|
success = daemon.trans_sysupgrade (enable_downgrade);
|
2014-10-22 13:44:02 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
2016-02-02 05:28:07 -03:00
|
|
|
success = false;
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
if (success) {
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.show ();
|
2015-03-18 12:07:18 -03:00
|
|
|
while (Gtk.events_pending ()) {
|
2014-10-22 13:44:02 -03:00
|
|
|
Gtk.main_iteration ();
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2014-10-30 10:44:09 -03:00
|
|
|
try {
|
2015-03-04 11:55:36 -03:00
|
|
|
daemon.start_trans_prepare ();
|
2014-10-30 10:44:09 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
2016-02-27 06:11:04 -03:00
|
|
|
release ();
|
2016-03-01 11:04:02 -03:00
|
|
|
success = false;
|
2016-02-27 06:11:04 -03:00
|
|
|
finish_transaction ();
|
2014-10-30 10:44:09 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
} else {
|
|
|
|
release ();
|
2016-02-02 05:28:07 -03:00
|
|
|
handle_error (get_current_error ());
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
} else {
|
|
|
|
handle_error (get_current_error ());
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-02 05:28:07 -03:00
|
|
|
public void sysupgrade (bool enable_downgrade) {
|
2014-11-08 13:50:35 -03:00
|
|
|
this.enable_downgrade = enable_downgrade;
|
2014-10-26 08:30:04 -03:00
|
|
|
string action = dgettext (null, "Starting full system upgrade") + "...";
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", action});
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (action);
|
|
|
|
progress_dialog.progressbar.set_fraction (0);
|
|
|
|
progress_dialog.progressbar.set_text ("");
|
|
|
|
progress_dialog.cancel_button.set_visible (true);
|
|
|
|
progress_dialog.close_button.set_visible (false);
|
2015-03-04 11:55:36 -03:00
|
|
|
while (Gtk.events_pending ()) {
|
2014-10-22 13:44:02 -03:00
|
|
|
Gtk.main_iteration ();
|
2015-03-04 11:55:36 -03:00
|
|
|
}
|
2016-03-01 11:04:02 -03:00
|
|
|
start_get_updates_for_sysupgrade ();
|
2016-02-02 05:28:07 -03:00
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
void on_get_updates_finished (Updates updates) {
|
2016-03-01 11:04:02 -03:00
|
|
|
daemon.get_updates_finished.disconnect (on_get_updates_finished);
|
|
|
|
get_updates_finished (updates);
|
|
|
|
}
|
|
|
|
|
|
|
|
void on_get_updates_for_sysupgrade_finished (Updates updates) {
|
|
|
|
daemon.get_updates_finished.disconnect (on_get_updates_for_sysupgrade_finished);
|
2016-02-02 05:28:07 -03:00
|
|
|
// get syncfirst updates
|
|
|
|
if (updates.is_syncfirst) {
|
|
|
|
clear_lists ();
|
|
|
|
if (mode == Mode.MANAGER) {
|
|
|
|
sysupgrade_after_trans = true;
|
|
|
|
}
|
|
|
|
foreach (unowned PackageInfos infos in updates.repos_updates) {
|
|
|
|
to_add.add (infos.name);
|
|
|
|
}
|
|
|
|
// run as a standard transaction
|
|
|
|
run ();
|
|
|
|
} else {
|
|
|
|
if (updates.aur_updates.length != 0) {
|
2015-03-04 11:55:36 -03:00
|
|
|
clear_lists ();
|
2016-02-02 05:28:07 -03:00
|
|
|
foreach (unowned PackageInfos infos in updates.aur_updates) {
|
2016-02-26 06:37:26 -03:00
|
|
|
if (!(infos.name in temporary_ignorepkgs)) {
|
2016-02-02 05:28:07 -03:00
|
|
|
to_build.add (infos.name);
|
2015-03-04 11:55:36 -03:00
|
|
|
}
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
}
|
|
|
|
if (updates.repos_updates.length != 0) {
|
|
|
|
sysupgrade_simple (enable_downgrade);
|
|
|
|
} else {
|
|
|
|
progress_dialog.show ();
|
|
|
|
while (Gtk.events_pending ()) {
|
|
|
|
Gtk.main_iteration ();
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
on_trans_prepare_finished (true);
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
public void clear_lists () {
|
2015-04-11 13:00:49 -03:00
|
|
|
to_add.remove_all ();
|
|
|
|
to_remove.remove_all ();
|
|
|
|
to_build.remove_all ();
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
public void run () {
|
2016-02-26 06:37:26 -03:00
|
|
|
string action = dgettext (null, "Preparing") + "...";
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", action});
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (action);
|
|
|
|
progress_dialog.progressbar.set_fraction (0);
|
|
|
|
progress_dialog.progressbar.set_text ("");
|
|
|
|
progress_dialog.cancel_button.set_visible (true);
|
|
|
|
progress_dialog.close_button.set_visible (false);
|
|
|
|
progress_dialog.show ();
|
2015-03-18 12:07:18 -03:00
|
|
|
while (Gtk.events_pending ()) {
|
2014-10-22 13:44:02 -03:00
|
|
|
Gtk.main_iteration ();
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
// run
|
2015-04-11 13:00:49 -03:00
|
|
|
if (to_add.length == 0
|
|
|
|
&& to_remove.length == 0
|
|
|
|
&& to_load.length == 0
|
|
|
|
&& to_build.length != 0) {
|
2014-10-22 13:44:02 -03:00
|
|
|
// there only AUR packages to build so no need to prepare transaction
|
2016-02-02 05:28:07 -03:00
|
|
|
on_trans_prepare_finished (true);
|
2014-10-22 13:44:02 -03:00
|
|
|
} else {
|
2016-03-01 11:04:02 -03:00
|
|
|
success = false;
|
2014-10-22 13:44:02 -03:00
|
|
|
try {
|
2016-02-02 05:28:07 -03:00
|
|
|
success = daemon.trans_init (flags);
|
2014-10-22 13:44:02 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
if (success) {
|
|
|
|
success = false;
|
|
|
|
foreach (unowned string name in to_add) {
|
2014-10-22 13:44:02 -03:00
|
|
|
try {
|
2016-02-02 05:28:07 -03:00
|
|
|
success = daemon.trans_add_pkg (name);
|
2014-10-22 13:44:02 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
if (!success) {
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
foreach (unowned string name in to_remove) {
|
2014-10-22 13:44:02 -03:00
|
|
|
try {
|
2016-02-02 05:28:07 -03:00
|
|
|
success = daemon.trans_remove_pkg (name);
|
2014-10-22 13:44:02 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
if (!success) {
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
foreach (unowned string path in to_load) {
|
2014-10-22 13:44:02 -03:00
|
|
|
try {
|
2016-02-02 05:28:07 -03:00
|
|
|
success = daemon.trans_load_pkg (path);
|
2014-10-22 13:44:02 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
if (!success) {
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
if (success) {
|
2014-10-30 10:44:09 -03:00
|
|
|
try {
|
2015-03-04 11:55:36 -03:00
|
|
|
daemon.start_trans_prepare ();
|
2014-10-30 10:44:09 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
2016-02-27 06:11:04 -03:00
|
|
|
release ();
|
2016-03-01 11:04:02 -03:00
|
|
|
success = false;
|
2016-02-27 06:11:04 -03:00
|
|
|
finish_transaction ();
|
2014-10-30 10:44:09 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
} else {
|
|
|
|
release ();
|
2016-02-02 05:28:07 -03:00
|
|
|
handle_error (get_current_error ());
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
} else {
|
|
|
|
handle_error (get_current_error ());
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
void choose_provider (string depend, string[] providers) {
|
2016-02-02 05:28:07 -03:00
|
|
|
var choose_provider_dialog = new ChooseProviderDialog (application_window);
|
|
|
|
choose_provider_dialog.label.set_markup ("<b>%s</b>".printf (dgettext (null, "Choose a provider for %s").printf (depend)));
|
|
|
|
foreach (unowned string provider in providers) {
|
|
|
|
choose_provider_dialog.comboboxtext.append_text (provider);
|
|
|
|
}
|
|
|
|
choose_provider_dialog.comboboxtext.active = 0;
|
2014-10-22 13:44:02 -03:00
|
|
|
choose_provider_dialog.run ();
|
|
|
|
try {
|
|
|
|
daemon.choose_provider (choose_provider_dialog.comboboxtext.active);
|
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
2015-04-11 13:00:49 -03:00
|
|
|
choose_provider_dialog.destroy ();
|
|
|
|
while (Gtk.events_pending ()) {
|
|
|
|
Gtk.main_iteration ();
|
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
Type set_transaction_sum () {
|
2015-01-02 18:29:04 -03:00
|
|
|
// return 0 if transaction_sum is empty, 2, if there are only aur updates, 1 otherwise
|
2016-02-26 06:37:26 -03:00
|
|
|
Type type = 0;
|
2014-10-22 13:44:02 -03:00
|
|
|
uint64 dsize = 0;
|
2016-02-02 05:28:07 -03:00
|
|
|
PackageInfos[] prepared_to_add = {};
|
|
|
|
PackageInfos[] prepared_to_remove = {};
|
2014-10-22 13:44:02 -03:00
|
|
|
string[] to_downgrade = {};
|
|
|
|
string[] to_install = {};
|
|
|
|
string[] to_reinstall = {};
|
|
|
|
string[] to_update = {};
|
2014-10-30 10:44:09 -03:00
|
|
|
string[] _to_build = {};
|
2015-03-04 11:55:36 -03:00
|
|
|
Gtk.TreeIter iter;
|
2014-10-22 13:44:02 -03:00
|
|
|
transaction_sum_dialog.top_label.set_markup ("<big><b>%s</b></big>".printf (dgettext (null, "Transaction Summary")));
|
|
|
|
transaction_sum_dialog.sum_list.clear ();
|
|
|
|
try {
|
|
|
|
prepared_to_add = daemon.trans_to_add ();
|
|
|
|
prepared_to_remove = daemon.trans_to_remove ();
|
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
foreach (unowned PackageInfos pkg_info in prepared_to_add) {
|
2014-10-22 13:44:02 -03:00
|
|
|
dsize += pkg_info.download_size;
|
2016-02-02 05:28:07 -03:00
|
|
|
try {
|
|
|
|
PackageInfos local_pkg_info = daemon.get_installed_pkg (pkg_info.name);
|
|
|
|
if (local_pkg_info.name == "") {
|
|
|
|
to_install += "%s %s".printf (pkg_info.name, pkg_info.version);
|
2015-03-04 11:55:36 -03:00
|
|
|
} else {
|
2016-02-02 05:28:07 -03:00
|
|
|
int cmp = Alpm.pkg_vercmp (pkg_info.version, local_pkg_info.version);
|
|
|
|
if (cmp == 1) {
|
|
|
|
to_update += "%s %s".printf (pkg_info.name, pkg_info.version);
|
|
|
|
} else if (cmp == 0) {
|
|
|
|
to_reinstall += "%s %s".printf (pkg_info.name, pkg_info.version);
|
|
|
|
} else {
|
|
|
|
to_downgrade += "%s %s".printf (pkg_info.name, pkg_info.version);
|
|
|
|
}
|
2015-03-04 11:55:36 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
foreach (unowned string name in to_build) {
|
2014-10-30 10:44:09 -03:00
|
|
|
_to_build += name;
|
2015-03-04 11:55:36 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
int len = prepared_to_remove.length;
|
|
|
|
int i;
|
|
|
|
if (len != 0) {
|
2016-02-26 06:37:26 -03:00
|
|
|
type |= Type.STANDARD;
|
2014-10-22 13:44:02 -03:00
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
|
|
|
0, dgettext (null, "To remove") + ":",
|
|
|
|
1, "%s %s".printf (prepared_to_remove[0].name, prepared_to_remove[0].version));
|
|
|
|
i = 1;
|
|
|
|
while (i < len) {
|
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
|
|
|
1, "%s %s".printf (prepared_to_remove[i].name, prepared_to_remove[i].version));
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
len = to_downgrade.length;
|
|
|
|
if (len != 0) {
|
2016-02-26 06:37:26 -03:00
|
|
|
type |= Type.STANDARD;
|
2014-10-22 13:44:02 -03:00
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
|
|
|
0, dgettext (null, "To downgrade") + ":",
|
|
|
|
1, to_downgrade[0]);
|
|
|
|
i = 1;
|
|
|
|
while (i < len) {
|
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
|
|
|
1, to_downgrade[i]);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2014-10-30 10:44:09 -03:00
|
|
|
len = _to_build.length;
|
2014-10-22 13:44:02 -03:00
|
|
|
if (len != 0) {
|
2016-02-26 06:37:26 -03:00
|
|
|
type |= Type.BUILD;
|
2014-10-22 13:44:02 -03:00
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
|
|
|
0, dgettext (null, "To build") + ":",
|
2014-10-30 10:44:09 -03:00
|
|
|
1, _to_build[0]);
|
2014-10-22 13:44:02 -03:00
|
|
|
i = 1;
|
|
|
|
while (i < len) {
|
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
2014-10-30 10:44:09 -03:00
|
|
|
1, _to_build[i]);
|
2014-10-22 13:44:02 -03:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
len = to_install.length;
|
|
|
|
if (len != 0) {
|
2016-02-26 06:37:26 -03:00
|
|
|
type |= Type.STANDARD;
|
2014-10-22 13:44:02 -03:00
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
|
|
|
0, dgettext (null, "To install") + ":",
|
|
|
|
1, to_install[0]);
|
|
|
|
i = 1;
|
|
|
|
while (i < len) {
|
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
|
|
|
1, to_install[i]);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
len = to_reinstall.length;
|
|
|
|
if (len != 0) {
|
2016-02-26 06:37:26 -03:00
|
|
|
type |= Type.STANDARD;
|
2014-10-22 13:44:02 -03:00
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
|
|
|
0, dgettext (null, "To reinstall") + ":",
|
|
|
|
1, to_reinstall[0]);
|
|
|
|
i = 1;
|
|
|
|
while (i < len) {
|
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
|
|
|
1, to_reinstall[i]);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2015-01-02 18:29:04 -03:00
|
|
|
len = to_update.length;
|
|
|
|
if (len != 0) {
|
2016-02-26 06:37:26 -03:00
|
|
|
type |= Type.UPDATE;
|
2015-01-03 10:52:26 -03:00
|
|
|
if (mode != Mode.UPDATER) {
|
2014-10-22 13:44:02 -03:00
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
|
|
|
0, dgettext (null, "To update") + ":",
|
|
|
|
1, to_update[0]);
|
|
|
|
i = 1;
|
|
|
|
while (i < len) {
|
|
|
|
transaction_sum_dialog.sum_list.insert_with_values (out iter, -1,
|
|
|
|
1, to_update[i]);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-03-04 11:55:36 -03:00
|
|
|
if (dsize == 0) {
|
2014-10-22 13:44:02 -03:00
|
|
|
transaction_sum_dialog.bottom_label.set_visible (false);
|
2015-03-04 11:55:36 -03:00
|
|
|
} else {
|
2014-10-26 08:30:04 -03:00
|
|
|
transaction_sum_dialog.bottom_label.set_markup ("<b>%s: %s</b>".printf (dgettext (null, "Total download size"), format_size (dsize)));
|
2014-10-22 13:44:02 -03:00
|
|
|
transaction_sum_dialog.bottom_label.set_visible (true);
|
|
|
|
}
|
2015-01-03 10:52:26 -03:00
|
|
|
return type;
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
2015-03-04 11:55:36 -03:00
|
|
|
public void start_commit () {
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.cancel_button.set_visible (false);
|
|
|
|
try {
|
2015-03-04 11:55:36 -03:00
|
|
|
daemon.start_trans_commit ();
|
2014-10-30 10:44:09 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
2016-02-27 06:11:04 -03:00
|
|
|
database_modified = true;
|
2016-03-01 11:04:02 -03:00
|
|
|
success = false;
|
2016-02-27 06:11:04 -03:00
|
|
|
finish_transaction ();
|
2014-10-30 10:44:09 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
public void build_aur_packages () {
|
2016-02-26 06:37:26 -03:00
|
|
|
string action = dgettext (null, "Building packages") + "...";
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", action});
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (action);
|
|
|
|
progress_dialog.progressbar.set_fraction (0);
|
|
|
|
progress_dialog.progressbar.set_text ("");
|
|
|
|
progress_dialog.cancel_button.set_visible (false);
|
|
|
|
progress_dialog.close_button.set_visible (false);
|
|
|
|
progress_dialog.expander.set_expanded (true);
|
|
|
|
progress_dialog.width_request = 700;
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.term.grab_focus ();
|
2014-12-30 11:04:40 -03:00
|
|
|
pulse_timeout_id = Timeout.add (500, (GLib.SourceFunc) progress_dialog.progressbar.pulse);
|
|
|
|
string[] cmds = {"yaourt", "-S"};
|
2015-08-20 10:11:18 -03:00
|
|
|
if (pamac_config.no_confirm_build) {
|
|
|
|
cmds += "--noconfirm";
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
foreach (unowned string name in to_build) {
|
2014-10-24 10:29:39 -03:00
|
|
|
cmds += name;
|
2015-04-11 13:00:49 -03:00
|
|
|
}
|
2014-10-24 10:29:39 -03:00
|
|
|
Pid child_pid;
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term (cmds, out child_pid);
|
2014-10-24 10:29:39 -03:00
|
|
|
// watch_child is needed in order to have the child_exited signal emitted
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.term.watch_child (child_pid);
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
public async Json.Object get_aur_infos (string aur_name) {
|
|
|
|
if (!aur_infos.contains (aur_name)) {
|
|
|
|
Json.Array results = AUR.multiinfo ({aur_name});
|
|
|
|
aur_infos.insert (aur_name, results.get_object_element (0));
|
|
|
|
}
|
|
|
|
return aur_infos.lookup (aur_name);
|
|
|
|
}
|
|
|
|
|
2014-10-22 13:44:02 -03:00
|
|
|
public void cancel () {
|
|
|
|
try {
|
|
|
|
daemon.trans_cancel ();
|
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
progress_dialog.expander.set_expanded (false);
|
|
|
|
Gtk.TextIter start_iter;
|
|
|
|
Gtk.TextIter end_iter;
|
|
|
|
transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
|
|
|
|
transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
|
|
|
|
transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter);
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
public void release () {
|
|
|
|
try {
|
|
|
|
daemon.trans_release ();
|
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
2016-02-26 06:37:26 -03:00
|
|
|
foreach (unowned string pkgname in temporary_ignorepkgs) {
|
2015-04-11 13:00:49 -03:00
|
|
|
remove_ignorepkg (pkgname);
|
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
public void stop_daemon () {
|
|
|
|
try {
|
|
|
|
daemon.quit ();
|
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-03 12:02:14 -03:00
|
|
|
void on_emit_event (uint primary_event, uint secondary_event, string[] details) {
|
2014-10-26 08:30:04 -03:00
|
|
|
string msg;
|
2014-12-03 12:02:14 -03:00
|
|
|
switch (primary_event) {
|
2016-02-02 05:28:07 -03:00
|
|
|
case Alpm.Event.Type.HOOK_START:
|
|
|
|
switch (secondary_event) {
|
|
|
|
case Alpm.HookWhen.PRE_TRANSACTION:
|
|
|
|
msg = dgettext (null, "Running pre-transaction hooks") + "...";
|
|
|
|
progress_dialog.action_label.set_text (msg);
|
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
|
|
|
break;
|
|
|
|
case Alpm.HookWhen.POST_TRANSACTION:
|
|
|
|
msg = dgettext (null, "Running post-transaction hooks") + "...";
|
|
|
|
progress_dialog.action_label.set_text (msg);
|
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Alpm.Event.Type.HOOK_RUN_START:
|
2016-02-06 05:33:07 -03:00
|
|
|
string textbar = "%s/%s".printf (details[2], details[3]);
|
|
|
|
if (textbar != previous_textbar) {
|
|
|
|
previous_textbar = textbar;
|
|
|
|
progress_dialog.progressbar.set_text (textbar);
|
|
|
|
}
|
|
|
|
float fraction = (float) int.parse (details[2]) / int.parse (details[3]);
|
|
|
|
if (fraction != previous_percent) {
|
|
|
|
previous_percent = fraction;
|
|
|
|
progress_dialog.progressbar.set_fraction (fraction);
|
|
|
|
}
|
|
|
|
if (details[1] != "") {
|
|
|
|
msg = details[1] + ":";
|
|
|
|
} else {
|
|
|
|
msg = details[0] + ":";
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.CHECKDEPS_START:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Checking dependencies") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.FILECONFLICTS_START:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Checking file conflicts") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.RESOLVEDEPS_START:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Resolving dependencies") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.INTERCONFLICTS_START:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Checking inter-conflicts") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2016-02-02 05:28:07 -03:00
|
|
|
case Alpm.Event.Type.TRANSACTION_START:
|
|
|
|
progress_dialog.cancel_button.set_visible (false);
|
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.PACKAGE_OPERATION_START:
|
2014-12-03 12:02:14 -03:00
|
|
|
switch (secondary_event) {
|
|
|
|
case Alpm.Package.Operation.INSTALL:
|
|
|
|
previous_filename = details[0];
|
|
|
|
msg = dgettext (null, "Installing %s").printf (details[0]) + "...";
|
|
|
|
progress_dialog.action_label.set_text (msg);
|
|
|
|
msg = dgettext (null, "Installing %s").printf ("%s (%s)".printf (details[0], details[1]))+ "...";
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-12-03 12:02:14 -03:00
|
|
|
break;
|
|
|
|
case Alpm.Package.Operation.REINSTALL:
|
|
|
|
previous_filename = details[0];
|
|
|
|
msg = dgettext (null, "Reinstalling %s").printf (details[0]) + "...";
|
|
|
|
progress_dialog.action_label.set_text (msg);
|
|
|
|
msg = dgettext (null, "Reinstalling %s").printf ("%s (%s)".printf (details[0], details[1]))+ "...";
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-12-03 12:02:14 -03:00
|
|
|
break;
|
|
|
|
case Alpm.Package.Operation.REMOVE:
|
|
|
|
previous_filename = details[0];
|
|
|
|
msg = dgettext (null, "Removing %s").printf (details[0]) + "...";
|
|
|
|
progress_dialog.action_label.set_text (msg);
|
|
|
|
msg = dgettext (null, "Removing %s").printf ("%s (%s)".printf (details[0], details[1]))+ "...";
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-12-03 12:02:14 -03:00
|
|
|
break;
|
|
|
|
case Alpm.Package.Operation.UPGRADE:
|
|
|
|
previous_filename = details[0];
|
|
|
|
msg = dgettext (null, "Upgrading %s").printf (details[0]) + "...";
|
|
|
|
progress_dialog.action_label.set_text (msg);
|
|
|
|
msg = dgettext (null, "Upgrading %s").printf ("%s (%s -> %s)".printf (details[0], details[1], details[2]))+ "...";
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-12-03 12:02:14 -03:00
|
|
|
break;
|
|
|
|
case Alpm.Package.Operation.DOWNGRADE:
|
|
|
|
previous_filename = details[0];
|
|
|
|
msg = dgettext (null, "Downgrading %s").printf (details[0]) + "...";
|
|
|
|
progress_dialog.action_label.set_text (msg);
|
|
|
|
msg = dgettext (null, "Downgrading %s").printf ("%s (%s -> %s)".printf (details[0], details[1], details[2]))+ "...";
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-12-03 12:02:14 -03:00
|
|
|
break;
|
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.INTEGRITY_START:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Checking integrity") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.KEYRING_START:
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.cancel_button.set_visible (true);
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Checking keyring") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-26 08:30:04 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.KEY_DOWNLOAD_START:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Downloading required keys") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.LOAD_START:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Loading packages files") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-26 08:30:04 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.DELTA_INTEGRITY_START:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Checking delta integrity") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-26 08:30:04 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.DELTA_PATCHES_START:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Applying deltas") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-26 08:30:04 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.DELTA_PATCH_START:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Generating %s with %s").printf (details[0], details[1]) + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-26 08:30:04 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.DELTA_PATCH_DONE:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Generation succeeded") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-26 08:30:04 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.DELTA_PATCH_FAILED:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Generation failed") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.SCRIPTLET_INFO:
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (dgettext (null, "Configuring %s").printf (previous_filename) + "...");
|
|
|
|
progress_dialog.expander.set_expanded (true);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", "-n", details[0]});
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.RETRIEVE_START:
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.cancel_button.set_visible (true);
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Downloading") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-12-03 12:02:14 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.DISKSPACE_START:
|
2014-10-26 08:30:04 -03:00
|
|
|
msg = dgettext (null, "Checking available disk space") + "...";
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.action_label.set_text (msg);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.OPTDEP_REMOVAL:
|
2015-08-20 13:23:43 -03:00
|
|
|
msg = dgettext (null, "%s optionally requires %s").printf (details[0], details[1]);
|
|
|
|
progress_dialog.spawn_in_term ({"echo", msg});
|
|
|
|
Gtk.TextIter end_iter;
|
|
|
|
msg += "\n";
|
|
|
|
transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
|
|
|
|
transaction_info_dialog.textbuffer.insert (ref end_iter, msg, msg.length);
|
2014-10-26 08:30:04 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.DATABASE_MISSING:
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", dgettext (null, "Database file for %s does not exist").printf (details[0])});
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.PACNEW_CREATED:
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", dgettext (null, "%s installed as %s.pacnew").printf (details[0])});
|
2014-12-03 12:02:14 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Event.Type.PACSAVE_CREATED:
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", dgettext (null, "%s installed as %s.pacsave").printf (details[0])});
|
2014-12-03 12:02:14 -03:00
|
|
|
break;
|
2014-10-22 13:44:02 -03:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2015-03-18 12:07:18 -03:00
|
|
|
while (Gtk.events_pending ()) {
|
2014-10-26 08:30:04 -03:00
|
|
|
Gtk.main_iteration ();
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
void on_emit_providers (string depend, string[] providers) {
|
|
|
|
choose_provider (depend, providers);
|
|
|
|
}
|
|
|
|
|
2016-02-02 05:28:07 -03:00
|
|
|
void on_emit_progress (uint progress, string pkgname, uint percent, uint n_targets, uint current_target) {
|
|
|
|
float fraction;
|
2014-10-22 13:44:02 -03:00
|
|
|
switch (progress) {
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Progress.ADD_START:
|
|
|
|
case Alpm.Progress.UPGRADE_START:
|
|
|
|
case Alpm.Progress.DOWNGRADE_START:
|
|
|
|
case Alpm.Progress.REINSTALL_START:
|
|
|
|
case Alpm.Progress.REMOVE_START:
|
2016-02-02 05:28:07 -03:00
|
|
|
fraction = ((float) (current_target - 1) / n_targets) + ((float) percent / (100 * n_targets));
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
2015-03-04 11:55:36 -03:00
|
|
|
case Alpm.Progress.CONFLICTS_START:
|
|
|
|
case Alpm.Progress.DISKSPACE_START:
|
|
|
|
case Alpm.Progress.INTEGRITY_START:
|
|
|
|
case Alpm.Progress.KEYRING_START:
|
|
|
|
case Alpm.Progress.LOAD_START:
|
2014-10-22 13:44:02 -03:00
|
|
|
default:
|
2016-02-02 05:28:07 -03:00
|
|
|
fraction = (float) percent / 100;
|
2014-10-22 13:44:02 -03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
string textbar = "%lu/%lu".printf (current_target, n_targets);
|
|
|
|
if (textbar != previous_textbar) {
|
|
|
|
previous_textbar = textbar;
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.progressbar.set_text (textbar);
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
if (fraction != previous_percent) {
|
|
|
|
previous_percent = fraction;
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.progressbar.set_fraction (fraction);
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
//~ while (Gtk.events_pending ()) {
|
|
|
|
//~ Gtk.main_iteration ();
|
|
|
|
//~ }
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
void on_emit_download (string filename, uint64 xfered, uint64 total) {
|
2014-12-30 11:04:40 -03:00
|
|
|
string label;
|
2016-02-02 05:28:07 -03:00
|
|
|
var text = new StringBuilder ();
|
|
|
|
float fraction;
|
2014-12-30 11:04:40 -03:00
|
|
|
if (filename != previous_filename) {
|
|
|
|
previous_filename = filename;
|
|
|
|
if (filename.has_suffix (".db")) {
|
|
|
|
label = dgettext (null, "Refreshing %s").printf (filename.replace (".db", "")) + "...";
|
|
|
|
} else {
|
|
|
|
label = dgettext (null, "Downloading %s").printf (filename.replace (".pkg.tar.xz", "")) + "...";
|
|
|
|
}
|
|
|
|
if (label != previous_label) {
|
|
|
|
previous_label = label;
|
|
|
|
progress_dialog.action_label.set_text (label);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", label});
|
2014-12-30 11:04:40 -03:00
|
|
|
}
|
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
if (total_download > 0) {
|
2016-02-02 05:28:07 -03:00
|
|
|
if (xfered == 0) {
|
|
|
|
previous_xfered = 0;
|
|
|
|
fraction = previous_percent;
|
|
|
|
text.append (previous_textbar);
|
|
|
|
timer.start ();
|
2015-03-18 12:07:18 -03:00
|
|
|
} else {
|
2016-02-14 10:18:08 -03:00
|
|
|
if (timer.elapsed () > 0) {
|
|
|
|
download_rate = ((download_rate * rates_nb) + (uint64) ((xfered - previous_xfered) / timer.elapsed ())) / (rates_nb + 1);
|
|
|
|
rates_nb++;
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
previous_xfered = xfered;
|
|
|
|
uint64 downloaded_total = xfered + already_downloaded;
|
|
|
|
fraction = (float) downloaded_total / total_download;
|
|
|
|
if (fraction <= 1) {
|
|
|
|
text.append ("%s/%s ".printf (format_size (xfered + already_downloaded), format_size (total_download)));
|
2016-02-14 10:18:08 -03:00
|
|
|
uint64 remaining_seconds = 0;
|
|
|
|
if (download_rate > 0) {
|
|
|
|
remaining_seconds = (total_download - downloaded_total) / download_rate;
|
|
|
|
}
|
|
|
|
// display remaining time after 5s and only if more than 10s are remaining
|
|
|
|
if (remaining_seconds > 9 && rates_nb > 9) {
|
2016-02-02 05:28:07 -03:00
|
|
|
if (remaining_seconds <= 50) {
|
|
|
|
text.append (dgettext (null, "About %u seconds remaining").printf ((uint) Math.ceilf ((float) remaining_seconds / 10) * 10));
|
|
|
|
} else {
|
|
|
|
uint remaining_minutes = (uint) Math.ceilf ((float) remaining_seconds / 60);
|
|
|
|
text.append (dngettext (null, "About %lu minute remaining",
|
|
|
|
"About %lu minutes remaining", remaining_minutes).printf (remaining_minutes));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
text.append ("%s".printf (format_size (xfered + already_downloaded)));
|
|
|
|
}
|
|
|
|
if (xfered == total) {
|
|
|
|
previous_filename = "";
|
|
|
|
already_downloaded += total;
|
|
|
|
} else {
|
|
|
|
timer.start ();
|
|
|
|
}
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
} else {
|
2016-02-02 05:28:07 -03:00
|
|
|
if (xfered == 0) {
|
|
|
|
previous_xfered = 0;
|
|
|
|
download_rate = 0;
|
|
|
|
rates_nb = 0;
|
|
|
|
fraction = 0;
|
|
|
|
timer.start ();
|
|
|
|
} else if (xfered == total) {
|
|
|
|
timer.stop ();
|
|
|
|
fraction = 1;
|
|
|
|
previous_filename = "";
|
2015-03-18 12:07:18 -03:00
|
|
|
} else {
|
2016-02-14 10:18:08 -03:00
|
|
|
if (timer.elapsed () > 0) {
|
|
|
|
download_rate = ((download_rate * rates_nb) + (uint64) ((xfered - previous_xfered) / timer.elapsed ())) / (rates_nb + 1);
|
|
|
|
rates_nb++;
|
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
previous_xfered = xfered;
|
|
|
|
fraction = (float) xfered / total;
|
|
|
|
if (fraction <= 1) {
|
|
|
|
text.append ("%s/%s ".printf (format_size (xfered), format_size (total)));
|
2016-02-14 10:18:08 -03:00
|
|
|
uint64 remaining_seconds = 0;
|
|
|
|
if (download_rate > 0) {
|
|
|
|
remaining_seconds = (total - xfered) / download_rate;
|
|
|
|
}
|
|
|
|
// display remaining time after 5s and only if more than 10s are remaining
|
|
|
|
if (remaining_seconds > 9 && rates_nb > 9) {
|
2016-02-02 05:28:07 -03:00
|
|
|
if (remaining_seconds <= 50) {
|
|
|
|
text.append (dgettext (null, "About %u seconds remaining").printf ((uint) Math.ceilf ((float) remaining_seconds / 10) * 10));
|
|
|
|
} else {
|
|
|
|
uint remaining_minutes = (uint) Math.ceilf ((float) remaining_seconds / 60);
|
|
|
|
text.append (dngettext (null, "About %lu minute remaining",
|
|
|
|
"About %lu minutes remaining", remaining_minutes).printf (remaining_minutes));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
text.append ("%s".printf (format_size (xfered)));
|
|
|
|
}
|
|
|
|
// reinitialize timer
|
|
|
|
timer.start ();
|
2014-11-16 07:31:44 -03:00
|
|
|
}
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
if (fraction != previous_percent) {
|
|
|
|
previous_percent = fraction;
|
|
|
|
progress_dialog.progressbar.set_fraction (fraction);
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2016-02-02 05:28:07 -03:00
|
|
|
if (text.str != previous_textbar) {
|
|
|
|
previous_textbar = text.str;
|
|
|
|
progress_dialog.progressbar.set_text (text.str);
|
2014-11-16 07:31:44 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
void on_emit_totaldownload (uint64 total) {
|
2016-02-02 05:28:07 -03:00
|
|
|
download_rate = 0;
|
|
|
|
rates_nb = 0;
|
|
|
|
previous_percent = 0;
|
|
|
|
previous_textbar = "";
|
2014-10-22 13:44:02 -03:00
|
|
|
total_download = total;
|
2016-02-02 05:28:07 -03:00
|
|
|
// this is emitted at the end of the total download
|
|
|
|
// with the value 0 so stop our timer
|
|
|
|
if (total == 0) {
|
|
|
|
timer.stop ();
|
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
void on_emit_log (uint level, string msg) {
|
|
|
|
// msg ends with \n
|
|
|
|
string? line = null;
|
2015-03-04 11:55:36 -03:00
|
|
|
Gtk.TextIter end_iter;
|
2014-10-22 13:44:02 -03:00
|
|
|
if ((Alpm.LogLevel) level == Alpm.LogLevel.WARNING) {
|
2015-03-18 12:12:35 -03:00
|
|
|
// do not show warning when manjaro-system remove db.lck
|
|
|
|
if (previous_filename != "manjaro-system") {
|
|
|
|
if (previous_filename != "") {
|
|
|
|
line = dgettext (null, "Warning") + ": " + previous_filename + ": " + msg;
|
|
|
|
} else {
|
|
|
|
line = dgettext (null, "Warning") + ": " + msg;
|
|
|
|
}
|
|
|
|
transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
|
|
|
|
transaction_info_dialog.textbuffer.insert (ref end_iter, msg, msg.length);
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
} else if ((Alpm.LogLevel) level == Alpm.LogLevel.ERROR) {
|
2015-03-18 12:07:18 -03:00
|
|
|
if (previous_filename != "") {
|
2014-11-08 13:50:35 -03:00
|
|
|
line = dgettext (null, "Error") + ": " + previous_filename + ": " + msg;
|
2015-03-18 12:07:18 -03:00
|
|
|
} else {
|
2014-11-08 13:50:35 -03:00
|
|
|
line = dgettext (null, "Error") + ": " + msg;
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
if (line != null) {
|
2014-10-30 10:44:09 -03:00
|
|
|
progress_dialog.expander.set_expanded (true);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", "-n", line});
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
void show_warnings () {
|
2014-10-22 13:44:02 -03:00
|
|
|
if (transaction_info_dialog.textbuffer.text != "") {
|
|
|
|
transaction_info_dialog.set_title (dgettext (null, "Warning"));
|
|
|
|
transaction_info_dialog.label.set_visible (false);
|
|
|
|
transaction_info_dialog.expander.set_visible (true);
|
|
|
|
transaction_info_dialog.expander.set_expanded (true);
|
|
|
|
transaction_info_dialog.run ();
|
|
|
|
transaction_info_dialog.hide ();
|
2015-03-18 12:07:18 -03:00
|
|
|
while (Gtk.events_pending ()) {
|
2014-11-08 13:50:35 -03:00
|
|
|
Gtk.main_iteration ();
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2015-03-04 11:55:36 -03:00
|
|
|
Gtk.TextIter start_iter;
|
|
|
|
Gtk.TextIter end_iter;
|
2014-10-22 13:44:02 -03:00
|
|
|
transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
|
|
|
|
transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
|
|
|
|
transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
void handle_error (ErrorInfos error) {
|
2016-02-02 05:28:07 -03:00
|
|
|
if (error.message != null && error.message != "") {
|
|
|
|
progress_dialog.expander.set_expanded (true);
|
|
|
|
progress_dialog.spawn_in_term ({"echo", "-n", error.message});
|
|
|
|
Gtk.TextIter start_iter;
|
|
|
|
Gtk.TextIter end_iter;
|
|
|
|
transaction_info_dialog.set_title (dgettext (null, "Error"));
|
|
|
|
transaction_info_dialog.label.set_visible (true);
|
|
|
|
transaction_info_dialog.label.set_markup (error.message);
|
|
|
|
if (error.details.length != 0) {
|
|
|
|
transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
|
|
|
|
transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
|
|
|
|
transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter);
|
|
|
|
transaction_info_dialog.expander.set_visible (true);
|
|
|
|
transaction_info_dialog.expander.set_expanded (true);
|
|
|
|
progress_dialog.spawn_in_term ({"echo", ":"});
|
|
|
|
foreach (unowned string detail in error.details) {
|
|
|
|
progress_dialog.spawn_in_term ({"echo", detail});
|
|
|
|
string str = detail + "\n";
|
|
|
|
transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
|
|
|
|
transaction_info_dialog.textbuffer.insert (ref end_iter, str, str.length);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
transaction_info_dialog.expander.set_visible (false);
|
|
|
|
}
|
|
|
|
progress_dialog.spawn_in_term ({"echo"});
|
|
|
|
transaction_info_dialog.run ();
|
|
|
|
transaction_info_dialog.hide ();
|
2014-10-26 08:30:04 -03:00
|
|
|
transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
|
|
|
|
transaction_info_dialog.textbuffer.get_end_iter (out end_iter);
|
|
|
|
transaction_info_dialog.textbuffer.delete (ref start_iter, ref end_iter);
|
2016-02-02 05:28:07 -03:00
|
|
|
progress_dialog.progressbar.set_fraction (0);
|
2016-02-27 06:11:04 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo"});
|
|
|
|
while (Gtk.events_pending ()) {
|
|
|
|
Gtk.main_iteration ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
finish_transaction ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void finish_transaction () {
|
|
|
|
if (database_modified) {
|
2016-03-01 11:04:02 -03:00
|
|
|
alpm_utils.reload ();
|
|
|
|
database_modified = false;
|
2016-02-27 06:11:04 -03:00
|
|
|
}
|
|
|
|
if (progress_dialog.expander.get_expanded ()) {
|
2016-02-02 05:28:07 -03:00
|
|
|
progress_dialog.cancel_button.set_visible (false);
|
|
|
|
progress_dialog.close_button.set_visible (true);
|
2016-02-27 06:11:04 -03:00
|
|
|
} else {
|
2016-03-01 11:04:02 -03:00
|
|
|
on_progress_dialog_close_button_clicked ();
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
void on_refresh_finished (bool success) {
|
2016-02-27 06:11:04 -03:00
|
|
|
database_modified = true;
|
2016-03-01 11:04:02 -03:00
|
|
|
this.success = success;
|
|
|
|
clear_lists ();
|
2016-02-02 05:28:07 -03:00
|
|
|
if (success) {
|
2016-03-01 11:04:02 -03:00
|
|
|
finish_transaction ();
|
2014-10-22 13:44:02 -03:00
|
|
|
} else {
|
2016-02-02 05:28:07 -03:00
|
|
|
handle_error (get_current_error ());
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
2014-11-08 13:50:35 -03:00
|
|
|
previous_filename = "";
|
2015-08-20 10:11:18 -03:00
|
|
|
daemon.refresh_finished.disconnect (on_refresh_finished);
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
2016-02-27 06:11:04 -03:00
|
|
|
void on_progress_dialog_close_button_clicked () {
|
2016-03-01 11:04:02 -03:00
|
|
|
finished (success);
|
2016-02-27 06:11:04 -03:00
|
|
|
progress_dialog.hide ();
|
|
|
|
while (Gtk.events_pending ()) {
|
|
|
|
Gtk.main_iteration ();
|
|
|
|
}
|
2016-03-01 11:04:02 -03:00
|
|
|
success = false;
|
2016-02-27 06:11:04 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
void on_progress_dialog_cancel_button_clicked () {
|
2016-02-02 05:28:07 -03:00
|
|
|
cancel ();
|
|
|
|
clear_lists ();
|
|
|
|
progress_dialog.spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"});
|
|
|
|
progress_dialog.hide ();
|
|
|
|
while (Gtk.events_pending ()) {
|
|
|
|
Gtk.main_iteration ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
void on_trans_prepare_finished (bool success) {
|
2016-03-01 11:04:02 -03:00
|
|
|
this.success = success;
|
2016-02-02 05:28:07 -03:00
|
|
|
if (success) {
|
2014-10-26 08:30:04 -03:00
|
|
|
show_warnings ();
|
2016-02-26 06:37:26 -03:00
|
|
|
Type type = set_transaction_sum ();
|
|
|
|
if (type == Type.UPDATE && mode == Mode.UPDATER) {
|
2015-01-03 10:52:26 -03:00
|
|
|
// there only updates
|
2015-03-04 11:55:36 -03:00
|
|
|
start_commit ();
|
2015-01-03 10:52:26 -03:00
|
|
|
} else if (type != 0) {
|
2015-03-04 11:55:36 -03:00
|
|
|
if (transaction_sum_dialog.run () == Gtk.ResponseType.OK) {
|
2014-10-22 13:44:02 -03:00
|
|
|
transaction_sum_dialog.hide ();
|
2015-03-18 12:07:18 -03:00
|
|
|
while (Gtk.events_pending ()) {
|
2014-10-22 13:44:02 -03:00
|
|
|
Gtk.main_iteration ();
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2016-02-26 06:37:26 -03:00
|
|
|
if (type == Type.BUILD) {
|
2015-01-03 10:52:26 -03:00
|
|
|
// there only AUR packages to build
|
2016-02-02 05:28:07 -03:00
|
|
|
release ();
|
|
|
|
on_trans_commit_finished (true);
|
2015-03-18 12:07:18 -03:00
|
|
|
} else {
|
2015-03-04 11:55:36 -03:00
|
|
|
start_commit ();
|
2015-03-18 12:07:18 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
} else {
|
|
|
|
transaction_sum_dialog.hide ();
|
2016-02-27 06:11:04 -03:00
|
|
|
unowned string action = dgettext (null, "Transaction cancelled");
|
|
|
|
progress_dialog.spawn_in_term ({"echo", action + ".\n"});
|
|
|
|
progress_dialog.action_label.set_text (action);
|
2014-10-22 13:44:02 -03:00
|
|
|
release ();
|
2016-02-02 05:28:07 -03:00
|
|
|
//to_build.remove_all ();
|
2014-11-24 17:34:23 -03:00
|
|
|
sysupgrade_after_trans = false;
|
2016-03-01 11:04:02 -03:00
|
|
|
success = false;
|
2016-02-27 06:11:04 -03:00
|
|
|
finish_transaction ();
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
} else {
|
2015-03-07 06:43:44 -03:00
|
|
|
//var err = ErrorInfos ();
|
|
|
|
//err.message = dgettext (null, "Nothing to do") + "\n";
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", dgettext (null, "Nothing to do") + ".\n"});
|
2014-10-22 13:44:02 -03:00
|
|
|
release ();
|
|
|
|
clear_lists ();
|
2016-02-27 06:11:04 -03:00
|
|
|
finish_transaction ();
|
2014-10-22 13:44:02 -03:00
|
|
|
//handle_error (err);
|
|
|
|
}
|
|
|
|
} else {
|
2016-02-02 05:28:07 -03:00
|
|
|
handle_error (get_current_error ());
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
void on_trans_commit_finished (bool success) {
|
2016-03-01 11:04:02 -03:00
|
|
|
this.success = success;
|
2016-02-02 05:28:07 -03:00
|
|
|
if (success) {
|
2015-04-11 13:00:49 -03:00
|
|
|
if (to_build.length != 0) {
|
|
|
|
if (to_add.length != 0
|
|
|
|
|| to_remove.length != 0
|
|
|
|
|| to_load.length != 0) {
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", dgettext (null, "Transaction successfully finished") + ".\n"});
|
2014-10-24 10:29:39 -03:00
|
|
|
}
|
2014-10-22 13:44:02 -03:00
|
|
|
build_aur_packages ();
|
|
|
|
} else {
|
|
|
|
clear_lists ();
|
2014-10-26 08:30:04 -03:00
|
|
|
show_warnings ();
|
2014-10-22 13:44:02 -03:00
|
|
|
if (sysupgrade_after_trans) {
|
|
|
|
sysupgrade_after_trans = false;
|
2016-02-02 05:28:07 -03:00
|
|
|
sysupgrade (false);
|
2014-10-22 13:44:02 -03:00
|
|
|
} else {
|
2016-02-27 06:11:04 -03:00
|
|
|
unowned string action = dgettext (null, "Transaction successfully finished");
|
|
|
|
progress_dialog.spawn_in_term ({"echo", action + ".\n"});
|
|
|
|
progress_dialog.action_label.set_text (action);
|
|
|
|
database_modified = true;
|
|
|
|
finish_transaction ();
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2016-02-02 05:28:07 -03:00
|
|
|
// if it is an authentication error, database was not modified
|
|
|
|
var err = get_current_error ();
|
2016-03-01 11:04:02 -03:00
|
|
|
if (err.message != dgettext (null, "Authentication failed")) {
|
2016-02-14 10:18:08 -03:00
|
|
|
clear_lists ();
|
2016-02-27 06:11:04 -03:00
|
|
|
database_modified = true;
|
2016-02-02 05:28:07 -03:00
|
|
|
}
|
2016-03-01 11:04:02 -03:00
|
|
|
handle_error (err);
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
total_download = 0;
|
|
|
|
already_downloaded = 0;
|
2014-11-08 13:50:35 -03:00
|
|
|
previous_filename = "";
|
2014-10-22 13:44:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
void on_term_child_exited (int status) {
|
2014-12-30 11:04:40 -03:00
|
|
|
Source.remove (pulse_timeout_id);
|
2016-02-14 10:18:08 -03:00
|
|
|
clear_lists ();
|
2016-02-02 05:28:07 -03:00
|
|
|
// let the time to the daemon to update databases
|
2015-03-27 12:31:07 -03:00
|
|
|
Timeout.add (1000, () => {
|
2016-02-02 05:28:07 -03:00
|
|
|
if (status == 0) {
|
2016-03-01 11:04:02 -03:00
|
|
|
success = true;
|
2016-02-27 06:11:04 -03:00
|
|
|
unowned string action = dgettext (null, "Transaction successfully finished");
|
2016-02-14 10:41:42 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo", action + ".\n"});
|
|
|
|
progress_dialog.action_label.set_text (action);
|
2016-02-02 05:28:07 -03:00
|
|
|
} else {
|
2016-03-01 11:04:02 -03:00
|
|
|
success = false;
|
2016-02-02 05:28:07 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo"});
|
|
|
|
}
|
2016-02-14 10:41:42 -03:00
|
|
|
progress_dialog.progressbar.set_fraction (1);
|
2016-03-01 11:04:02 -03:00
|
|
|
alpm_utils.reload ();
|
|
|
|
database_modified = false;
|
|
|
|
progress_dialog.cancel_button.set_visible (false);
|
|
|
|
progress_dialog.close_button.set_visible (true);
|
2015-03-27 12:31:07 -03:00
|
|
|
return false;
|
|
|
|
});
|
2015-03-04 11:55:36 -03:00
|
|
|
}
|
|
|
|
|
2016-02-26 06:37:26 -03:00
|
|
|
void on_set_pkgreason_finished () {
|
2016-03-01 11:04:02 -03:00
|
|
|
alpm_utils.reload ();
|
2016-02-26 06:37:26 -03:00
|
|
|
set_pkgreason_finished ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
|
|
|
|
bool enable_aur, bool search_aur, bool check_aur_updates,
|
|
|
|
bool no_confirm_build) {
|
2016-02-02 05:28:07 -03:00
|
|
|
pamac_config.reload ();
|
2016-02-26 06:37:26 -03:00
|
|
|
write_pamac_config_finished (recurse, refresh_period, no_update_hide_icon,
|
|
|
|
enable_aur, search_aur, check_aur_updates,
|
|
|
|
no_confirm_build);
|
|
|
|
}
|
|
|
|
|
|
|
|
void on_write_alpm_config_finished (bool checkspace) {
|
2016-03-01 11:04:02 -03:00
|
|
|
alpm_utils.reload ();
|
2016-02-26 06:37:26 -03:00
|
|
|
write_alpm_config_finished (checkspace);
|
|
|
|
}
|
|
|
|
|
|
|
|
void on_write_mirrors_config_finished (string choosen_country, string choosen_generation_method) {
|
|
|
|
write_mirrors_config_finished (choosen_country, choosen_generation_method);
|
2014-12-30 11:04:40 -03:00
|
|
|
}
|
|
|
|
|
2015-08-20 10:11:18 -03:00
|
|
|
void on_generate_mirrors_list_data (string line) {
|
|
|
|
progress_dialog.spawn_in_term ({"echo", "-n", line});
|
2014-12-30 11:04:40 -03:00
|
|
|
}
|
|
|
|
|
2015-08-20 10:11:18 -03:00
|
|
|
void on_generate_mirrors_list_finished () {
|
2014-12-30 11:04:40 -03:00
|
|
|
Source.remove (pulse_timeout_id);
|
2015-08-20 10:11:18 -03:00
|
|
|
progress_dialog.spawn_in_term ({"echo"});
|
2015-03-07 05:39:51 -03:00
|
|
|
// force a dbs refresh
|
2016-02-02 05:28:07 -03:00
|
|
|
start_refresh (true);
|
2014-12-30 11:04:40 -03:00
|
|
|
}
|
|
|
|
|
2014-10-22 13:44:02 -03:00
|
|
|
void connecting_dbus_signals () {
|
|
|
|
try {
|
2016-02-02 05:28:07 -03:00
|
|
|
daemon = Bus.get_proxy_sync (BusType.SYSTEM, "org.manjaro.pamac", "/org/manjaro/pamac");
|
|
|
|
// Set environment variables
|
|
|
|
daemon.set_environment_variables (pamac_config.environment_variables);
|
2014-10-22 13:44:02 -03:00
|
|
|
// Connecting to signals
|
|
|
|
daemon.emit_event.connect (on_emit_event);
|
|
|
|
daemon.emit_providers.connect (on_emit_providers);
|
|
|
|
daemon.emit_progress.connect (on_emit_progress);
|
|
|
|
daemon.emit_download.connect (on_emit_download);
|
|
|
|
daemon.emit_totaldownload.connect (on_emit_totaldownload);
|
|
|
|
daemon.emit_log.connect (on_emit_log);
|
2015-03-04 11:55:36 -03:00
|
|
|
daemon.trans_prepare_finished.connect (on_trans_prepare_finished);
|
|
|
|
daemon.trans_commit_finished.connect (on_trans_commit_finished);
|
2016-02-26 06:37:26 -03:00
|
|
|
daemon.set_pkgreason_finished.connect (on_set_pkgreason_finished);
|
|
|
|
daemon.write_mirrors_config_finished.connect (on_write_mirrors_config_finished);
|
|
|
|
daemon.write_alpm_config_finished.connect (on_write_alpm_config_finished);
|
2015-03-04 11:55:36 -03:00
|
|
|
daemon.write_pamac_config_finished.connect (on_write_pamac_config_finished);
|
2015-08-20 10:11:18 -03:00
|
|
|
daemon.generate_mirrors_list_data.connect (on_generate_mirrors_list_data);
|
|
|
|
daemon.generate_mirrors_list_finished.connect (on_generate_mirrors_list_finished);
|
2014-10-22 13:44:02 -03:00
|
|
|
} catch (IOError e) {
|
|
|
|
stderr.printf ("IOError: %s\n", e.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|