Re: Python extension manipulating bookmarks



On Thu, Oct 13, 2005 at 10:10:13PM -0400, Adam Hooper wrote:
>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.

Cool. It used to work just fine. I've been using that code for months
with Epiphany 1.6. Can't say I understand how it worked, but it did.
Anyway, no point in dwelling on past luck...

>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)".

Now that you mention it it does sound like a logical solution. The only
reason I might have been thrown off before was the lack of a
`remove_bookmark()` function (while `remove_keyword()` is there, why the
asymmetry?).

>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.

I'm having some problems with Epiphany dying on me when removing a
bookmark. Since I don't have an Epiphany with debugging symbols I
suspect bug-buddy won't be very useful. I'll try to put together a
minimal app that shows the same behaviour later on today... stay tuned
:-)

/M

-- 
Magnus Therning                    (OpenPGP: 0xAB4DFBA4)
magnus therning org
http://therning.org/magnus

Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.

BTW, I learned a lovely new acronym today: "Law Enforcement Agency
Key" -- LEAK.
      -- Charles H. Lindsey

Attachment: pgpNBNOiWcKEK.pgp
Description: PGP signature



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