Ticket #1235: sugar-1235.3.patch

File sugar-1235.3.patch, 4.1 KB (added by alsroot, 12 years ago)
  • src/jarabe/journal/listview.py

    From 108bd1f0dd0dba82432eaf80dee0dc74b6f7c4b9 Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Sun, 6 Sep 2009 14:04:35 +0000
    Subject: Reset list view vadjustment if on mapping #1235
    
    Setting vadjustment.props.value doesn't work if window is hidden
    (for example afer opening details dialog), so have to reset it
    on every mapping.
    
    ---
     src/jarabe/journal/listview.py |   18 +++++++++++++++---
     1 files changed, 15 insertions(+), 3 deletions(-)
    
    diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
    index 82e76b0..593ce21 100644
    a b class BaseListView(gtk.Bin): 
    7171        self._model = None
    7272        self._progress_bar = None
    7373        self._last_progress_bar_pulse = None
     74        self._scroll_position = 0.
    7475
    7576        gobject.GObject.__init__(self)
    7677
     78        self.connect('map', self.__map_cb)
     79        self.connect('unrealize', self.__unrealize_cb)
    7780        self.connect('destroy', self.__destroy_cb)
    7881
    7982        self._scrolled_window = gtk.ScrolledWindow()
    class BaseListView(gtk.Bin): 
    292295        logging.debug('ListView.__model_ready_cb')
    293296        self._stop_progress_bar()
    294297
    295         scroll_position = self.tree_view.props.vadjustment.props.value
    296         logging.debug('ListView.__model_ready_cb %r', scroll_position)
     298        self._scroll_position = self.tree_view.props.vadjustment.props.value
     299        logging.debug('ListView.__model_ready_cb %r', self._scroll_position)
    297300
    298301        # Cannot set it up earlier because will try to access the model and it
    299302        # needs to be ready.
    300303        self.tree_view.set_model(self._model)
    301304
    302         self.tree_view.props.vadjustment.props.value = scroll_position
     305        self.tree_view.props.vadjustment.props.value = self._scroll_position
    303306        self.tree_view.props.vadjustment.value_changed()
    304307
    305308        if len(tree_model) == 0:
    class BaseListView(gtk.Bin): 
    310313        else:
    311314            self._clear_message()
    312315
     316    def __map_cb(self, widget):
     317        logging.debug('ListView.__map_cb %r', self._scroll_position)
     318        self.tree_view.props.vadjustment.props.value = self._scroll_position
     319        self.tree_view.props.vadjustment.value_changed()
     320
     321    def __unrealize_cb(self, widget):
     322        self._scroll_position = self.tree_view.props.vadjustment.props.value
     323        logging.debug('ListView.__map_cb %r', self._scroll_position)
     324
    313325    def _is_query_empty(self):
    314326        # FIXME: This is a hack, we shouldn't have to update this every time
    315327        # a new search term is added.
  • src/jarabe/journal/listview.py

    -- 
    1.6.3.3
    
    
    From fb3b748ab9ae88bd71bdcc96dab438c923103982 Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Sun, 6 Sep 2009 14:05:15 +0000
    Subject: Suppress requery glicthes when current row comes from top rows #1235
    
    ---
     src/jarabe/journal/listview.py |   10 +++++++---
     1 files changed, 7 insertions(+), 3 deletions(-)
    
    diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py
    index 593ce21..badeb24 100644
    a b class BaseListView(gtk.Bin): 
    292292        self._model.setup()
    293293
    294294    def __model_ready_cb(self, tree_model):
    295         logging.debug('ListView.__model_ready_cb')
    296295        self._stop_progress_bar()
    297296
    298297        self._scroll_position = self.tree_view.props.vadjustment.props.value
    299298        logging.debug('ListView.__model_ready_cb %r', self._scroll_position)
    300299
    301         # Cannot set it up earlier because will try to access the model and it
    302         # needs to be ready.
     300        # prevent glitches while later vadjustment setting
     301        self.tree_view.hide()
     302
     303        # Cannot set it up earlier because will try to access the model
     304        # and it needs to be ready.
    303305        self.tree_view.set_model(self._model)
    304306
    305307        self.tree_view.props.vadjustment.props.value = self._scroll_position
    306308        self.tree_view.props.vadjustment.value_changed()
    307309
     310        self.tree_view.show()
     311
    308312        if len(tree_model) == 0:
    309313            if self._is_query_empty():
    310314                self._show_message(MESSAGE_EMPTY_JOURNAL)