Merge lp:~mvo/software-center/builder_get_cleanup into lp:software-center

Proposed by Michael Vogt on 2012-03-23
Status: Merged
Merged at revision: 2912
Proposed branch: lp:~mvo/software-center/builder_get_cleanup
Merge into: lp:software-center
Diff against target: 112 lines (+15/-33)
2 files modified
data/ui/gtk3/SoftwareCenter.ui (+1/-1)
softwarecenter/ui/gtk3/app.py (+14/-32)
To merge this branch: bzr merge lp:~mvo/software-center/builder_get_cleanup
Reviewer Review Type Date Requested Status
Kiwinote 2012-03-23 Approve on 2012-03-23
Review via email: mp+98993@code.launchpad.net

Description of the change

This is a small cleanup branch that removes the use of self.builder.get_object() and uses them via the attributes
of the SoftwareCenterAppGtk3 class instead. SimpleGtkbuilderApp makes the widgets available automatically for us.

To post a comment you must log in.
Kiwinote (kiwinote) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/ui/gtk3/SoftwareCenter.ui'
2--- data/ui/gtk3/SoftwareCenter.ui 2012-03-20 09:45:14 +0000
3+++ data/ui/gtk3/SoftwareCenter.ui 2012-03-23 09:50:25 +0000
4@@ -129,7 +129,7 @@
5 <property name="use_underline">True</property>
6 <signal name="activate" handler="on_menu_file_activate" swapped="no"/>
7 <child type="submenu">
8- <object class="GtkMenu" id="menu1">
9+ <object class="GtkMenu" id="menu_file">
10 <property name="visible">True</property>
11 <property name="can_focus">False</property>
12 <child>
13
14=== modified file 'softwarecenter/ui/gtk3/app.py'
15--- softwarecenter/ui/gtk3/app.py 2012-03-23 09:28:37 +0000
16+++ softwarecenter/ui/gtk3/app.py 2012-03-23 09:50:25 +0000
17@@ -210,8 +210,7 @@
18
19 # Disable software-properties if it does not exist
20 if not os.path.exists("/usr/bin/software-properties-gtk"):
21- sources = self.builder.get_object("menuitem_software_sources")
22- sources.set_sensitive(False)
23+ self.menuitem_software_sources.set_sensitive(False)
24
25 with ExecutionTime("opening the pkginfo"):
26 # a main iteration friendly apt cache
27@@ -379,48 +378,35 @@
28 self.restore_state()
29
30 # Adapt menu entries
31- supported_menuitem = self.builder.get_object(
32- "menuitem_view_supported_only")
33- supported_menuitem.set_label(self.distro.get_supported_filter_name())
34- file_menu = self.builder.get_object("menu1")
35+ self.menuitem_view_supported_only.set_label(
36+ self.distro.get_supported_filter_name())
37
38 # this will be set sensitive once a the availablepane is available
39 self.menuitem_recommendations.set_sensitive(False)
40
41 if not self.distro.DEVELOPER_URL:
42- help_menu = self.builder.get_object("menu_help")
43- developer_separator = self.builder.get_object(
44- "separator_developer")
45- help_menu.remove(developer_separator)
46- developer_menuitem = self.builder.get_object("menuitem_developer")
47- help_menu.remove(developer_menuitem)
48+ self.menu_help.remove(self.separator_developer)
49+ self.menu_help.remove(self.menuitem_developer)
50
51 # Check if oneconf is available
52 och = is_oneconf_available()
53 if not och:
54- file_menu.remove(self.builder.get_object(
55- "menuitem_sync_between_computers"))
56+ self.menu_file.remove(self.menuitem_sync_between_computers)
57
58 # restore the state of the add to launcher menu item, or remove the
59 # menu item if Unity is not currently running
60- add_to_launcher_menuitem = self.builder.get_object(
61- "menuitem_add_to_launcher")
62 if is_unity_running():
63- add_to_launcher_menuitem.set_active(
64+ self.menuitem_add_to_launcher.set_active(
65 self.available_pane.add_to_launcher_enabled)
66 else:
67- view_menu = self.builder.get_object("menu_view")
68- add_to_launcher_separator = self.builder.get_object(
69- "add_to_launcher_separator")
70- view_menu.remove(add_to_launcher_separator)
71- view_menu.remove(add_to_launcher_menuitem)
72+ self.menu_view.remove(self.add_to_launcher_separator)
73+ self.menu_view.remove(self.menuitem_add_to_launcher)
74
75 # run s-c-agent update
76 if options.disable_buy or not self.distro.PURCHASE_APP_URL:
77- file_menu.remove(self.builder.get_object(
78- "menuitem_reinstall_purchases"))
79+ self.menu_file.remove(self.menuitem_reinstall_purchases)
80 if not (options.enable_lp or och):
81- file_menu.remove(self.builder.get_object("separator_login"))
82+ self.menu_file.remove(self.separator_login)
83 else:
84 # running the agent will trigger a db reload so we do it later
85 GObject.timeout_add_seconds(30, self._run_software_center_agent)
86@@ -430,9 +416,7 @@
87
88 # TODO: Remove the following two lines once we have remove repository
89 # support in aptdaemon (see LP: #723911)
90- file_menu = self.builder.get_object("menu1")
91- file_menu.remove(self.builder.get_object(
92- "menuitem_deauthorize_computer"))
93+ self.menu_file.remove(self.menuitem_deauthorize_computer)
94
95 # keep track of the current active pane
96 self.active_pane = self.available_pane
97@@ -536,13 +520,11 @@
98 self._update_recommendations_menuitem(opted_in=False)
99
100 def _update_recommendations_menuitem(self, opted_in):
101- recommendations_menuitem = self.builder.get_object(
102- "menuitem_recommendations")
103 if opted_in:
104- recommendations_menuitem.set_label(
105+ self.menuitem_recommendations.set_label(
106 _(u"Turn Off Recommendations"))
107 else:
108- recommendations_menuitem.set_label(
109+ self.menuitem_recommendations.set_label(
110 _(u"Turn On Recommendations…"))
111
112 def _on_update_software_center_agent_finished(self, pid, condition):

Subscribers

People subscribed via source and target branches