From 7a71e1859ecfbf6d325b0b2713dfdc7328ee5755 Mon Sep 17 00:00:00 2001 From: guinux Date: Fri, 5 Feb 2016 10:50:46 +0100 Subject: [PATCH] fix #95 and other fixes --- src/alpm_config.vala | 8 +++++++- src/manager_window.vala | 11 ++++++----- src/preferences_dialog.vala | 27 +++++++++++++-------------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/alpm_config.vala b/src/alpm_config.vala index a0d8e7d..d5168d5 100644 --- a/src/alpm_config.vala +++ b/src/alpm_config.vala @@ -83,21 +83,27 @@ namespace Alpm { // free internal data of alpm lists if (cachedirs != null) { cachedirs.free_data (); + cachedirs = new Alpm.List (); } if (hookdirs != null) { hookdirs.free_data (); + hookdirs = new Alpm.List (); } if (ignoregroups != null) { ignoregroups.free_data (); + ignoregroups = new Alpm.List (); } if (ignorepkgs != null) { ignorepkgs.free_data (); + ignorepkgs = new Alpm.List (); } if (noextracts != null) { noextracts.free_data (); + noextracts = new Alpm.List (); } if (noupgrades != null) { noupgrades.free_data (); + noupgrades = new Alpm.List (); } usesyslog = 0; checkspace = 0; @@ -338,7 +344,7 @@ namespace Alpm { } else if (line.contains ("CheckSpace")) { if (new_conf.contains ("CheckSpace")) { bool val = new_conf.get ("CheckSpace").get_boolean (); - if (val == true) { + if (val) { data += "CheckSpace\n"; } else { data += "#CheckSpace\n"; diff --git a/src/manager_window.vala b/src/manager_window.vala index 4fdde33..9149e42 100644 --- a/src/manager_window.vala +++ b/src/manager_window.vala @@ -974,11 +974,11 @@ namespace Pamac { foreach (var optdep in pkg.optdepends) { if (Alpm.find_satisfier (alpm_config.handle.localdb.pkgcache, optdep.name) == null) { 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, 1, optdep.name, 2, optdep.desc); + } } choose_dep_dialog.label.set_markup ("%s".printf ( dngettext (null, "%s has %u uninstalled optional dependency.\nChoose if you would like to install it", @@ -986,11 +986,12 @@ namespace Pamac { if (choose_dep_dialog.run () == Gtk.ResponseType.OK) { choose_dep_dialog.deps_list.foreach ((model, path, iter) => { 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); - bool selected = val.get_boolean (); - if (selected) { + if ((bool) val) { + // get value at column 1 to get the pkg name 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) { transaction.to_add.add (sync_pkg.name); } diff --git a/src/preferences_dialog.vala b/src/preferences_dialog.vala index 58f2db1..855df8c 100644 --- a/src/preferences_dialog.vala +++ b/src/preferences_dialog.vala @@ -98,6 +98,7 @@ namespace Pamac { } 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); + transaction.daemon.write_alpm_config_finished.connect (on_write_alpm_config_finished); 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); 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); check_aur_updates_checkbutton.toggled.connect (on_check_aur_updates_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 () { var new_pamac_conf = new HashTable (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); } @@ -266,15 +266,15 @@ namespace Pamac { var ignorepkg_string = new StringBuilder (); choose_ignorepkgs_dialog.pkgs_list.foreach ((model, path, iter) => { 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); - bool selected = val.get_boolean (); - if (selected) { + if ((bool) val) { + // get value at column 1 to get the pkg name choose_ignorepkgs_dialog.pkgs_list.get_value (iter, 1, out val); - unowned string name = val.get_string (); if (ignorepkg_string.len != 0) { ignorepkg_string.append (" "); } - ignorepkg_string.append (name); + ignorepkg_string.append ((string) val); } return false; }); @@ -298,13 +298,12 @@ namespace Pamac { ignorepkgs_liststore.remove (iter); var ignorepkg_string = new StringBuilder (); ignorepkgs_liststore.foreach ((model, path, iter) => { - GLib.Value val; - ignorepkgs_liststore.get_value (iter, 0, out val); - unowned string name = val.get_string (); + GLib.Value name; + ignorepkgs_liststore.get_value (iter, 0, out name); if (ignorepkg_string.len != 0) { ignorepkg_string.append (" "); } - ignorepkg_string.append (name); + ignorepkg_string.append ((string) name); return false; }); var new_alpm_conf = new HashTable (str_hash, str_equal); @@ -318,6 +317,7 @@ namespace Pamac { // re-populate ignorepkgs_liststore Gtk.TreeIter iter; ignorepkgs_liststore.clear (); + alpm_config.reload (); for (unowned Alpm.List list = alpm_config.ignorepkgs; list != null; list = list.next ()) { 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) { int index = 0; mirrors_country_comboboxtext.model.foreach ((model, path, iter) => { - GLib.Value val; - model.get_value (iter, 0, out val); - unowned string country = val.get_string (); - if (choosen_country == country) { + GLib.Value country; + model.get_value (iter, 0, out country); + if ((string) country == choosen_country) { return true; } index += 1;