Re: Python extension manipulating bookmarks



On Thu, 2005-10-13 at 18:14 +0100, Magnus Therning wrote:
> I've just upgraded to Gnome 2.12.1 (on Ubuntu) and with it came Epiphany
> 1.8.2. This seemingly caused my python extension to stop working. :(
> 
> I've tracked it down to a problem with removing a URL from the bookmark.
> In 1.6 the following code would work:
> 
>  bms = epiphany.ephy_shell_get_default().get_bookmarks()
>  [ code that found a specific bookmarks 'b' ]
>  bms.disconnect(b.get_id())
> 
> After this, the bookmark would be removed from the list of bookmarks.
> Since the upgrade the code above has no effect at all!
> 
> How do I properly remove a bookmark in a Python extension?
> Are there any requirements on the bookmark I want to remove? (e.g. that
> it has no keywords)

You'd have to show us the rest of your code. Those two lines demonstrate
at least one bug: disconnect() is a GObject function: it's meant to
disconnect a signal from bms to some other object. (The parameter is
meant be an integer ID returned from a corresponding bms.connect())
call. In other words, that last line never deleted any bookmarks.

EphyNode is undocumented, so you'll probably want to have
epiphany/lib/ephy-node.h open to get a vague idea of what functions you
need. In essence, once you've got an EphyNode representing the bookmark
you want to delete, you should be able to call
"bms.get_bookmarks().remove_child(b)".

I'm not 100% sure of this. I've never used EphyNode from Python, and
more critically, I've never really understood EphyNode all that well
even in C (which is why it's undocumented :P). Let us know if it works
out or if you need more help.

-- 
Adam Hooper <adamh densi com>

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]