Merge ~osomon/software-properties:updates-refresh into software-properties:ubuntu/master

Proposed by Olivier Tilloy
Status: Merged
Merged at revision: b88ade8cef820b0b1b10cd5d0aae6e8c38e73787
Proposed branch: ~osomon/software-properties:updates-refresh
Merge into: software-properties:ubuntu/master
Prerequisite: ~osomon/software-properties:update-pot
Diff against target: 1196 lines (+340/-214)
3 files modified
data/gtkbuilder/main.ui (+76/-58)
po/software-properties.pot (+109/-93)
softwareproperties/gtk/SoftwarePropertiesGtk.py (+155/-63)
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Review via email: mp+379345@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Here we go: Note that I didn’t test the ppa yet. I have some comments, some suggestions, but apart from my "what if we only have updates" or so, nothing blocking once this one is answered.

Good work!

review: Needs Information
Revision history for this message
Olivier Tilloy (osomon) wrote :

Thanks for the review, much appreciated!
I have fixed the "what if we only have updates" case, thanks very much for catching it! I have also applied some suggested changes, and replied inline otherwise.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

The answers and changes look perfect to me! Thanks. I just need to do a testing round and we are good to merge/release :)

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

The basic test cases are all working as expected (including the trick "keep backport but disable security" which goes to custom).

If I try to trick by disabling main in the release pocket but keep it for -security (and others), the selection goes to Custom as expected.
Same if I disable main only for the -security pocket, the selection goes to Custom.

However, if I disable universe for the release pocket and disable it as well for -security, the selection goes from "All updates" to "All security updates". It's a little bit misleading because universe is still enabled here for -updates and -backports, I would rather fallback to custom, wdyt?

This is indeed an edge case, but I feel some of our users will fall into it and we should maybe address it?

Otherwise, I didn’t spot anything else, good work!

review: Needs Information
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Another test:
- if you disable main for the release pocket, it select "Custom" -> ack. However, if you then select another option like "All updates", nothing happens -> it’s still on Custom and sources.list isn’t fix

Revision history for this message
Olivier Tilloy (osomon) wrote :

I see what's happening here. This code only deals with additional pockets (-updates, -security, -backports, -proposed). It doesn't handle the release pocket.

Does it make sense to have additional pockets enabled while the release pocket isn't? In other words, is this a valid use case?

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

I think the use case is valid in the sense that it will be configuration that necessirally some users will have and experience. I think those use case should at least fallback to "Custom" to not show an erronous state.

At least, changing from Custom to another option should "fix" the configuration IMHO

Revision history for this message
Olivier Tilloy (osomon) wrote :

That sort of makes sense.
I updated the code to force-enable the release pocket when the previously selected option was "Custom", but that doesn't seem to have an effect. Looks the underlying backend code isn't designed to handle this case. I'll have to dig deeper.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I've been playing with this and there doesn't appear to be a clean and reliable way to programatically fix a broken sources.list: force-enabling the release pocket will enable it for certain components (main and restricted I think), but we might still end up in an inconsistent state where another pocket has other components enabled.

The backend code however tells us when there's an inconsistent state, so I would suggest making the combobox insensitive in such cases. This wouldn't allow users to automagically fix their broken sources, but at least it wouldn't give them the wrong impression that they can change their update subscriptions.

What do you think?

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Maybe check with mpt, but I think disabling the widget when it’s in "Custom" and we can’t fix it is a good stop gap solution.

The second side is the wrong detection of broken config (some components disabled in the release pockets, but not on others), do you think you can detect it and display "Custom" for them as well?

Revision history for this message
Olivier Tilloy (osomon) wrote :

Note that when some components are inconsistently disabled in e.g. the release pocket, the corresponding checkboxes on the first tab ("Ubuntu Software") should be unchecked.
So in fact the user has a way to fix their sources.list by checking those checkboxes again.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Ah, good point. Then, I think thus showing the content "upgrade" status is fine and I don’t have any further objections.

Keep me posted about the disabling state and we can merge/ship it then.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

