fix #95 and other fixes

This commit is contained in:
guinux 2016-02-05 10:50:46 +01:00
parent 2200d318fc
commit 7a71e1859e
3 changed files with 26 additions and 20 deletions

View File

@ -83,21 +83,27 @@ namespace Alpm {
// free internal data of alpm lists // free internal data of alpm lists
if (cachedirs != null) { if (cachedirs != null) {
cachedirs.free_data (); cachedirs.free_data ();
cachedirs = new Alpm.List<string> ();
} }
if (hookdirs != null) { if (hookdirs != null) {
hookdirs.free_data (); hookdirs.free_data ();
hookdirs = new Alpm.List<string?> ();
} }
if (ignoregroups != null) { if (ignoregroups != null) {
ignoregroups.free_data (); ignoregroups.free_data ();
ignoregroups = new Alpm.List<string> ();
} }
if (ignorepkgs != null) { if (ignorepkgs != null) {
ignorepkgs.free_data (); ignorepkgs.free_data ();
ignorepkgs = new Alpm.List<string> ();
} }
if (noextracts != null) { if (noextracts != null) {
noextracts.free_data (); noextracts.free_data ();
noextracts = new Alpm.List<string> ();
} }
if (noupgrades != null) { if (noupgrades != null) {
noupgrades.free_data (); noupgrades.free_data ();
noupgrades = new Alpm.List<string> ();
} }
usesyslog = 0; usesyslog = 0;
checkspace = 0; checkspace = 0;
@ -338,7 +344,7 @@ namespace Alpm {
} else if (line.contains ("CheckSpace")) { } else if (line.contains ("CheckSpace")) {
if (new_conf.contains ("CheckSpace")) { if (new_conf.contains ("CheckSpace")) {
bool val = new_conf.get ("CheckSpace").get_boolean (); bool val = new_conf.get ("CheckSpace").get_boolean ();
if (val == true) { if (val) {
data += "CheckSpace\n"; data += "CheckSpace\n";
} else { } else {
data += "#CheckSpace\n"; data += "#CheckSpace\n";

View File

@ -974,23 +974,24 @@ namespace Pamac {
foreach (var optdep in pkg.optdepends) { foreach (var optdep in pkg.optdepends) {
if (Alpm.find_satisfier (alpm_config.handle.localdb.pkgcache, optdep.name) == null) { if (Alpm.find_satisfier (alpm_config.handle.localdb.pkgcache, optdep.name) == null) {
length++; length++;
}
choose_dep_dialog.deps_list.insert_with_values (out iter, -1, choose_dep_dialog.deps_list.insert_with_values (out iter, -1,
0, false, 0, false,
1, optdep.name, 1, optdep.name,
2, optdep.desc); 2, optdep.desc);
} }
}
choose_dep_dialog.label.set_markup ("<b>%s</b>".printf ( choose_dep_dialog.label.set_markup ("<b>%s</b>".printf (
dngettext (null, "%s has %u uninstalled optional dependency.\nChoose if you would like to install it", dngettext (null, "%s has %u uninstalled optional dependency.\nChoose if you would like to install it",
"%s has %u uninstalled optional dependencies.\nChoose those you would like to install", length).printf (pkg.name, length))); "%s has %u uninstalled optional dependencies.\nChoose those you would like to install", length).printf (pkg.name, length)));
if (choose_dep_dialog.run () == Gtk.ResponseType.OK) { if (choose_dep_dialog.run () == Gtk.ResponseType.OK) {
choose_dep_dialog.deps_list.foreach ((model, path, iter) => { choose_dep_dialog.deps_list.foreach ((model, path, iter) => {
GLib.Value val; GLib.Value val;
// get value at column 0 to know if it is selected
choose_dep_dialog.deps_list.get_value (iter, 0, out val); choose_dep_dialog.deps_list.get_value (iter, 0, out val);
bool selected = val.get_boolean (); if ((bool) val) {
if (selected) { // get value at column 1 to get the pkg name
choose_dep_dialog.deps_list.get_value (iter, 1, out val); choose_dep_dialog.deps_list.get_value (iter, 1, out val);
unowned Alpm.Package? sync_pkg = get_sync_pkg (val.get_string ()); unowned Alpm.Package? sync_pkg = get_sync_pkg ((string) val);
if (sync_pkg != null) { if (sync_pkg != null) {
transaction.to_add.add (sync_pkg.name); transaction.to_add.add (sync_pkg.name);
} }

View File

@ -98,6 +98,7 @@ namespace Pamac {
} }
remove_unrequired_deps_button.state_set.connect (on_remove_unrequired_deps_button_state_set); remove_unrequired_deps_button.state_set.connect (on_remove_unrequired_deps_button_state_set);
check_space_button.state_set.connect (on_check_space_button_state_set); check_space_button.state_set.connect (on_check_space_button_state_set);
transaction.daemon.write_alpm_config_finished.connect (on_write_alpm_config_finished);
check_updates_button.state_set.connect (on_check_updates_button_state_set); check_updates_button.state_set.connect (on_check_updates_button_state_set);
refresh_period_spin_button.value_changed.connect (on_refresh_period_spin_button_value_changed); refresh_period_spin_button.value_changed.connect (on_refresh_period_spin_button_value_changed);
no_update_hide_icon_checkbutton.toggled.connect (on_no_update_hide_icon_checkbutton_toggled); no_update_hide_icon_checkbutton.toggled.connect (on_no_update_hide_icon_checkbutton_toggled);
@ -146,7 +147,6 @@ namespace Pamac {
search_aur_checkbutton.toggled.connect (on_search_aur_checkbutton_toggled); search_aur_checkbutton.toggled.connect (on_search_aur_checkbutton_toggled);
check_aur_updates_checkbutton.toggled.connect (on_check_aur_updates_checkbutton_toggled); check_aur_updates_checkbutton.toggled.connect (on_check_aur_updates_checkbutton_toggled);
no_confirm_build_checkbutton.toggled.connect (on_no_confirm_build_checkbutton_toggled); no_confirm_build_checkbutton.toggled.connect (on_no_confirm_build_checkbutton_toggled);
transaction.daemon.write_alpm_config_finished.connect (on_write_alpm_config_finished);
} }
} }
@ -174,7 +174,7 @@ namespace Pamac {
void on_refresh_period_spin_button_value_changed () { void on_refresh_period_spin_button_value_changed () {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal); var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("RefreshPeriod", new Variant.int32 (refresh_period_spin_button.get_value_as_int ())); new_pamac_conf.insert ("RefreshPeriod", new Variant.uint64 (refresh_period_spin_button.get_value_as_int ()));
transaction.start_write_pamac_config (new_pamac_conf); transaction.start_write_pamac_config (new_pamac_conf);
} }
@ -266,15 +266,15 @@ namespace Pamac {
var ignorepkg_string = new StringBuilder (); var ignorepkg_string = new StringBuilder ();
choose_ignorepkgs_dialog.pkgs_list.foreach ((model, path, iter) => { choose_ignorepkgs_dialog.pkgs_list.foreach ((model, path, iter) => {
GLib.Value val; GLib.Value val;
// get value at column 0 to know if it is selected
choose_ignorepkgs_dialog.pkgs_list.get_value (iter, 0, out val); choose_ignorepkgs_dialog.pkgs_list.get_value (iter, 0, out val);
bool selected = val.get_boolean (); if ((bool) val) {
if (selected) { // get value at column 1 to get the pkg name
choose_ignorepkgs_dialog.pkgs_list.get_value (iter, 1, out val); choose_ignorepkgs_dialog.pkgs_list.get_value (iter, 1, out val);
unowned string name = val.get_string ();
if (ignorepkg_string.len != 0) { if (ignorepkg_string.len != 0) {
ignorepkg_string.append (" "); ignorepkg_string.append (" ");
} }
ignorepkg_string.append (name); ignorepkg_string.append ((string) val);
} }
return false; return false;
}); });
@ -298,13 +298,12 @@ namespace Pamac {
ignorepkgs_liststore.remove (iter); ignorepkgs_liststore.remove (iter);
var ignorepkg_string = new StringBuilder (); var ignorepkg_string = new StringBuilder ();
ignorepkgs_liststore.foreach ((model, path, iter) => { ignorepkgs_liststore.foreach ((model, path, iter) => {
GLib.Value val; GLib.Value name;
ignorepkgs_liststore.get_value (iter, 0, out val); ignorepkgs_liststore.get_value (iter, 0, out name);
unowned string name = val.get_string ();
if (ignorepkg_string.len != 0) { if (ignorepkg_string.len != 0) {
ignorepkg_string.append (" "); ignorepkg_string.append (" ");
} }
ignorepkg_string.append (name); ignorepkg_string.append ((string) name);
return false; return false;
}); });
var new_alpm_conf = new HashTable<string,Variant> (str_hash, str_equal); var new_alpm_conf = new HashTable<string,Variant> (str_hash, str_equal);
@ -318,6 +317,7 @@ namespace Pamac {
// re-populate ignorepkgs_liststore // re-populate ignorepkgs_liststore
Gtk.TreeIter iter; Gtk.TreeIter iter;
ignorepkgs_liststore.clear (); ignorepkgs_liststore.clear ();
alpm_config.reload ();
for (unowned Alpm.List<string> list = alpm_config.ignorepkgs; list != null; list = list.next ()) { for (unowned Alpm.List<string> list = alpm_config.ignorepkgs; list != null; list = list.next ()) {
ignorepkgs_liststore.insert_with_values (out iter, -1, 0, list.data); ignorepkgs_liststore.insert_with_values (out iter, -1, 0, list.data);
} }
@ -342,10 +342,9 @@ namespace Pamac {
void on_write_mirrors_config_finished (string choosen_country, string choosen_generation_method) { void on_write_mirrors_config_finished (string choosen_country, string choosen_generation_method) {
int index = 0; int index = 0;
mirrors_country_comboboxtext.model.foreach ((model, path, iter) => { mirrors_country_comboboxtext.model.foreach ((model, path, iter) => {
GLib.Value val; GLib.Value country;
model.get_value (iter, 0, out val); model.get_value (iter, 0, out country);
unowned string country = val.get_string (); if ((string) country == choosen_country) {
if (choosen_country == country) {
return true; return true;
} }
index += 1; index += 1;