~donadigo/+junk/euclide-bazaar

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
/*
 * Copyright (c) 2011 Lucas Baudin <xapantu@gmail.com>
 *
 * This is a free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; see the file COPYING.  If not,
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *`
 */

using Euclide;
using Granite.Widgets;

Settings euclide_settings;
Scratch.Services.Interface plugins;

public class Euclide.Plugin : Peas.Activatable, Object {

    Gtk.ActionGroup main_actions;
    Gtk.UIManager ui;
    Terminal terminal;
    RawTerminal raw_terminal;
    Gtk.Menu menu_binaries;
    ProgramList list;
    Gtk.Notebook notebook_terminal;
    Gtk.ToolButton toolbar_compile;
    Granite.Widgets.ToolArrow build_arrow;
    CMake.Parser cmake;
    Euclide.Bazaar.BazaarDialog bzr_dialog;
    GLib.List<CMake.Parser> projects;
    SearchBar search_bar;

    static string current_folder = GLib.Environment.get_home_dir ();
    static string project_path;
    static string executable;

    Scratch.MainWindow? window = null;
    Scratch.Widgets.Toolbar? toolbar = null;

    const string ui_string = """
        <ui>
        <popup name="CompactMenu" accelerators="true">
            <menuitem name="Open Project" action="Open Project"/>
            <menuitem name="Terminal" action="Terminal"/>
            <menuitem name="Build and test" action="Build and test"/>
            <menuitem name="Only Build" action="Only Build"/>
            <menuitem name="Clean" action="Clean"/>
            <menuitem name="Plugins" action="Plugins"/>
        <menu action="Add">
            <menuitem name="AddLibrary" action="AddLibrary"/>
            <menuitem name="AddExecutable" action="AddExecutable"/>
            </menu>
            <menuitem name="Project Settings" action="Project Settings"/>
            <menuitem name="Settings" action="Settings"/>
            <menuitem name="About" action="About"/>
        </popup>
        <popup name="MenuItemTool" accelerators="false">
            <menuitem name="Save" action="Save"/>
            <menuitem name="New" action="New"/>
            <menuitem name="Compile" action="Compile"/>
            <menuitem name="Build and test" action="Build and test"/>
            <menuitem name="Fetch" action="Fetch"/>
            <menuitem name="Save as" action="Save as"/>
            <menuitem name="About" action="About"/>
        </popup>
        <popup name="AppMenu" accelerators="true">
            <separator />
            <menuitem name="AddExecutable" action="AddExecutable"/>
            <menuitem name="AddLibrary" action="AddLibrary"/>
            <menuitem name="Open Project" action="Open Project"/>
        </popup>
        </ui>
    """;

    void on_new_source_view (Scratch.Services.Document doc) {
        var view = doc.source_view;
        ((Gtk.TextView)view).key_press_event.connect(Euclide.SourceView.on_insert_event);
    }

    void hook_preferences_dialog (Object dialog) {
        var preferences_dialog = dialog as Scratch.Dialogs.Preferences;
        assert(preferences_dialog != null);
        this.projects.foreach ((project) => {
            var euclide_settings = new ProjectSettingsDialog(project);
            //preferences_dialog.main_static_notebook.append_page (euclide_settings, new Gtk.Label(project.project.name));
        });
    }

    void on_new_window (Scratch.MainWindow window) {
        if (this.window != null)
            return;
        this.window = window;
        debug ("");
        window.add_accel_group (ui.get_accel_group ());
    }

    void action_new_project () {
        var dialog = new NewProjectDialog (this.window);
        string project = dialog.create ();
        if (project != null) {
            open_project (project);
        }
        dialog.destroy ();
    }

    void action_add_library () {
        var dialog = new EntryDialog (this.window);
        dialog.title = _("Add Library");
        dialog.run ();
        cmake.add_target (dialog.value_entry, true /* is library */);

        list.open_project (cmake);
        update_executable_menu ();

        dialog.destroy ();
    }

    void action_add_executable () {
        var dialog = new EntryDialog (this.window);
        dialog.title = _("Add Executable");
        dialog.run ();
        cmake.add_target(dialog.value_entry);

        list.open_project(cmake);
        update_executable_menu();

        dialog.destroy();
    }

    /*void welcome_activated(int index) {
        switch(index)
        {
        case 0: /* create *
            action_new_project();
            break;
        case 1: /* open project *
            action_open_project();
            break;
        case 2:
            action_open_file();
            break;
        default:
            open_project(euclide_settings.get_string("recent-" + (index - 2).to_string()));
            break;
        }
    }*/

