~mmcg069/software-center/bug850033

« back to all changes in this revision

Viewing changes to softwarecenter/ui/gtk3/session/navhistory.py

  • Committer: Matthew McGowan
  • Date: 2011-09-15 09:36:59 UTC
  • mfrom: (2289.1.33 trunk)
  • Revision ID: matthew.joseph.mcgowan@gmail.com-20110915093659-672y0axj5aev396x
merge w trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
            return False
170
170
        if len(self) == 0:
171
171
            return True
 
172
 
172
173
        last = self[-1]
173
 
        if item.__str__() == last.__str__():
174
 
            return False
 
174
        last_vs = last.view_state
 
175
        item_vs = item.view_state
 
176
        # HACK: special case, check for subsequent searches
 
177
        # if subsequent search, update previous item_vs.search_term
 
178
        # to current.
 
179
 
 
180
        # do import of Pages enum here: else drama!
 
181
        from softwarecenter.ui.gtk3.panes.availablepane import AvailablePane
 
182
        if (item.page == AvailablePane.Pages.LIST and
 
183
            last.page == AvailablePane.Pages.LIST and
 
184
            item_vs.search_term and last_vs.search_term and
 
185
            item_vs.search_term != last_vs.search_term):
 
186
            # update last search term with current search_term
 
187
            last.view_state.search_term = item_vs.search_term
 
188
            # ... but return False, resulting in 'item' not being
 
189
            # appended
 
190
            return False
 
191
 
 
192
        elif item.__str__() == last.__str__():
 
193
            return False
 
194
 
175
195
        return True
176
196
 
177
197
    def append(self, item):