[Shotwell] compiling my first shotwell extension

Francesco Spegni francesco.spegni at gmail.com
Fri Aug 24 14:08:08 UTC 2012


Hello everybody,

I'm trying to familiarize with the development of shotwell plugins using 
this guide:

http://redmine.yorba.org/projects/shotwell/wiki/ShotwellArchWritingPlugins

and reading the code of the picasa publishing extension. My intent is to 
realize a simple extension that applies a single transformation to the 
selected photography (a polaroid-like frame around the picture, using 
the linux "convert" command, e.g. :

convert image.jpg -thumbnail 350x350 -gravity center -background black -bordercolor white +polaroid final image.png

).

The questions below are rather simple, but searching the internet I 
wasn't able to find the explanations I needed.

The problems I'm facing right now is:
- how to detect, from the class that extends Pluggable, the currently 
selected picture(s)?
- is there a way to lunch my service from a context menu that appears 
right-clicking on the picture(s)?
- so far my Service has the following structure:

public class FrameService : Object, Spit.Pluggable {
     private const string ICON_FILENAME = "...";

     private static Gdk.Pixbuf[] icon_pixbuf_set = null;

     public FrameService(GLib.File resource_directory) {
         if (icon_pixbuf_set == null)
             icon_pixbuf_set = Resources.load_icon_set(
                 resource_directory.get_child(ICON_FILENAME));
     }

     public int get_pluggable_interface(int min_host_interface,
         int max_host_interface)
     {
         return Spit.negotiate_interfaces(min_host_interface, 
max_host_interface,
             Spit.Publishing.CURRENT_INTERFACE);
// WHAT DOES THIS LINE MEAN?!? ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     }

     public unowned string get_id() {
         return "org.yorba.shotwell.transform.framservice";
     }

     public unowned string get_pluggable_name() {
         return ...;
     }

     public void get_info(ref Spit.PluggableInfo info)
     {
...
     }

     public Spit.Publishing.Publisher.MediaType get_supported_media() {
         return (Spit.Publishing.Publisher.MediaType.PHOTO);
     }

     public void activation(bool enabled) {
         if (enabled)
         {
             print("Service activation");
         }
         else
         {
             print("Service deactivation");
         }
     }
}

// and as usual ...
public Spit.Module? spit_entry_point(...) { ... }


my question is: the FrameService.activation(...) method is called when 
the plugin is loaded, i.e. during the startup of the shotwell 
application. How can I catch the actual invocation of the plugin in 
order to execute the command I'm interested in?
- last but not least: how do I compile my plugin to produce the .so file 
? how do I link my plugin to the Spit and Gdk libraries?

Thank you very much,

-- 
Francesco Spegni

"Ama le nuvole, le macchine, i libri, ma prima di tutto ama l'uomo" -
Nazim Hikmet

http://www.manuefra.eu
skype: francesco.spegni



More information about the Shotwell-list mailing list