Commit 19d3c394 authored by guinux's avatar guinux

some fixes

parent e5214474
......@@ -133,11 +133,10 @@ namespace Pamac {
}
public async List<Package> get_installed_pkgs_async () {
SourceFunc callback = get_installed_pkgs_async.callback;
var pkgs = new List<Package> ();
new Thread<int> ("get_installed_pkgs", () => {
pkgs = alpm_utils.get_installed_pkgs ();
Idle.add ((owned) callback);
get_installed_pkgs_async.callback ();
return 0;
});
yield;
......@@ -149,11 +148,10 @@ namespace Pamac {
}
public async List<Package> get_installed_apps_async () {
SourceFunc callback = get_installed_apps_async.callback;
var pkgs = new List<Package> ();
new Thread<int> ("get_installed_apps", () => {
pkgs = alpm_utils.get_installed_apps ();
Idle.add ((owned) callback);
get_installed_apps_async.callback ();
return 0;
});
yield;
......@@ -165,11 +163,10 @@ namespace Pamac {
}
public async List<Package> get_explicitly_installed_pkgs_async () {
SourceFunc callback = get_explicitly_installed_pkgs_async.callback;
var pkgs = new List<Package> ();
new Thread<int> ("get_explicitly_installed_pkgs", () => {
pkgs = alpm_utils.get_explicitly_installed_pkgs ();
Idle.add ((owned) callback);
get_explicitly_installed_pkgs_async.callback ();
return 0;
});
yield;
......@@ -181,11 +178,10 @@ namespace Pamac {
}
public async List<Package> get_foreign_pkgs_async () {
SourceFunc callback = get_foreign_pkgs_async.callback;
var pkgs = new List<Package> ();
new Thread<int> ("get_foreign_pkgs", () => {
pkgs = alpm_utils.get_foreign_pkgs ();
Idle.add ((owned) callback);
get_foreign_pkgs_async.callback ();
return 0;
});
yield;
......@@ -197,11 +193,10 @@ namespace Pamac {
}
public async List<Package> get_orphans_async () {
SourceFunc callback = get_orphans_async.callback;
var pkgs = new List<Package> ();
new Thread<int> ("get_orphans", () => {
pkgs = alpm_utils.get_orphans ();
Idle.add ((owned) callback);
get_orphans_async.callback ();
return 0;
});
yield;
......@@ -225,11 +220,10 @@ namespace Pamac {
}
public async List<Package> search_pkgs_async (string search_string) {
SourceFunc callback = search_pkgs_async.callback;
var pkgs = new List<Package> ();
new Thread<int> ("search_pkgs", () => {
pkgs = alpm_utils.search_pkgs (search_string);
Idle.add ((owned) callback);
search_pkgs_async.callback ();
return 0;
});
yield;
......@@ -249,11 +243,10 @@ namespace Pamac {
}
public async List<AURPackage> search_in_aur_async (string search_string) {
SourceFunc callback = search_in_aur_async.callback;
var pkgs = new List<AURPackage> ();
new Thread<int> ("search_in_aur", () => {
pkgs = alpm_utils.search_in_aur (search_string);
Idle.add ((owned) callback);
search_in_aur_async.callback ();
return 0;
});
yield;
......@@ -273,11 +266,10 @@ namespace Pamac {
}
public async List<Package> get_category_pkgs_async (string category) {
SourceFunc callback = get_category_pkgs_async.callback;
var pkgs = new List<Package> ();
new Thread<int> ("get_category_pkgs", () => {
pkgs = alpm_utils.get_category_pkgs (category);
Idle.add ((owned) callback);
get_category_pkgs_async.callback ();
return 0;
});
yield;
......@@ -297,11 +289,10 @@ namespace Pamac {
}
public async List<Package> get_repo_pkgs_async (string repo) {
SourceFunc callback = get_repo_pkgs_async.callback;
var pkgs = new List<Package> ();
new Thread<int> ("get_repo_pkgs", () => {
pkgs = alpm_utils.get_repo_pkgs (repo);
Idle.add ((owned) callback);
get_repo_pkgs_async.callback ();
return 0;
});
yield;
......@@ -321,11 +312,10 @@ namespace Pamac {
}
public async List<Package> get_group_pkgs_async (string group_name) {
SourceFunc callback = get_group_pkgs_async.callback;
var pkgs = new List<Package> ();
new Thread<int> ("get_group_pkgs", () => {
pkgs = alpm_utils.get_group_pkgs (group_name);
Idle.add ((owned) callback);
get_group_pkgs_async.callback ();
return 0;
});
yield;
......@@ -349,11 +339,10 @@ namespace Pamac {
}
public async List<string> get_pkg_files_async (string pkgname) {
SourceFunc callback = get_pkg_files_async.callback;
var files = new List<string> ();
new Thread<int> ("get_pkg_files", () => {
files = alpm_utils.get_pkg_files (pkgname);
Idle.add ((owned) callback);
get_pkg_files_async.callback ();
return 0;
});
yield;
......@@ -373,11 +362,10 @@ namespace Pamac {
}
public async AURPackage get_aur_pkg_async (string pkgname) {
SourceFunc callback = get_aur_pkg_async.callback;
var pkg = new AURPackage ();
new Thread<int> ("get_aur_pkg", () => {
pkg = alpm_utils.get_aur_pkg (pkgname);
Idle.add ((owned) callback);
get_aur_pkg_async.callback ();
return 0;
});
yield;
......@@ -393,11 +381,10 @@ namespace Pamac {
}
public async AURPackageDetails get_aur_pkg_details_async (string pkgname) {
SourceFunc callback = get_aur_pkg_details_async.callback;
var pkg = new AURPackageDetails ();
new Thread<int> ("get_aur_pkg_details", () => {
pkg = alpm_utils.get_aur_pkg_details (pkgname);
Idle.add ((owned) callback);
get_aur_pkg_details_async.callback ();
return 0;
});
yield;
......@@ -413,11 +400,10 @@ namespace Pamac {
}
public async Updates get_updates_async () {
SourceFunc callback = get_updates_async.callback;
var updates = new Updates ();
new Thread<int> ("get_updates", () => {
updates = get_updates ();
Idle.add ((owned) callback);
get_updates_async.callback ();
return 0;
});
yield;
......
......@@ -480,6 +480,13 @@ namespace Pamac {
show_sidebar ();
} else {
hide_sidebar ();
unowned Gtk.ListBoxRow repo_row = search_listbox.get_row_at_index (0);
repo_row.activatable = true;
repo_row.selectable = true;
repo_row.can_focus = true;
repo_row.get_child ().sensitive = true;
search_listbox.select_row (repo_row);
on_search_listbox_row_activated (search_listbox.get_selected_row ());
origin_stack.visible_child_name = "repos";
}
}
......@@ -1947,10 +1954,16 @@ namespace Pamac {
}
var pkgs = database.search_pkgs_async.end (res);
if (pkgs.length () == 0 && database.config.enable_aur) {
database.search_in_aur_async.begin (search_string, (obj, res) => {
unowned Gtk.ListBoxRow aur_row = search_listbox.get_row_at_index (1);
if (database.search_in_aur_async.end (res).length () > 0) {
origin_stack.visible_child_name = "aur";
row.activatable = false;
row.selectable = false;
row.has_focus = false;
row.can_focus = false;
row.get_child ().sensitive = false;
search_listbox.select_row (aur_row);
on_search_listbox_row_activated (search_listbox.get_selected_row ());
} else {
populate_packages_list (pkgs);
}
......@@ -1978,6 +1991,21 @@ namespace Pamac {
database.search_in_aur_async.begin (search_string, (obj, res) => {
populate_aur_list (database.search_in_aur_async.end (res));
});
database.search_pkgs_async.begin (search_string, (obj, res) => {
unowned Gtk.ListBoxRow repo_row = search_listbox.get_row_at_index (0);
if (database.search_pkgs_async.end (res).length () > 0 ) {
repo_row.activatable = true;
repo_row.selectable = true;
repo_row.can_focus = true;
repo_row.get_child ().sensitive = true;
} else {
repo_row.activatable = false;
repo_row.selectable = false;
repo_row.has_focus = false;
repo_row.can_focus = false;
repo_row.get_child ().sensitive = false;
}
});
packages_list.clear ();
break;
default:
......
......@@ -226,8 +226,8 @@ namespace Pamac {
replaces_priv = new List<string> ();
conflicts_priv = new List<string> ();
}
internal AURPackageDetails.from_struct (owned AURPackageDetailsStruct pkg_struct) {
this.pkg_struct = (owned) pkg_struct;
internal AURPackageDetails.from_struct (owned AURPackageDetailsStruct pkg_struct_) {
this.pkg_struct = (owned) pkg_struct_;
licenses_priv = new List<string> ();
depends_priv = new List<string> ();
makedepends_priv = new List<string> ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment