~docky-core/plank/keybindings

« back to all changes in this revision

Viewing changes to src/Main.vala

  • Committer: Rico Tzschichholz
  • Date: 2015-11-02 08:40:11 UTC
  • Revision ID: ricotz@ubuntu.com-20151102084011-faalf09598xzh4ct
Add docklets support (internal/private)

Based on initially proposed docky 3.0 branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
//
19
19
 
20
20
using Plank.Factories;
 
21
using Plank.Items;
21
22
 
22
23
namespace Plank
23
24
{
29
30
                Intl.textdomain (Build.GETTEXT_PACKAGE);
30
31
                
31
32
                var application = new Plank.Main ();
32
 
                Factory.init (application, new ItemFactory ());
 
33
                Factory.init (application, new DockletsItemFactory ());
33
34
                return application.run (argv);
34
35
        }
35
36
        
 
37
        public class DockletsItemFactory : ItemFactory
 
38
        {
 
39
                public override DockElement make_element (GLib.File file)
 
40
                {
 
41
                        var launcher = get_launcher_from_dockitem (file);
 
42
                        
 
43
                        Docky.Docklet? docklet;
 
44
                        if ((docklet = Docky.DockletManager.get_default ().get_docklet_by_uri (launcher)) != null)
 
45
                                return docklet.make_element (launcher, file);
 
46
                        
 
47
                        return default_make_element (file, launcher);
 
48
                }
 
49
        }
 
50
        
36
51
        public class Main : AbstractMain
37
52
        {
38
53
                public Main ()
78
93
                                about_license_type : Gtk.License.GPL_3_0
79
94
                        );
80
95
                }
 
96
                
 
97
                public override void initialize ()
 
98
                {
 
99
                        Docky.DockletManager.get_default ().load_docklets ();
 
100
                }
81
101
        }
82
102
}