fix displaying empty details page

This commit is contained in:
guinux 2016-05-01 10:19:35 +02:00
parent e7bc6266d2
commit c650791851

View File

@ -796,15 +796,27 @@ namespace Pamac {
var treemodel = treeview.get_model (); var treemodel = treeview.get_model ();
Gtk.TreeIter iter; Gtk.TreeIter iter;
treemodel.get_iter (out iter, path); treemodel.get_iter (out iter, path);
string val; string depstring;
treemodel.get (iter, 1, out val); treemodel.get (iter, 1, out depstring);
string pkgname = val.split (":", 2)[0].replace (" [" + dgettext (null, "Installed") + "]", ""); // if depstring contains a version restriction search a satisfier directly
// just search for the name first to search for AUR after if (">" in depstring || "=" in depstring || "<" in depstring) {
AlpmPackage pkg = transaction.get_installed_pkg (pkgname); var pkg = transaction.find_installed_satisfier (depstring);
if (pkg.name == "") { if (pkg.name != "") {
pkg = transaction.get_sync_pkg (pkgname); display_package_properties (pkg.name);
} else {
pkg = transaction.find_sync_satisfier (depstring);
if (pkg.name != "") {
display_package_properties (pkg.name);
} }
if (pkg.name == "") { }
} else {
string pkgname = depstring.split (":", 2)[0].replace (" [" + dgettext (null, "Installed") + "]", "");
// just search for the name first to search for AUR after
if (transaction.get_installed_pkg (pkgname).name != "") {
display_package_properties (pkgname);
} else if (transaction.get_sync_pkg (pkgname).name != "") {
display_package_properties (pkgname);
} else {
this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH)); this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH));
while (Gtk.events_pending ()) { while (Gtk.events_pending ()) {
Gtk.main_iteration (); Gtk.main_iteration ();
@ -814,17 +826,18 @@ namespace Pamac {
if (transaction.get_aur_details.end (res).name != "") { if (transaction.get_aur_details.end (res).name != "") {
display_aur_properties (pkgname); display_aur_properties (pkgname);
} else { } else {
pkg = transaction.find_installed_satisfier (pkgname); var pkg = transaction.find_installed_satisfier (pkgname);
if (pkg.name == "") {
pkg = transaction.find_sync_satisfier (pkgname);
}
if (pkg.name != "") { if (pkg.name != "") {
display_package_properties (pkgname); display_package_properties (pkg.name);
} else {
pkg = transaction.find_sync_satisfier (pkgname);
if (pkg.name != "") {
display_package_properties (pkg.name);
}
} }
} }
}); });
} else { }
display_package_properties (pkgname);
} }
} }
} }