[Shotwell] compiling my first shotwell extension
Adam Dingle
adam at yorba.org
Fri Aug 24 18:07:17 UTC 2012
Francesco,
thanks for your interest in writing in a Shotwell plugin. Unfortunately Shotwell's plugin system is limited. At this time, a plugin can *only* do one of the following:
- add a new publishing destination (like YouTube)
- add a new slideshow transition type
- add a new import source (like F-Spot)
These correspond to the plugin types you see in the Shotwell Preferences dialog in the Plugins tab. In the code, each of these plugin types corresponds to an extension point as described in the plugin documentation.
It would be fantastic if Shotwell plugins could perform photo transformations as you suggest - but unfortunately the framework just doesn't support that yet. See
http://redmine.yorba.org/issues/1603
and
http://redmine.yorba.org/issues/3440
adam
On Fri, Aug 24, 2012 at 7:08 AM, Francesco Spegni <francesco.spegni at gmail.com> wrote:
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