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

Proposed by Michael Vogt
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 Approve
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.
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
=== modified file 'data/ui/gtk3/SoftwareCenter.ui'
--- data/ui/gtk3/SoftwareCenter.ui 2012-03-20 09:45:14 +0000
+++ data/ui/gtk3/SoftwareCenter.ui 2012-03-23 09:50:25 +0000
@@ -129,7 +129,7 @@
129 <property name="use_underline">True</property>129 <property name="use_underline">True</property>
130 <signal name="activate" handler="on_menu_file_activate" swapped="no"/>130 <signal name="activate" handler="on_menu_file_activate" swapped="no"/>
131 <child type="submenu">131 <child type="submenu">
132 <object class="GtkMenu" id="menu1">132 <object class="GtkMenu" id="menu_file">
133 <property name="visible">True</property>133 <property name="visible">True</property>
134 <property name="can_focus">False</property>134 <property name="can_focus">False</property>
135 <child>135 <child>
136136
=== modified file 'softwarecenter/ui/gtk3/app.py'
--- softwarecenter/ui/gtk3/app.py 2012-03-23 09:28:37 +0000
+++ softwarecenter/ui/gtk3/app.py 2012-03-23 09:50:25 +0000
@@ -210,8 +210,7 @@
210210
211 # Disable software-properties if it does not exist211 # Disable software-properties if it does not exist
212 if not os.path.exists("/usr/bin/software-properties-gtk"):212 if not os.path.exists("/usr/bin/software-properties-gtk"):
213 sources = self.builder.get_object("menuitem_software_sources")213 self.menuitem_software_sources.set_sensitive(False)
214 sources.set_sensitive(False)
215214
216 with ExecutionTime("opening the pkginfo"):215 with ExecutionTime("opening the pkginfo"):
217 # a main iteration friendly apt cache216 # a main iteration friendly apt cache
@@ -379,48 +378,35 @@
379 self.restore_state()378 self.restore_state()
380379
381 # Adapt menu entries380 # Adapt menu entries
382 supported_menuitem = self.builder.get_object(381 self.menuitem_view_supported_only.set_label(
383 "menuitem_view_supported_only")382 self.distro.get_supported_filter_name())
384 supported_menuitem.set_label(self.distro.get_supported_filter_name())
385 file_menu = self.builder.get_object("menu1")
386383
387 # this will be set sensitive once a the availablepane is available384 # this will be set sensitive once a the availablepane is available
388 self.menuitem_recommendations.set_sensitive(False)385 self.menuitem_recommendations.set_sensitive(False)
389386
390 if not self.distro.DEVELOPER_URL:387 if not self.distro.DEVELOPER_URL:
391 help_menu = self.builder.get_object("menu_help")388 self.menu_help.remove(self.separator_developer)
392 developer_separator = self.builder.get_object(389 self.menu_help.remove(self.menuitem_developer)
393 "separator_developer")
394 help_menu.remove(developer_separator)
395 developer_menuitem = self.builder.get_object("menuitem_developer")
396 help_menu.remove(developer_menuitem)
397390
398 # Check if oneconf is available391 # Check if oneconf is available
399 och = is_oneconf_available()392 och = is_oneconf_available()
400 if not och:393 if not och:
401 file_menu.remove(self.builder.get_object(394 self.menu_file.remove(self.menuitem_sync_between_computers)
402 "menuitem_sync_between_computers"))
403395
404 # restore the state of the add to launcher menu item, or remove the396 # restore the state of the add to launcher menu item, or remove the
405 # menu item if Unity is not currently running397 # menu item if Unity is not currently running
406 add_to_launcher_menuitem = self.builder.get_object(
407 "menuitem_add_to_launcher")
408 if is_unity_running():398 if is_unity_running():
409 add_to_launcher_menuitem.set_active(399 self.menuitem_add_to_launcher.set_active(
410 self.available_pane.add_to_launcher_enabled)400 self.available_pane.add_to_launcher_enabled)
411 else:401 else:
412 view_menu = self.builder.get_object("menu_view")402 self.menu_view.remove(self.add_to_launcher_separator)
413 add_to_launcher_separator = self.builder.get_object(403 self.menu_view.remove(self.menuitem_add_to_launcher)
414 "add_to_launcher_separator")
415 view_menu.remove(add_to_launcher_separator)
416 view_menu.remove(add_to_launcher_menuitem)
417404
418 # run s-c-agent update405 # run s-c-agent update
419 if options.disable_buy or not self.distro.PURCHASE_APP_URL:406 if options.disable_buy or not self.distro.PURCHASE_APP_URL:
420 file_menu.remove(self.builder.get_object(407 self.menu_file.remove(self.menuitem_reinstall_purchases)
421 "menuitem_reinstall_purchases"))
422 if not (options.enable_lp or och):408 if not (options.enable_lp or och):
423 file_menu.remove(self.builder.get_object("separator_login"))409 self.menu_file.remove(self.separator_login)
424 else:410 else:
425 # running the agent will trigger a db reload so we do it later411 # running the agent will trigger a db reload so we do it later
426 GObject.timeout_add_seconds(30, self._run_software_center_agent)412 GObject.timeout_add_seconds(30, self._run_software_center_agent)
@@ -430,9 +416,7 @@
430416
431 # TODO: Remove the following two lines once we have remove repository417 # TODO: Remove the following two lines once we have remove repository
432 # support in aptdaemon (see LP: #723911)418 # support in aptdaemon (see LP: #723911)
433 file_menu = self.builder.get_object("menu1")419 self.menu_file.remove(self.menuitem_deauthorize_computer)
434 file_menu.remove(self.builder.get_object(
435 "menuitem_deauthorize_computer"))
436420
437 # keep track of the current active pane421 # keep track of the current active pane
438 self.active_pane = self.available_pane422 self.active_pane = self.available_pane
@@ -536,13 +520,11 @@
536 self._update_recommendations_menuitem(opted_in=False)520 self._update_recommendations_menuitem(opted_in=False)
537521
538 def _update_recommendations_menuitem(self, opted_in):522 def _update_recommendations_menuitem(self, opted_in):
539 recommendations_menuitem = self.builder.get_object(
540 "menuitem_recommendations")
541 if opted_in:523 if opted_in:
542 recommendations_menuitem.set_label(524 self.menuitem_recommendations.set_label(
543 _(u"Turn Off Recommendations"))525 _(u"Turn Off Recommendations"))
544 else:526 else:
545 recommendations_menuitem.set_label(527 self.menuitem_recommendations.set_label(
546 _(u"Turn On Recommendations…"))528 _(u"Turn On Recommendations…"))
547529
548 def _on_update_software_center_agent_finished(self, pid, condition):530 def _on_update_software_center_agent_finished(self, pid, condition):

Subscribers

People subscribed via source and target branches