1/*
2* Copyright (c) 2011-2013 Yorba Foundation
3*
4* This program is free software; you can redistribute it and/or
5* modify it under the terms of the GNU Lesser General Public
6* License as published by the Free Software Foundation; either
7* version 2.1 of the License, or (at your option) any later version.
8*
9* This program is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12* General Public License for more details.
13*
14* You should have received a copy of the GNU General Public
15* License along with this program; if not, write to the
16* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17* Boston, MA 02110-1301 USA
18*/
19
20private class ShotwellTransitions : Object, Spit.Module {
21    private Spit.Pluggable[] pluggables = new Spit.Pluggable[0];
22
23    public ShotwellTransitions (GLib.File module_file) {
24        Gtk.IconTheme.get_default ().add_resource_path ("/io/elementary/photos/plugins/transitions/icons");
25        GLib.File resource_directory = module_file.get_parent ();
26
27        pluggables += new FadeEffectDescriptor (resource_directory);
28        pluggables += new SlideEffectDescriptor (resource_directory);
29        pluggables += new CrumbleEffectDescriptor (resource_directory);
30        pluggables += new BlindsEffectDescriptor (resource_directory);
31        pluggables += new CircleEffectDescriptor (resource_directory);
32        pluggables += new CirclesEffectDescriptor (resource_directory);
33        pluggables += new ClockEffectDescriptor (resource_directory);
34        pluggables += new SquaresEffectDescriptor (resource_directory);
35        pluggables += new ChessEffectDescriptor (resource_directory);
36        pluggables += new StripesEffectDescriptor (resource_directory);
37    }
38
39    public unowned string get_module_name () {
40        return _ ("Core Slideshow Transitions");
41    }
42
43    public unowned string get_version () {
44        return _VERSION;
45    }
46
47    public unowned string get_id () {
48        return "io.elementary.photos.transitions";
49    }
50
51    public unowned Spit.Pluggable[]? get_pluggables () {
52        return pluggables;
53    }
54}
55
56// This entry point is required for all SPIT modules.
57public Spit.Module? spit_entry_point (Spit.EntryPointParams *params) {
58    params->module_spit_interface = Spit.negotiate_interfaces (params->host_min_spit_interface,
59                                    params->host_max_spit_interface, Spit.CURRENT_INTERFACE);
60
61    return (params->module_spit_interface != Spit.UNSUPPORTED_INTERFACE)
62           ? new ShotwellTransitions (params->module_file) : null;
63}
64
65// Base class for all transition descriptors in this module
66public abstract class ShotwellTransitionDescriptor : Object, Spit.Pluggable, Spit.Transitions.Descriptor {
67    private GLib.Icon icon;
68
69    protected ShotwellTransitionDescriptor (GLib.File resource_directory) {
70        icon = new ThemedIcon ("slideshow-plugin");
71    }
72
73    public int get_pluggable_interface (int min_host_interface, int max_host_interface) {
74        return Spit.negotiate_interfaces (min_host_interface, max_host_interface,
75                                          Spit.Transitions.CURRENT_INTERFACE);
76    }
77
78    public abstract unowned string get_id ();
79
80    public abstract unowned string get_pluggable_name ();
81
82    public void get_info (ref Spit.PluggableInfo info) {
83        info.authors = "Maxim Kartashev";
84        info.copyright = _ ("Copyright 2010 Maxim Kartashev, Copyright 2011-2013 Yorba Foundation");
85        info.translators = Resources.TRANSLATORS;
86        info.version = _VERSION;
87        info.website_name = Resources.WEBSITE_NAME;
88        info.website_url = Resources.WEBSITE_URL;
89        info.is_license_wordwrapped = false;
90        info.license = Resources.LICENSE;
91        info.icon = icon;
92    }
93
94    public void activation (bool enabled) {
95    }
96
97    public abstract Spit.Transitions.Effect create (Spit.HostInterface host);
98}
99