    void update_executable_menu () {
        Gtk.RadioMenuItem menuitem = null;
        foreach (var w in menu_binaries.get_children()) {
            w.destroy();
        }
        foreach (var bin in cmake.project.bin) {
            menuitem = new Gtk.RadioMenuItem.with_label((menuitem != null ? menuitem.get_group() : null), bin.name);
            menuitem.activate.connect( () => { executable = bin.filename; });
            menu_binaries.append(menuitem);
        }
        menu_binaries.show_all();
    }

    Gtk.VBox create_binary_choice () {
        var vbox = new Gtk.VBox(false, 0);
        Gtk.RadioButton? former_radio = null;
        this.projects.foreach ((project) => {
            foreach(var bin in project.project.bin) {
                former_radio = new Gtk.RadioButton(former_radio == null ? null : former_radio.get_group());
                former_radio.label = bin.name;
                former_radio.toggled.connect( () => { executable = bin.filename; });
                vbox.pack_start(former_radio);
                if(bin.filename == executable)
                    former_radio.active = true;
            }
        });
        return vbox;
    }

    void unlock_project_actions()
    {
        main_actions.get_action("Project Settings").set_sensitive(true);
        main_actions.get_action("Add").set_sensitive(true);
        main_actions.get_action("AddLibrary").set_sensitive(true);
        main_actions.get_action("AddExecutable").set_sensitive(true);
    }

    void lock_project_actions()
    {
        main_actions.get_action("Project Settings").set_sensitive(false);
        main_actions.get_action("Add").set_sensitive(false);
        main_actions.get_action("AddLibrary").set_sensitive(false);
        main_actions.get_action("AddExecutable").set_sensitive(false);
    }

    public void open_project(string filename) {
        unlock_project_actions();
        unlock_build();
        project_path = filename;
        cmake = new Euclide.CMake.Parser(project_path + "/CMakeLists.txt");
        if(cmake.project.bin.size > 0)
            executable = cmake.project.bin[0].filename;
        cmake.project.project_path = project_path;
        projects.append(cmake);
        list.open_project(cmake, project_path);
        update_executable_menu();
        list.no_show_all = false;
        list.visible = true;
        list.show_all();
    }

    public void action_fetch() {
        search_bar.grab_focus();
    }

    Threads.SimpleCommand simple_command;
    BuildActions.Build build_command;
    BuildActions.Check check_command;

    public void action_build() {
        show_terminal();
        lock_build();
        build_command = new BuildActions.Build(cmake, raw_terminal, terminal, list.progress);
        build_command.build_finished.connect( (exit) => {
            unlock_build();
            if(exit == 0)
            {
                raw_terminal.clear();
                string[] arguments = cmake.arguments.split(" ");
                Gee.LinkedList<string> new_arguments = new Gee.LinkedList<string>();
                new_arguments.add(executable);
                foreach(var arg in arguments)
                    new_arguments.add(arg);
                try {
                    raw_terminal.fork_command_full (Vte.PtyFlags.DEFAULT, project_path, new_arguments.to_array(), null, SpawnFlags.SEARCH_PATH, null, null);
                } catch (Error e) {
                    warning (e.message);
                }
            }
            else
            {
                show_terminal();
            }
         });
         build_command.run();
    }

    public void action_only_build()
    {
        show_terminal();
        lock_build();
        build_command = new BuildActions.Build(cmake, raw_terminal, terminal, list.progress);
        build_command.build_finished.connect( (exit) => {
            unlock_build();
        });
        build_command.run();
    }

    void lock_build()
    {
        notebook_terminal.page = 0;
        main_actions.get_action("Clean").set_sensitive(false);
        main_actions.get_action("Build and test").set_sensitive(false);
        main_actions.get_action("Compile").set_sensitive(false);
        main_actions.get_action("Only Build").set_sensitive(false);
        build_arrow.set_sensitive(false);
        toolbar_compile.set_sensitive(false);
    }

    void unlock_build()
    {
        main_actions.get_action("Clean").set_sensitive(true);
        main_actions.get_action("Build and test").set_sensitive(true);
        main_actions.get_action("Compile").set_sensitive(true);
        main_actions.get_action("Only Build").set_sensitive(true);
        build_arrow.set_sensitive (true);
        toolbar_compile.set_sensitive(true);
    }