This looks good to me, ready to be released for now! Thanks for the fixes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/data/gtkbuilder/main.ui b/data/gtkbuilder/main.ui
2index 642e45c..149954b 100644
3--- a/data/gtkbuilder/main.ui
4+++ b/data/gtkbuilder/main.ui
5@@ -8,6 +8,25 @@
6 <column type="gchararray"/>
7 </columns>
8 </object>
9+ <object class="GtkListStore" id="model_updates_subscription">
10+ <columns>
11+ <!-- column-name text -->
12+ <column type="gchararray"/>
13+ </columns>
14+ <data>
15+ <row>
16+ <col id="0" translatable="yes">All updates</col>
17+ </row>
18+ <row>
19+ <col id="0" translatable="yes">Security and recommended updates</col>
20+ </row>
21+ <row>
22+ <col id="0" translatable="yes">Security updates only</col>
23+ </row>
24+ <!-- a fourth row with translatable label "Custom" is inserted/removed
25+ dynamically in the model -->
26+ </data>
27+ </object>
28 <object class="GtkListStore" id="model_normal_updates_display">
29 <columns>
30 <!-- column-name text -->
31@@ -503,74 +522,72 @@
32 </packing>
33 </child>
34 <child>
35- <object class="GtkVBox" id="vbox8">
36+ <object class="GtkVBox">
37 <property name="visible">True</property>
38 <property name="can_focus">False</property>
39 <property name="border_width">12</property>
40 <property name="spacing">18</property>
41 <child>
42- <object class="GtkFrame" id="frame_children">
43+ <object class="GtkAlignment">
44 <property name="visible">True</property>
45 <property name="can_focus">False</property>
46- <property name="label_xalign">0</property>
47- <property name="shadow_type">none</property>
48+ <property name="top_padding">6</property>
49+ <property name="left_padding">12</property>
50 <child>
51- <object class="GtkAlignment" id="alignment7">
52+ <object class="GtkVBox">
53 <property name="visible">True</property>
54 <property name="can_focus">False</property>
55- <property name="top_padding">6</property>
56- <property name="left_padding">12</property>
57+ <property name="spacing">6</property>
58 <child>
59- <object class="GtkVBox" id="vbox_updates">
60+ <object class="GtkHBox">
61 <property name="visible">True</property>
62 <property name="can_focus">False</property>
63 <property name="spacing">6</property>
64 <child>
65- <placeholder/>
66- </child>
67- <child>
68- <placeholder/>
69+ <object class="GtkLabel" id="label_updates_1">
70+ <property name="visible">True</property>
71+ <property name="can_focus">False</property>
72+ <property name="label" translatable="yes">Subscribed to:</property>
73+ <property name="xalign">1</property>
74+ </object>
75+ <packing>
76+ <property name="expand">False</property>
77+ <property name="fill">False</property>
78+ <property name="position">0</property>
79+ </packing>
80 </child>
81 <child>
82- <placeholder/>
83+ <object class="GtkComboBox" id="combobox_updates_subscription">
84+ <property name="visible">True</property>
85+ <property name="can_focus">False</property>
86+ <property name="model">model_updates_subscription</property>
87+ <child>
88+ <object class="GtkCellRendererText"/>
89+ <attributes>
90+ <attribute name="text">0</attribute>
91+ </attributes>
92+ </child>
93+ </object>
94+ <packing>
95+ <property name="expand">True</property>
96+ <property name="fill">True</property>
97+ <property name="position">1</property>
98+ </packing>
99 </child>
100 </object>
101+ <packing>
102+ <property name="expand">False</property>
103+ <property name="fill">False</property>
104+ <property name="position">0</property>
105+ </packing>
106 </child>
107- </object>
108- </child>
109- <child type="label">
110- <object class="GtkLabel" id="label_updates">
111- <property name="visible">True</property>
112- <property name="can_focus">False</property>
113- <property name="label" translatable="yes">Install updates from:</property>
114- <property name="use_markup">True</property>
115- </object>
116- </child>
117- </object>
118- <packing>
119- <property name="expand">False</property>
120- <property name="fill">True</property>
121- <property name="position">0</property>
122- </packing>
123- </child>
124- <child>
125- <object class="GtkAlignment" id="alignment2">
126- <property name="visible">True</property>
127- <property name="can_focus">False</property>
128- <property name="top_padding">6</property>
129- <property name="left_padding">12</property>
130- <child>
131- <object class="GtkVBox" id="vbox6">
132- <property name="visible">True</property>
133- <property name="can_focus">False</property>
134- <property name="spacing">6</property>
135 <child>
136- <object class="GtkHBox" id="hbox_check_for_updates">
137+ <object class="GtkHBox">
138 <property name="visible">True</property>
139 <property name="can_focus">False</property>
140 <property name="spacing">6</property>
141 <child>
142- <object class="GtkLabel" id="label3">
143+ <object class="GtkLabel" id="label_updates_2">
144 <property name="visible">True</property>
145 <property name="can_focus">False</property>
146 <property name="label" translatable="yes">Automatically check for updates:</property>
147@@ -588,7 +605,7 @@
148 <property name="can_focus">False</property>
149 <property name="model">model_updates_interval</property>
150 <child>
151- <object class="GtkCellRendererText" id="renderer_updateinterval"/>
152+ <object class="GtkCellRendererText"/>
153 <attributes>
154 <attribute name="text">0</attribute>
155 </attributes>
156@@ -604,16 +621,16 @@
157 <packing>
158 <property name="expand">False</property>
159 <property name="fill">False</property>
160- <property name="position">0</property>
161+ <property name="position">1</property>
162 </packing>
163 </child>
164 <child>
165- <object class="GtkHBox" id="hbox1">
166+ <object class="GtkHBox">
167 <property name="visible">True</property>
168 <property name="can_focus">False</property>
169 <property name="spacing">6</property>
170 <child>
171- <object class="GtkLabel" id="label4">
172+ <object class="GtkLabel" id="label_updates_3">
173 <property name="visible">True</property>
174 <property name="can_focus">False</property>
175 <property name="label" translatable="yes">When there are security updates:</property>
176@@ -631,7 +648,7 @@
177 <property name="can_focus">False</property>
178 <property name="model">model_security_updates_display_behavior</property>
179 <child>
180- <object class="GtkCellRendererText" id="renderer_securityupdates"/>
181+ <object class="GtkCellRendererText"/>
182 <attributes>
183 <attribute name="text">0</attribute>
184 </attributes>
185@@ -647,16 +664,16 @@
186 <packing>
187 <property name="expand">False</property>
188 <property name="fill">False</property>
189- <property name="position">1</property>
190+ <property name="position">2</property>
191 </packing>
192 </child>
193 <child>
194- <object class="GtkHBox" id="hbox2">
195+ <object class="GtkHBox">
196 <property name="visible">True</property>
197 <property name="can_focus">False</property>
198 <property name="spacing">6</property>
199 <child>
200- <object class="GtkLabel" id="label5">
201+ <object class="GtkLabel" id="label_updates_4">
202 <property name="visible">True</property>
203 <property name="can_focus">False</property>
204 <property name="label" translatable="yes">When there are other updates:</property>
205@@ -674,7 +691,7 @@
206 <property name="can_focus">False</property>
207 <property name="model">model_normal_updates_display</property>
208 <child>
209- <object class="GtkCellRendererText" id="renderer_otherupdates"/>
210+ <object class="GtkCellRendererText"/>
211 <attributes>
212 <attribute name="text">0</attribute>
213 </attributes>
214@@ -690,7 +707,7 @@
215 <packing>
216 <property name="expand">False</property>
217 <property name="fill">False</property>
218- <property name="position">2</property>
219+ <property name="position">3</property>
220 </packing>
221 </child>
222 </object>
223@@ -713,7 +730,7 @@
224 <property name="can_focus">False</property>
225 <property name="spacing">6</property>
226 <child>
227- <object class="GtkLabel" id="label29">
228+ <object class="GtkLabel" id="label_updates_5">
229 <property name="visible">True</property>
230 <property name="can_focus">False</property>
231 <property name="label" translatable="yes">Notify me of a new Ubuntu version:</property>
232@@ -1406,10 +1423,11 @@
233 </object>
234 <object class="GtkSizeGroup" id="sizegroup1">
235 <widgets>
236- <widget name="label3"/>
237- <widget name="label4"/>
238- <widget name="label5"/>
239- <widget name="label29"/>
240+ <widget name="label_updates_1"/>
241+ <widget name="label_updates_2"/>
242+ <widget name="label_updates_3"/>
243+ <widget name="label_updates_4"/>
244+ <widget name="label_updates_5"/>
245 </widgets>
246 </object>
247 </interface>
248diff --git a/po/software-properties.pot b/po/software-properties.pot
249index 06e1e31..6d5c53a 100644
250--- a/po/software-properties.pot
251+++ b/po/software-properties.pot
252@@ -8,7 +8,7 @@ msgid ""
253 msgstr ""
254 "Project-Id-Version: PACKAGE VERSION\n"
255 "Report-Msgid-Bugs-To: \n"
256-"POT-Creation-Date: 2020-02-17 17:37+0100\n"
257+"POT-Creation-Date: 2020-02-26 19:01+0100\n"
258 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
259 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
260 "Language-Team: LANGUAGE <LL@li.org>\n"
261@@ -27,7 +27,7 @@ msgid "To change software repository settings, you need to authenticate."
262 msgstr ""
263
264 #: ../data/software-properties-gtk.desktop.in.h:1
265-#: ../data/gtkbuilder/main.ui.h:14
266+#: ../data/gtkbuilder/main.ui.h:17
267 msgid "Software & Updates"
268 msgstr ""
269
270@@ -59,8 +59,8 @@ msgid ""
271 msgstr ""
272
273 #: ../data/software-properties-qt.desktop.in.h:1
274-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:693
275-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:712
276+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:796
277+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:815
278 msgid "Software Sources"
279 msgstr ""
280
281@@ -254,27 +254,27 @@ msgid "Canceling..."
282 msgstr ""
283
284 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:211
285-#: ../data/gtkbuilder/main.ui.h:9
286+#: ../data/gtkbuilder/main.ui.h:12
287 msgid "Daily"
288 msgstr ""
289
290 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:212
291-#: ../data/gtkbuilder/main.ui.h:10
292+#: ../data/gtkbuilder/main.ui.h:13
293 msgid "Every two days"
294 msgstr ""
295
296 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:213
297-#: ../data/gtkbuilder/main.ui.h:11
298+#: ../data/gtkbuilder/main.ui.h:14
299 msgid "Weekly"
300 msgstr ""
301
302 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:214
303-#: ../data/gtkbuilder/main.ui.h:12
304+#: ../data/gtkbuilder/main.ui.h:15
305 msgid "Every two weeks"
306 msgstr ""
307
308 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:221
309-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:266
310+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:313
311 #, python-format
312 msgid "Every %s days"
313 msgstr ""
314@@ -291,7 +291,7 @@ msgstr ""
315 #. first %s is the description of the component
316 #. second %s is the code name of the comp, eg main, universe
317 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:282
318-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:339
319+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:386
320 #, python-format
321 msgid "%s (%s)"
322 msgstr ""
323@@ -299,33 +299,33 @@ msgstr ""
324 #. add a separator and the option to choose another mirror from the list
325 #. #FIXME server_store.append(["sep", None, True])
326 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:345
327-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:469
328-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:562
329+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:543
330+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:671
331 msgid "Other..."
332 msgstr ""
333
334 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:713
335-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:985
336+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1081
337 msgid "Import key"
338 msgstr ""
339
340 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:716
341-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:999
342+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1095
343 msgid "Error importing selected file"
344 msgstr ""
345
346 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:717
347-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1000
348+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1096
349 msgid "The selected file may not be a GPG key file or it might be corrupt."
350 msgstr ""
351
352 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:730
353-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1016
354+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1111
355 msgid "Error removing the key"
356 msgstr ""
357
358 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:731
359-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1017
360+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1112
361 msgid "The key you selected could not be removed. Please report this as a bug."
362 msgstr ""
363
364@@ -360,86 +360,86 @@ msgid "CD Error"
365 msgstr ""
366
367 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:815
368-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:851
369+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:952
370 msgid "Error scanning the CD"
371 msgstr ""
372
373 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:857
374-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1080
375+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1172
376 msgid "Error while applying changes"
377 msgstr ""
378
379 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1101
380-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1313
381+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1405
382 msgid "This device is using the recommended driver."
383 msgstr ""
384
385 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1103
386-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1314
387+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1406
388 msgid "This device is using an alternative driver."
389 msgstr ""
390
391 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1105
392-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1315
393+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1407
394 msgid "This device is using a manually-installed driver."
395 msgstr ""
396
397 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1106
398-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1316
399+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1408
400 msgid "This device is not working."
401 msgstr ""
402
403 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1115
404-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1325
405+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1417
406 msgid "Continue using a manually installed driver"
407 msgstr ""
408
409 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1142
410-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1352
411+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1444
412 msgid "Using {} from {}"
413 msgstr ""
414
415 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1144
416-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1354
417+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1446
418 msgid "Using {}"
419 msgstr ""
420
421 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1151
422-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1361
423+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1453
424 msgid "open source"
425 msgstr ""
426
427 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1153
428-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1363
429+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1455
430 msgid "proprietary"
431 msgstr ""
432
433 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1156
434-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1366
435+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1458
436 #, python-brace-format
437 msgid "{base_description} ({licence}, tested)"
438 msgstr ""
439
440 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1158
441-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1368
442+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1460
443 #, python-brace-format
444 msgid "{base_description} ({licence})"
445 msgstr ""
446
447 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1176
448-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1388
449+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1480
450 msgid "Do not use the device"
451 msgstr ""
452
453 #. 1 for priority over the icon to stretch
454 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1219
455-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1426
456+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1518
457 msgid "Unknown"
458 msgstr ""
459
460 #: ../softwareproperties/qt/SoftwarePropertiesQt.py:1287
461-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1494
462-#: ../data/gtkbuilder/main.ui.h:37
463+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1586
464+#: ../data/gtkbuilder/main.ui.h:40
465 msgid "No proprietary drivers are in use."
466 msgstr ""
467
468@@ -477,7 +477,7 @@ msgstr ""
469 msgid "Binary"
470 msgstr ""
471
472-#: ../softwareproperties/qt/DialogEdit.py:44 ../data/gtkbuilder/main.ui.h:15
473+#: ../softwareproperties/qt/DialogEdit.py:44 ../data/gtkbuilder/main.ui.h:18
474 msgid "Source code"
475 msgstr ""
476
477@@ -521,77 +521,81 @@ msgid "Completed %s of %s tests"
478 msgstr ""
479
480 #. TRANS: %s stands for the distribution name e.g. Debian or Ubuntu
481-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:326
482+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:373
483 #, python-format
484 msgid "%s Software"
485 msgstr ""
486
487-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:703
488-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:722
489+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:485
490+msgid "Custom"
491+msgstr ""
492+
493+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:806
494+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:825
495 msgid "Active"
496 msgstr ""
497
498-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:761
499+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:863
500 msgid "Key"
501 msgstr ""
502
503-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:778
504+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:880
505 msgid "_Add key from paste data"
506 msgstr ""
507
508-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:791
509-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:802
510+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:893
511+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:904
512 msgid "Error importing key"
513 msgstr ""
514
515-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:792
516-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:803
517+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:894
518+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:905
519 msgid "The selected data may not be a GPG key file or it might be corrupt."
520 msgstr ""
521
522-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:852
523+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:953
524 msgid "Could not find a suitable CD."
525 msgstr ""
526
527-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1069
528+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1161
529 msgid "Applying changes..."
530 msgstr ""
531
532-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1188
533-#: ../data/gtkbuilder/main.ui.h:45
534+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1280
535+#: ../data/gtkbuilder/main.ui.h:48
536 msgid "Re_vert"
537 msgstr ""
538
539-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1190
540+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1282
541 msgid "_Apply Changes"
542 msgstr ""
543
544-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1192
545+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1284
546 msgid "_Cancel"
547 msgstr ""
548
549-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1194
550+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1286
551 msgid "_Restart..."
552 msgstr ""
553
554-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1209
555+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1301
556 msgid "Searching for available drivers..."
557 msgstr ""
558
559-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1239
560+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1331
561 msgid "An error occurred while searching for drivers."
562 msgstr ""
563
564 #. No drivers found.
565-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1408
566+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1500
567 msgid "No additional drivers available."
568 msgstr ""
569
570-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1475
571+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1567
572 msgid "You need to restart the computer to complete the driver changes."
573 msgstr ""
574
575-#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1489
576+#: ../softwareproperties/gtk/SoftwarePropertiesGtk.py:1581
577 #, python-format
578 msgid "%(count)d proprietary driver in use."
579 msgid_plural "%(count)d proprietary drivers in use."
580@@ -809,160 +813,172 @@ msgid "Scanning CD-ROM"
581 msgstr ""
582
583 #: ../data/gtkbuilder/main.ui.h:1
584-msgid "Display immediately"
585+msgid "All updates"
586 msgstr ""
587
588 #: ../data/gtkbuilder/main.ui.h:2
589-msgid "Display weekly"
590+msgid "Security and recommended updates"
591 msgstr ""
592
593 #: ../data/gtkbuilder/main.ui.h:3
594-msgid "Display every two weeks"
595+msgid "Security updates only"
596 msgstr ""
597
598 #: ../data/gtkbuilder/main.ui.h:4
599-msgid "For any new version"
600+msgid "Display immediately"
601 msgstr ""
602
603 #: ../data/gtkbuilder/main.ui.h:5
604-msgid "For long-term support versions"
605+msgid "Display weekly"
606 msgstr ""
607
608 #: ../data/gtkbuilder/main.ui.h:6
609-msgid "Never"
610+msgid "Display every two weeks"
611 msgstr ""
612
613 #: ../data/gtkbuilder/main.ui.h:7
614-msgid "Download automatically"
615+msgid "For any new version"
616 msgstr ""
617
618 #: ../data/gtkbuilder/main.ui.h:8
619+msgid "For long-term support versions"
620+msgstr ""
621+
622+#: ../data/gtkbuilder/main.ui.h:9
623+msgid "Never"
624+msgstr ""
625+
626+#: ../data/gtkbuilder/main.ui.h:10
627+msgid "Download automatically"
628+msgstr ""
629+
630+#: ../data/gtkbuilder/main.ui.h:11
631 msgid "Download and install automatically"
632 msgstr ""
633
634-#: ../data/gtkbuilder/main.ui.h:13
635+#: ../data/gtkbuilder/main.ui.h:16
636 msgid "To install from a CD-ROM or DVD, insert the medium into the drive."
637 msgstr ""
638
639-#: ../data/gtkbuilder/main.ui.h:16
640+#: ../data/gtkbuilder/main.ui.h:19
641 msgid "Download from:"
642 msgstr ""
643
644-#: ../data/gtkbuilder/main.ui.h:17
645+#: ../data/gtkbuilder/main.ui.h:20
646 msgid "<b>Downloadable from the Internet</b>"
647 msgstr ""
648
649-#: ../data/gtkbuilder/main.ui.h:18
650+#: ../data/gtkbuilder/main.ui.h:21
651 msgid "<b>Installable from CD-ROM/DVD</b>"
652 msgstr ""
653
654-#: ../data/gtkbuilder/main.ui.h:19
655+#: ../data/gtkbuilder/main.ui.h:22
656 msgid "Add..."
657 msgstr ""
658
659-#: ../data/gtkbuilder/main.ui.h:20
660+#: ../data/gtkbuilder/main.ui.h:23
661 msgid "Edit..."
662 msgstr ""
663
664-#: ../data/gtkbuilder/main.ui.h:21
665+#: ../data/gtkbuilder/main.ui.h:24
666 msgid "Add Volume..."
667 msgstr ""
668
669-#: ../data/gtkbuilder/main.ui.h:22
670+#: ../data/gtkbuilder/main.ui.h:25
671 msgid "Other Software"
672 msgstr ""
673
674-#: ../data/gtkbuilder/main.ui.h:23
675-msgid "Install updates from:"
676+#: ../data/gtkbuilder/main.ui.h:26
677+msgid "Subscribed to:"
678 msgstr ""
679
680-#: ../data/gtkbuilder/main.ui.h:24
681+#: ../data/gtkbuilder/main.ui.h:27
682 msgid "Automatically check for updates:"
683 msgstr ""
684
685-#: ../data/gtkbuilder/main.ui.h:25
686+#: ../data/gtkbuilder/main.ui.h:28
687 msgid "When there are security updates:"
688 msgstr ""
689
690-#: ../data/gtkbuilder/main.ui.h:26
691+#: ../data/gtkbuilder/main.ui.h:29
692 msgid "When there are other updates:"
693 msgstr ""
694
695-#: ../data/gtkbuilder/main.ui.h:27
696+#: ../data/gtkbuilder/main.ui.h:30
697 msgid "Notify me of a new Ubuntu version:"
698 msgstr ""
699
700-#: ../data/gtkbuilder/main.ui.h:28
701+#: ../data/gtkbuilder/main.ui.h:31
702 msgid "Updates"
703 msgstr ""
704
705-#: ../data/gtkbuilder/main.ui.h:29
706+#: ../data/gtkbuilder/main.ui.h:32
707 msgid "<b>Trusted software providers</b>"
708 msgstr ""
709
710-#: ../data/gtkbuilder/main.ui.h:30
711+#: ../data/gtkbuilder/main.ui.h:33
712 msgid " "
713 msgstr ""
714
715-#: ../data/gtkbuilder/main.ui.h:31
716+#: ../data/gtkbuilder/main.ui.h:34
717 msgid ""
718 "Keys are used to authenticate the correct source of software and so protect "
719 "your computer from malicious software"
720 msgstr ""
721
722-#: ../data/gtkbuilder/main.ui.h:32
723+#: ../data/gtkbuilder/main.ui.h:35
724 msgid "_Import Key File..."
725 msgstr ""
726
727-#: ../data/gtkbuilder/main.ui.h:33
728+#: ../data/gtkbuilder/main.ui.h:36
729 msgid "Import the public key from a trusted software provider"
730 msgstr ""
731
732-#: ../data/gtkbuilder/main.ui.h:34
733+#: ../data/gtkbuilder/main.ui.h:37
734 msgid "Restore _Defaults"
735 msgstr ""
736
737-#: ../data/gtkbuilder/main.ui.h:35
738+#: ../data/gtkbuilder/main.ui.h:38
739 msgid "Restore the default keys of your distribution"
740 msgstr ""
741
742-#: ../data/gtkbuilder/main.ui.h:36
743+#: ../data/gtkbuilder/main.ui.h:39
744 msgid "Authentication"
745 msgstr ""
746
747-#: ../data/gtkbuilder/main.ui.h:38
748+#: ../data/gtkbuilder/main.ui.h:41
749 msgid ""
750 "<small>A proprietary driver has private code that Ubuntu developers can't "
751 "review or improve. Security and other updates are dependent on the driver "
752 "vendor.</small>"
753 msgstr ""
754
755-#: ../data/gtkbuilder/main.ui.h:39
756+#: ../data/gtkbuilder/main.ui.h:42
757 msgid "Additional Drivers"
758 msgstr ""
759
760-#: ../data/gtkbuilder/main.ui.h:40
761+#: ../data/gtkbuilder/main.ui.h:43
762 msgid ""
763 "Use proposed updates if you’re willing to report bugs on any problems that "
764 "occur."
765 msgstr ""
766
767-#: ../data/gtkbuilder/main.ui.h:41
768+#: ../data/gtkbuilder/main.ui.h:44
769 msgid "Developer Options"
770 msgstr ""
771
772-#: ../data/gtkbuilder/main.ui.h:42
773+#: ../data/gtkbuilder/main.ui.h:45
774 msgid ""
775 "Canonical Livepatch helps keep your system secure by applying security "
776 "updates that don't require a restart. <a href=\"https://www.ubuntu.com/"
777 "livepatch\">Learn More</a>"
778 msgstr ""
779
780-#: ../data/gtkbuilder/main.ui.h:43
781+#: ../data/gtkbuilder/main.ui.h:46
782 msgid "column"
783 msgstr ""
784
785-#: ../data/gtkbuilder/main.ui.h:44
786+#: ../data/gtkbuilder/main.ui.h:47
787 msgid "Show Livepatch status in the top bar"
788 msgstr ""
789
790diff --git a/softwareproperties/gtk/SoftwarePropertiesGtk.py b/softwareproperties/gtk/SoftwarePropertiesGtk.py
791index ae35ec0..c38d406 100644
792--- a/softwareproperties/gtk/SoftwarePropertiesGtk.py
793+++ b/softwareproperties/gtk/SoftwarePropertiesGtk.py
794@@ -1,12 +1,13 @@
795 # GTK+ based frontend to software-properties
796 #
797-# Copyright (c) 2004-2018 Canonical Ltd.
798+# Copyright (c) 2004-2020 Canonical Ltd.
799 # 2004-2005 Michiel Sikkes
800 #
801 # Author: Michiel Sikkes <michiel@eyesopened.nl>
802 # Michael Vogt <mvo@debian.org>
803 # Sebastian Heinlein <glatzor@ubuntu.com>
804 # Andrea Azzarone <andrea.azzarone@canonical.com>
805+# Olivier Tilloy <olivier.tilloy@canonical.com>
806 #
807 # This program is free software; you can redistribute it and/or
808 # modify it under the terms of the GNU General Public License as
809@@ -83,6 +84,52 @@ RESPONSE_ADD = 2
810 STORE_VISIBLE
811 ) = list(range(5))
812
813+# rows for the updates subscription combobox
814+(
815+ UPDATES_ALL,
816+ UPDATES_RECOMMENDED,
817+ UPDATES_SECURITY,
818+ UPDATES_CUSTOM,
819+) = range(4)
820+
821+# names of the pockets
822+POCKET_SECURITY = "security"
823+POCKET_UPDATES = "updates"
824+POCKET_BACKPORTS = "backports"
825+
826+
827+class UpdateSubscriptions(object):
828+ security = False
829+ updates = False
830+ backports = False
831+ other = False
832+ inconsistent = False
833+
834+ def get_status(self):
835+ if self.other:
836+ return UPDATES_CUSTOM
837+ if self.security and self.updates and self.backports:
838+ return UPDATES_ALL
839+ elif self.security and self.updates and not self.backports:
840+ return UPDATES_RECOMMENDED
841+ elif self.security and not self.updates and not self.backports:
842+ return UPDATES_SECURITY
843+ return UPDATES_CUSTOM
844+
845+
846+def maybe_log_authentication_canceled_error(dbus_exception):
847+ """Log an error if the DBus exception was raised because the user canceled
848+ the authentication prompt shown when changing apt sources/configuration.
849+
850+ Return True if it is, so that calling code can do further processing,
851+ False otherwise.
852+ """
853+ if dbus_exception._dbus_error_name == \
854+ 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
855+ logging.error("Authentication canceled, changes have not been saved")
856+ return True
857+ return False
858+
859
860 def error(parent_window, summary, msg):
861 """ show a error dialog """
862@@ -347,29 +394,28 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
863 self.vbox_dist_comps.add(checkbox)
864 checkbox.show()
865
866- # Setup the checkbuttons for the child repos / updates
867- for checkbutton in self.vbox_updates.get_children():
868- self.vbox_updates.remove(checkbutton)
869+ # Setup the checkbuttons for the child repos
870 for checkbutton in self.dev_box.get_children():
871 self.dev_box.remove(checkbutton)
872- if len(self.distro.source_template.children) < 1:
873- self.frame_children.hide()
874 for template in self.distro.source_template.children:
875 # Do not show source entries in there
876 if template.type == "deb-src":
877 continue
878-
879- checkbox = Gtk.CheckButton(label="%s (%s)" % (template.description,
880- template.name))
881- checkbox.template = template
882- self.handlers[checkbox] = checkbox.connect("toggled",
883- self.on_checkbutton_child_toggled,
884- template)
885 if "proposed" in template.name:
886+ checkbox = Gtk.CheckButton(label="%s (%s)" % (template.description,
887+ template.name))
888+ checkbox.template = template
889+ self.handlers[checkbox] = \
890+ checkbox.connect("toggled",
891+ self.on_checkbutton_child_toggled,
892+ template)
893 self.dev_box.add(checkbox)
894- else:
895- self.vbox_updates.add(checkbox)
896- checkbox.show()
897+ checkbox.show()
898+
899+ # Setup the combo box for updates subscriptions
900+ combobox = self.combobox_updates_subscription
901+ self.handlers[combobox] = combobox.connect(
902+ "changed", self.on_combobox_updates_subscription_changed)
903
904 # setup the server chooser
905 cell = Gtk.CellRendererText()
906@@ -398,12 +444,6 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
907 self.block_handlers()
908
909 # Enable or disable the child source checkbuttons
910- for checkbox in self.vbox_updates.get_children():
911- (active, inconsistent) = self.get_comp_child_state(checkbox.template)
912- checkbox.set_active(active)
913- checkbox.set_inconsistent(inconsistent)
914-
915- # Enable or disable the child source checkbuttons
916 for checkbox in self.dev_box.get_children():
917 (active, inconsistent) = self.get_comp_child_state(checkbox.template)
918 checkbox.set_active(active)
919@@ -416,14 +456,48 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
920 checkbox.set_inconsistent(inconsistent)
921 checkbox.set_active(active)
922
923+ # Refresh the combo box for updates subscriptions
924+ subscriptions = UpdateSubscriptions()
925+ for template in self.distro.source_template.children:
926+ # Do not show source entries in there
927+ if template.type == "deb-src":
928+ continue
929+ pocket = template.name.split('-')[-1]
930+ (active, inconsistent) = self.get_comp_child_state(template)
931+ subscriptions.inconsistent |= inconsistent
932+ if active:
933+ if pocket == POCKET_SECURITY:
934+ subscriptions.security = True
935+ elif pocket == POCKET_UPDATES:
936+ subscriptions.updates = True
937+ elif pocket == POCKET_BACKPORTS:
938+ subscriptions.backports = True
939+ else:
940+ subscriptions.other = True
941+
942+ status = subscriptions.get_status()
943+ combobox = self.combobox_updates_subscription
944+ model = combobox.get_model()
945+ if status == UPDATES_CUSTOM:
946+ try:
947+ model.get_iter_from_string(str(UPDATES_CUSTOM))
948+ except ValueError:
949+ model.append([_("Custom")])
950+ else:
951+ try:
952+ model.remove(model.get_iter_from_string(str(UPDATES_CUSTOM)))
953+ except ValueError:
954+ pass
955+ combobox.set_active(status)
956+ combobox.set_sensitive(not subscriptions.inconsistent)
957+
958 # If no components are enabled there will be no need for updates
959 # and source code
960 if len(self.distro.enabled_comps) < 1:
961- self.vbox_updates.set_sensitive(False)
962+ self.combobox_updates_subscription.set_sensitive(False)
963 self.dev_box.set_sensitive(False)
964 self.checkbutton_source_code.set_sensitive(False)
965 else:
966- self.vbox_updates.set_sensitive(True)
967 self.dev_box.set_sensitive(True)
968 self.checkbutton_source_code.set_sensitive(True)
969
970@@ -510,9 +584,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
971 if state != self.get_update_automation_level():
972 self.backend.SetUpdateAutomationLevel(state)
973 except dbus.DBusException as e:
974- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
975- logging.error("Authentication canceled, changes have not been saved")
976-
977+ if maybe_log_authentication_canceled_error(e):
978 combo_handler = self.handlers[self.combobox_security_updates]
979 self.combobox_security_updates.handler_block(combo_handler)
980 self.set_security_update_level()
981@@ -537,15 +609,52 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
982 try:
983 self.backend.SetReleaseUpgradesPolicy(i)
984 except dbus.DBusException as e:
985- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
986- logging.error("Authentication canceled, changes have not been saved")
987-
988+ if maybe_log_authentication_canceled_error(e):
989 combo_handler = self.handlers[self.combobox_release_upgrades]
990 self.combobox_release_upgrades.handler_block(combo_handler)
991 i = self.get_release_upgrades_policy()
992 self.combobox_release_upgrades.set_active(i)
993 self.combobox_release_upgrades.handler_unblock(combo_handler)
994
995+ def on_combobox_updates_subscription_changed(self, combobox):
996+ index = combobox.get_active()
997+ if index != UPDATES_CUSTOM:
998+ model = combobox.get_model()
999+ try:
1000+ model.remove(model.get_iter_from_string(str(UPDATES_CUSTOM)))
1001+ except ValueError:
1002+ pass
1003+
1004+ def _toggle_child_source(pocket, enabled):
1005+ source = "{}-{}".format(self.distro.codename, pocket)
1006+ if enabled:
1007+ logging.info("enabling {}".format(source))
1008+ self.backend.EnableChildSource(source)
1009+ else:
1010+ logging.info("disabling {}".format(source))
1011+ self.backend.DisableChildSource(source)
1012+
1013+ try:
1014+ if index == UPDATES_ALL:
1015+ _toggle_child_source(POCKET_SECURITY, True)
1016+ _toggle_child_source(POCKET_UPDATES, True)
1017+ _toggle_child_source(POCKET_BACKPORTS, True)
1018+ elif index == UPDATES_RECOMMENDED:
1019+ _toggle_child_source(POCKET_SECURITY, True)
1020+ _toggle_child_source(POCKET_UPDATES, True)
1021+ _toggle_child_source(POCKET_BACKPORTS, False)
1022+ elif index == UPDATES_SECURITY:
1023+ _toggle_child_source(POCKET_SECURITY, True)
1024+ _toggle_child_source(POCKET_UPDATES, False)
1025+ _toggle_child_source(POCKET_BACKPORTS, False)
1026+ for template in self.distro.source_template.children:
1027+ if template.type == "deb-src":
1028+ continue
1029+ pocket = template.name.split('-')[-1]
1030+ if pocket not in (POCKET_SECURITY, POCKET_UPDATES, POCKET_BACKPORTS):
1031+ _toggle_child_source(pocket, False)
1032+ except dbus.DBusException as e:
1033+ maybe_log_authentication_canceled_error(e)
1034
1035 def on_combobox_server_changed(self, combobox):
1036 """
1037@@ -573,8 +682,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1038 self.active_server = combobox.get_active()
1039 self.backend.ChangeMainDownloadServer(uri)
1040 except dbus.DBusException as e:
1041- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1042- logging.error("Authentication canceled, changes have not been saved")
1043+ maybe_log_authentication_canceled_error(e)
1044
1045 # mvo: is this still needed?
1046 #else:
1047@@ -591,8 +699,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1048 else:
1049 self.backend.DisableComponent(comp)
1050 except dbus.DBusException as e:
1051- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1052- logging.error("Authentication canceled, changes have not been saved")
1053+ maybe_log_authentication_canceled_error(e)
1054
1055 def on_checkbutton_child_toggled(self, checkbutton, template):
1056 """
1057@@ -604,8 +711,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1058 else:
1059 self.backend.EnableChildSource(template.name)
1060 except dbus.DBusException as e:
1061- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1062- logging.error("Authentication canceled, changes have not been saved")
1063+ maybe_log_authentication_canceled_error(e)
1064
1065 def on_checkbutton_source_code_toggled(self, checkbutton):
1066 """ Disable or enable the source code for all sources """
1067@@ -615,8 +721,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1068 else:
1069 self.backend.DisableSourceCodeSources()
1070 except dbus.DBusException as e:
1071- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1072- logging.error("Authentication canceled, changes have not been saved")
1073+ maybe_log_authentication_canceled_error(e)
1074
1075 def on_checkbutton_popcon_toggled(self, widget):
1076 """ The user clicked on the popcon paritipcation button """
1077@@ -626,8 +731,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1078 try:
1079 self.backend.SetPopconPariticipation(widget.get_active())
1080 except dbus.DBusException as e:
1081- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1082- logging.error("Authentication canceled, changes have not been saved")
1083+ maybe_log_authentication_canceled_error(e)
1084
1085 def open_file(self, file):
1086 """Show a confirmation for adding the channels of the specified file"""
1087@@ -645,8 +749,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1088 for source in new_sources:
1089 self.backend.AddSourceFromLine(str(source))
1090 except dbus.DBusException as e:
1091- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1092- logging.error("Authentication canceled, changes have not been saved")
1093+ maybe_log_authentication_canceled_error(e)
1094
1095 def on_sources_drag_data_received(self, widget, context, x, y,
1096 selection, target_type, timestamp):
1097@@ -750,8 +853,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1098 try:
1099 self.backend.ToggleSourceUse(str(source_entry))
1100 except dbus.DBusException as e:
1101- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1102- logging.error("Authentication canceled, changes have not been saved")
1103+ maybe_log_authentication_canceled_error(e)
1104
1105 def init_keys(self):
1106 """Setup the user interface parts needed for the key handling"""
1107@@ -812,8 +914,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1108 try:
1109 self.backend.Revert()
1110 except dbus.DBusException as e:
1111- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1112- logging.error("Authentication canceled, changes have not been saved")
1113+ maybe_log_authentication_canceled_error(e)
1114 if self.settings:
1115 self.settings.set_int("regular-auto-launch-interval", self.initial_auto_launch)
1116 self.show_auto_update_level()
1117@@ -897,9 +998,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1118 try:
1119 self.backend.SetUpdateInterval(value)
1120 except dbus.DBusException as e:
1121- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1122- logging.error("Authentication canceled, changes have not been saved")
1123-
1124+ if maybe_log_authentication_canceled_error(e):
1125 update_days = self.get_update_interval()
1126 combo_handler = self.handlers[self.combobox_update_interval]
1127 for key in self.combobox_interval_mapping:
1128@@ -918,8 +1017,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1129 try:
1130 self.backend.AddSourceFromLine(line)
1131 except dbus.DBusException as e:
1132- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1133- logging.error("Authentication canceled, changes have not been saved")
1134+ maybe_log_authentication_canceled_error(e)
1135
1136 def on_edit_clicked(self, widget):
1137 """Show a dialog to edit an ISV source"""
1138@@ -935,8 +1033,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1139 self.backend.ReplaceSourceEntry(str(old_source_entry),
1140 str(dialog.new_source_entry))
1141 except dbus.DBusException as e:
1142- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1143- logging.error("Authentication canceled, changes have not been saved")
1144+ maybe_log_authentication_canceled_error(e)
1145
1146 # FIXME:outstanding from merge
1147 def on_isv_source_activated(self, treeview, path, column):
1148@@ -976,8 +1073,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1149 try:
1150 self.backend.RemoveSource(str(source_entry))
1151 except dbus.DBusException as e:
1152- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1153- logging.error("Authentication canceled, changes have not been saved")
1154+ maybe_log_authentication_canceled_error(e)
1155
1156 def add_key_clicked(self, widget):
1157 """Provide a file chooser that allows to add the gnupg of a trusted
1158@@ -1000,8 +1096,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1159 _("The selected file may not be a GPG key file "
1160 "or it might be corrupt."))
1161 except dbus.DBusException as e:
1162- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1163- logging.error("Authentication canceled, changes have not been saved")
1164+ maybe_log_authentication_canceled_error(e)
1165
1166 def remove_key_clicked(self, widget):
1167 """Remove a trusted software vendor key"""
1168@@ -1017,16 +1112,14 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1169 _("The key you selected could not be removed. "
1170 "Please report this as a bug."))
1171 except dbus.DBusException as e:
1172- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1173- logging.error("Authentication canceled, changes have not been saved")
1174+ maybe_log_authentication_canceled_error(e)
1175
1176 def on_restore_clicked(self, widget):
1177 """Restore the original keys"""
1178 try:
1179 self.backend.UpdateKeys()
1180 except dbus.DBusException as e:
1181- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1182- logging.error("Authentication canceled, changes have not been saved")
1183+ maybe_log_authentication_canceled_error(e)
1184
1185 def on_delete_event(self, widget, args):
1186 """Close the window if requested"""
1187@@ -1054,8 +1147,7 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
1188 try:
1189 self.backend.AddCdromSource()
1190 except dbus.DBusException as e:
1191- if e._dbus_error_name == 'com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy':
1192- logging.error("Authentication canceled, changes have not been saved")
1193+ maybe_log_authentication_canceled_error(e)
1194
1195 def on_driver_changes_progress(self, progress, ptype, data=None):
1196 #print(progress)

Subscribers

People subscribed via source and target branches