possibility to ignore some updates in pamac-updater, do not close progress window when yaourt failed and other improvements
This commit is contained in:
parent
65e5756807
commit
22af5edc77
@ -2,7 +2,6 @@
|
||||
MANAGER_GRESOURCE_FILE = pamac.manager.gresource.xml
|
||||
|
||||
MANAGER_RESOURCES_FILES = manager_window.ui \
|
||||
packages_chooser_dialog.ui \
|
||||
choose_dep_dialog.ui \
|
||||
history_dialog.ui \
|
||||
preferences_dialog.ui \
|
||||
|
@ -52,7 +52,6 @@
|
||||
<property name="pixels_below_lines">2</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="cursor_visible">False</property>
|
||||
<signal name="size-allocate" handler="on_textview_size_allocate" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -1,65 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<template class="PamacPackagesChooserDialog" parent="GtkFileChooserDialog">
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes">Install local packages</property>
|
||||
<property name="role">GtkFileChooserDialog</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="default_width">900</property>
|
||||
<property name="icon_name">system-software-install</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="create_folders">False</property>
|
||||
<property name="local_only">False</property>
|
||||
<property name="select_multiple">True</property>
|
||||
<signal name="file-activated" handler="on_file_activated" swapped="no"/>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="filechooserdialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="filechooserdialog-action_area1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="package_cancel_button">
|
||||
<property name="label" translatable="yes">_Cancel</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="package_open_button">
|
||||
<property name="label" translatable="yes">_Open</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-6">package_cancel_button</action-widget>
|
||||
<action-widget response="-3">package_open_button</action-widget>
|
||||
</action-widgets>
|
||||
</template>
|
||||
</interface>
|
@ -3,7 +3,6 @@
|
||||
<gresource prefix="/org/manjaro/pamac/manager">
|
||||
<file preprocess="xml-stripblanks">manager_window.ui</file>
|
||||
<file preprocess="xml-stripblanks">history_dialog.ui</file>
|
||||
<file preprocess="xml-stripblanks">packages_chooser_dialog.ui</file>
|
||||
<file preprocess="xml-stripblanks">choose_dep_dialog.ui</file>
|
||||
<file preprocess="to-pixdata">package-available.png</file>
|
||||
<file preprocess="to-pixdata">package-install.png</file>
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<template class="PamacUpdaterWindow" parent="GtkApplicationWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Update Manager</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes">Update Manager</property>
|
||||
<property name="window_position">center</property>
|
||||
<property name="default_width">500</property>
|
||||
<property name="icon_name">system-software-update</property>
|
||||
<property name="show_menubar">True</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
@ -25,6 +26,7 @@
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -48,16 +50,28 @@
|
||||
<property name="mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
|
||||
<child>
|
||||
<object class="GtkCellRendererToggle" id="select_update">
|
||||
<signal name="toggled" handler="on_select_update_toggled" swapped="no"/>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="active">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
|
||||
<property name="expand">True</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="_name">
|
||||
<object class="GtkCellRendererText" id="update_name">
|
||||
<property name="width">200</property>
|
||||
<property name="height">22</property>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
@ -65,12 +79,12 @@
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="_size">
|
||||
<object class="GtkCellRendererText" id="download_size">
|
||||
<property name="width">80</property>
|
||||
<property name="height">22</property>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="text">1</attribute>
|
||||
<attribute name="text">2</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
@ -81,6 +95,7 @@
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -91,6 +106,7 @@
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -108,18 +124,21 @@
|
||||
<property name="label" translatable="yes">_Preferences</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="clicked" handler="on_preferences_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -133,12 +152,14 @@
|
||||
<property name="label" translatable="yes">_Refresh</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="clicked" handler="on_refresh_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -147,12 +168,14 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="clicked" handler="on_apply_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -160,12 +183,14 @@
|
||||
<property name="label" translatable="yes">_Close</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
@ -173,12 +198,14 @@
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -74,7 +74,7 @@ pamac-daemon: ../vapi/libalpm.vapi ../vapi/polkit-gobject-1.vapi $(COMMON_SOURCE
|
||||
alpm_utils.vala \
|
||||
daemon.vala
|
||||
|
||||
pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(TRANSACTION_SOURCES) choose_dep_dialog.vala history_dialog.vala packages_chooser_dialog.vala ../resources/manager_resources.c packages_model.vala manager_window.vala manager.vala
|
||||
pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(TRANSACTION_SOURCES) choose_dep_dialog.vala history_dialog.vala ../resources/manager_resources.c packages_model.vala manager_window.vala manager.vala
|
||||
valac -o pamac-manager \
|
||||
$(COMMON_VALA_FLAGS) \
|
||||
$(TRANSACTION_VALA_FLAGS) \
|
||||
@ -83,7 +83,6 @@ pamac-manager: ../vapi/libalpm.vapi $(COMMON_SOURCES) $(TRANSACTION_SOURCES) cho
|
||||
$(TRANSACTION_SOURCES) \
|
||||
choose_dep_dialog.vala \
|
||||
history_dialog.vala \
|
||||
packages_chooser_dialog.vala \
|
||||
../resources/manager_resources.c \
|
||||
packages_model.vala \
|
||||
manager_window.vala \
|
||||
|
@ -95,7 +95,6 @@ namespace Alpm {
|
||||
repo_order = {};
|
||||
// parse conf file
|
||||
parse_file (conf_path);
|
||||
get_handle ();
|
||||
}
|
||||
|
||||
public void get_handle () {
|
||||
|
@ -114,6 +114,9 @@ namespace AUR {
|
||||
|
||||
public Json.Array multiinfo (string[] pkgnames) {
|
||||
Json.Array results = new Json.Array ();
|
||||
if (pkgnames.length == 0) {
|
||||
return results;
|
||||
}
|
||||
var builder = new StringBuilder ();
|
||||
builder.append (rpc_url);
|
||||
builder.append (rpc_multiinfo);
|
||||
|
@ -46,8 +46,7 @@ namespace Pamac {
|
||||
if (deps_list.get_iter_from_string (out iter, path)) {;
|
||||
deps_list.get_value (iter, 0, out val);
|
||||
selected = val.get_boolean ();
|
||||
selected = (!selected);
|
||||
deps_list.set_value (iter, 0, selected);
|
||||
deps_list.set_value (iter, 0, !selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
134
src/daemon.vala
134
src/daemon.vala
@ -106,7 +106,7 @@ namespace Pamac {
|
||||
public void start_write_pamac_config (HashTable<string,Variant> new_pamac_conf, GLib.BusName sender) {
|
||||
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||
try {
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync (null);
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync ();
|
||||
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
|
||||
authority.check_authorization.begin (
|
||||
subject,
|
||||
@ -120,21 +120,23 @@ namespace Pamac {
|
||||
if (result.get_is_authorized ()) {
|
||||
pamac_config.write (new_pamac_conf);
|
||||
pamac_config.reload ();
|
||||
write_pamac_config_finished (pamac_config.refresh_period, pamac_config.enable_aur, pamac_config.recurse);
|
||||
}
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
} finally {
|
||||
write_pamac_config_finished (pamac_config.refresh_period, pamac_config.enable_aur, pamac_config.recurse);
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (GLib.Error e) {
|
||||
write_pamac_config_finished (pamac_config.refresh_period, pamac_config.enable_aur, pamac_config.recurse);
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public void start_write_alpm_config (HashTable<string,Variant> new_alpm_conf, GLib.BusName sender) {
|
||||
try {
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync (null);
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync ();
|
||||
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
|
||||
authority.check_authorization.begin (
|
||||
subject,
|
||||
@ -148,14 +150,17 @@ namespace Pamac {
|
||||
if (result.get_is_authorized ()) {
|
||||
alpm_config.write (new_alpm_conf);
|
||||
alpm_config.reload ();
|
||||
write_alpm_config_finished ();
|
||||
refresh_handle ();
|
||||
}
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
} finally {
|
||||
write_alpm_config_finished ();
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (GLib.Error e) {
|
||||
write_alpm_config_finished ();
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
}
|
||||
@ -193,32 +198,33 @@ namespace Pamac {
|
||||
null,
|
||||
out standard_output,
|
||||
out standard_error);
|
||||
// stdout
|
||||
IOChannel output = new IOChannel.unix_new (standard_output);
|
||||
output.add_watch (IOCondition.IN | IOCondition.HUP, (channel, condition) => {
|
||||
return process_line (channel, condition, "stdout");
|
||||
});
|
||||
// stderr
|
||||
IOChannel error = new IOChannel.unix_new (standard_error);
|
||||
error.add_watch (IOCondition.IN | IOCondition.HUP, (channel, condition) => {
|
||||
return process_line (channel, condition, "stderr");
|
||||
});
|
||||
ChildWatch.add (child_pid, (pid, status) => {
|
||||
// Triggered when the child indicated by child_pid exits
|
||||
Process.close_pid (pid);
|
||||
alpm_config.reload ();
|
||||
refresh_handle ();
|
||||
generate_mirrorlist_finished ();
|
||||
});
|
||||
} catch (SpawnError e) {
|
||||
generate_mirrorlist_finished ();
|
||||
stdout.printf ("SpawnError: %s\n", e.message);
|
||||
}
|
||||
// stdout:
|
||||
IOChannel output = new IOChannel.unix_new (standard_output);
|
||||
output.add_watch (IOCondition.IN | IOCondition.HUP, (channel, condition) => {
|
||||
return process_line (channel, condition, "stdout");
|
||||
});
|
||||
// stderr:
|
||||
IOChannel error = new IOChannel.unix_new (standard_error);
|
||||
error.add_watch (IOCondition.IN | IOCondition.HUP, (channel, condition) => {
|
||||
return process_line (channel, condition, "stderr");
|
||||
});
|
||||
ChildWatch.add (child_pid, (pid, status) => {
|
||||
// Triggered when the child indicated by child_pid exits
|
||||
Process.close_pid (pid);
|
||||
alpm_config.reload ();
|
||||
refresh_handle ();
|
||||
generate_mirrorlist_finished ();
|
||||
});
|
||||
}
|
||||
|
||||
public void start_write_mirrors_config (HashTable<string,Variant> new_mirrors_conf, GLib.BusName sender) {
|
||||
var mirrors_config = new Alpm.MirrorsConfig ("/etc/pacman-mirrors.conf");
|
||||
try {
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync (null);
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync ();
|
||||
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
|
||||
authority.check_authorization.begin (
|
||||
subject,
|
||||
@ -231,22 +237,24 @@ namespace Pamac {
|
||||
var result = authority.check_authorization.end (res);
|
||||
if (result.get_is_authorized ()) {
|
||||
mirrors_config.write (new_mirrors_conf);
|
||||
write_mirrors_config_finished ();
|
||||
generate_mirrorlist ();
|
||||
}
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
} finally {
|
||||
write_mirrors_config_finished ();
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (GLib.Error e) {
|
||||
write_mirrors_config_finished ();
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public void start_set_pkgreason (string pkgname, uint reason, GLib.BusName sender) {
|
||||
try {
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync (null);
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync ();
|
||||
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
|
||||
authority.check_authorization.begin (
|
||||
subject,
|
||||
@ -262,15 +270,17 @@ namespace Pamac {
|
||||
if (pkg != null) {
|
||||
pkg.reason = (Alpm.Package.Reason) reason;
|
||||
refresh_handle ();
|
||||
set_pkgreason_finished ();
|
||||
}
|
||||
}
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
} finally {
|
||||
set_pkgreason_finished ();
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (GLib.Error e) {
|
||||
set_pkgreason_finished ();
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
}
|
||||
@ -298,25 +308,23 @@ namespace Pamac {
|
||||
err.details = details;
|
||||
}
|
||||
databases_lock_mutex.unlock ();
|
||||
Idle.add((owned) callback);
|
||||
Idle.add ((owned) callback);
|
||||
return success;
|
||||
});
|
||||
yield;
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
yield;
|
||||
return err;
|
||||
}
|
||||
|
||||
public void start_refresh (int force, bool emit_finish_signal) {
|
||||
public void start_refresh (int force) {
|
||||
intern_lock = true;
|
||||
refresh.begin (force, (obj, res) => {
|
||||
var err = refresh.end (res);
|
||||
intern_lock = false;
|
||||
refresh_handle ();
|
||||
if (emit_finish_signal) {
|
||||
refresh_finished (err);
|
||||
}
|
||||
refresh_finished (err);
|
||||
});
|
||||
}
|
||||
|
||||
@ -335,6 +343,14 @@ namespace Pamac {
|
||||
return alpm_config.ignorepkg;
|
||||
}
|
||||
|
||||
public void add_ignorepkg (string pkgname) {
|
||||
alpm_config.handle.add_ignorepkg (pkgname);
|
||||
}
|
||||
|
||||
public void remove_ignorepkg (string pkgname) {
|
||||
alpm_config.handle.remove_ignorepkg (pkgname);
|
||||
}
|
||||
|
||||
public bool should_hold (string pkgname) {
|
||||
if (alpm_config.holdpkgs.find_custom (pkgname, strcmp) != null) {
|
||||
return true;
|
||||
@ -634,10 +650,10 @@ namespace Pamac {
|
||||
return updates;
|
||||
} else {
|
||||
string[] local_pkgs = {};
|
||||
foreach (var local_pkg in alpm_config.handle.localdb.pkgcache) {
|
||||
// continue only if the local pkg is not in IgnorePkg or IgnoreGroup
|
||||
if (alpm_config.handle.should_ignore (local_pkg) == 0) {
|
||||
candidate = local_pkg.sync_newversion (alpm_config.handle.syncdbs);
|
||||
foreach (var installed_pkg in alpm_config.handle.localdb.pkgcache) {
|
||||
// check if installed_pkg is in IgnorePkg or IgnoreGroup
|
||||
if (alpm_config.handle.should_ignore (installed_pkg) == 0) {
|
||||
candidate = installed_pkg.sync_newversion (alpm_config.handle.syncdbs);
|
||||
if (candidate != null) {
|
||||
infos.name = candidate.name;
|
||||
infos.version = candidate.version;
|
||||
@ -647,15 +663,15 @@ namespace Pamac {
|
||||
updates_infos += infos;
|
||||
} else {
|
||||
if (enable_aur) {
|
||||
// check if it is a local pkg
|
||||
// check if installed_pkg is a local pkg
|
||||
foreach (var db in alpm_config.handle.syncdbs) {
|
||||
pkg = Alpm.find_satisfier (db.pkgcache, local_pkg.name);
|
||||
pkg = Alpm.find_satisfier (db.pkgcache, installed_pkg.name);
|
||||
if (pkg != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pkg == null) {
|
||||
local_pkgs += local_pkg.name;
|
||||
local_pkgs += installed_pkg.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -911,13 +927,13 @@ namespace Pamac {
|
||||
}
|
||||
}
|
||||
databases_lock_mutex.unlock ();
|
||||
Idle.add((owned) callback);
|
||||
Idle.add ((owned) callback);
|
||||
return ret;
|
||||
});
|
||||
yield;
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
yield;
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -972,7 +988,7 @@ namespace Pamac {
|
||||
SourceFunc callback = trans_commit.callback;
|
||||
var err = ErrorInfos ();
|
||||
try {
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync (null);
|
||||
Polkit.Authority authority = Polkit.Authority.get_sync ();
|
||||
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
|
||||
authority.check_authorization.begin (
|
||||
subject,
|
||||
@ -1034,22 +1050,24 @@ namespace Pamac {
|
||||
}
|
||||
trans_release ();
|
||||
databases_lock_mutex.unlock ();
|
||||
Idle.add((owned) callback);
|
||||
Idle.add ((owned) callback);
|
||||
return ret;
|
||||
});
|
||||
} else {
|
||||
err.message = _("Authentication failed");
|
||||
trans_release ();
|
||||
Idle.add ((owned) callback);
|
||||
}
|
||||
} catch (GLib.Error e) {
|
||||
Idle.add ((owned) callback);
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
yield;
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
yield;
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1067,6 +1085,10 @@ namespace Pamac {
|
||||
}
|
||||
|
||||
public void trans_cancel () {
|
||||
if (alpm_config.handle.trans_interrupt () == 0) {
|
||||
// a transaction is being interrupted
|
||||
return;
|
||||
}
|
||||
// explicitly quit to avoid a crash
|
||||
// this daemon should be auto-restarted
|
||||
quit ();
|
||||
@ -1074,11 +1096,19 @@ namespace Pamac {
|
||||
|
||||
[DBus (no_reply = true)]
|
||||
public void quit () {
|
||||
// be sure to not quit with locked databases
|
||||
alpm_config.handle.trans_interrupt ();
|
||||
alpm_config.handle.trans_release ();
|
||||
if (lockfile.query_exists () == false) {
|
||||
loop.quit ();
|
||||
try {
|
||||
new Thread<int>.try ("quit thread", () => {
|
||||
databases_lock_mutex.lock ();
|
||||
// be sure to not quit with locked databases
|
||||
alpm_config.handle.trans_release ();
|
||||
if (lockfile.query_exists () == false) {
|
||||
loop.quit ();
|
||||
}
|
||||
databases_lock_mutex.unlock ();
|
||||
return 0;
|
||||
});
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
}
|
||||
// End of Daemon Object
|
||||
@ -1280,6 +1310,7 @@ void on_bus_acquired (DBusConnection conn) {
|
||||
}
|
||||
catch (IOError e) {
|
||||
stderr.printf ("Could not register service\n");
|
||||
loop.quit ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1290,8 +1321,11 @@ void main () {
|
||||
|
||||
Bus.own_name (BusType.SYSTEM, "org.manjaro.pamac", BusNameOwnerFlags.NONE,
|
||||
on_bus_acquired,
|
||||
() => {},
|
||||
() => stderr.printf ("Could not acquire name\n"));
|
||||
null,
|
||||
() => {
|
||||
stderr.printf ("Could not acquire name\n");
|
||||
loop.quit ();
|
||||
});
|
||||
|
||||
loop = new MainLoop ();
|
||||
loop.run ();
|
||||
|
@ -28,13 +28,5 @@ namespace Pamac {
|
||||
public HistoryDialog (ManagerWindow window) {
|
||||
Object (transient_for: window, use_header_bar: 0);
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
public void on_textview_size_allocate () {
|
||||
// auto-scrolling method
|
||||
var scrollable = textview as Gtk.Scrollable;
|
||||
var adj = scrollable.get_vadjustment ();
|
||||
adj.set_value (adj.get_upper () - adj.get_page_size ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace Pamac {
|
||||
if (pamac_run == false) {
|
||||
foreach (File file in files) {
|
||||
string? path = file.get_path ();
|
||||
transaction.to_load.insert (path, path);
|
||||
transaction.to_load.add ((owned) path);
|
||||
}
|
||||
transaction.run ();
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
using Gtk;
|
||||
using Alpm;
|
||||
|
||||
const string VERSION = "2.2.2";
|
||||
const string VERSION = "2.3";
|
||||
|
||||
namespace Pamac {
|
||||
|
||||
@ -118,10 +118,6 @@ namespace Pamac {
|
||||
|
||||
public SortInfo sortinfo;
|
||||
|
||||
//dialogs
|
||||
HistoryDialog history_dialog;
|
||||
PackagesChooserDialog packages_chooser_dialog;
|
||||
|
||||
public ManagerWindow (Gtk.Application application) {
|
||||
Object (application: application);
|
||||
|
||||
@ -184,9 +180,6 @@ namespace Pamac {
|
||||
}
|
||||
enable_aur (pamac_config.enable_aur);
|
||||
|
||||
history_dialog = new HistoryDialog (this);
|
||||
packages_chooser_dialog = new PackagesChooserDialog (this, transaction);
|
||||
|
||||
set_buttons_sensitive (false);
|
||||
|
||||
// sort by name by default
|
||||
@ -544,25 +537,25 @@ namespace Pamac {
|
||||
packages_list.get_value (iter, 0, out val);
|
||||
string name = val.get_string ();
|
||||
if (name != dgettext (null, "No package found")) {
|
||||
if (transaction.to_add.steal (name)) {
|
||||
} else if (transaction.to_remove.steal (name)) {
|
||||
} else if (transaction.to_build.steal (name)) {
|
||||
if (transaction.to_add.remove (name)) {
|
||||
} else if (transaction.to_remove.remove (name)) {
|
||||
} else if (transaction.to_build.remove (name)) {
|
||||
} else {
|
||||
packages_list.get_value (iter, 3, out val);
|
||||
string db_name = val.get_string ();
|
||||
if (db_name == "local") {
|
||||
if (transaction.should_hold (name) == false) {
|
||||
transaction.to_remove.insert (name, name);
|
||||
transaction.to_remove.add ((owned) name);
|
||||
}
|
||||
} else if (db_name == "AUR") {
|
||||
transaction.to_build.insert (name, name);
|
||||
transaction.to_build.add ((owned) name);
|
||||
} else {
|
||||
transaction.to_add.insert (name, name);
|
||||
transaction.to_add.add ((owned) name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (transaction.to_add.size () + transaction.to_remove.size () + transaction.to_build.size () == 0) {
|
||||
if (transaction.to_add.length + transaction.to_remove.length + transaction.to_build.length == 0) {
|
||||
set_buttons_sensitive (false);
|
||||
} else {
|
||||
set_buttons_sensitive (true);
|
||||
@ -575,54 +568,54 @@ namespace Pamac {
|
||||
Pamac.Package find_pkg;
|
||||
foreach (Pamac.Package pkg in selected_pkgs) {
|
||||
if (pkg.repo == "AUR") {
|
||||
transaction.to_build.insert (pkg.name, pkg.name);
|
||||
transaction.to_build.add (pkg.name);
|
||||
} else {
|
||||
find_pkg = transaction.find_local_pkg (pkg.name);
|
||||
if (find_pkg.name == "") {
|
||||
transaction.to_add.insert (pkg.name, pkg.name);
|
||||
transaction.to_add.add (pkg.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (transaction.to_add.size () != 0 || transaction.to_build.size () != 0) {
|
||||
if (transaction.to_add.length != 0 || transaction.to_build.length != 0) {
|
||||
set_buttons_sensitive (true);
|
||||
}
|
||||
}
|
||||
|
||||
void on_reinstall_item_activate () {
|
||||
foreach (Pamac.Package pkg in selected_pkgs) {
|
||||
transaction.to_remove.steal (pkg.name);
|
||||
transaction.to_remove.remove (pkg.name);
|
||||
if (pkg.repo == "local") {
|
||||
transaction.to_add.insert (pkg.name, pkg.name);
|
||||
transaction.to_add.add (pkg.name);
|
||||
}
|
||||
}
|
||||
if (transaction.to_add.size () != 0) {
|
||||
if (transaction.to_add.length != 0) {
|
||||
set_buttons_sensitive (true);
|
||||
}
|
||||
}
|
||||
|
||||
void on_remove_item_activate () {
|
||||
foreach (Pamac.Package pkg in selected_pkgs) {
|
||||
transaction.to_add.steal (pkg.name);
|
||||
transaction.to_add.remove (pkg.name);
|
||||
if (transaction.should_hold (pkg.name) == false) {
|
||||
if (pkg.repo == "local") {
|
||||
transaction.to_remove.insert (pkg.name, pkg.name);
|
||||
transaction.to_remove.add (pkg.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (transaction.to_remove.size () != 0) {
|
||||
if (transaction.to_remove.length != 0) {
|
||||
set_buttons_sensitive (true);
|
||||
}
|
||||
}
|
||||
|
||||
void on_deselect_item_activate () {
|
||||
foreach (Pamac.Package pkg in selected_pkgs) {
|
||||
if (transaction.to_add.steal (pkg.name)) {
|
||||
} else if (transaction.to_remove.steal (pkg.name)) {
|
||||
} else if (transaction.to_build.steal (pkg.name)) {
|
||||
if (transaction.to_add.remove (pkg.name)) {
|
||||
} else if (transaction.to_remove.remove (pkg.name)) {
|
||||
} else if (transaction.to_build.remove (pkg.name)) {
|
||||
}
|
||||
}
|
||||
if (transaction.to_add.size () == 0 && transaction.to_remove.size () == 0
|
||||
&& transaction.to_load.size () == 0 && transaction.to_build.size () == 0) {
|
||||
if (transaction.to_add.length == 0 && transaction.to_remove.length == 0
|
||||
&& transaction.to_load.length == 0 && transaction.to_build.length == 0) {
|
||||
set_buttons_sensitive (false);
|
||||
}
|
||||
}
|
||||
@ -643,29 +636,27 @@ namespace Pamac {
|
||||
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:", optdeps.length).printf (pkg.name, optdeps.length)));
|
||||
choose_dep_dialog.run ();
|
||||
choose_dep_dialog.hide ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
choose_dep_dialog.deps_list.foreach ((model, path, iter) => {
|
||||
GLib.Value val;
|
||||
bool selected;
|
||||
string name;
|
||||
choose_dep_dialog.deps_list.get_value (iter, 0, out val);
|
||||
selected = val.get_boolean ();
|
||||
bool selected = val.get_boolean ();
|
||||
if (selected) {
|
||||
choose_dep_dialog.deps_list.get_value (iter, 1, out val);
|
||||
name = val.get_string ();
|
||||
transaction.to_add.insert (name, name);
|
||||
string name = val.get_string ();
|
||||
transaction.to_add.add ((owned) name);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
choose_dep_dialog.destroy ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void on_install_optional_deps_item_activate () {
|
||||
choose_opt_dep (selected_pkgs);
|
||||
if (transaction.to_add.size () != 0) {
|
||||
if (transaction.to_add.length != 0) {
|
||||
set_buttons_sensitive (true);
|
||||
}
|
||||
}
|
||||
@ -952,7 +943,7 @@ namespace Pamac {
|
||||
Pamac.Package[] pkgs = {};
|
||||
Pamac.Package find_pkg;
|
||||
if (state == dgettext (null, "To install")) {
|
||||
foreach (string name in transaction.to_add.get_keys ()) {
|
||||
foreach (string name in transaction.to_add) {
|
||||
find_pkg = transaction.find_local_pkg (name);
|
||||
if (find_pkg.name != "") {
|
||||
pkgs += find_pkg;
|
||||
@ -965,7 +956,7 @@ namespace Pamac {
|
||||
}
|
||||
populate_packages_list (pkgs);
|
||||
} else if (state == dgettext (null, "To remove")) {
|
||||
foreach (string name in transaction.to_remove.get_keys ()) {
|
||||
foreach (string name in transaction.to_remove) {
|
||||
find_pkg = transaction.find_local_pkg (name);
|
||||
if (find_pkg.name != "") {
|
||||
pkgs += find_pkg;
|
||||
@ -1024,7 +1015,7 @@ namespace Pamac {
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
public void on_history_item_activate () {
|
||||
public void on_history_item_activate () {
|
||||
var file = GLib.File.new_for_path ("/var/log/pamac.log");
|
||||
if (!file.query_exists ()) {
|
||||
GLib.stderr.printf ("File '%s' doesn't exist.\n", file.get_path ());
|
||||
@ -1036,16 +1027,17 @@ namespace Pamac {
|
||||
var dis = new DataInputStream (file.read ());
|
||||
string line;
|
||||
// Read lines until end of file (null) is reached
|
||||
while ((line = dis.read_line (null)) != null) {
|
||||
text.append (line);
|
||||
text.append ("\n");
|
||||
while ((line = dis.read_line ()) != null) {
|
||||
// construct text in reverse order
|
||||
text.prepend (line + "\n");
|
||||
}
|
||||
} catch (GLib.Error e) {
|
||||
GLib.stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
var history_dialog = new HistoryDialog (this);
|
||||
history_dialog.textview.buffer.set_text (text.str, (int) text.len);
|
||||
history_dialog.run ();
|
||||
history_dialog.hide ();
|
||||
history_dialog.destroy ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
@ -1054,26 +1046,40 @@ namespace Pamac {
|
||||
|
||||
[GtkCallback]
|
||||
public void on_local_item_activate () {
|
||||
int response = packages_chooser_dialog.run ();
|
||||
if (response== Gtk.ResponseType.ACCEPT) {
|
||||
SList<string> packages_paths = packages_chooser_dialog.get_filenames ();
|
||||
Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog (
|
||||
dgettext (null, "Install local packages"), this, Gtk.FileChooserAction.OPEN,
|
||||
dgettext (null, "_Cancel"), Gtk.ResponseType.CANCEL,
|
||||
dgettext (null, "_Open"),Gtk.ResponseType.ACCEPT);
|
||||
chooser.window_position = Gtk.WindowPosition.CENTER_ON_PARENT;
|
||||
chooser.icon_name = "system-software-install";
|
||||
chooser.default_width = 900;
|
||||
chooser.select_multiple = true;
|
||||
chooser.local_only = false;
|
||||
chooser.create_folders = false;
|
||||
Gtk.FileFilter package_filter = new Gtk.FileFilter ();
|
||||
package_filter.set_filter_name (dgettext (null, "Alpm Package"));
|
||||
package_filter.add_pattern ("*.pkg.tar.xz");
|
||||
chooser.add_filter (package_filter);
|
||||
if (chooser.run () == Gtk.ResponseType.ACCEPT) {
|
||||
SList<string> packages_paths = chooser.get_filenames ();
|
||||
if (packages_paths.length () != 0) {
|
||||
foreach (string path in packages_paths) {
|
||||
transaction.to_load.insert (path, path);
|
||||
transaction.to_load.add (path);
|
||||
}
|
||||
this.get_window ().set_cursor (new Gdk.Cursor (Gdk.CursorType.WATCH));
|
||||
packages_chooser_dialog.hide ();
|
||||
chooser.destroy ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
transaction.run ();
|
||||
}
|
||||
} else {
|
||||
packages_chooser_dialog.hide ();
|
||||
chooser.destroy ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
@ -1125,7 +1131,7 @@ namespace Pamac {
|
||||
set_buttons_sensitive (false);
|
||||
refresh_packages_list ();
|
||||
}
|
||||
transaction.to_load.steal_all ();
|
||||
transaction.to_load.remove_all ();
|
||||
this.get_window ().set_cursor (null);
|
||||
}
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* pamac-vala
|
||||
*
|
||||
* Copyright (C) 2014-2015 Guillaume Benoit <guillaume@manjaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a get of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Pamac {
|
||||
|
||||
[GtkTemplate (ui = "/org/manjaro/pamac/manager/packages_chooser_dialog.ui")]
|
||||
public class PackagesChooserDialog : Gtk.FileChooserDialog {
|
||||
|
||||
ManagerWindow window;
|
||||
Transaction transaction;
|
||||
|
||||
public PackagesChooserDialog (ManagerWindow window, Transaction transaction) {
|
||||
Object (transient_for: window, use_header_bar: 0);
|
||||
|
||||
Gtk.FileFilter package_filter = new Gtk.FileFilter ();
|
||||
package_filter.set_filter_name (dgettext (null, "Alpm Package"));
|
||||
package_filter.add_pattern ("*.pkg.tar.xz");
|
||||
this.add_filter (package_filter);
|
||||
|
||||
this.window = window;
|
||||
this.transaction = transaction;
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
public void on_file_activated () {
|
||||
SList<string> packages_paths = this.get_filenames ();
|
||||
if (packages_paths.length () != 0) {
|
||||
foreach (string path in packages_paths) {
|
||||
transaction.to_load.insert (path, path);
|
||||
}
|
||||
window.get_window ().set_cursor (new Gdk.Cursor (Gdk.CursorType.WATCH));
|
||||
this.hide ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
transaction.run ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -20,18 +20,53 @@
|
||||
namespace Pamac {
|
||||
[DBus (name = "org.manjaro.pamac")]
|
||||
public interface Daemon : Object {
|
||||
public abstract void start_refresh (int force, bool emit_signal) throws IOError;
|
||||
public abstract void start_refresh (int force) throws IOError;
|
||||
}
|
||||
}
|
||||
|
||||
bool check_pamac_running () {
|
||||
Application app;
|
||||
bool run = false;
|
||||
app = new Application ("org.manjaro.pamac.manager", 0);
|
||||
try {
|
||||
app.register ();
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
run = app.get_is_remote ();
|
||||
if (run) {
|
||||
return run;
|
||||
}
|
||||
app = new Application ("org.manjaro.pamac.updater", 0);
|
||||
try {
|
||||
app.register ();
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
run = app.get_is_remote ();
|
||||
if (run) {
|
||||
return run;
|
||||
}
|
||||
app = new Application ("org.manjaro.pamac.install", 0);
|
||||
try {
|
||||
app.register ();
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
run = app.get_is_remote ();
|
||||
return run;
|
||||
}
|
||||
|
||||
int main (string[] args) {
|
||||
Pamac.Daemon daemon;
|
||||
try {
|
||||
daemon = Bus.get_proxy_sync (BusType.SYSTEM, "org.manjaro.pamac",
|
||||
"/org/manjaro/pamac");
|
||||
daemon.start_refresh (0, false);
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
if (check_pamac_running () == false) {
|
||||
try {
|
||||
daemon = Bus.get_proxy_sync (BusType.SYSTEM, "org.manjaro.pamac",
|
||||
"/org/manjaro/pamac");
|
||||
daemon.start_refresh (0);
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -24,10 +24,12 @@ namespace Pamac {
|
||||
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_set_pkgreason (string pkgname, uint reason) throws IOError;
|
||||
public abstract void start_refresh (int force, bool emit_finish_signal) throws IOError;
|
||||
public abstract void start_refresh (int force) throws IOError;
|
||||
public abstract bool get_checkspace () throws IOError;
|
||||
public abstract string get_syncfirst () throws IOError;
|
||||
public abstract string get_ignorepkg () throws IOError;
|
||||
public abstract void add_ignorepkg (string pkgname) throws IOError;
|
||||
public abstract void remove_ignorepkg (string pkgname) throws IOError;
|
||||
public abstract bool should_hold (string pkgname) throws IOError;
|
||||
public abstract async Pamac.Package[] get_all_pkgs () throws IOError;
|
||||
public abstract async Pamac.Package[] get_installed_pkgs () throws IOError;
|
||||
@ -88,10 +90,11 @@ namespace Pamac {
|
||||
|
||||
public Alpm.TransFlag flags;
|
||||
// those hashtables will be used as set
|
||||
public HashTable<string,string> to_add;
|
||||
public HashTable<string,string> to_remove;
|
||||
public HashTable<string,string> to_load;
|
||||
public HashTable<string,string> to_build;
|
||||
public GenericSet<string?> to_add;
|
||||
public GenericSet<string?> to_remove;
|
||||
public GenericSet<string?> to_load;
|
||||
public GenericSet<string?> to_build;
|
||||
public GenericSet<string?> special_ignorepkgs;
|
||||
|
||||
public Mode mode;
|
||||
|
||||
@ -103,9 +106,6 @@ namespace Pamac {
|
||||
string previous_filename;
|
||||
uint pulse_timeout_id;
|
||||
bool sysupgrade_after_trans;
|
||||
// it seems that upgrade after build can cause trouble
|
||||
// so disable it and let's see if it's fine
|
||||
//bool sysupgrade_after_build;
|
||||
int build_status;
|
||||
int enable_downgrade;
|
||||
|
||||
@ -116,7 +116,6 @@ namespace Pamac {
|
||||
TransactionSumDialog transaction_sum_dialog;
|
||||
TransactionInfoDialog transaction_info_dialog;
|
||||
ProgressDialog progress_dialog;
|
||||
PreferencesDialog preferences_dialog;
|
||||
//parent window
|
||||
Gtk.ApplicationWindow? window;
|
||||
|
||||
@ -125,17 +124,17 @@ namespace Pamac {
|
||||
|
||||
public Transaction (Gtk.ApplicationWindow? window) {
|
||||
flags = Alpm.TransFlag.CASCADE;
|
||||
to_add = new HashTable<string,string> (str_hash, str_equal);
|
||||
to_remove = new HashTable<string,string> (str_hash, str_equal);
|
||||
to_load = new HashTable<string,string> (str_hash, str_equal);
|
||||
to_build = new HashTable<string,string> (str_hash, str_equal);
|
||||
to_add = new GenericSet<string?> (str_hash, str_equal);
|
||||
to_remove = new GenericSet<string?> (str_hash, str_equal);
|
||||
to_load = new GenericSet<string?> (str_hash, str_equal);
|
||||
to_build = new GenericSet<string?> (str_hash, str_equal);
|
||||
special_ignorepkgs = new GenericSet<string?> (str_hash, str_equal);
|
||||
connecting_dbus_signals ();
|
||||
//creating dialogs
|
||||
this.window = window;
|
||||
transaction_sum_dialog = new TransactionSumDialog (window);
|
||||
transaction_info_dialog = new TransactionInfoDialog (window);
|
||||
progress_dialog = new ProgressDialog (this, window);
|
||||
preferences_dialog = new PreferencesDialog (window);
|
||||
//creating terminal
|
||||
term = new Vte.Terminal ();
|
||||
term.scroll_on_output = false;
|
||||
@ -167,7 +166,6 @@ namespace Pamac {
|
||||
previous_percent = 0.0;
|
||||
previous_filename = "";
|
||||
sysupgrade_after_trans = false;
|
||||
//sysupgrade_after_build = false;
|
||||
build_status = 0;
|
||||
}
|
||||
|
||||
@ -216,7 +214,7 @@ namespace Pamac {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
try {
|
||||
daemon.start_refresh (force, true);
|
||||
daemon.start_refresh (force);
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
@ -252,6 +250,23 @@ namespace Pamac {
|
||||
return ignorepkg;
|
||||
}
|
||||
|
||||
public void add_ignorepkg (string pkgname) {
|
||||
try {
|
||||
daemon.add_ignorepkg (pkgname);
|
||||
special_ignorepkgs.add (pkgname);
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove_ignorepkg (string pkgname) {
|
||||
try {
|
||||
daemon.remove_ignorepkg (pkgname);
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public bool should_hold (string pkgname) {
|
||||
bool should_hold = false;
|
||||
try {
|
||||
@ -423,15 +438,23 @@ namespace Pamac {
|
||||
return updates;
|
||||
}
|
||||
|
||||
public void sysupgrade_simple (int enable_downgrade) {
|
||||
progress_dialog.progressbar.set_fraction (0);
|
||||
progress_dialog.cancel_button.set_visible (true);
|
||||
public ErrorInfos init () {
|
||||
var err = ErrorInfos ();
|
||||
foreach (string pkgname in special_ignorepkgs) {
|
||||
add_ignorepkg (pkgname);
|
||||
}
|
||||
try {
|
||||
err = daemon.trans_init (0);
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
public void sysupgrade_simple (int enable_downgrade) {
|
||||
progress_dialog.progressbar.set_fraction (0);
|
||||
progress_dialog.cancel_button.set_visible (true);
|
||||
var err = init ();
|
||||
if (err.message != "") {
|
||||
finished (true);
|
||||
handle_error (err);
|
||||
@ -481,18 +504,15 @@ namespace Pamac {
|
||||
sysupgrade_after_trans = true;
|
||||
}
|
||||
foreach (UpdateInfos infos in updates.repos_updates) {
|
||||
to_add.insert (infos.name, infos.name);
|
||||
to_add.add (infos.name);
|
||||
}
|
||||
// run as a standard transaction
|
||||
run ();
|
||||
} else {
|
||||
if (updates.aur_updates.length != 0) {
|
||||
clear_lists ();
|
||||
//if (repos_updates_len != 0) {
|
||||
//sysupgrade_after_build = true;
|
||||
//}
|
||||
foreach (UpdateInfos infos in updates.aur_updates) {
|
||||
to_build.insert (infos.name, infos.name);
|
||||
to_build.add (infos.name);
|
||||
}
|
||||
}
|
||||
if (updates.repos_updates.length != 0) {
|
||||
@ -510,9 +530,9 @@ namespace Pamac {
|
||||
}
|
||||
|
||||
public void clear_lists () {
|
||||
to_add.steal_all ();
|
||||
to_remove.steal_all ();
|
||||
to_build.steal_all ();
|
||||
to_add.remove_all ();
|
||||
to_remove.remove_all ();
|
||||
to_build.remove_all ();
|
||||
}
|
||||
|
||||
public void run () {
|
||||
@ -529,10 +549,10 @@ namespace Pamac {
|
||||
}
|
||||
// run
|
||||
var err = ErrorInfos ();
|
||||
if (to_add.size () == 0
|
||||
&& to_remove.size () == 0
|
||||
&& to_load.size () == 0
|
||||
&& to_build.size () != 0) {
|
||||
if (to_add.length == 0
|
||||
&& to_remove.length == 0
|
||||
&& to_load.length == 0
|
||||
&& to_build.length != 0) {
|
||||
// there only AUR packages to build so no need to prepare transaction
|
||||
on_trans_prepare_finished (err);
|
||||
} else {
|
||||
@ -545,7 +565,7 @@ namespace Pamac {
|
||||
finished (true);
|
||||
handle_error (err);
|
||||
} else {
|
||||
foreach (string name in to_add.get_keys ()) {
|
||||
foreach (string name in to_add) {
|
||||
try {
|
||||
err = daemon.trans_add_pkg (name);
|
||||
} catch (IOError e) {
|
||||
@ -555,7 +575,7 @@ namespace Pamac {
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (string name in to_remove.get_keys ()) {
|
||||
foreach (string name in to_remove) {
|
||||
try {
|
||||
err = daemon.trans_remove_pkg (name);
|
||||
} catch (IOError e) {
|
||||
@ -565,7 +585,7 @@ namespace Pamac {
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (string path in to_load.get_keys ()) {
|
||||
foreach (string path in to_load) {
|
||||
try {
|
||||
err = daemon.trans_load_pkg (path);
|
||||
} catch (IOError e) {
|
||||
@ -595,19 +615,20 @@ namespace Pamac {
|
||||
var choose_provider_dialog = new ChooseProviderDialog (window);
|
||||
choose_provider_dialog.label.set_markup ("<b>%s</b>".printf (dgettext (null, "Choose a provider for %s").printf (depend, len)));
|
||||
choose_provider_dialog.comboboxtext.remove_all ();
|
||||
foreach (string provider in providers)
|
||||
foreach (string provider in providers) {
|
||||
choose_provider_dialog.comboboxtext.append_text (provider);
|
||||
}
|
||||
choose_provider_dialog.comboboxtext.active = 0;
|
||||
choose_provider_dialog.run ();
|
||||
choose_provider_dialog.hide ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
try {
|
||||
daemon.choose_provider (choose_provider_dialog.comboboxtext.active);
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
choose_provider_dialog.destroy ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
}
|
||||
|
||||
public TransactionType set_transaction_sum () {
|
||||
@ -646,7 +667,7 @@ namespace Pamac {
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (string name in to_build.get_keys ()) {
|
||||
foreach (string name in to_build) {
|
||||
_to_build += name;
|
||||
}
|
||||
int len = prepared_to_remove.length;
|
||||
@ -761,8 +782,9 @@ namespace Pamac {
|
||||
term.grab_focus ();
|
||||
pulse_timeout_id = Timeout.add (500, (GLib.SourceFunc) progress_dialog.progressbar.pulse);
|
||||
string[] cmds = {"yaourt", "-S"};
|
||||
foreach (string name in to_build.get_keys ())
|
||||
foreach (string name in to_build) {
|
||||
cmds += name;
|
||||
}
|
||||
Pid child_pid;
|
||||
spawn_in_term (cmds, out child_pid);
|
||||
// watch_child is needed in order to have the child_exited signal emitted
|
||||
@ -783,6 +805,9 @@ namespace Pamac {
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
foreach (string pkgname in special_ignorepkgs) {
|
||||
remove_ignorepkg (pkgname);
|
||||
}
|
||||
}
|
||||
|
||||
public void stop_daemon () {
|
||||
@ -807,6 +832,7 @@ namespace Pamac {
|
||||
public async void run_preferences_dialog () {
|
||||
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||
var mirrors_config = new Alpm.MirrorsConfig ("/etc/pacman-mirrors.conf");
|
||||
var preferences_dialog = new PreferencesDialog (window);
|
||||
bool enable_aur = pamac_config.enable_aur;
|
||||
bool recurse = pamac_config.recurse;
|
||||
int refresh_period = pamac_config.refresh_period;
|
||||
@ -841,14 +867,10 @@ namespace Pamac {
|
||||
} else {
|
||||
preferences_dialog.mirrorlist_generation_method_comboboxtext.active = 1;
|
||||
}
|
||||
int response = preferences_dialog.run ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
|
||||
var new_alpm_conf = new HashTable<string,Variant> (str_hash, str_equal);
|
||||
var new_mirrors_conf = new HashTable<string,Variant> (str_hash, str_equal);
|
||||
if (response == Gtk.ResponseType.OK) {
|
||||
if (preferences_dialog.run () == Gtk.ResponseType.OK) {
|
||||
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
|
||||
var new_alpm_conf = new HashTable<string,Variant> (str_hash, str_equal);
|
||||
var new_mirrors_conf = new HashTable<string,Variant> (str_hash, str_equal);
|
||||
enable_aur = preferences_dialog.enable_aur_button.get_active ();
|
||||
recurse = preferences_dialog.remove_unrequired_deps_button.get_active ();
|
||||
refresh_period = preferences_dialog.refresh_period_spin_button.get_value_as_int ();
|
||||
@ -890,35 +912,35 @@ namespace Pamac {
|
||||
&& preferences_dialog.mirrorlist_generation_method_comboboxtext.get_active_text () == dgettext (null, "speed")) {
|
||||
new_mirrors_conf.insert ("Method", new Variant.string (dgettext (null, "speed")));
|
||||
}
|
||||
if (new_pamac_conf.size () != 0) {
|
||||
start_write_pamac_config (new_pamac_conf);
|
||||
SourceFunc callback = run_preferences_dialog.callback;
|
||||
ulong handler_id = daemon.write_pamac_config_finished.connect (() => {
|
||||
Idle.add((owned) callback);
|
||||
});
|
||||
yield;
|
||||
daemon.disconnect (handler_id);
|
||||
}
|
||||
if (new_alpm_conf.size () != 0) {
|
||||
start_write_alpm_config (new_alpm_conf);
|
||||
SourceFunc callback = run_preferences_dialog.callback;
|
||||
ulong handler_id = daemon.write_alpm_config_finished.connect (() => {
|
||||
Idle.add((owned) callback);
|
||||
});
|
||||
yield;
|
||||
daemon.disconnect (handler_id);
|
||||
}
|
||||
if (new_mirrors_conf.size () != 0) {
|
||||
start_write_mirrors_config (new_mirrors_conf);
|
||||
SourceFunc callback = run_preferences_dialog.callback;
|
||||
ulong handler_id = daemon.write_mirrors_config_finished.connect (() => {
|
||||
Idle.add((owned) callback);
|
||||
});
|
||||
yield;
|
||||
daemon.disconnect (handler_id);
|
||||
}
|
||||
}
|
||||
if (new_pamac_conf.size () != 0) {
|
||||
start_write_pamac_config (new_pamac_conf);
|
||||
SourceFunc callback = run_preferences_dialog.callback;
|
||||
ulong handler_id = daemon.write_pamac_config_finished.connect (() => {
|
||||
Idle.add((owned) callback);
|
||||
});
|
||||
yield;
|
||||
daemon.disconnect (handler_id);
|
||||
}
|
||||
if (new_alpm_conf.size () != 0) {
|
||||
start_write_alpm_config (new_alpm_conf);
|
||||
SourceFunc callback = run_preferences_dialog.callback;
|
||||
ulong handler_id = daemon.write_alpm_config_finished.connect (() => {
|
||||
Idle.add((owned) callback);
|
||||
});
|
||||
yield;
|
||||
daemon.disconnect (handler_id);
|
||||
}
|
||||
if (new_mirrors_conf.size () != 0) {
|
||||
start_write_mirrors_config (new_mirrors_conf);
|
||||
SourceFunc callback = run_preferences_dialog.callback;
|
||||
ulong handler_id = daemon.write_mirrors_config_finished.connect (() => {
|
||||
Idle.add((owned) callback);
|
||||
});
|
||||
yield;
|
||||
daemon.disconnect (handler_id);
|
||||
}
|
||||
preferences_dialog.hide ();
|
||||
preferences_dialog.destroy ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
@ -1263,8 +1285,8 @@ namespace Pamac {
|
||||
sysupgrade (0);
|
||||
}
|
||||
} else {
|
||||
handle_error (error);
|
||||
finished (true);
|
||||
handle_error (error);
|
||||
}
|
||||
previous_filename = "";
|
||||
}
|
||||
@ -1275,7 +1297,6 @@ namespace Pamac {
|
||||
TransactionType type = set_transaction_sum ();
|
||||
if (type == TransactionType.UPDATE && mode == Mode.UPDATER) {
|
||||
// there only updates
|
||||
//sysupgrade_after_build = false;
|
||||
start_commit ();
|
||||
} else if (type != 0) {
|
||||
if (transaction_sum_dialog.run () == Gtk.ResponseType.OK) {
|
||||
@ -1298,9 +1319,8 @@ namespace Pamac {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
release ();
|
||||
to_build.steal_all ();
|
||||
to_build.remove_all ();
|
||||
sysupgrade_after_trans = false;
|
||||
//sysupgrade_after_build = false;
|
||||
finished (true);
|
||||
}
|
||||
} else {
|
||||
@ -1324,33 +1344,33 @@ namespace Pamac {
|
||||
|
||||
public void on_trans_commit_finished (ErrorInfos error) {
|
||||
if (error.message == "") {
|
||||
if (to_build.size () != 0) {
|
||||
if (to_add.size () != 0
|
||||
|| to_remove.size () != 0
|
||||
|| to_load.size () != 0) {
|
||||
if (to_build.length != 0) {
|
||||
if (to_add.length != 0
|
||||
|| to_remove.length != 0
|
||||
|| to_load.length != 0) {
|
||||
spawn_in_term ({"echo", dgettext (null, "Transaction successfully finished") + ".\n"});
|
||||
}
|
||||
build_aur_packages ();
|
||||
} else {
|
||||
//progress_dialog.action_label.set_text (dgettext (null, "Transaction successfully finished"));
|
||||
//progress_dialog.close_button.set_visible (true);
|
||||
clear_lists ();
|
||||
show_warnings ();
|
||||
if (sysupgrade_after_trans) {
|
||||
sysupgrade_after_trans = false;
|
||||
sysupgrade (0);
|
||||
//} else if (sysupgrade_after_build) {
|
||||
//sysupgrade_simple (enable_downgrade);
|
||||
} else {
|
||||
if (build_status == 0) {
|
||||
spawn_in_term ({"echo", dgettext (null, "Transaction successfully finished") + ".\n"});
|
||||
progress_dialog.hide ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
} else {
|
||||
progress_dialog.progressbar.set_fraction (0);
|
||||
progress_dialog.cancel_button.set_visible (false);
|
||||
progress_dialog.close_button.set_visible (true);
|
||||
spawn_in_term ({"echo"});
|
||||
}
|
||||
progress_dialog.hide ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
finished (false);
|
||||
}
|
||||
}
|
||||
@ -1366,7 +1386,7 @@ namespace Pamac {
|
||||
|
||||
void on_term_child_exited (int status) {
|
||||
Source.remove (pulse_timeout_id);
|
||||
to_build.steal_all ();
|
||||
to_build.remove_all ();
|
||||
build_status = status;
|
||||
// let the time to the daemon to update packages
|
||||
Timeout.add (1000, () => {
|
||||
|
@ -27,16 +27,17 @@ const string noupdate_info = _("Your system is up-to-date");
|
||||
namespace Pamac {
|
||||
[DBus (name = "org.manjaro.pamac")]
|
||||
public interface Daemon : Object {
|
||||
public abstract void start_refresh (int force, bool emit_signal) throws IOError;
|
||||
public abstract void start_refresh (int force) throws IOError;
|
||||
public abstract async Updates get_updates (bool enable_aur) throws IOError;
|
||||
[DBus (no_reply = true)]
|
||||
public abstract void quit () throws IOError;
|
||||
public abstract async void quit () throws IOError;
|
||||
public signal void refresh_finished (ErrorInfos error);
|
||||
}
|
||||
|
||||
public class TrayIcon: Gtk.Application {
|
||||
Notify.Notification notification;
|
||||
Daemon daemon;
|
||||
bool locked;
|
||||
bool intern_lock;
|
||||
bool extern_lock;
|
||||
uint refresh_timeout_id;
|
||||
Gtk.StatusIcon status_icon;
|
||||
Gtk.Menu menu;
|
||||
@ -54,15 +55,13 @@ namespace Pamac {
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
// Connecting to signal
|
||||
daemon.refresh_finished.connect (on_refresh_finished);
|
||||
}
|
||||
|
||||
void stop_daemon () {
|
||||
if (check_pamac_running () == false && lockfile.query_exists () == false) {
|
||||
try {
|
||||
daemon.quit ();
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
daemon.quit.begin ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +96,7 @@ namespace Pamac {
|
||||
try {
|
||||
Process.spawn_command_line_async ("pamac-updater");
|
||||
} catch (SpawnError e) {
|
||||
print(e.message);
|
||||
stderr.printf ("SpawnError: %s\n", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,7 +104,7 @@ namespace Pamac {
|
||||
try {
|
||||
Process.spawn_command_line_async ("pamac-manager");
|
||||
} catch (SpawnError e) {
|
||||
print(e.message);
|
||||
stderr.printf ("SpawnError: %s\n", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,11 +113,12 @@ namespace Pamac {
|
||||
status_icon.set_tooltip_markup (info);
|
||||
}
|
||||
|
||||
bool refresh () {
|
||||
bool start_refresh () {
|
||||
if (check_pamac_running () == false) {
|
||||
start_daemon ();
|
||||
try {
|
||||
daemon.start_refresh (0, false);
|
||||
daemon.start_refresh (0);
|
||||
intern_lock = true;
|
||||
} catch (IOError e) {
|
||||
stderr.printf ("IOError: %s\n", e.message);
|
||||
}
|
||||
@ -126,6 +126,11 @@ namespace Pamac {
|
||||
return true;
|
||||
}
|
||||
|
||||
void on_refresh_finished () {
|
||||
intern_lock = false;
|
||||
check_updates ();
|
||||
}
|
||||
|
||||
void check_updates () {
|
||||
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||
daemon.get_updates.begin (pamac_config.enable_aur, (obj, res) => {
|
||||
@ -203,9 +208,9 @@ namespace Pamac {
|
||||
}
|
||||
|
||||
bool check_pacman_running () {
|
||||
if (locked) {
|
||||
if (extern_lock) {
|
||||
if (lockfile.query_exists () == false) {
|
||||
locked = false;
|
||||
extern_lock = false;
|
||||
// let the time to the daemon to update packages
|
||||
Timeout.add (1000, () => {
|
||||
check_updates ();
|
||||
@ -214,7 +219,9 @@ namespace Pamac {
|
||||
}
|
||||
} else {
|
||||
if (lockfile.query_exists () == true) {
|
||||
locked = true;
|
||||
if (intern_lock == false) {
|
||||
extern_lock = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -224,7 +231,7 @@ namespace Pamac {
|
||||
if (refresh_timeout_id != 0) {
|
||||
Source.remove (refresh_timeout_id);
|
||||
}
|
||||
refresh_timeout_id = Timeout.add_seconds (refresh_period_in_hours*3600, refresh);
|
||||
refresh_timeout_id = Timeout.add_seconds (refresh_period_in_hours*3600, start_refresh);
|
||||
}
|
||||
|
||||
public override void startup () {
|
||||
@ -234,7 +241,8 @@ namespace Pamac {
|
||||
|
||||
base.startup ();
|
||||
|
||||
locked = false;
|
||||
intern_lock = false;
|
||||
extern_lock = false;
|
||||
refresh_timeout_id = 0;
|
||||
|
||||
status_icon = new Gtk.StatusIcon ();
|
||||
@ -249,7 +257,7 @@ namespace Pamac {
|
||||
var alpm_config = new Alpm.Config ("/etc/pacman.conf");
|
||||
lockfile = GLib.File.new_for_path (alpm_config.handle.lockfile);
|
||||
Timeout.add (500, check_pacman_running);
|
||||
refresh ();
|
||||
start_refresh ();
|
||||
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||
launch_refresh_timeout ((uint) pamac_config.refresh_period);
|
||||
|
||||
|
@ -27,6 +27,8 @@ namespace Pamac {
|
||||
[GtkChild]
|
||||
public Gtk.TreeView updates_treeview;
|
||||
[GtkChild]
|
||||
public Gtk.CellRendererToggle select_update;
|
||||
[GtkChild]
|
||||
public Gtk.Label bottom_label;
|
||||
[GtkChild]
|
||||
public Gtk.Button apply_button;
|
||||
@ -38,7 +40,7 @@ namespace Pamac {
|
||||
public UpdaterWindow (Gtk.Application application) {
|
||||
Object (application: application);
|
||||
|
||||
updates_list = new Gtk.ListStore (2, typeof (string), typeof (string));
|
||||
updates_list = new Gtk.ListStore (3, typeof (bool), typeof (string), typeof (string));
|
||||
updates_treeview.set_model (updates_list);
|
||||
|
||||
transaction = new Transaction (this as Gtk.ApplicationWindow);
|
||||
@ -51,6 +53,14 @@ namespace Pamac {
|
||||
on_refresh_button_clicked ();
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
public void on_select_update_toggled (string path) {
|
||||
Gtk.TreePath treepath = new Gtk.TreePath.from_string (path);
|
||||
Gtk.TreeIter iter;
|
||||
updates_list.get_iter (out iter, treepath);
|
||||
updates_list.set (iter, 0, !select_update.active);
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
public void on_preferences_button_clicked () {
|
||||
transaction.run_preferences_dialog.begin (() => {
|
||||
@ -64,6 +74,23 @@ namespace Pamac {
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
updates_list.foreach ((model, path, iter) => {
|
||||
GLib.Value val;
|
||||
updates_list.get_value (iter, 0, out val);
|
||||
bool selected = val.get_boolean ();
|
||||
if (selected) {
|
||||
updates_list.get_value (iter, 1, out val);
|
||||
// string has the form "pkgname pkgversion"
|
||||
string pkgname = val.get_string ().split (" ", 2)[0];
|
||||
transaction.special_ignorepkgs.remove (pkgname);
|
||||
} else {
|
||||
updates_list.get_value (iter, 1, out val);
|
||||
// string has the form "pkgname pkgversion"
|
||||
string pkgname = val.get_string ().split (" ", 2)[0];
|
||||
transaction.special_ignorepkgs.add ((owned) pkgname);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
transaction.sysupgrade (0);
|
||||
}
|
||||
|
||||
@ -108,13 +135,17 @@ namespace Pamac {
|
||||
}
|
||||
dsize += infos.download_size;
|
||||
updates_nb++;
|
||||
updates_list.insert_with_values (out iter, -1, 0, name, 1, size);
|
||||
if (infos.name in transaction.special_ignorepkgs) {
|
||||
updates_list.insert_with_values (out iter, -1, 0, false, 1, name, 2, size);
|
||||
} else {
|
||||
updates_list.insert_with_values (out iter, -1, 0, true, 1, name, 2, size);
|
||||
}
|
||||
}
|
||||
foreach (UpdateInfos infos in updates.aur_updates) {
|
||||
name = infos.name + " " + infos.version;
|
||||
size = "";
|
||||
updates_nb++;
|
||||
updates_list.insert_with_values (out iter, -1, 0, name, 1, size);
|
||||
updates_list.insert_with_values (out iter, -1, 0, true, 1, name, 2, size);
|
||||
}
|
||||
if (updates_nb == 0) {
|
||||
top_label.set_markup("<b>%s</b>".printf (dgettext (null, "Your system is up-to-date")));
|
||||
|
Loading…
Reference in New Issue
Block a user