[Sugar-devel] [PATCH] Store and restore session for each tab

Manuel Quiñones manuq at laptop.org
Tue Jan 3 21:08:35 EST 2012


2012/1/3 Simon Schampijer <simon at schampijer.de>:
> On 20/12/11 14:54, Manuel Quiñones wrote:
>> For going to a specific item in the history, it uses go_back() method
>> of WebKit.WebView.  I tried also with WebKit.WebHistoryItem go_back(),
>> seemed the proper solution, but the page wouldn't update.
>
> Using webkit_web_view_go_back [1] is the right thing to do here. Epiphany is
> doing the same. Tbh, I am not sure I understand what WebKit.WebHistoryItem
> go_back() is doing, I was trying to dig into the Webkit code but stopped
> after a while of poking around...

This was a bit confusing for me, I thought webkit would have a better
way to iterate over the history of visited pages, but it doesn't.
Happy to hear Epiphany does the same.

> I have a counter proposal for your patch (applies on top of your patch)
> which does the following things:
>
> * the sessionstore code is moved into Browser, we do have
> set_history_index/get_history_index already there, the TabbedView does use
> that path for their requests about the history

I agree, there is no reason for a separate py file with that code.

> * I did rename a few bits s/session/history and the return value from
> self.get_back_forward_list() I use back_forward_list as variable

Looks much better now.  I was respecting the old code names without a reason.

> * I folded _get_history and _set_history into their appropriate 'mother'
> methods

I agree.

> * I tried to make set_history_index a bit cleaner, the API provided by
> webkitgtk does not seem to cleanly allow our usage like:
> get_current_item_index and go_to_back_forward_item(index) also the API does
> seem to miss a back_forward_list.get_length() (see the code we have to do in
> _items_history_as_list) there only exist a
> back_forward_list.get_back_length() and
> back_forward_list.get_forward_length().

This is a much nicer way to set the history index!

> That should be pretty much it, let me know what you think,

Great improvement over my patch, Simon.  I only have to remove the
import of sessionstore in browse.py to test yours.

I will rebase your patch for current Browse code and resend.

Cheers,

-- 
.. manuq ..


More information about the Sugar-devel mailing list