Backend file

When I was implement my Vala Backend solution, in addition to metadata files I implement two other files with basically two classes Backend and Document. This post, I’m describing the first one.

Backend’s class implements class Backend Implementation from gcp original source. So, you need reference this class as a abstract class on your code and override tree methods:

  • create_document
  • destroy_document
  • on_document_changed (trigger your method to deal with document update)

I still don’t know why, but I needed to include this lines to make it works fine:

[ModuleInit]
public void peas_register_types (TypeModule module)
{
    Peas.ObjectModule mod = module as Peas.ObjectModule;

    mod.register_extension_type (typeof (Gcp.Backend),
                                 typeof (Gcp.Vala.Backend));
}

I “stole” this from C backend code😛 I will ask my mentors about it, since it is present on backends that was implemented using Vala but I didn’t see on Python’s codes.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: