From 6024012729bd0d5c794036bacb00678573295fe6 Mon Sep 17 00:00:00 2001 From: guinux Date: Mon, 24 Nov 2014 21:34:23 +0100 Subject: [PATCH] fixes --- examples/pactree.vala | 2 +- src/daemon.vala | 25 +++++++++---------------- src/manager_window.vala | 15 ++++++--------- src/transaction.vala | 23 +++++++++++++++++++---- 4 files changed, 35 insertions(+), 30 deletions(-) diff --git a/examples/pactree.vala b/examples/pactree.vala index 4dfb58e..bc2b5bd 100644 --- a/examples/pactree.vala +++ b/examples/pactree.vala @@ -187,7 +187,7 @@ static void walk_reverse_deps(Package pkg, int depth) { if((max_depth >= 0) && (depth > max_depth)) return; walked.add(pkg.name); - unowned Alpm.List required_by = pkg.compute_requiredby (); + Alpm.List required_by = pkg.compute_requiredby (); foreach(string? i in required_by) { string pkgname = i; diff --git a/src/daemon.vala b/src/daemon.vala index bce5af7..6691555 100644 --- a/src/daemon.vala +++ b/src/daemon.vala @@ -121,23 +121,16 @@ namespace Pamac { ErrorInfos err = ErrorInfos (); string[] details = {}; int success = 0; - int ret = handle.trans_init (0); - if (ret == 0) { - foreach (var db in handle.syncdbs) { - ret = db.update (force_refresh); - if (ret >= 0) { - success++; - } + int ret; + foreach (var db in handle.syncdbs) { + ret = db.update (force_refresh); + if (ret >= 0) { + success++; } - // We should always succeed if at least one DB was upgraded - we may possibly - // fail later with unresolved deps, but that should be rare, and would be expected - if (success == 0) { - err.str = _("Failed to synchronize any databases"); - details += Alpm.strerror (handle.errno ()); - err.details = details; - } - trans_release (); - } else { + } + // We should always succeed if at least one DB was upgraded - we may possibly + // fail later with unresolved deps, but that should be rare, and would be expected + if (success == 0) { err.str = _("Failed to synchronize any databases"); details += Alpm.strerror (handle.errno ()); err.details = details; diff --git a/src/manager_window.vala b/src/manager_window.vala index c2b5552..96c322c 100644 --- a/src/manager_window.vala +++ b/src/manager_window.vala @@ -250,22 +250,17 @@ namespace Pamac { public void set_infos_list (Pamac.Package pkg) { name_label.set_markup ("%s %s".printf (pkg.name, pkg.version)); - // fix &,-,>,< in desc string desc; if (pkg.alpm_pkg != null) - desc = pkg.alpm_pkg.desc; + desc = Markup.escape_text (pkg.alpm_pkg.desc); else - desc = pkg.aur_json.get_string_member ("Description"); - desc = desc.replace ("&", "&"); - desc = desc.replace ("<->", "/"); + desc = Markup.escape_text (pkg.aur_json.get_string_member ("Description")); desc_label.set_markup (desc); - // fix & in url string url; if (pkg.alpm_pkg != null) - url = pkg.alpm_pkg.url; + url = Markup.escape_text (pkg.alpm_pkg.url); else - url = pkg.aur_json.get_string_member ("URL"); - url = url.replace ("&", "&"); + url = Markup.escape_text (pkg.aur_json.get_string_member ("URL")); link_label.set_markup ("%s".printf (url, url)); StringBuilder licenses = new StringBuilder (); licenses.append (dgettext (null, "Licenses")); @@ -509,6 +504,8 @@ namespace Pamac { TreeSelection selection = search_treeview.get_selection (); if (selection.get_selected (out model, out iter)) { on_search_treeview_selection_changed (); + } else { + show_all_pkgs (); } } else if (current_page == 1) { on_groups_treeview_selection_changed (); diff --git a/src/transaction.vala b/src/transaction.vala index e1065c9..ae1a27d 100644 --- a/src/transaction.vala +++ b/src/transaction.vala @@ -249,8 +249,8 @@ namespace Pamac { // run as a standard transaction run (); } else { - UpdatesInfos[] updates = get_repos_updates (handle, ignorepkg); - uint repos_updates_len = updates.length; + UpdatesInfos[] repos_updates = get_repos_updates (handle, ignorepkg); + int repos_updates_len = repos_updates.length; if (check_aur) { if (aur_checked == false) { aur_updates = get_aur_updates (handle, ignorepkg); @@ -554,12 +554,18 @@ namespace Pamac { } } - public void spawn_in_term (string[] args, out int pid = null) { + public void spawn_in_term (string[] args, out Pid child_pid = null) { + Pid intern_pid; try { - Process.spawn_async (null, args, null, SpawnFlags.DO_NOT_REAP_CHILD, pty.child_setup, out pid); + Process.spawn_async (null, args, null, SpawnFlags.DO_NOT_REAP_CHILD, pty.child_setup, out intern_pid); + ChildWatch.add (intern_pid, (pid, status) => { + // triggered when the child indicated by intern_pid exits + Process.close_pid (pid); + }); } catch (SpawnError e) { stderr.printf ("SpawnError: %s\n", e.message); } + child_pid = intern_pid; term.set_pty (pty); } @@ -906,6 +912,10 @@ namespace Pamac { transaction_sum_dialog.hide (); while (Gtk.events_pending ()) Gtk.main_iteration (); + if (aur_updates.length != 0) + to_build.steal_all (); + sysupgrade_after_trans = false; + sysupgrade_after_build = false; finished (true); } } else if (sysupgrade_after_build) { @@ -923,6 +933,10 @@ namespace Pamac { while (Gtk.events_pending ()) Gtk.main_iteration (); release (); + if (aur_updates.length != 0) + to_build.steal_all (); + sysupgrade_after_trans = false; + sysupgrade_after_build = false; finished (true); } } else if (mode == Mode.UPDATER) { @@ -987,6 +1001,7 @@ namespace Pamac { already_downloaded = 0; build_status = 0; previous_filename = ""; + aur_checked = false; } void on_term_child_exited (int status) {