1
// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
5
Copyright (C) 2011-2012 Mario Guerriero <mefrio.g@gmail.com>
6
This program is free software: you can redistribute it and/or modify it
7
under the terms of the GNU Lesser General Public License version 3, as published
8
by the Free Software Foundation.
10
This program is distributed in the hope that it will be useful, but
11
WITHOUT ANY WARRANTY; without even the implied warranties of
12
MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13
PURPOSE. See the GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License along
16
with this program. If not, see <http://www.gnu.org/licenses/>
23
public class Scratch.Plugins.Bash : Peas.ExtensionBase, Peas.Activatable
26
Vte.Terminal terminal;
27
public Object object { owned get; construct; }
29
public void update_state () {
32
public void activate () {
33
plugins = (Scratch.Plugins.Interface)object;
34
plugins.register_function(Interface.Hook.BOTTOMBAR, on_bottombar);
37
public void deactivate () {
42
void on_bottombar () {
43
if (plugins.bottombar != null && plugins.scratch_app != null) {
45
this.terminal = new Vte.Terminal ();
48
this.terminal.fork_command_full (Vte.PtyFlags.DEFAULT, "~/", { Vte.get_user_shell () }, null, GLib.SpawnFlags.SEARCH_PATH, null, null);
49
} catch (GLib.Error e) {
53
plugins.bottombar.append_page (terminal, new Gtk.Label ("Bash"));
59
public void peas_register_types (GLib.TypeModule module) {
60
var objmodule = module as Peas.ObjectModule;
61
objmodule.register_extension_type (typeof (Peas.Activatable),
62
typeof (Scratch.Plugins.Bash));