    void action_make_check()
    {
        lock_build();
        check_command = new BuildActions.Check(cmake, raw_terminal);
        show_terminal();
        check_command.build_finished.connect( (exit) => {
            unlock_build();
        });
        check_command.run();
    }


    public void action_build_tests()
    {
        lock_build();
        build_command = new BuildActions.Build(cmake, raw_terminal, terminal, list.progress);
        show_terminal();
        build_command.build_finished.connect( (exit) => {
            if(exit == 0)
            {
                if(!euclide_settings.get_boolean ("make-ctest"))
                {
                    notebook_terminal.page = 1;
                    raw_terminal.clear();
                    simple_command = new Threads.SimpleCommand(project_path + "/build/", "/usr/bin/ctest -V");
                    simple_command.output_changed.connect((text) => {raw_terminal.add_text(text); });
                    simple_command.done.connect( (exit) => {
                        unlock_build();
                    });
                    simple_command.run();
                }
                else
                    action_make_check();
            }
            else
                unlock_build();
         });
         build_command.run();
    }

    public void action_clean_project()
    {
        lock_build();
        simple_command = new Threads.SimpleCommand(project_path + "/build/", "/usr/bin/make clean");
        simple_command.output_changed.connect((text) => {raw_terminal.add_text(text); });
        simple_command.done.connect( () => {unlock_build(); });
        simple_command.run();
    }

    public void action_terminal() {
        notebook_terminal.visible = !notebook_terminal.visible;
        notebook_terminal.no_show_all = !notebook_terminal.no_show_all;
    }

    public void show_terminal () {
        terminal_grid.visible = true;
        terminal_grid.no_show_all = false;
        terminal_grid.show_all();
        scrolled_raw_terminal.visible = true;
        scrolled_raw_terminal.no_show_all = false;
        scrolled_raw_terminal.show_all();
    }

    public void hide_terminal () {
        terminal_grid.visible = false;
        terminal_grid.no_show_all = true;
        scrolled_raw_terminal.visible = false;
        scrolled_raw_terminal.no_show_all = true;
    }

    public void open_file(string file_path, int line = -1)
    {
        var file = GLib.File.new_for_path (file_path);
        plugins.open_file (file).source_view.go_to_line (line);
    }

    void action_open_project () {
        var file_chooser = new Gtk.FileChooserDialog (_("Open a file..."),
            this.window, Gtk.FileChooserAction.OPEN,
            Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
            Gtk.Stock.OPEN, Gtk.ResponseType.ACCEPT, null);
        file_chooser.set_current_folder (current_folder);
        file_chooser.add_filter (get_project_filter ());

        int reponse = file_chooser.run ();
        if (reponse == Gtk.ResponseType.ACCEPT) {
            open_project (file_chooser.get_current_folder ());
        }
        current_folder = file_chooser.get_current_folder ();
        file_chooser.destroy ();
        show_terminal ();
    }

