~and471/software-center/fix-524289

« back to all changes in this revision

Viewing changes to softwarecenter/view/viewswitcher.py

  • Committer: Gary Lasker
  • Date: 2010-07-16 05:35:23 UTC
  • mto: (858.2.51 buy-something)
  • mto: This revision was merged to the branch mainline in revision 980.
  • Revision ID: gary.lasker@canonical.com-20100716053523-jdk11wm20ti52km1
auto-switch to the Previous Purchases node after it is added

Show diffs side-by-side

added added

removed removed

Lines of Context:
174
174
        if model:
175
175
            expanded = self.row_expanded(model.get_path(model.installed_iter))
176
176
        return expanded
 
177
        
 
178
    def select_channel_node(self, channel_name, installed_only):
 
179
        """ select the specified channel node """
 
180
        model = self.get_model()
 
181
        if model:
 
182
            channel_iter_to_select = model.get_channel_iter_for_name(channel_name,
 
183
                                                                     installed_only)
 
184
            if channel_iter_to_select:
 
185
                self.set_cursor(model.get_path(channel_iter_to_select))
177
186
 
178
187
    def _on_channels_refreshed(self, model):
179
188
        """
180
189
        when channels are refreshed, the viewswitcher channel is unselected so
181
190
        we need to reselect it
182
191
        """
183
 
        model = self.get_model()
184
 
        if model:
185
 
            channel_iter_to_select = model.get_channel_iter_for_name(self.selected_channel_name,
186
 
                                                                     self.selected_channel_installed_only)
187
 
            if channel_iter_to_select:
188
 
                self.set_cursor(model.get_path(channel_iter_to_select))
 
192
        self.select_channel_node(self.selected_channel_name,
 
193
                                 self.selected_channel_installed_only)
189
194
 
190
195
    def _on_row_deleted(self, widget, path):
191
196
        if self.get_cursor()[0] is None: