Merge lp:~mvo/software-center/config-tweak into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 2942
Proposed branch: lp:~mvo/software-center/config-tweak
Merge into: lp:software-center
Diff against target: 58 lines (+3/-9)
4 files modified
softwarecenter/backend/recagent.py (+0/-4)
softwarecenter/config.py (+3/-0)
softwarecenter/ui/gtk3/app.py (+0/-2)
softwarecenter/ui/gtk3/views/purchaseview.py (+0/-3)
To merge this branch: bzr merge lp:~mvo/software-center/config-tweak
Reviewer Review Type Date Requested Status
Kiwinote Approve
Gary Lasker Pending
Review via email: mp+100492@code.launchpad.net

Description of the change

Drive-by cleanup to avoid having to check for has_section/add_section and instead define the "general" section
directly in the SoftwareCenterConfig class

To post a comment you must log in.
Revision history for this message
Kiwinote (kiwinote) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/backend/recagent.py'
2--- softwarecenter/backend/recagent.py 2012-04-02 17:33:08 +0000
3+++ softwarecenter/backend/recagent.py 2012-04-02 18:25:31 +0000
4@@ -113,13 +113,9 @@
5 return recommender_profile_id
6
7 def _set_recommender_profile_id(self, profile_id):
8- if not self.config.has_section("general"):
9- self.config.add_section("general")
10 self.config.set("general", "recommender_profile_id", profile_id)
11
12 def _set_recommender_uuid(self, uuid):
13- if not self.config.has_section("general"):
14- self.config.add_section("general")
15 self.config.set("general", "recommender_uuid", uuid)
16
17 def post_submit_profile(self, db):
18
19=== modified file 'softwarecenter/config.py'
20--- softwarecenter/config.py 2012-03-15 10:43:13 +0000
21+++ softwarecenter/config.py 2012-04-02 18:25:31 +0000
22@@ -33,6 +33,9 @@
23 SafeConfigParser.__init__(self)
24 if not os.path.exists(os.path.dirname(config)):
25 os.makedirs(os.path.dirname(config))
26+ # we always want this section, even on fresh installs
27+ self.add_section("general")
28+ # read the config
29 self.configfile = config
30 try:
31 self.read(self.configfile)
32
33=== modified file 'softwarecenter/ui/gtk3/app.py'
34--- softwarecenter/ui/gtk3/app.py 2012-04-02 16:27:30 +0000
35+++ softwarecenter/ui/gtk3/app.py 2012-04-02 18:25:31 +0000
36@@ -1310,8 +1310,6 @@
37 window = self.window_main.get_window()
38 if window is None:
39 return
40- if not self.config.has_section("general"):
41- self.config.add_section("general")
42 maximized = window.get_state() & Gdk.WindowState.MAXIMIZED
43 if maximized:
44 self.config.set("general", "maximized", "True")
45
46=== modified file 'softwarecenter/ui/gtk3/views/purchaseview.py'
47--- softwarecenter/ui/gtk3/views/purchaseview.py 2012-03-26 11:31:21 +0000
48+++ softwarecenter/ui/gtk3/views/purchaseview.py 2012-04-02 18:25:31 +0000
49@@ -138,9 +138,6 @@
50 res = show_accept_tos_dialog(get_parent(self))
51 if not res:
52 return False
53- # config parser will not add sections automatically :/
54- if not self.config.has_section("general"):
55- self.config.add_section("general")
56 self.config.set("general", "accepted_tos", "yes")
57 return True
58 return True

Subscribers

People subscribed via source and target branches