    static const Gtk.ActionEntry[] main_entries = {
        { "Terminal", null,
        /* label, accelerator */       N_("Terminal"), null,
        /* tooltip */                  N_("Terminal"),
                                     action_terminal },
        { "Only Build", Gtk.Stock.EXECUTE,
        /* label, accelerator */       N_("Only Build"), "<Control><shift>b",
        /* tooltip */                  N_("Only Build"),
                                     action_only_build },
        { "Compile", Gtk.Stock.MEDIA_PLAY,
        /* label, accelerator */       N_("Compile"), "<Control><shift>r",
        /* tooltip */                  N_("Compile"),
                                     action_build },
        { "Build and test", Gtk.Stock.EXECUTE,
        /* label, accelerator */       N_("Build and test"), "<Control>u",
        /* tooltip */                  N_("Build and test"),
                                     action_build_tests },
        { "Open Project", Gtk.Stock.OPEN,
        /* label, accelerator */       N_("Open Project"), "<Control><shift>o",
        /* tooltip */                  N_("Open Project"),
                                     action_open_project },
        { "Clean", Gtk.Stock.CLEAR,
        /* label, accelerator */       N_("Clean"), "<Control><alt>c",
        /* tooltip */                  N_("Clean"),
                                     action_clean_project },
        { "New Project", Gtk.Stock.NEW,
        /* label, accelerator */       N_("New Project"), "<Control><shift>n",
        /* tooltip */                  N_("New Project"),
                                     action_new_project },
        { "Add", null,
        /* label, accelerator */       N_("Add"), null,
        /* tooltip */                  N_("Add"),
                                     null },
        { "AddLibrary", Gtk.Stock.ADD,
        /* label, accelerator */       N_("Add a library"), null,
        /* tooltip */                  N_("Add a library"),
                                     action_add_library },
        { "AddExecutable", Gtk.Stock.ADD,
        /* label, accelerator */       N_("Add an executable"), null,
        /* tooltip */                  N_("Add an excutable"),
                                     action_add_executable },
        { "Project Settings", null,
        /* label, accelerator */       N_("Project Settings"), null,
        /* tooltip */                  N_("Project Settings"),
                                     null },
        { "Settings", null,
        /* label, accelerator */       N_("Settings"), null,
        /* tooltip */                  N_("Settings"),
                                     null },
        { "About", null,
        /* label, accelerator */       N_("About"), null,
        /* tooltip */                  N_("About"),
                                     null },
        { "Save", null,
        /* label, accelerator */       N_("Save"), null,
        /* tooltip */                  N_("Save"),
                                     null },
        { "New", null,
        /* label, accelerator */       N_("New"), null,
        /* tooltip */                  N_("New"),
                                     null },
        { "Fetch", null,
        /* label, accelerator */       N_("Fetch"), null,
        /* tooltip */                  N_("Fetch"),
                                     null },
        { "Save as", null,
        /* label, accelerator */       N_("Save as"), null,
        /* tooltip */                  N_("Save as"),
                                     null },
        { "Plugins", null,
        /* label, accelerator */       N_("Plugins"), null,
        /* tooltip */                  N_("Plugins"),
                                     null }
    };

    Gtk.FileFilter get_project_filter() {
        var filter = new Gtk.FileFilter();
        filter.set_filter_name(_("CMake Project"));
        filter.add_pattern("CMakeLists.txt");
        return filter;
    }

    public Object object { owned get; construct; }

    public void activate()
    {

        /* Init stuff */

        euclide_settings = new Settings("org.pantheon.euclide.settings");
        main_actions = new Gtk.ActionGroup("MainActionGroup"); /* Actions and UIManager */
        main_actions.set_translation_domain("euclide");
        main_actions.add_actions(main_entries, this);

        build_arrow = new Granite.Widgets.ToolArrow();
        build_arrow.no_show_all = false;
        build_arrow.visible = true;

        // Init internationalization support
        Intl.setlocale (LocaleCategory.ALL, "");
        string langpack_dir = Path.build_filename (Constants.INSTALL_PREFIX, "share", "locale");
        Intl.bindtextdomain (Constants.GETTEXT_PACKAGE, langpack_dir);
        Intl.bind_textdomain_codeset (Constants.GETTEXT_PACKAGE, "UTF-8");
        Intl.textdomain (Constants.GETTEXT_PACKAGE);

        // Init projects var
        this.projects = new GLib.List<CMake.Parser> ();

        ui = new Gtk.UIManager();
        try {
            ui.add_ui_from_string(ui_string, -1);
        }
        catch(Error e) {
            error("Couldn't load the UI");
        }
        ui.insert_action_group(main_actions, 0);
        ui.ensure_update();
        list = new ProgramList();
        list.open_file.connect( (s) => {open_file(s);});
        notebook_terminal = new Gtk.Notebook();

        terminal = new Terminal();
        terminal.open_file.connect(open_file);

        raw_terminal = new RawTerminal();
        raw_terminal.child_exited.connect( () => { raw_terminal.add_text("[Exited]\n"); });

        toolbar_compile = (Gtk.ToolButton)new Gtk.MenuToolButton.from_stock(Gtk.Stock.EXECUTE);
        menu_binaries = new Gtk.Menu ();
        menu_binaries.show_all ();
        ((Gtk.MenuToolButton)toolbar_compile).set_menu(menu_binaries);
        toolbar_compile.clicked.connect (() => { action_build(); });

        plugins = (Scratch.Services.Interface) object;
        plugins.hook_notebook_sidebar.connect (on_notebook_sidebar);
        plugins.hook_main_menu.connect (on_main_menu);
        plugins.hook_notebook_bottom.connect (on_notebook_bottom);
        plugins.hook_toolbar.connect (on_toolbar);
        plugins.hook_window.connect (on_new_window);
        plugins.hook_document.connect (on_new_source_view);
        plugins.hook_preferences_dialog.connect (hook_preferences_dialog);

        lock_build ();
        lock_project_actions ();

        //on_set_arg();

        /* Templates! */
        var template_manager = plugins.template_manager;
        template_manager.template_loaded.connect ((t, f) => {
            debug (f.get_path ());
            // Open loaded template
            if (!f.query_exists ())
                return;

            open_project (f.get_path ());
            current_folder = f.get_path ();
            show_terminal ();
        });

    }

