forked from cromer/pamac-classic
add clean cache feature in preferences (as paccache frontend)
This commit is contained in:
parent
eb57d65876
commit
412d1f9a02
@ -13,7 +13,6 @@
|
|||||||
../resources/progress_dialog.ui
|
../resources/progress_dialog.ui
|
||||||
../resources/history_dialog.ui
|
../resources/history_dialog.ui
|
||||||
../resources/transaction_sum_dialog.ui
|
../resources/transaction_sum_dialog.ui
|
||||||
../resources/choose_dep_dialog.ui
|
|
||||||
../resources/manager_window.ui
|
../resources/manager_window.ui
|
||||||
../resources/updater_window.ui
|
../resources/updater_window.ui
|
||||||
../resources/preferences_dialog.ui
|
../resources/preferences_dialog.ui
|
||||||
|
41
po/pamac.pot
41
po/pamac.pot
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Pamac\n"
|
"Project-Id-Version: Pamac\n"
|
||||||
"Report-Msgid-Bugs-To: guillaume@manjaro.org\n"
|
"Report-Msgid-Bugs-To: guillaume@manjaro.org\n"
|
||||||
"POT-Creation-Date: 2015-08-20 11:53+0200\n"
|
"POT-Creation-Date: 2016-04-24 08:44+0200\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -25,6 +25,10 @@ msgstr ""
|
|||||||
msgid "Failed to initialize alpm library"
|
msgid "Failed to initialize alpm library"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../src/daemon.vala ../src/transaction.vala
|
||||||
|
msgid "Authentication failed"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: ../src/daemon.vala
|
#: ../src/daemon.vala
|
||||||
msgid "Failed to synchronize any databases"
|
msgid "Failed to synchronize any databases"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -101,10 +105,6 @@ msgstr ""
|
|||||||
msgid "%s is invalid or corrupted"
|
msgid "%s is invalid or corrupted"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../src/daemon.vala ../src/transaction.vala
|
|
||||||
msgid "Authentication failed"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../src/daemon.vala
|
#: ../src/daemon.vala
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%s appears to be truncated: %jd/%jd bytes\n"
|
msgid "%s appears to be truncated: %jd/%jd bytes\n"
|
||||||
@ -325,7 +325,7 @@ msgstr ""
|
|||||||
msgid "Warning"
|
msgid "Warning"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../src/transaction.vala
|
#: ../src/transaction.vala ../resources/progress_dialog.ui
|
||||||
msgid "_Close"
|
msgid "_Close"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -518,8 +518,7 @@ msgstr ""
|
|||||||
msgid "Install Local Packages"
|
msgid "Install Local Packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../src/manager_window.vala ../resources/progress_dialog.ui
|
#: ../src/manager_window.vala ../resources/transaction_sum_dialog.ui
|
||||||
#: ../resources/transaction_sum_dialog.ui ../resources/choose_dep_dialog.ui
|
|
||||||
#: ../resources/manager_window.ui ../resources/updater_window.ui
|
#: ../resources/manager_window.ui ../resources/updater_window.ui
|
||||||
#: ../resources/choose_ignorepkgs_dialog.ui
|
#: ../resources/choose_ignorepkgs_dialog.ui
|
||||||
msgid "_Cancel"
|
msgid "_Cancel"
|
||||||
@ -553,7 +552,7 @@ msgstr ""
|
|||||||
msgid "Choose a Provider"
|
msgid "Choose a Provider"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../resources/choose_provider_dialog.ui ../resources/choose_dep_dialog.ui
|
#: ../resources/choose_provider_dialog.ui
|
||||||
#: ../resources/choose_ignorepkgs_dialog.ui
|
#: ../resources/choose_ignorepkgs_dialog.ui
|
||||||
msgid "Choose"
|
msgid "Choose"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -562,10 +561,6 @@ msgstr ""
|
|||||||
msgid "Progress"
|
msgid "Progress"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../resources/progress_dialog.ui
|
|
||||||
msgid "_Hide"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../resources/history_dialog.ui
|
#: ../resources/history_dialog.ui
|
||||||
msgid "Pamac History"
|
msgid "Pamac History"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -578,10 +573,6 @@ msgstr ""
|
|||||||
msgid "Commit"
|
msgid "Commit"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../resources/choose_dep_dialog.ui
|
|
||||||
msgid "Choose Optional Dependencies"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../resources/manager_window.ui ../resources/updater_window.ui
|
#: ../resources/manager_window.ui ../resources/updater_window.ui
|
||||||
msgid "Refresh databases"
|
msgid "Refresh databases"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -724,6 +715,22 @@ msgstr ""
|
|||||||
msgid "Do not ask for confirmation when building packages"
|
msgid "Do not ask for confirmation when building packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../resources/preferences_dialog.ui
|
||||||
|
msgid "Number of each package to keep in the cache:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../resources/preferences_dialog.ui
|
||||||
|
msgid "Only remove uninstalled packages"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../resources/preferences_dialog.ui
|
||||||
|
msgid "Clean cache"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../resources/preferences_dialog.ui
|
||||||
|
msgid "Cache"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: ../resources/choose_ignorepkgs_dialog.ui
|
#: ../resources/choose_ignorepkgs_dialog.ui
|
||||||
msgid "Choose Ignored Upgrades"
|
msgid "Choose Ignored Upgrades"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -2,7 +2,13 @@
|
|||||||
<!-- Generated with glade 3.20.0 -->
|
<!-- Generated with glade 3.20.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.14"/>
|
<requires lib="gtk+" version="3.14"/>
|
||||||
<object class="GtkAdjustment" id="adjustment">
|
<object class="GtkAdjustment" id="cache_keep_nb_adjustment">
|
||||||
|
<property name="upper">10</property>
|
||||||
|
<property name="value">3</property>
|
||||||
|
<property name="step_increment">1</property>
|
||||||
|
<property name="page_increment">10</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkAdjustment" id="refresh_period_adjustment">
|
||||||
<property name="lower">1</property>
|
<property name="lower">1</property>
|
||||||
<property name="upper">1000</property>
|
<property name="upper">1000</property>
|
||||||
<property name="value">6</property>
|
<property name="value">6</property>
|
||||||
@ -204,7 +210,7 @@
|
|||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="caps_lock_warning">False</property>
|
<property name="caps_lock_warning">False</property>
|
||||||
<property name="input_purpose">number</property>
|
<property name="input_purpose">number</property>
|
||||||
<property name="adjustment">adjustment</property>
|
<property name="adjustment">refresh_period_adjustment</property>
|
||||||
<property name="numeric">True</property>
|
<property name="numeric">True</property>
|
||||||
<property name="update_policy">if-valid</property>
|
<property name="update_policy">if-valid</property>
|
||||||
<property name="value">6</property>
|
<property name="value">6</property>
|
||||||
@ -657,6 +663,103 @@ All AUR users should be familiar with the build process.</property>
|
|||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="cache_config_box">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">6</property>
|
||||||
|
<property name="margin_right">6</property>
|
||||||
|
<property name="margin_start">6</property>
|
||||||
|
<property name="margin_end">6</property>
|
||||||
|
<property name="margin_top">6</property>
|
||||||
|
<property name="margin_bottom">6</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">6</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="spacing">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="cache_keep_nb_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="label" translatable="yes">Number of each package to keep in the cache:</property>
|
||||||
|
<property name="wrap">True</property>
|
||||||
|
<property name="max_width_chars">300</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSpinButton" id="cache_keep_nb_spin_button">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="tooltip_text" translatable="yes">How often to check for updates, value in hours</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="caps_lock_warning">False</property>
|
||||||
|
<property name="input_purpose">number</property>
|
||||||
|
<property name="adjustment">cache_keep_nb_adjustment</property>
|
||||||
|
<property name="numeric">True</property>
|
||||||
|
<property name="update_policy">if-valid</property>
|
||||||
|
<property name="value">3</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="cache_only_uninstalled_checkbutton">
|
||||||
|
<property name="label" translatable="yes">Only remove uninstalled packages</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="margin_start">22</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="cache_clean_button">
|
||||||
|
<property name="label" translatable="yes">Clean cache</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="margin_top">12</property>
|
||||||
|
<signal name="clicked" handler="on_cache_clean_button_clicked" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="name">cache</property>
|
||||||
|
<property name="title" translatable="yes">Cache</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
@ -281,12 +281,50 @@ namespace Pamac {
|
|||||||
generate_mirrors_list_finished ();
|
generate_mirrors_list_finished ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start_generate_mirrors_list () {
|
public void start_generate_mirrors_list (GLib.BusName sender) {
|
||||||
|
check_authorization.begin (sender, (obj, res) => {
|
||||||
|
bool authorized = check_authorization.end (res);
|
||||||
|
if (authorized) {
|
||||||
try {
|
try {
|
||||||
thread_pool.add (new AlpmAction (generate_mirrors_list));
|
thread_pool.add (new AlpmAction (generate_mirrors_list));
|
||||||
} catch (ThreadError e) {
|
} catch (ThreadError e) {
|
||||||
stderr.printf ("Thread Error %s\n", e.message);
|
stderr.printf ("Thread Error %s\n", e.message);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
current_error = ErrorInfos () {
|
||||||
|
message = _("Authentication failed")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clean_cache (uint keep_nb, bool only_uninstalled, GLib.BusName sender) {
|
||||||
|
check_authorization.begin (sender, (obj, res) => {
|
||||||
|
bool authorized = check_authorization.end (res);
|
||||||
|
if (authorized) {
|
||||||
|
string[] commands = {"paccache", "-rq"};
|
||||||
|
commands += "-k%u".printf (keep_nb);
|
||||||
|
if (only_uninstalled) {
|
||||||
|
commands += "-u";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
var process = new Subprocess.newv (
|
||||||
|
commands,
|
||||||
|
SubprocessFlags.STDOUT_PIPE | SubprocessFlags.STDERR_MERGE);
|
||||||
|
var dis = new DataInputStream (process.get_stdout_pipe ());
|
||||||
|
string? line;
|
||||||
|
while ((line = dis.read_line ()) != null) {
|
||||||
|
print ("%s\n",line);
|
||||||
|
}
|
||||||
|
} catch (Error e) {
|
||||||
|
stderr.printf ("Error: %s\n", e.message);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
current_error = ErrorInfos () {
|
||||||
|
message = _("Authentication failed")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start_write_mirrors_config (HashTable<string,Variant> new_mirrors_conf, GLib.BusName sender) {
|
public void start_write_mirrors_config (HashTable<string,Variant> new_mirrors_conf, GLib.BusName sender) {
|
||||||
|
@ -56,6 +56,10 @@ namespace Pamac {
|
|||||||
Gtk.CheckButton check_aur_updates_checkbutton;
|
Gtk.CheckButton check_aur_updates_checkbutton;
|
||||||
[GtkChild]
|
[GtkChild]
|
||||||
Gtk.CheckButton no_confirm_build_checkbutton;
|
Gtk.CheckButton no_confirm_build_checkbutton;
|
||||||
|
[GtkChild]
|
||||||
|
Gtk.SpinButton cache_keep_nb_spin_button;
|
||||||
|
[GtkChild]
|
||||||
|
Gtk.CheckButton cache_only_uninstalled_checkbutton;
|
||||||
|
|
||||||
Gtk.ListStore ignorepkgs_liststore;
|
Gtk.ListStore ignorepkgs_liststore;
|
||||||
Transaction transaction;
|
Transaction transaction;
|
||||||
@ -368,5 +372,11 @@ namespace Pamac {
|
|||||||
transaction.start_generate_mirrors_list ();
|
transaction.start_generate_mirrors_list ();
|
||||||
generate_mirrors_list_button.get_style_context ().remove_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
|
generate_mirrors_list_button.get_style_context ().remove_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[GtkCallback]
|
||||||
|
void on_cache_clean_button_clicked () {
|
||||||
|
transaction.clean_cache ((uint) cache_keep_nb_spin_button.get_value_as_int (),
|
||||||
|
cache_only_uninstalled_checkbutton.active);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ namespace Pamac {
|
|||||||
public abstract void start_write_alpm_config (HashTable<string,Variant> new_alpm_conf) throws IOError;
|
public abstract void start_write_alpm_config (HashTable<string,Variant> new_alpm_conf) throws IOError;
|
||||||
public abstract void start_write_mirrors_config (HashTable<string,Variant> new_mirrors_conf) throws IOError;
|
public abstract void start_write_mirrors_config (HashTable<string,Variant> new_mirrors_conf) throws IOError;
|
||||||
public abstract void start_generate_mirrors_list () throws IOError;
|
public abstract void start_generate_mirrors_list () throws IOError;
|
||||||
|
public abstract void clean_cache (uint keep_nb, bool only_uninstalled) throws IOError;
|
||||||
public abstract void start_set_pkgreason (string pkgname, uint reason) throws IOError;
|
public abstract void start_set_pkgreason (string pkgname, uint reason) throws IOError;
|
||||||
public abstract AlpmPackage get_installed_pkg (string pkgname) throws IOError;
|
public abstract AlpmPackage get_installed_pkg (string pkgname) throws IOError;
|
||||||
public abstract void start_refresh (bool force) throws IOError;
|
public abstract void start_refresh (bool force) throws IOError;
|
||||||
@ -351,6 +352,14 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clean_cache (uint keep_nb, bool only_uninstalled) {
|
||||||
|
try {
|
||||||
|
daemon.clean_cache (keep_nb, only_uninstalled);
|
||||||
|
} catch (IOError e) {
|
||||||
|
stderr.printf ("IOError: %s\n", e.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void start_set_pkgreason (string pkgname, uint reason) {
|
public void start_set_pkgreason (string pkgname, uint reason) {
|
||||||
try {
|
try {
|
||||||
daemon.start_set_pkgreason (pkgname, reason);
|
daemon.start_set_pkgreason (pkgname, reason);
|
||||||
|
Loading…
Reference in New Issue
Block a user