Merge lp:~azzar1/update-manager/fix-lp-1807900 into lp:update-manager

Proposed by Andrea Azzarone
Status: Rejected
Rejected by: Sebastien Bacher
Proposed branch: lp:~azzar1/update-manager/fix-lp-1807900
Merge into: lp:update-manager
Diff against target: 96 lines (+31/-3)
2 files modified
UpdateManager/Dialogs.py (+24/-3)
UpdateManager/UpdateManager.py (+7/-0)
To merge this branch: bzr merge lp:~azzar1/update-manager/fix-lp-1807900
Reviewer Review Type Date Requested Status
Sebastien Bacher Needs Information
Review via email: mp+366051@code.launchpad.net

Commit message

Check if software-properties-livepatch.desktop is available to show (or not to show) the Livepatch settings button.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

The changes include some refactoring, you change the behaviour of the button in case livepatch is included in the label right (opening now on the livepatch tab while it was not doing it before) ? Is that described in the specification?

review: Needs Information
Revision history for this message
Andrea Azzarone (azzar1) wrote :

I asked mpt and that button should not open the Livepatch page. I'll update the MP ASAP.

Revision history for this message
Brian Murray (brian-murray) wrote :

Will somebody else be picking this up?

Revision history for this message
Sebastien Bacher (seb128) wrote :

Brian, yes, we will reassign to someone in desktop

Revision history for this message
Sebastien Bacher (seb128) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Unmerged revisions

2851. By Andrea Azzarone

Check if software-properties-livepatch.desktop is available to show (or not to show) the Livepatch settings button.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UpdateManager/Dialogs.py'
2--- UpdateManager/Dialogs.py 2019-04-08 17:00:30 +0000
3+++ UpdateManager/Dialogs.py 2019-04-15 11:41:13 +0000
4@@ -44,6 +44,7 @@
5 from gettext import gettext as _
6 from gettext import ngettext
7
8+LIVEPATCH_DESKTOP_FILE = "software-properties-livepatch.desktop"
9
10 class Dialog(object):
11 def __init__(self, window_main):
12@@ -129,9 +130,20 @@
13 else:
14 return None
15
16+ def add_livepatch_settings_button(self):
17+ if self._has_livepatch_settings_ui():
18+ return self.add_button(_("Settings & Livepatch…"),
19+ self.on_livepatch_settings_button_clicked,
20+ secondary=True)
21+ else:
22+ return None
23+
24 def on_settings_button_clicked(self):
25 self.window_main.show_settings()
26
27+ def on_livepatch_settings_button_clicked(self):
28+ self.window_main.show_livepatch_settings()
29+
30 def set_header(self, label):
31 if label:
32 self.label_header.set_markup(
33@@ -153,18 +165,28 @@
34 codename = get_dist()
35 return di.is_lts(codename)
36
37+ def _has_livepatch_settings_ui(self):
38+ try:
39+ return Gio.DesktopAppInfo.new(LIVEPATCH_DESKTOP_FILE)
40+ except:
41+ return None
42+
43 def on_livepatch_status_ready(self, active, cs, ps, fixes):
44 self.set_desc(None)
45
46 if not active:
47 if self._is_livepatch_supported() and \
48- self.settings_button and \
49+ self._has_livepatch_settings_ui() and \
50 self.settings.get_int('launch-count') >= 4:
51 self.set_desc(_("<b>Tip:</b> You can use Livepatch to "
52 "keep your computer more secure between "
53 "restarts."))
54- self.settings_button.set_label(_("Settings & Livepatch…"))
55+ self.add_livepatch_settings_button()
56+ else:
57+ self.add_settings_button()
58 return
59+ else:
60+ self.add_settings_button()
61
62 needs_reschedule = False
63
64@@ -224,7 +246,6 @@
65 self.set_header(_("No software updates are available."))
66 else:
67 self.set_header(_("The software on this computer is up to date."))
68- self.settings_button = self.add_settings_button()
69 self.focus_button = self.add_button(Gtk.STOCK_OK,
70 self.window_main.close)
71 self.check_livepatch_status()
72
73=== modified file 'UpdateManager/UpdateManager.py'
74--- UpdateManager/UpdateManager.py 2019-04-08 17:00:30 +0000
75+++ UpdateManager/UpdateManager.py 2019-04-15 11:41:13 +0000
76@@ -68,6 +68,7 @@
77
78 # file that signals if we need to reboot
79 REBOOT_REQUIRED_FILE = "/var/run/reboot-required"
80+LIVEPATCH_DESKTOP_FILE = "software-properties-livepatch.desktop"
81
82
83 class UpdateManager(Gtk.Window):
84@@ -210,6 +211,12 @@
85 finally:
86 self.start_available()
87
88+ def show_livepatch_settings(self):
89+ info = Gio.DesktopAppInfo.new(LIVEPATCH_DESKTOP_FILE)
90+
91+ if info is not None:
92+ info.launch()
93+
94 def start_update(self):
95 if self.options.no_update:
96 self.start_available()

Subscribers

People subscribed via source and target branches

to status/vote changes: