Johnny [Life & Code]

Semper Exploro!

A simple Eplugin

leave a comment »

(This page is still under development. The information may not be accurate)

Writing a simple EPlugin


Learn a concept by reading through the code. This what my mentor says and i prefer this type of learning. This is a quick method to learn the basics of a concept. So here we’ll learn about EPlugins by writing a simple plugin. Lets write a plugin that will print the XXXXXXXXXXXXXX of the attachments of a mail.
More concepts will be disscused in the EPlugin manual. But here we will look in to the basic stuff alone.

Objective :

Synopsis :

> Identify Hook point
> Write EPLUG
> Write a
> Add plugin in
> Write a factory function
> Implement Logic

Identify Hook Point.

First step is to identify the proper HOOK point. This depends on the type of plugin you want to write.
With Eplugins you can create context sensitive menu items to toolbar buttons and main menu items. To have a list of available hook point you can refer the manual. Or to get a fresh list of hookpoints you can find out by

grep -inr “@hook” *

at the top directory of evolution source

So since we want a hook point for mail attachments, the following hookpoints will do the job

> org.gnome.evolution.mail.formathtmldisplay.popup
> org.gnome.evolution.mail.attachments.popup
> org.gnome.evolution.mail.composer.attachmentbar.popup

For more hook points and their possible use refer evolution manual.

Writing a EPLUG

The manual has good documentation on the hook points.

Imports ICS attachments to calendar.
Let me explain the tags and properties

[ The following section is directly taken from eplugin-manual ]

Id : A unique string identifying this plugin. By convention this will follow the java-like
class namespace system. e.g. com.ximian.evolution.test-plugin

Type : The type name of the plugin loader. Currently shlib and mono are the only supported
values. If no known handler is registered for this type, the plugin definition is silently

Domain : The translation domain for this plugin, as passed to the dcgettext call of the gettext
package. If not supplied then the default application domain is used (i.e. “evolution”).
This is used to translate translatable strings for display.

Name : A short name for the plugin. “Bob’s Wonder Extender” might be suitable. This value
will be translated.

Description : A longer description of the plugin’s purpose. This value will be translated.

Hook : This is a list of all of the hooks that this plugin wishes to hook into. See the Plugin
Hooks section for the details of the basic hook types defined.
The hook class is resolved using the registered hook types, and if none can be
found, or a version mismatch occurs, then the hook is silently ignored.


Awaiting Content ( 🙂 you can contribute to this … )

Write a factory function.

This is the callback function that is invoked when the menu is created.

void * function(ep, data);
EPlugin * ep;
void * data;

> function : The callback function.
> ep : The container EPlugin representing this plugin.
> data : Hook context data. It is part of the hook’s api to specify the type of this pointer.
> return : value Return data. It is part of the hook’s api to specify the type of this pointer.

Add plugin to

Time to add this plugin to to gernerate the make file.

Implement Logic

Well this is the place you need to add the code..

Written by Johnny

March 11, 2006 at 5:40 pm

Leave a Reply

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

You are commenting using your 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: