add right click menu with multiple selection and fixes

This commit is contained in:
guinux
2014-11-08 17:50:35 +01:00
parent 807e1040ac
commit 0d3b34d7c4
62 changed files with 7761 additions and 6630 deletions

View File

@@ -19,6 +19,7 @@ MANAGER_GRESOURCE_FILE = ../resources/pamac.manager.gresource.xml
MANAGER_RESOURCES_FILES = ../resources/manager_window.ui \
../resources/packages_chooser_dialog.ui \
../resources/choose_dep_dialog.ui \
../resources/history_dialog.ui \
../resources/preferences_dialog.ui \
../resources/progress_dialog.ui \
@@ -78,7 +79,7 @@ updater_resources.c: $(UPDATER_GRESOURCE_FILE) $(UPDATER_RESOURCES_FILES)
installer_resources.c: $(INSTALLER_GRESOURCE_FILE) $(INSTALLER_RESOURCES_FILES)
glib-compile-resources $(INSTALLER_GRESOURCE_FILE) --sourcedir=../resources --target=installer_resources.c --generate-source
pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) preferences_dialog.vala history_dialog.vala packages_chooser_dialog.vala manager_resources.c package.vala transaction.vala packages_model.vala manager_window.vala manager.vala
pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) choose_dep_dialog.vala preferences_dialog.vala history_dialog.vala packages_chooser_dialog.vala manager_resources.c package.vala transaction.vala packages_model.vala manager_window.vala manager.vala
valac -o pamac-manager \
$(COMMON_VALA_FLAGS) \
--pkg=gtk+-3.0 \
@@ -88,6 +89,7 @@ pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(DIALOGS_FILES) preferenc
--gresources=$(MANAGER_GRESOURCE_FILE) \
$(COMMON_SOURCES) \
$(DIALOGS_FILES) \
choose_dep_dialog.vala \
preferences_dialog.vala \
history_dialog.vala \
packages_chooser_dialog.vala \

View File

@@ -0,0 +1,54 @@
/*
* pamac-vala
*
* Copyright (C) 2014 Guillaume Benoit <guillaume@manjaro.org>
*
* 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 {
[GtkTemplate (ui = "/org/manjaro/pamac/manager/choose_dep_dialog.ui")]
public class ChooseDependenciesDialog : Gtk.Dialog {
[GtkChild]
public Gtk.Label label;
[GtkChild]
public Gtk.TreeView treeview;
[GtkChild]
public Gtk.CellRendererToggle renderertoggle;
public Gtk.ListStore deps_list;
public ChooseDependenciesDialog (Gtk.ApplicationWindow? window) {
Object (transient_for: window, use_header_bar: 0);
deps_list = new Gtk.ListStore (3, typeof (bool), typeof (string), typeof (string));
treeview.set_model (deps_list);
}
[GtkCallback]
void on_renderertoggle_toggled (string path) {
Gtk.TreeIter iter;
GLib.Value val;
bool selected;
if (deps_list.get_iter_from_string (out iter, path)) {;
deps_list.get_value (iter, 0, out val);
selected = val.get_boolean ();
selected = (!selected);
deps_list.set_value (iter, 0, selected);
}
}
}
}

View File

@@ -74,17 +74,18 @@ namespace Pamac {
previous_percent = 0;
}
public void write_config (HashTable<string,string> new_conf, GLib.BusName sender) {
public async void write_config (HashTable<string,string> new_conf, GLib.BusName sender) {
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
try {
Polkit.Authority authority = Polkit.Authority.get_sync (null);
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
Polkit.AuthorizationResult result = authority.check_authorization_sync
(subject,
"org.manjaro.pamac.commit",
null,
Polkit.CheckAuthorizationFlags.ALLOW_USER_INTERACTION,
null);
Polkit.AuthorizationResult result = yield authority.check_authorization (
subject,
"org.manjaro.pamac.commit",
null,
Polkit.CheckAuthorizationFlags.ALLOW_USER_INTERACTION,
null
);
if (result.get_is_authorized ()) {
pamac_config.write (new_conf);
}
@@ -93,6 +94,28 @@ namespace Pamac {
}
}
public async void set_pkgreason (string pkgname, uint reason, GLib.BusName sender) {
try {
Polkit.Authority authority = Polkit.Authority.get_sync (null);
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
Polkit.AuthorizationResult result = yield authority.check_authorization (
subject,
"org.manjaro.pamac.commit",
null,
Polkit.CheckAuthorizationFlags.ALLOW_USER_INTERACTION,
null
);
if (result.get_is_authorized ()) {
init_alpm_config ();
unowned Package? pkg = handle.localdb.get_pkg (pkgname);
if (pkg != null)
pkg.reason = (PkgReason) reason;
}
} catch (GLib.Error e) {
stderr.printf ("%s\n", e.message);
}
}
private int refresh_real () {
init_alpm_config ();
ErrorInfos err = ErrorInfos ();
@@ -181,12 +204,12 @@ namespace Pamac {
ErrorInfos err = ErrorInfos ();
string[] details = {};
unowned Package? pkg = null;
//pkg = handle.find_dbs_satisfier (handle.syncdbs, pkgname);
foreach (var db in handle.syncdbs) {
pkg = find_satisfier (db.pkgcache, pkgname);
if (pkg != null)
break;
}
pkg = handle.find_dbs_satisfier (handle.syncdbs, pkgname);
//foreach (var db in handle.syncdbs) {
//pkg = find_satisfier (db.pkgcache, pkgname);
//if (pkg != null)
//break;
//}
if (pkg == null) {
err.str = _("Failed to prepare transaction");
details += _("target not found: %s").printf (pkgname);

View File

@@ -93,6 +93,16 @@ namespace Pamac {
[GtkChild]
public Button cancel_button;
public Gtk.Menu right_click_menu;
public Gtk.MenuItem deselect_item;
public Gtk.MenuItem install_item;
public Gtk.MenuItem remove_item;
public Gtk.SeparatorMenuItem separator_item;
public Gtk.MenuItem reinstall_item;
public Gtk.MenuItem install_optional_deps_item;
public Gtk.MenuItem explicitly_installed_item;
public GLib.List<Pamac.Package> selected_pkgs;
public ListStore search_list;
public ListStore groups_list;
public ListStore states_list;
@@ -118,6 +128,29 @@ namespace Pamac {
aur_results = new HashTable<string, Json.Array> (str_hash, str_equal);
right_click_menu = new Gtk.Menu ();
deselect_item = new Gtk.MenuItem.with_label (dgettext (null, "Deselect"));
deselect_item.activate.connect (on_deselect_item_activate);
right_click_menu.append (deselect_item);
install_item = new Gtk.MenuItem.with_label (dgettext (null, "Install"));
install_item.activate.connect (on_install_item_activate);
right_click_menu.append (install_item);
remove_item = new Gtk.MenuItem.with_label (dgettext (null, "Remove"));
remove_item.activate.connect (on_remove_item_activate);
right_click_menu.append (remove_item);
separator_item = new Gtk.SeparatorMenuItem ();
right_click_menu.append (separator_item);
reinstall_item = new Gtk.MenuItem.with_label (dgettext (null, "Reinstall"));
reinstall_item.activate.connect (on_reinstall_item_activate);
right_click_menu.append (reinstall_item);
install_optional_deps_item = new Gtk.MenuItem.with_label (dgettext (null, "Install optional dependencies"));
install_optional_deps_item.activate.connect (on_install_optional_deps_item_activate);
right_click_menu.append (install_optional_deps_item);
explicitly_installed_item = new Gtk.MenuItem.with_label (dgettext (null, "Mark as explicitly installed"));
explicitly_installed_item.activate.connect (on_explicitly_installed_item_activate);
right_click_menu.append (explicitly_installed_item);
right_click_menu.show_all ();
search_list = new Gtk.ListStore (1, typeof (string));
search_treeview.set_model (search_list);
groups_list = new Gtk.ListStore (1, typeof (string));
@@ -464,9 +497,11 @@ namespace Pamac {
[GtkCallback]
public void on_packages_treeview_selection_changed () {
TreeModel model;
TreeIter? iter;
TreeSelection selection = packages_treeview.get_selection ();
if (selection.get_selected (out model, out iter)) {
GLib.List<TreePath> selected = selection.get_selected_rows (out model);
if (selected.length () == 1) {
TreeIter iter;
model.get_iter (out iter, selected.nth_data (0));
Pamac.Package pkg = (Pamac.Package) iter.user_data;
if (pkg.alpm_pkg != null) {
set_infos_list (pkg);
@@ -497,12 +532,9 @@ namespace Pamac {
packages_list.get_value (iter, 0, out val);
string name = val.get_string ();
if (name != dgettext (null, "No package found")) {
if (transaction.to_add.contains (name)) {
transaction.to_add.steal (name);
} else if (transaction.to_remove.contains (name)) {
transaction.to_remove.steal (name);
} else if (transaction.to_build.contains (name)) {
transaction.to_build.steal (name);
if (transaction.to_add.steal (name)) {
} else if (transaction.to_remove.steal (name)) {
} else if (transaction.to_build.steal (name)) {
} else {
packages_list.get_value (iter, 3, out val);
string db_name = val.get_string ();
@@ -527,10 +559,188 @@ namespace Pamac {
packages_treeview.queue_draw ();
}
void on_install_item_activate () {
unowned Alpm.Package? find_pkg = null;
foreach (Pamac.Package pkg in selected_pkgs) {
if (pkg.repo == "AUR")
transaction.to_build.insert (pkg.name, pkg.name);
else {
find_pkg = transaction.handle.localdb.get_pkg (pkg.name);
if (find_pkg == null)
transaction.to_add.insert (pkg.name, pkg.name);
}
}
if (transaction.to_add.size () != 0 || transaction.to_build.size () != 0) {
set_buttons_sensitive (true);
}
}
void on_reinstall_item_activate () {
foreach (Pamac.Package pkg in selected_pkgs) {
if (pkg.repo == "local")
transaction.to_add.insert (pkg.name, pkg.name);
}
if (transaction.to_add.size () != 0)
set_buttons_sensitive (true);
}
void on_remove_item_activate () {
foreach (Pamac.Package pkg in selected_pkgs) {
if ((pkg.name in transaction.holdpkg) == false) {
if (pkg.repo == "local")
transaction.to_remove.insert (pkg.name, pkg.name);
}
}
if (transaction.to_remove.size () != 0)
set_buttons_sensitive (true);
}
void on_deselect_item_activate () {
foreach (Pamac.Package pkg in selected_pkgs) {
if (transaction.to_add.steal (pkg.name)) {
} else if (transaction.to_remove.steal (pkg.name)) {
} else if (transaction.to_build.steal (pkg.name)) {
}
}
if (transaction.to_add.size () == 0 && transaction.to_remove.size () == 0
&& transaction.to_load.size () == 0 && transaction.to_build.size () == 0) {
set_buttons_sensitive (false);
}
}
public void choose_opt_dep (GLib.List<Pamac.Package> pkgs) {
uint nb;
TreeIter iter;
unowned Alpm.Package? found;
foreach (Pamac.Package pkg in pkgs) {
var choose_dep_dialog = new ChooseDependenciesDialog (this);
nb = 0;
foreach (unowned Depend opt_dep in pkg.alpm_pkg.optdepends) {
found = find_satisfier (transaction.handle.localdb.pkgcache, opt_dep.compute_string ());
if (found == null) {
choose_dep_dialog.deps_list.insert_with_values (out iter, -1,
0, false,
1, opt_dep.name,
2, opt_dep.desc);
nb += 1;
}
}
choose_dep_dialog.label.set_markup ("<b>%s</b>".printf (dgettext (null, "%s has %u uninstalled optional dependencies.\nChoose those you would like to install:").printf (pkg.name, nb)));
choose_dep_dialog.run ();
choose_dep_dialog.hide ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
choose_dep_dialog.deps_list.foreach ((model, path, iter) => {
GLib.Value val;
bool selected;
string name;
choose_dep_dialog.deps_list.get_value (iter, 0, out val);
selected = val.get_boolean ();
if (selected) {
choose_dep_dialog.deps_list.get_value (iter, 1, out val);
name = val.get_string ();
transaction.to_add.insert (name, name);
}
return false;
});
}
}
void on_install_optional_deps_item_activate () {
choose_opt_dep (selected_pkgs);
if (transaction.to_add.size () != 0)
set_buttons_sensitive (true);
}
void on_explicitly_installed_item_activate () {
foreach (Pamac.Package pkg in selected_pkgs) {
transaction.set_pkgreason.begin (pkg.name, PkgReason.EXPLICIT, (obj, res) => {
transaction.set_pkgreason.end (res);
refresh_packages_list ();
});
}
}
[GtkCallback]
public bool on_list_treeview_button_press_event (Gdk.EventButton event) {
// to do
return false;
public bool on_packages_treeview_button_press_event (Gdk.EventButton event) {
packages_treeview.grab_focus ();
// Check if right mouse button was clicked
if (event.type == Gdk.EventType.BUTTON_PRESS && event.button == 3) {
TreeIter iter;
TreePath? treepath;
Pamac.Package clicked_pkg;
TreeSelection selection = packages_treeview.get_selection ();
packages_treeview.get_path_at_pos ((int) event.x, (int) event.y, out treepath, null, null, null);
packages_list.get_iter (out iter, treepath);
clicked_pkg = (Pamac.Package) iter.user_data;
if (clicked_pkg.name == dgettext (null, "No package found"))
return true;
if (selection.path_is_selected (treepath) == false) {
selection.unselect_all ();
selection.select_path (treepath);
}
GLib.List<TreePath> selected_paths = selection.get_selected_rows (null);
deselect_item.set_sensitive (false);
install_item.set_sensitive (false);
remove_item.set_sensitive (false);
reinstall_item.set_sensitive (false);
install_optional_deps_item.set_sensitive (false);
explicitly_installed_item.set_sensitive (false);
selected_pkgs = new GLib.List<Pamac.Package> ();
foreach (TreePath path in selected_paths) {
packages_list.get_iter (out iter, path);
clicked_pkg = (Pamac.Package) iter.user_data;
selected_pkgs.append (clicked_pkg);
}
foreach (Pamac.Package pkg in selected_pkgs) {
if (transaction.to_add.contains (pkg.name)
|| transaction.to_remove.contains (pkg.name)
|| transaction.to_build.contains (pkg.name)) {
deselect_item.set_sensitive (true);
break;
}
}
foreach (Pamac.Package pkg in selected_pkgs) {
if (pkg.repo != "local") {
install_item.set_sensitive (true);
break;
}
}
foreach (Pamac.Package pkg in selected_pkgs) {
if (pkg.repo == "local") {
remove_item.set_sensitive (true);
break;
}
}
if (selected_pkgs.length () == 1) {
unowned Alpm.Package? find_pkg = null;
clicked_pkg = selected_pkgs.nth_data (0);
if (clicked_pkg.repo == "local") {
unowned Alpm.List<Depend?> optdepends = clicked_pkg.alpm_pkg.optdepends;
if (optdepends.length != 0) {
uint nb = 0;
unowned Alpm.Package? found;
foreach (unowned Depend opt_dep in optdepends) {
found = find_satisfier (transaction.handle.localdb.pkgcache, opt_dep.compute_string ());
if (found == null)
nb += 1;
}
if (nb != 0)
install_optional_deps_item.set_sensitive (true);
}
if (clicked_pkg.alpm_pkg.reason == PkgReason.DEPEND)
explicitly_installed_item.set_sensitive (true);
find_pkg = get_syncpkg (transaction.handle, clicked_pkg.name);
if (find_pkg != null) {
if (pkg_vercmp (find_pkg.version, clicked_pkg.version) == 0)
reinstall_item.set_sensitive (true);
}
}
}
right_click_menu.popup (null, null, null, event.button, event.time);
return true;
} else
return false;
}
[GtkCallback]
@@ -833,6 +1043,8 @@ namespace Pamac {
history_dialog.textview.buffer.set_text (text.str, (int) text.len);
history_dialog.run ();
history_dialog.hide ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
}
}
@@ -853,6 +1065,8 @@ namespace Pamac {
}
} else
packages_chooser_dialog.hide ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
}
[GtkCallback]
@@ -880,11 +1094,16 @@ namespace Pamac {
if (refresh_period != pamac_config.refresh_period)
new_conf.insert ("RefreshPeriod", refresh_period.to_string ());
if (new_conf.size () != 0) {
transaction.write_config (new_conf);
pamac_config.reload ();
transaction.write_config.begin (new_conf, (obj, res) => {
transaction.write_config.end (res);
pamac_config.reload ();
search_aur_button.set_active (pamac_config.enable_aur);
});
}
}
preferences_dialog.hide ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
}
[GtkCallback]

View File

@@ -24,7 +24,8 @@ using Alpm;
namespace Pamac {
[DBus (name = "org.manjaro.pamac")]
public interface Daemon : Object {
public abstract void write_config (HashTable<string,string> new_conf) throws IOError;
public abstract async void write_config (HashTable<string,string> new_conf) throws IOError;
public abstract async void set_pkgreason (string pkgname, uint reason) throws IOError;
public abstract void refresh (int force, bool emit_signal) throws IOError;
public abstract ErrorInfos trans_init (TransFlag transflags) throws IOError;
public abstract ErrorInfos trans_sysupgrade (int enable_downgrade) throws IOError;
@@ -79,12 +80,12 @@ namespace Pamac {
bool sysupgrade_after_trans;
bool sysupgrade_after_build;
int build_status;
int enable_downgrade;
Terminal term;
Pty pty;
//dialogs
ChooseProviderDialog choose_provider_dialog;
TransactionSumDialog transaction_sum_dialog;
TransactionInfoDialog transaction_info_dialog;
ProgressDialog progress_dialog;
@@ -105,7 +106,6 @@ namespace Pamac {
connecting_dbus_signals ();
//creating dialogs
this.window = window;
choose_provider_dialog = new ChooseProviderDialog (window);
transaction_sum_dialog = new TransactionSumDialog (window);
transaction_info_dialog = new TransactionInfoDialog (window);
progress_dialog = new ProgressDialog (this, window);
@@ -144,9 +144,18 @@ namespace Pamac {
build_status = 0;
}
public void write_config (HashTable<string,string> new_conf) {
public async void write_config (HashTable<string,string> new_conf) {
try {
daemon.write_config (new_conf);
yield daemon.write_config (new_conf);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
}
public async void set_pkgreason (string pkgname, PkgReason reason) {
try {
yield daemon.set_pkgreason (pkgname, (uint) reason);
refresh_alpm_config ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
@@ -169,6 +178,8 @@ namespace Pamac {
progress_dialog.cancel_button.set_visible (true);
progress_dialog.close_button.set_visible (false);
progress_dialog.show ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
try {
daemon.refresh (force, true);
} catch (IOError e) {
@@ -177,7 +188,6 @@ namespace Pamac {
}
public void sysupgrade_simple (int enable_downgrade) {
print ("simple sysupgrade\n");
progress_dialog.progressbar.set_fraction (0);
progress_dialog.cancel_button.set_visible (true);
ErrorInfos err = ErrorInfos ();
@@ -213,6 +223,7 @@ namespace Pamac {
}
public void sysupgrade (int enable_downgrade) {
this.enable_downgrade = enable_downgrade;
string action = dgettext (null, "Starting full system upgrade") + "...";
spawn_in_term ({"/usr/bin/echo", action});
progress_dialog.action_label.set_text (action);
@@ -223,7 +234,6 @@ namespace Pamac {
while (Gtk.events_pending ())
Gtk.main_iteration ();
// sysupgrade
print ("get syncfirst\n");
// get syncfirst updates
UpdatesInfos[] syncfirst_updates = get_syncfirst_updates (handle, syncfirst);
if (syncfirst_updates.length != 0) {
@@ -235,17 +245,27 @@ namespace Pamac {
// run as a standard transaction
run ();
} else {
UpdatesInfos[] updates = get_repos_updates (handle, ignorepkg);
uint repos_updates_len = updates.length;
if (pamac_config.enable_aur) {
print ("get aur updates\n");
UpdatesInfos[] aur_updates = get_aur_updates (handle, ignorepkg);
if (aur_updates.length != 0) {
clear_lists ();
sysupgrade_after_build = true;
if (repos_updates_len != 0)
sysupgrade_after_build = true;
foreach (UpdatesInfos infos in aur_updates)
to_build.insert (infos.name, infos.name);
}
}
sysupgrade_simple (enable_downgrade);
if (repos_updates_len != 0)
sysupgrade_simple (enable_downgrade);
else {
progress_dialog.show ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
ErrorInfos err = ErrorInfos ();
on_emit_trans_prepared (err);
}
}
}
@@ -328,6 +348,7 @@ namespace Pamac {
public void choose_provider (string depend, string[] providers) {
int len = providers.length;
var choose_provider_dialog = new ChooseProviderDialog (window);
choose_provider_dialog.label.set_markup ("<b>%s</b>".printf (dgettext (null, "Choose a provider for %s").printf (depend, len)));
choose_provider_dialog.comboboxtext.remove_all ();
foreach (string provider in providers)
@@ -755,11 +776,17 @@ namespace Pamac {
string? line = null;
TextIter end_iter;
if ((Alpm.LogLevel) level == Alpm.LogLevel.WARNING) {
line = dgettext (null, "Warning") + ": " + previous_filename + ": " + msg;
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);
} else if ((Alpm.LogLevel) level == Alpm.LogLevel.ERROR) {
line = dgettext (null, "Error") + ": " + previous_filename + ": " + msg;
if (previous_filename != "")
line = dgettext (null, "Error") + ": " + previous_filename + ": " + msg;
else
line = dgettext (null, "Error") + ": " + msg;
}
if (line != null) {
progress_dialog.expander.set_expanded (true);
@@ -775,6 +802,8 @@ namespace Pamac {
transaction_info_dialog.expander.set_expanded (true);
transaction_info_dialog.run ();
transaction_info_dialog.hide ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
TextIter start_iter;
TextIter end_iter;
transaction_info_dialog.textbuffer.get_start_iter (out start_iter);
@@ -823,6 +852,8 @@ namespace Pamac {
if (error.str == "") {
if (mode == Mode.UPDATER) {
progress_dialog.hide ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
finished (false);
} else {
sysupgrade (0);
@@ -831,6 +862,7 @@ namespace Pamac {
handle_error (error);
finished (true);
}
previous_filename = "";
}
public void on_emit_trans_prepared (ErrorInfos error) {
@@ -855,10 +887,11 @@ namespace Pamac {
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"});
progress_dialog.hide ();
transaction_sum_dialog.hide ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
finished (true);
}
} else if (sysupgrade_after_build) {
print ("sysupgrade_after_build\n");
sysupgrade_after_build = false;
commit ();
} else if (transaction_sum_dialog.run () == ResponseType.OK) {
@@ -870,16 +903,21 @@ namespace Pamac {
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction cancelled") + ".\n"});
progress_dialog.hide ();
transaction_sum_dialog.hide ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
release ();
finished (true);
}
} else if (mode == Mode.UPDATER) {
sysupgrade_after_build = false;
commit ();
} else {
//ErrorInfos err = ErrorInfos ();
//err.str = dgettext (null, "Nothing to do") + "\n";
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Nothing to do") + ".\n"});
progress_dialog.hide ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
release ();
clear_lists ();
finished (false);
@@ -911,13 +949,15 @@ namespace Pamac {
sysupgrade_after_trans = false;
sysupgrade (0);
} else if (sysupgrade_after_build) {
sysupgrade_simple (0);
sysupgrade_simple (enable_downgrade);
} else {
if (build_status == 0)
spawn_in_term ({"/usr/bin/echo", dgettext (null, "Transaction successfully finished") + ".\n"});
else
spawn_in_term ({"/usr/bin/echo"});
progress_dialog.hide ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
finished (false);
}
}
@@ -929,6 +969,7 @@ namespace Pamac {
total_download = 0;
already_downloaded = 0;
build_status = 0;
previous_filename = "";
}
void on_term_child_exited (int status) {

View File

@@ -84,11 +84,16 @@ namespace Pamac {
if (refresh_period != pamac_config.refresh_period)
new_conf.insert ("RefreshPeriod", refresh_period.to_string ());
if (new_conf.size () != 0) {
transaction.write_config (new_conf);
pamac_config.reload ();
transaction.write_config.begin (new_conf, (obj, res) => {
transaction.write_config.end (res);
pamac_config.reload ();
set_updates_list.begin ();
});
}
}
preferences_dialog.hide ();
while (Gtk.events_pending ())
Gtk.main_iteration ();
}
[GtkCallback]
@@ -113,13 +118,15 @@ namespace Pamac {
}
public void on_emit_trans_finished (bool error) {
if (error == false) {
set_updates_list ();
}
this.get_window ().set_cursor (null);
while (Gtk.events_pending ())
Gtk.main_iteration ();
set_updates_list.begin ((obj, res) => {
set_updates_list.end (res);
this.get_window ().set_cursor (null);
});
}
public void set_updates_list () {
public async void set_updates_list () {
TreeIter iter;
string name;
string size;