Re: Starting to write Seed extensions




On 2010.04.05, at 3:15 PM, Jonathan Wadelius wrote:

Hi,

Another question that is probably more related to the _javascript_ syntax. I have looked in the GIR file and figured out why my calls are not working, not because the functions don't exist, but because they are not functions but methods. I've not coded in _javascript_ before and do not know how to call a method. Do I need a specific instance of an object to call it from?

Yes, you need an instance of an object to call methods on.

If I for example want to call the "save" method in the "EphySession" class, how do I get the object from Epiphany?

An EphyShell object has a .get_session() method which returns the associated EphySession.

So... perhaps

Epiphany.EphyShell.get_default().get_session()

I don't know if this works (I'm not at a box with GNOME installed at the moment), but something similar should.

In "reopen-closed-tabs" the EphyWindow is passed to the function as an argument. Any way to change that to an EphySession object?

Nope (and as you can see above, not necessary).

Sorry for all the questions. Your answers are really helping! 

:-)

//
  Jonathan



mån 2010-04-05 klockan 11:56 -0400 skrev Tim Horton:
On 2010.04.05, at 11:48 AM, Jonthan Wadelius wrote:

Hi,

I've been trying to figure this out today. In "reopen-closed-tabs" there is a call to Epiphany.EphyShell.get_default(), and I concluded that it is the same as "ephy_shell_get_default()" in "ephy-shell.c". However no other functions that I have tried work. Is there any way to open the file that  is imported when I write "Epiphany =  imports.gi.Epiphany"? Where is it located? That way I could know what works and what does not.



You can look at the GIR... should be in /usr/share/gir-1.0/Epiphany-1.0.gir or something like that (I'm not totally sure of the path right now, but you get the picture).


It's a bit verbose, but it's basically what Seed uses to generate the mappings.


Alternatively, give me a function you want to call and I'll give you the mapping and try to give you an idea of how to figure it out yourself.


--Tim

Thanks for the help!
Jonathan


sön 2010-04-04 klockan 13:40 -0500 skrev Diego Escalante Urrelo:
Hi Jonthan

El dom, 04-04-2010 a las 19:54 +0200, Jonthan Wadelius escribió:
> Hi,
> 
> Thanks for the quick reply! I've been looking at the two examples
> "reopen-closed-tabs" and "close-multiple-tabs" but don't understand
> yet how a function from the epiphany source is called from the seed
> extension. If I for example would want to call "ephy_session_save" in
> "ephy_session.c", how would I write the code? 
> 

You need to import Epiphany from the gobject introspection seed module,
sort of like this:

epiphany = imports.gi.Epiphany
(from the top of my head, it might be epiphany, in minus)

then you have access to all classes and functions, say
epiphany.EphyWindow and the like.
Check out this:
        http://devel.akbkhome.com/seed/index.shtml
        
Those are auto generated documentation for all seed modules available,
I'm not sure how recent Epiphany's docs are, but probably can give you
an idea.
Check also this about mapping of C names to seed ones, notice that it's
also included in seed tarball:
        http://people.gnome.org/~racarr/seed/mapping/mapping.html

Like Xan said, hopefully we will improve this for this cycle. I could
tell you for example that calling some WebKit functions will crash you
(those with wrong ownership), keep that in mind if you start getting
weird crashes when using them :). Epiphany and GTK, and friends, should
be ok though.

Don't hesitate to ask!

Diego



_______________________________________________
epiphany-list mailing list
epiphany-list gnome org
http://mail.gnome.org/mailman/listinfo/epiphany-list






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