downgrade window shows currently installed version

This commit is contained in:
heliguy
2024-07-14 13:15:47 -04:00
parent 1cb6520a77
commit ddba312b69
3 changed files with 14 additions and 6 deletions

View File

@@ -48,12 +48,13 @@ Adw.Clamp versions_clamp {
Adw.PreferencesGroup mask_group {
Adw.SwitchRow mask_row {
title: _("Disable Updates");
active: true;
}
}
Adw.PreferencesGroup versions_group {
title: _("Select a Release");
description: _("This will uninstalls the current release and install the chosen one instead. Note that downgrading can cause issues.");
description: _("This will uninstall the current release and install the chosen one instead. Note that downgrading can cause issues.");
}
}
}

View File

@@ -62,11 +62,16 @@ class ChangeVersionPage(Adw.NavigationPage):
def idle(*args):
for index, commit in enumerate(commits):
row = Adw.ActionRow(title=GLib.markup_escape_text(changes[index]), subtitle=f"{GLib.markup_escape_text(commit)}\n{GLib.markup_escape_text(dates[index])}")
check = Gtk.CheckButton()
check.connect("activate", lambda *_, comm=commit: self.set_commit(comm))
check.set_group(self.root_group_check_button)
row.set_activatable_widget(check)
row.add_prefix(check)
if commit == self.package.cli_info["commit"]:
row.set_sensitive(False)
row.add_prefix(Gtk.Image(icon_name="check-plain-symbolic", margin_start=5, margin_end=5))
row.set_tooltip_text(_("Currently Installed Version"))
else:
check = Gtk.CheckButton()
check.connect("activate", lambda *_, comm=commit: self.set_commit(comm))
check.set_group(self.root_group_check_button)
row.set_activatable_widget(check)
row.add_prefix(check)
self.versions_group.add(row)
GLib.idle_add(idle)

View File

@@ -159,6 +159,7 @@ class Flatpak:
word[1] = word[1].replace("?", " ")
cli_info[word[0]] = word[1]
self.cli_info = cli_info
return cli_info
def __init__(self, columns):
@@ -177,6 +178,7 @@ class Flatpak:
}
self.data_path = f"{home}/.var/app/{columns[2]}"
self.data_size = -1
self.cli_info = None
installation = columns[7]
if len(i := installation.split(' ')) > 1:
self.info["installation"] = i[1].replace("(", "").replace(")", "")