forked from cromer/pamac-classic
some fixes and improvements
This commit is contained in:
parent
0d3b34d7c4
commit
ed0bacc1d3
4
po/fr.po
4
po/fr.po
@ -408,12 +408,12 @@ msgstr "Vérification de l'espace disque disponible"
|
||||
#: src/transaction.vala:685
|
||||
#, c-format
|
||||
msgid "%s optionally requires %s"
|
||||
msgstr ""
|
||||
msgstr "%s peut nécessiter %s"
|
||||
|
||||
#: src/transaction.vala:688
|
||||
#, c-format
|
||||
msgid "Database file for %s does not exist"
|
||||
msgstr ""
|
||||
msgstr "Le dépôt %s n'existe pas"
|
||||
|
||||
#: src/transaction.vala:740
|
||||
#, c-format
|
||||
|
@ -2,7 +2,6 @@
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<template class="PamacChooseDependenciesDialog" parent="GtkDialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes">Choose Optional Dependencies</property>
|
||||
<property name="modal">True</property>
|
||||
@ -25,7 +24,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -2,7 +2,6 @@
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<template class="PamacChooseProviderDialog" parent="GtkDialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes">Choose a Provider</property>
|
||||
<property name="modal">True</property>
|
||||
@ -25,7 +24,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
@ -2,7 +2,6 @@
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<template class="PamacHistoryDialog" parent="GtkDialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes">Pamac History</property>
|
||||
<property name="default_width">600</property>
|
||||
@ -25,7 +24,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -23,7 +23,7 @@
|
||||
<object class="GtkButton" id="refresh_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Refresh databases</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="clicked" handler="on_refresh_button_clicked" swapped="no"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
@ -46,7 +46,7 @@
|
||||
<object class="GtkButton" id="valid_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Apply changes</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="clicked" handler="on_valid_button_clicked" swapped="no"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
@ -69,7 +69,7 @@
|
||||
<object class="GtkButton" id="cancel_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Cancel all planned changes</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="clicked" handler="on_cancel_button_clicked" swapped="no"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
@ -91,6 +91,7 @@
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="menu_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="popup">main_menu</property>
|
||||
<property name="use_popover">True</property>
|
||||
<style>
|
||||
@ -164,6 +165,7 @@
|
||||
<child>
|
||||
<object class="GtkSwitch" id="search_aur_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Search in AUR</property>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
@ -492,7 +494,7 @@
|
||||
<child>
|
||||
<object class="GtkViewport" id="viewport1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box5">
|
||||
<property name="visible">True</property>
|
||||
@ -502,7 +504,7 @@
|
||||
<child>
|
||||
<object class="GtkLabel" id="name_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="selectable">True</property>
|
||||
@ -516,7 +518,7 @@
|
||||
<child>
|
||||
<object class="GtkLabel" id="desc_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="selectable">True</property>
|
||||
@ -544,7 +546,7 @@
|
||||
<child>
|
||||
<object class="GtkLabel" id="licenses_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="selectable">True</property>
|
||||
@ -579,7 +581,7 @@
|
||||
<child>
|
||||
<object class="GtkTreeView" id="deps_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="headers_clickable">False</property>
|
||||
<property name="enable_search">False</property>
|
||||
@ -640,7 +642,7 @@
|
||||
<child>
|
||||
<object class="GtkTreeView" id="details_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="headers_clickable">False</property>
|
||||
<property name="enable_search">False</property>
|
||||
|
@ -29,7 +29,6 @@
|
||||
<property name="use_underline">True</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -43,8 +42,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -28,6 +28,7 @@
|
||||
<property name="label" translatable="yes">_Cancel</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="clicked" handler="on_cancel_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
@ -40,6 +41,7 @@
|
||||
<property name="label" translatable="yes">_Close</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
@ -78,7 +80,7 @@
|
||||
<child>
|
||||
<object class="GtkExpander" id="expander">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="resize_toplevel">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
|
@ -21,7 +21,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -34,7 +34,6 @@
|
||||
<property name="label" translatable="yes">_OK</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -38,7 +38,7 @@
|
||||
<child>
|
||||
<object class="GtkTreeView" id="updates_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="headers_clickable">False</property>
|
||||
@ -101,7 +101,6 @@
|
||||
<property name="label" translatable="yes">_Preferences</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="clicked" handler="on_preferences_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
@ -119,8 +118,7 @@
|
||||
<child>
|
||||
<object class="GtkButtonBox" id="buttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
@ -128,7 +126,6 @@
|
||||
<property name="label" translatable="yes">_Refresh</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="clicked" handler="on_refresh_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
@ -142,7 +139,7 @@
|
||||
<property name="label" translatable="yes">_Apply</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="clicked" handler="on_apply_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
@ -156,7 +153,6 @@
|
||||
<property name="label" translatable="yes">_Close</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
|
@ -59,8 +59,6 @@ public int pkgcmp (Alpm.Package pkg1, Alpm.Package pkg2) {
|
||||
|
||||
public unowned Alpm.List<Alpm.Package?> search_all_dbs (Alpm.Handle handle, Alpm.List<string?> needles) {
|
||||
unowned Alpm.List<Alpm.Package?> syncpkgs = null;
|
||||
unowned Alpm.List<Alpm.Package?> tmp = null;
|
||||
unowned Alpm.List<Alpm.Package?> diff = null;
|
||||
unowned Alpm.List<Alpm.Package?> result = null;
|
||||
|
||||
result = handle.localdb.search (needles);
|
||||
@ -69,15 +67,11 @@ public unowned Alpm.List<Alpm.Package?> search_all_dbs (Alpm.Handle handle, Alpm
|
||||
if (syncpkgs.length == 0)
|
||||
syncpkgs = db.search (needles);
|
||||
else {
|
||||
tmp = db.search (needles);
|
||||
diff = tmp.diff (syncpkgs, (Alpm.List.CompareFunc) pkgcmp);
|
||||
syncpkgs.join (diff);
|
||||
syncpkgs.join (db.search (needles).diff (syncpkgs, (Alpm.List.CompareFunc) pkgcmp));
|
||||
}
|
||||
}
|
||||
|
||||
diff = syncpkgs.diff (result, (Alpm.List.CompareFunc) pkgcmp);
|
||||
|
||||
result.join (diff);
|
||||
result.join (syncpkgs.diff (result, (Alpm.List.CompareFunc) pkgcmp));
|
||||
//result.sort ((Alpm.List.CompareFunc) pkgcmp);
|
||||
|
||||
return result;
|
||||
@ -92,17 +86,7 @@ public unowned Alpm.List<Alpm.Package?> group_pkgs_all_dbs (Alpm.Handle handle,
|
||||
result.add (pkg);
|
||||
}
|
||||
|
||||
// FIX IT: provided methods don't work for syncdbs so it's done manually
|
||||
foreach (unowned Alpm.DB db in handle.syncdbs) {
|
||||
foreach (unowned Alpm.Package pkg in db.pkgcache) {
|
||||
foreach (string name in pkg.groups) {
|
||||
if (name == grp_name) {
|
||||
if (Alpm.pkg_find (result, pkg.name) == null)
|
||||
result.add (pkg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
result.join (Alpm.find_group_pkgs (handle.syncdbs, grp_name).diff (result, (Alpm.List.CompareFunc) pkgcmp));
|
||||
|
||||
//result.sort ((Alpm.List.CompareFunc) pkgcmp);
|
||||
|
||||
@ -111,25 +95,19 @@ public unowned Alpm.List<Alpm.Package?> group_pkgs_all_dbs (Alpm.Handle handle,
|
||||
|
||||
public unowned Alpm.List<Alpm.Package?> get_all_pkgs (Alpm.Handle handle) {
|
||||
unowned Alpm.List<Alpm.Package?> syncpkgs = null;
|
||||
unowned Alpm.List<Alpm.Package?> tmp = null;
|
||||
unowned Alpm.List<Alpm.Package?> diff = null;
|
||||
unowned Alpm.List<Alpm.Package?> result = null;
|
||||
|
||||
result = handle.localdb.pkgcache;
|
||||
result = handle.localdb.pkgcache.copy ();
|
||||
|
||||
foreach (unowned Alpm.DB db in handle.syncdbs) {
|
||||
if (syncpkgs.length == 0)
|
||||
syncpkgs = db.pkgcache;
|
||||
syncpkgs = db.pkgcache.copy ();
|
||||
else {
|
||||
tmp = db.pkgcache;
|
||||
diff = tmp.diff (syncpkgs, (Alpm.List.CompareFunc) pkgcmp);
|
||||
syncpkgs.join (diff);
|
||||
syncpkgs.join (db.pkgcache.diff (syncpkgs, (Alpm.List.CompareFunc) pkgcmp));
|
||||
}
|
||||
}
|
||||
|
||||
diff = syncpkgs.diff (result, (Alpm.List.CompareFunc) pkgcmp);
|
||||
|
||||
result.join (diff);
|
||||
result.join (syncpkgs.diff (result, (Alpm.List.CompareFunc) pkgcmp));
|
||||
//result.sort ((Alpm.List.CompareFunc) pkgcmp);
|
||||
|
||||
return result;
|
||||
|
@ -74,12 +74,12 @@ namespace Pamac {
|
||||
previous_percent = 0;
|
||||
}
|
||||
|
||||
public async void write_config (HashTable<string,string> new_conf, GLib.BusName sender) {
|
||||
public void write_config (HashTable<string,string> new_conf, GLib.BusName sender) {
|
||||
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||
try {
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync (null);
|
||||
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
|
||||
Polkit.AuthorizationResult result = yield authority.check_authorization (
|
||||
Polkit.AuthorizationResult result = authority.check_authorization_sync (
|
||||
subject,
|
||||
"org.manjaro.pamac.commit",
|
||||
null,
|
||||
@ -94,11 +94,11 @@ namespace Pamac {
|
||||
}
|
||||
}
|
||||
|
||||
public async void set_pkgreason (string pkgname, uint reason, GLib.BusName sender) {
|
||||
public void set_pkgreason (string pkgname, uint reason, GLib.BusName sender) {
|
||||
try {
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync (null);
|
||||
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
|
||||
Polkit.AuthorizationResult result = yield authority.check_authorization (
|
||||
Polkit.AuthorizationResult result = authority.check_authorization_sync (
|
||||
subject,
|
||||
"org.manjaro.pamac.commit",
|
||||
null,
|
||||
@ -483,6 +483,7 @@ namespace Pamac {
|
||||
public void trans_cancel () {
|
||||
handle.trans_interrupt ();
|
||||
handle.trans_release ();
|
||||
init_alpm_config ();
|
||||
}
|
||||
|
||||
public void quit () {
|
||||
|
@ -21,7 +21,6 @@ namespace Pamac {
|
||||
|
||||
public class Installer: Gtk.Application {
|
||||
Transaction transaction;
|
||||
Pamac.Config pamac_config;
|
||||
bool pamac_run;
|
||||
|
||||
public Installer () {
|
||||
@ -46,8 +45,7 @@ namespace Pamac {
|
||||
transaction_info_dialog.run ();
|
||||
transaction_info_dialog.hide ();
|
||||
} else {
|
||||
pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||
transaction = new Pamac.Transaction (null, pamac_config);
|
||||
transaction = new Pamac.Transaction (null);
|
||||
transaction.finished.connect (on_emit_trans_finished);
|
||||
this.hold ();
|
||||
}
|
||||
|
@ -49,8 +49,12 @@ namespace Pamac {
|
||||
}
|
||||
|
||||
public override void activate () {
|
||||
if (pamac_run == false)
|
||||
if (pamac_run == false) {
|
||||
manager_window.present ();
|
||||
while (Gtk.events_pending ())
|
||||
Gtk.main_iteration ();
|
||||
manager_window.show_all_pkgs ();
|
||||
}
|
||||
}
|
||||
|
||||
public override void shutdown () {
|
||||
|
@ -59,8 +59,6 @@ namespace Pamac {
|
||||
[GtkChild]
|
||||
public TreeView search_treeview;
|
||||
[GtkChild]
|
||||
public TreeSelection search_treeview_selection;
|
||||
[GtkChild]
|
||||
public TreeView groups_treeview;
|
||||
[GtkChild]
|
||||
public TreeView states_treeview;
|
||||
@ -93,27 +91,29 @@ namespace Pamac {
|
||||
[GtkChild]
|
||||
public Button cancel_button;
|
||||
|
||||
public Gtk.Menu right_click_menu;
|
||||
public Gtk.MenuItem deselect_item;
|
||||
public Gtk.MenuItem install_item;
|
||||
public Gtk.MenuItem remove_item;
|
||||
public Gtk.SeparatorMenuItem separator_item;
|
||||
public Gtk.MenuItem reinstall_item;
|
||||
public Gtk.MenuItem install_optional_deps_item;
|
||||
public Gtk.MenuItem explicitly_installed_item;
|
||||
public GLib.List<Pamac.Package> selected_pkgs;
|
||||
// menu
|
||||
Gtk.Menu right_click_menu;
|
||||
Gtk.MenuItem deselect_item;
|
||||
Gtk.MenuItem install_item;
|
||||
Gtk.MenuItem remove_item;
|
||||
Gtk.SeparatorMenuItem separator_item;
|
||||
Gtk.MenuItem reinstall_item;
|
||||
Gtk.MenuItem install_optional_deps_item;
|
||||
Gtk.MenuItem explicitly_installed_item;
|
||||
GLib.List<Pamac.Package> selected_pkgs;
|
||||
|
||||
public ListStore search_list;
|
||||
public ListStore groups_list;
|
||||
public ListStore states_list;
|
||||
public ListStore repos_list;
|
||||
public ListStore deps_list;
|
||||
public ListStore details_list;
|
||||
// liststore
|
||||
ListStore search_list;
|
||||
ListStore groups_list;
|
||||
ListStore states_list;
|
||||
ListStore repos_list;
|
||||
ListStore deps_list;
|
||||
ListStore details_list;
|
||||
|
||||
PackagesModel packages_list;
|
||||
HashTable<string, Json.Array> aur_results;
|
||||
|
||||
public Pamac.Config pamac_config;
|
||||
Pamac.Config pamac_config;
|
||||
public Transaction transaction;
|
||||
|
||||
public SortInfo sortinfo;
|
||||
@ -177,7 +177,8 @@ namespace Pamac {
|
||||
|
||||
pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||
|
||||
transaction = new Pamac.Transaction (this as ApplicationWindow, pamac_config);
|
||||
transaction = new Pamac.Transaction (this as ApplicationWindow);
|
||||
transaction.check_aur = pamac_config.enable_aur;
|
||||
transaction.finished.connect (on_emit_trans_finished);
|
||||
|
||||
history_dialog = new HistoryDialog (this);
|
||||
@ -201,9 +202,18 @@ namespace Pamac {
|
||||
cancel_button.set_sensitive (sensitive);
|
||||
}
|
||||
|
||||
public void show_all_pkgs () {
|
||||
this.get_window ().set_cursor (new Gdk.Cursor (Gdk.CursorType.WATCH));
|
||||
populate_packages_list (get_all_pkgs (transaction.handle));
|
||||
this.get_window ().set_cursor (null);
|
||||
}
|
||||
|
||||
public void update_lists () {
|
||||
string[] grps = {};
|
||||
TreeIter iter;
|
||||
TreeSelection selection;
|
||||
selection = repos_treeview.get_selection ();
|
||||
selection.changed.disconnect (on_repos_treeview_selection_changed);
|
||||
foreach (unowned DB db in transaction.handle.syncdbs) {
|
||||
repos_list.insert_with_values (out iter, -1, 0, db.name);
|
||||
foreach (unowned Group grp in db.groupcache) {
|
||||
@ -213,14 +223,29 @@ namespace Pamac {
|
||||
}
|
||||
}
|
||||
repos_list.insert_with_values (out iter, -1, 0, dgettext (null, "local"));
|
||||
repos_list.get_iter_first (out iter);
|
||||
selection.select_iter (iter);
|
||||
selection.changed.connect_after (on_repos_treeview_selection_changed);
|
||||
|
||||
selection = groups_treeview.get_selection ();
|
||||
selection.changed.disconnect (on_groups_treeview_selection_changed);
|
||||
foreach (string name in grps)
|
||||
groups_list.insert_with_values (out iter, -1, 0, name);
|
||||
groups_list.set_sort_column_id (0, SortType.ASCENDING);
|
||||
groups_list.get_iter_first (out iter);
|
||||
selection.select_iter (iter);
|
||||
selection.changed.connect_after (on_groups_treeview_selection_changed);
|
||||
|
||||
selection = states_treeview.get_selection ();
|
||||
selection.changed.disconnect (on_states_treeview_selection_changed);
|
||||
states_list.insert_with_values (out iter, -1, 0, dgettext (null, "Installed"));
|
||||
//states_list.insert_with_values (out iter, -1, 0, dgettext (null, "Uninstalled"));
|
||||
states_list.insert_with_values (out iter, -1, 0, dgettext (null, "Orphans"));
|
||||
states_list.insert_with_values (out iter, -1, 0, dgettext (null, "To install"));
|
||||
states_list.insert_with_values (out iter, -1, 0, dgettext (null, "To remove"));
|
||||
states_list.get_iter_first (out iter);
|
||||
selection.select_iter (iter);
|
||||
selection.changed.connect_after (on_states_treeview_selection_changed);
|
||||
}
|
||||
|
||||
public void set_infos_list (Pamac.Package pkg) {
|
||||
@ -654,11 +679,10 @@ namespace Pamac {
|
||||
|
||||
void on_explicitly_installed_item_activate () {
|
||||
foreach (Pamac.Package pkg in selected_pkgs) {
|
||||
transaction.set_pkgreason.begin (pkg.name, PkgReason.EXPLICIT, (obj, res) => {
|
||||
transaction.set_pkgreason.end (res);
|
||||
refresh_packages_list ();
|
||||
});
|
||||
transaction.set_pkgreason (pkg.name, PkgReason.EXPLICIT);
|
||||
}
|
||||
transaction.refresh_alpm_config ();
|
||||
refresh_packages_list ();
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
@ -833,7 +857,7 @@ namespace Pamac {
|
||||
search_pkgs.begin (search_string, (obj, res) => {
|
||||
Json.Array aur_pkgs;
|
||||
unowned Alpm.List<Alpm.Package?> pkgs = search_pkgs.end (res, out aur_pkgs);
|
||||
if (pkgs.length != 0) {
|
||||
if (pkgs.length != 0 || aur_pkgs.get_length () != 0) {
|
||||
// add search string in search_list if needed
|
||||
bool found = false;
|
||||
TreeIter? iter;
|
||||
@ -855,27 +879,28 @@ namespace Pamac {
|
||||
if ((string) line == search_string) {
|
||||
found = true;
|
||||
// block the signal to not populate when we select the iter in search_list
|
||||
search_treeview_selection.changed.disconnect (on_search_treeview_selection_changed);
|
||||
selection.changed.disconnect (on_search_treeview_selection_changed);
|
||||
selection.select_iter (_iter);
|
||||
search_treeview_selection.changed.connect_after (on_search_treeview_selection_changed);
|
||||
selection.changed.connect_after (on_search_treeview_selection_changed);
|
||||
populate_packages_list (pkgs, aur_pkgs);
|
||||
}
|
||||
return found;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (found == false) {
|
||||
search_list.insert_with_values (out iter, -1, 0, search_string);
|
||||
// block the signal to not populate when we select the iter in search_list
|
||||
search_treeview_selection.changed.disconnect (on_search_treeview_selection_changed);
|
||||
selection.changed.disconnect (on_search_treeview_selection_changed);
|
||||
selection.select_iter (iter);
|
||||
search_treeview_selection.changed.connect_after (on_search_treeview_selection_changed);
|
||||
selection.changed.connect_after (on_search_treeview_selection_changed);
|
||||
populate_packages_list (pkgs, aur_pkgs);
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
// populate with empty lists
|
||||
populate_packages_list (pkgs, aur_pkgs);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -955,15 +980,11 @@ namespace Pamac {
|
||||
} else if (state == dgettext (null, "Installed")) {
|
||||
pkgs = transaction.handle.localdb.pkgcache;
|
||||
} else if (state == dgettext (null, "Uninstalled")) {
|
||||
unowned Alpm.List<Alpm.Package?> tmp = null;
|
||||
unowned Alpm.List<Alpm.Package?> diff = null;
|
||||
foreach (unowned DB db in transaction.handle.syncdbs) {
|
||||
if (pkgs.length == 0)
|
||||
pkgs = db.pkgcache;
|
||||
pkgs = db.pkgcache.copy ();
|
||||
else {
|
||||
tmp = db.pkgcache;
|
||||
diff = tmp.diff (pkgs, (Alpm.List.CompareFunc) pkgcmp);
|
||||
pkgs.join (diff);
|
||||
pkgs.join (db.pkgcache.diff (pkgs, (Alpm.List.CompareFunc) pkgcmp));
|
||||
}
|
||||
}
|
||||
} else if (state == dgettext (null, "Orphans")) {
|
||||
@ -1094,11 +1115,9 @@ namespace Pamac {
|
||||
if (refresh_period != pamac_config.refresh_period)
|
||||
new_conf.insert ("RefreshPeriod", refresh_period.to_string ());
|
||||
if (new_conf.size () != 0) {
|
||||
transaction.write_config.begin (new_conf, (obj, res) => {
|
||||
transaction.write_config.end (res);
|
||||
pamac_config.reload ();
|
||||
search_aur_button.set_active (pamac_config.enable_aur);
|
||||
});
|
||||
transaction.write_config (new_conf);
|
||||
pamac_config.reload ();
|
||||
search_aur_button.set_active (pamac_config.enable_aur);
|
||||
}
|
||||
}
|
||||
preferences_dialog.hide ();
|
||||
|
@ -24,8 +24,8 @@ using Alpm;
|
||||
namespace Pamac {
|
||||
[DBus (name = "org.manjaro.pamac")]
|
||||
public interface Daemon : Object {
|
||||
public abstract async void write_config (HashTable<string,string> new_conf) throws IOError;
|
||||
public abstract async void set_pkgreason (string pkgname, uint reason) throws IOError;
|
||||
public abstract void write_config (HashTable<string,string> new_conf) throws IOError;
|
||||
public abstract void set_pkgreason (string pkgname, uint reason) throws IOError;
|
||||
public abstract void refresh (int force, bool emit_signal) throws IOError;
|
||||
public abstract ErrorInfos trans_init (TransFlag transflags) throws IOError;
|
||||
public abstract ErrorInfos trans_sysupgrade (int enable_downgrade) throws IOError;
|
||||
@ -59,7 +59,6 @@ namespace Pamac {
|
||||
public string[] holdpkg;
|
||||
public string[] ignorepkg;
|
||||
public Handle handle;
|
||||
public Pamac.Config pamac_config;
|
||||
|
||||
public Alpm.TransFlag flags;
|
||||
// those hashtables will be used as set
|
||||
@ -81,6 +80,9 @@ namespace Pamac {
|
||||
bool sysupgrade_after_build;
|
||||
int build_status;
|
||||
int enable_downgrade;
|
||||
public bool check_aur;
|
||||
UpdatesInfos[] aur_updates;
|
||||
bool aur_checked;
|
||||
|
||||
Terminal term;
|
||||
Pty pty;
|
||||
@ -94,9 +96,8 @@ namespace Pamac {
|
||||
|
||||
public signal void finished (bool error);
|
||||
|
||||
public Transaction (ApplicationWindow? window, Pamac.Config pamac_config) {
|
||||
public Transaction (ApplicationWindow? window) {
|
||||
refresh_alpm_config ();
|
||||
this.pamac_config = pamac_config;
|
||||
mode = Mode.MANAGER;
|
||||
flags = Alpm.TransFlag.CASCADE;
|
||||
to_add = new HashTable<string, string> (str_hash, str_equal);
|
||||
@ -142,19 +143,22 @@ namespace Pamac {
|
||||
sysupgrade_after_trans = false;
|
||||
sysupgrade_after_build = false;
|
||||
build_status = 0;
|
||||
check_aur = false;
|
||||
aur_updates = {};
|
||||
aur_checked = false;
|
||||
}
|
||||
|
||||
public async void write_config (HashTable<string,string> new_conf) {
|
||||
public void write_config (HashTable<string,string> new_conf) {
|
||||
try {
|
||||
yield daemon.write_config (new_conf);
|
||||
daemon.write_config (new_conf);
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public async void set_pkgreason (string pkgname, PkgReason reason) {
|
||||
public void set_pkgreason (string pkgname, PkgReason reason) {
|
||||
try {
|
||||
yield daemon.set_pkgreason (pkgname, (uint) reason);
|
||||
daemon.set_pkgreason (pkgname, (uint) reason);
|
||||
refresh_alpm_config ();
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
@ -247,8 +251,11 @@ namespace Pamac {
|
||||
} else {
|
||||
UpdatesInfos[] updates = get_repos_updates (handle, ignorepkg);
|
||||
uint repos_updates_len = updates.length;
|
||||
if (pamac_config.enable_aur) {
|
||||
UpdatesInfos[] aur_updates = get_aur_updates (handle, ignorepkg);
|
||||
if (check_aur) {
|
||||
if (aur_checked == false) {
|
||||
aur_updates = get_aur_updates (handle, ignorepkg);
|
||||
aur_checked = true;
|
||||
}
|
||||
if (aur_updates.length != 0) {
|
||||
clear_lists ();
|
||||
if (repos_updates_len != 0)
|
||||
@ -749,22 +756,32 @@ namespace Pamac {
|
||||
}
|
||||
if (total_download > 0) {
|
||||
fraction = (float) (xfered + already_downloaded) / total_download;
|
||||
textbar = "%s/%s".printf (format_size (xfered + already_downloaded), format_size (total_download));
|
||||
if (fraction > 0)
|
||||
textbar = "%s/%s".printf (format_size (xfered + already_downloaded), format_size (total_download));
|
||||
else
|
||||
textbar = "%s".printf (format_size (xfered + already_downloaded));
|
||||
} else {
|
||||
fraction = (float) xfered / total;
|
||||
textbar = "%s/%s".printf (format_size (xfered), format_size (total));
|
||||
if (fraction > 0)
|
||||
textbar = "%s/%s".printf (format_size (xfered), format_size (total));
|
||||
else
|
||||
textbar = "%s".printf (format_size (xfered));
|
||||
}
|
||||
if (fraction != previous_percent) {
|
||||
previous_percent = fraction;
|
||||
progress_dialog.progressbar.set_fraction (fraction);
|
||||
}
|
||||
|
||||
if (fraction > 0) {
|
||||
if (fraction != previous_percent) {
|
||||
previous_percent = fraction;
|
||||
progress_dialog.progressbar.set_fraction (fraction);
|
||||
}
|
||||
} else
|
||||
progress_dialog.progressbar.set_fraction (0);
|
||||
if (textbar != previous_textbar) {
|
||||
previous_textbar = textbar;
|
||||
progress_dialog.progressbar.set_text (textbar);
|
||||
}
|
||||
if (xfered == total)
|
||||
if (xfered == total) {
|
||||
already_downloaded += total;
|
||||
previous_filename = "";
|
||||
}
|
||||
}
|
||||
|
||||
void on_emit_totaldownload (uint64 total) {
|
||||
|
@ -47,17 +47,17 @@ namespace Pamac {
|
||||
updates_list = new Gtk.ListStore (2, typeof (string), typeof (string));
|
||||
updates_treeview.set_model (updates_list);
|
||||
|
||||
transaction = new Transaction (this as ApplicationWindow, pamac_config);
|
||||
transaction = new Transaction (this as ApplicationWindow);
|
||||
transaction.mode = Mode.UPDATER;
|
||||
transaction.check_aur = pamac_config.enable_aur;
|
||||
transaction.finished.connect (on_emit_trans_finished);
|
||||
|
||||
preferences_dialog = new PreferencesDialog (this as ApplicationWindow);
|
||||
|
||||
top_label.set_markup("<b>%s</b>".printf (dgettext (null, "Your system is up-to-date")));
|
||||
bottom_label.set_visible (false);
|
||||
apply_button.set_sensitive (false);
|
||||
|
||||
transaction.refresh (0);
|
||||
on_refresh_button_clicked ();
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
@ -84,11 +84,9 @@ namespace Pamac {
|
||||
if (refresh_period != pamac_config.refresh_period)
|
||||
new_conf.insert ("RefreshPeriod", refresh_period.to_string ());
|
||||
if (new_conf.size () != 0) {
|
||||
transaction.write_config.begin (new_conf, (obj, res) => {
|
||||
transaction.write_config.end (res);
|
||||
pamac_config.reload ();
|
||||
set_updates_list.begin ();
|
||||
});
|
||||
transaction.write_config (new_conf);
|
||||
pamac_config.reload ();
|
||||
set_updates_list.begin ();
|
||||
}
|
||||
}
|
||||
preferences_dialog.hide ();
|
||||
@ -118,12 +116,7 @@ namespace Pamac {
|
||||
}
|
||||
|
||||
public void on_emit_trans_finished (bool error) {
|
||||
while (Gtk.events_pending ())
|
||||
Gtk.main_iteration ();
|
||||
set_updates_list.begin ((obj, res) => {
|
||||
set_updates_list.end (res);
|
||||
this.get_window ().set_cursor (null);
|
||||
});
|
||||
set_updates_list.begin ();
|
||||
}
|
||||
|
||||
public async void set_updates_list () {
|
||||
@ -132,6 +125,10 @@ namespace Pamac {
|
||||
string size;
|
||||
uint64 dsize = 0;
|
||||
uint updates_nb = 0;
|
||||
this.get_window ().set_cursor (new Gdk.Cursor (Gdk.CursorType.WATCH));
|
||||
while (Gtk.events_pending ())
|
||||
Gtk.main_iteration ();
|
||||
top_label.set_markup ("");
|
||||
updates_list.clear ();
|
||||
// get syncfirst updates
|
||||
UpdatesInfos[] syncfirst_updates = get_syncfirst_updates (transaction.handle, transaction.syncfirst);
|
||||
@ -147,6 +144,8 @@ namespace Pamac {
|
||||
updates_list.insert_with_values (out iter, -1, 0, name, 1, size);
|
||||
}
|
||||
} else {
|
||||
while (Gtk.events_pending ())
|
||||
Gtk.main_iteration ();
|
||||
UpdatesInfos[] updates = get_repos_updates (transaction.handle, transaction.ignorepkg);
|
||||
foreach (UpdatesInfos infos in updates) {
|
||||
name = infos.name + " " + infos.version;
|
||||
@ -187,6 +186,10 @@ namespace Pamac {
|
||||
bottom_label.set_visible (true);
|
||||
} else
|
||||
bottom_label.set_visible (false);
|
||||
|
||||
this.get_window ().set_cursor (null);
|
||||
while (Gtk.events_pending ())
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace Alpm {
|
||||
public unowned Package? find_satisfier(Alpm.List<Package> pkgs, string depstring);
|
||||
public unowned Package? pkg_find(Alpm.List<Package> haystack, string needle);
|
||||
public int pkg_vercmp(string a, string b);
|
||||
public unowned Alpm.List<Package?> find_group_pkgs(Alpm.List<DB> dbs, string name);
|
||||
public unowned Alpm.List<unowned Package?> find_group_pkgs(Alpm.List<DB> dbs, string name);
|
||||
public unowned Package? sync_newversion(Package pkg, Alpm.List<DB> dbs);
|
||||
/** Returns the string corresponding to an error number. */
|
||||
public unowned string strerror(Errno err);
|
||||
@ -247,7 +247,7 @@ namespace Alpm {
|
||||
[CCode (cname = "alpm_get_localdb")] get;
|
||||
}
|
||||
|
||||
public unowned Alpm.List<DB?> syncdbs {
|
||||
public unowned Alpm.List<unowned DB?> syncdbs {
|
||||
[CCode (cname = "alpm_get_syncdbs")] get;
|
||||
}
|
||||
|
||||
@ -281,11 +281,11 @@ namespace Alpm {
|
||||
|
||||
/** Returns a list of packages added by the transaction.*/
|
||||
[CCode (cname = "alpm_trans_get_add")]
|
||||
public unowned Alpm.List<Package?> trans_to_add();
|
||||
public unowned Alpm.List<unowned Package?> trans_to_add();
|
||||
|
||||
/** Returns the list of packages removed by the transaction.*/
|
||||
[CCode (cname = "alpm_trans_get_remove")]
|
||||
public unowned Alpm.List<Package?> trans_to_remove();
|
||||
public unowned Alpm.List<unowned Package?> trans_to_remove();
|
||||
|
||||
public LogCallBack logcb {
|
||||
[CCode (cname = "alpm_option_get_logcb")] get;
|
||||
@ -406,11 +406,11 @@ namespace Alpm {
|
||||
[CCode (cname = "alpm_db_set_servers")] set;
|
||||
}
|
||||
|
||||
public unowned Alpm.List<Package?> pkgcache {
|
||||
public unowned Alpm.List<unowned Package?> pkgcache {
|
||||
[CCode (cname = "alpm_db_get_pkgcache")] get;
|
||||
}
|
||||
|
||||
public unowned Alpm.List<Group?> groupcache {
|
||||
public unowned Alpm.List<unowned Group?> groupcache {
|
||||
[CCode (cname = "alpm_db_get_groupcache")] get;
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ namespace Alpm {
|
||||
|
||||
public unowned Package? get_pkg(string name);
|
||||
public unowned Group? get_group(string name);
|
||||
public unowned Alpm.List<Package?> search(Alpm.List<string> needles);
|
||||
public unowned Alpm.List<unowned Package?> search(Alpm.List<string> needles);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -505,25 +505,25 @@ namespace Alpm {
|
||||
public unowned Alpm.List<unowned string?> groups {
|
||||
[CCode (cname = "alpm_pkg_get_groups")] get;
|
||||
}
|
||||
public unowned Alpm.List<Depend?> depends {
|
||||
public unowned Alpm.List<unowned Depend?> depends {
|
||||
[CCode (cname = "alpm_pkg_get_depends")] get;
|
||||
}
|
||||
public unowned Alpm.List<Depend?> optdepends {
|
||||
public unowned Alpm.List<unowned Depend?> optdepends {
|
||||
[CCode (cname = "alpm_pkg_get_optdepends")] get;
|
||||
}
|
||||
public unowned Alpm.List<Depend?> conflicts {
|
||||
public unowned Alpm.List<unowned Depend?> conflicts {
|
||||
[CCode (cname = "alpm_pkg_get_conflicts")] get;
|
||||
}
|
||||
public unowned Alpm.List<Depend?> provides {
|
||||
public unowned Alpm.List<unowned Depend?> provides {
|
||||
[CCode (cname = "alpm_pkg_get_provides")] get;
|
||||
}
|
||||
public unowned Alpm.List<Depend?> replaces {
|
||||
public unowned Alpm.List<unowned Depend?> replaces {
|
||||
[CCode (cname = "alpm_pkg_get_replaces")] get;
|
||||
}
|
||||
public unowned Alpm.List<File?> files {
|
||||
public unowned Alpm.List<unowned File?> files {
|
||||
[CCode (cname = "alpm_pkg_get_files_list")] get;
|
||||
}
|
||||
public unowned Alpm.List<Backup?> backup {
|
||||
public unowned Alpm.List<unowned Backup?> backup {
|
||||
[CCode (cname = "alpm_pkg_get_backup")] get;
|
||||
}
|
||||
public unowned DB? db {
|
||||
@ -579,7 +579,7 @@ namespace Alpm {
|
||||
[CCode (cname = "alpm_group_t", has_type_id = false)]
|
||||
public class Group {
|
||||
public string name;
|
||||
public unowned Alpm.List<Package?> packages;
|
||||
public unowned Alpm.List<unowned Package?> packages;
|
||||
}
|
||||
|
||||
/** Package upgrade delta */
|
||||
@ -988,7 +988,8 @@ namespace Alpm {
|
||||
[CCode (cname = "alpm_list_remove_data"), ReturnsModifiedPointer ()]
|
||||
public unowned void? remove(G data, CompareFunc fn);
|
||||
|
||||
public List<G> copy();
|
||||
public unowned List<G> copy();
|
||||
public List<G> copy_data();
|
||||
|
||||
[ReturnsModifiedPointer ()]
|
||||
public unowned void reverse ();
|
||||
|
Loading…
Reference in New Issue
Block a user