    void on_notebook_sidebar (Gtk.Notebook sidebar) {
        sidebar.append_page (list, new Gtk.Label (_("Project")));
    }

    Gtk.Grid terminal_grid;
    Gtk.ScrolledWindow scrolled_raw_terminal;

    void on_notebook_bottom (Gtk.Notebook bottombar) {
        terminal_grid = new Gtk.Grid ();
        raw_terminal.vexpand = true;
        raw_terminal.hexpand = true;
        var sb = new Gtk.Scrollbar (Gtk.Orientation.VERTICAL, raw_terminal.vadjustment);
        terminal_grid.attach (raw_terminal, 0, 0, 1, 1);
        terminal_grid.attach (sb, 1, 0, 1, 1);
        bottombar.append_page (terminal_grid, new Gtk.Label (_("Compilation")));

        scrolled_raw_terminal = new Gtk.ScrolledWindow (null, null);
        scrolled_raw_terminal.add (terminal);
        bottombar.append_page (scrolled_raw_terminal, new Gtk.Label (_("Output")));

        hide_terminal ();
    }

    void on_main_menu (Gtk.Menu main_menu) {
        /*var sep = new Gtk.SeparatorMenuItem ();
        main_menu.insert (sep, 5);
        sep.show ();
        var menu = ui.get_widget ("ui/AppMenu") as Gtk.Menu;
        ((Gtk.Container)menu).get_children ().foreach ((w) => {
            w.unparent ();
            main_menu.insert ((Gtk.MenuItem)w, 5);
        });*/
        main_menu.insert ((Gtk.MenuItem)main_actions.get_action ("AddExecutable").create_menu_item (), 5);
        main_menu.insert ((Gtk.MenuItem)main_actions.get_action ("AddLibrary").create_menu_item (), 5);
        main_menu.insert ((Gtk.MenuItem)main_actions.get_action ("Open Project").create_menu_item (), 5);
    }

    /*** TOOLBAR  SECTION ***/
    void on_toolbar (Scratch.Widgets.Toolbar toolbar) {
        if (this.toolbar != null)
            return;
        this.toolbar = toolbar;
        build_arrow.clicked.connect (on_show_popover);
        toolbar.pack_start (build_arrow);
        toolbar.pack_start ((Gtk.ToolItem)main_actions.get_action ("Compile").create_tool_item ());
        toolbar.pack_start ((Gtk.ToolItem)main_actions.get_action ("Only Build").create_tool_item ());
        var bzr_btn = new Gtk.Button.from_icon_name("applications-versioncontrol", Gtk.IconSize.LARGE_TOOLBAR);
        bzr_btn.clicked.connect(() => {
            bzr_dialog = new Bazaar.BazaarDialog ();
            bzr_dialog.build_ui (current_folder);
        });
        toolbar.pack_end (bzr_btn);
        toolbar.show_all ();
    }

    public void deactivate() {
    }

    public void update_state() {
    }

    void on_show_popover() {
        build_arrow.set_state (true);
        var build_popover = new Granite.Widgets.PopOver();
        build_popover.move_to_widget(build_arrow);
        var box = build_popover.get_content_area() as Gtk.Box;
        var label = new Gtk.Label(_("Binary to launch:"));
        label.halign = Gtk.Align.START;
        box.pack_start(label);
        box.pack_start(create_binary_choice());
        var arguments = new Granite.Widgets.HintedEntry(_("Arguments..."));
        arguments.text = cmake.arguments;
        arguments.set_margin_top(10);
        box.pack_start(arguments);
        build_popover.show_all();
        build_popover.present();
        build_popover.run();
        cmake.arguments = arguments.text;
        build_popover.destroy();
        build_arrow.set_state (false);

    }

    /*public void on_set_arg()
    {
        if (plugins.set_name.down() == "euclide" && plugins.argument != null)
            open_project(plugins.argument);
    }*/

}

[ModuleInit]
public void peas_register_types (GLib.TypeModule module) {
  var objmodule = module as Peas.ObjectModule;
  objmodule.register_extension_type (typeof (Peas.Activatable),
                                     typeof (Euclide.Plugin));
}