2
Copyright (C) 2013 Julien Spautz <spautz.julien@gmail.com>
4
This program or library is free software; you can redistribute it
5
and/or modify it under the terms of the GNU Lesser General Public
6
License as published by the Free Software Foundation; either
7
version 3 of the License, or (at your option) any later version.
9
This library 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
Lesser General Public License for more details.
14
You should have received a copy of the GNU Lesser General
15
Public License along with this library; if not, write to the
16
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301 USA.
20
public class Pantheon.Startup.Widgets.Editor : Gtk.Grid {
22
public string icon { get; set; }
24
public new string name {
25
get { return name_entry.text; }
26
set { name_entry.text = value; }
29
public string comment {
30
get { return comment_entry.text; }
31
set { comment_entry.text = value; }
34
public string command {
35
get { return command_entry.text; }
36
set { command_entry.text = value; }
43
Backend.KeyFile key_file;
46
Gtk.Entry comment_entry;
47
Gtk.Entry command_entry;
50
var name_label = new Gtk.Label (_("Name:"));
51
name_label.halign = Gtk.Align.END;
52
name_entry = new Gtk.Entry ();
53
name_entry.placeholder_text = _("Application name");
54
name_entry.width_request = 300;
55
name_entry.valign = Gtk.Align.END;
57
var comment_label = new Gtk.Label (_("Description:"));
58
comment_label.halign = Gtk.Align.END;
59
comment_entry = new Gtk.Entry ();
60
comment_entry.placeholder_text = _("Short description");
62
var command_label = new Gtk.Label (_("Command:"));
63
command_label.halign = Gtk.Align.END;
64
command_entry = new Gtk.Entry ();
65
command_entry.placeholder_text = _("Command to execute");
67
this.attach (name_label, 0, 0, 1, 1);
68
this.attach (name_entry, 1, 0, 1, 1);
69
this.attach (comment_label, 0, 1, 1, 1);
70
this.attach (comment_entry, 1, 1, 1, 1);
71
this.attach (command_label, 0, 2, 1, 1);
72
this.attach (command_entry, 1, 2, 1, 1);
77
halign = Gtk.Align.CENTER;
79
name_entry.notify["text"].connect (() => {
80
key_file.name = name_entry.text;
81
key_file.write_to_file ();
84
comment_entry.notify["text"].connect (() => {
85
key_file.comment = comment_entry.text;
86
key_file.write_to_file ();
89
command_entry.notify["text"].connect (() => {
90
key_file.command = command_entry.text;
91
key_file.write_to_file ();
95
public void load_key_file (Backend.KeyFile key_file) {
96
this.key_file = key_file;
98
name_entry.text = key_file.name;
99
comment_entry.text = key_file.comment;
100
command_entry.text = key_file.command;
b'\\ No newline at end of file'