1 /* Demo Recorder for MAEMO 5
2 * Copyright (C) 2010 Dru Moore <usr@dru-id.co.uk>
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2,
5 * or (at your option) any later version, as published by the Free
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 public class TrackDetailsDialog : Hildon.Dialog {
22 Hildon.Entry name_entry;
24 public string get_name() {
25 return name_entry.get_text();
27 public void set_name(string name) {
28 name_entry.set_text(name);
32 public TrackDetailsDialog(Gtk.Widget parent, string title) {
33 this.set_parent(parent);
34 this.set_title(title);
35 this.set_default_response(Gtk.ResponseType.CANCEL);
36 construct_interface("");
39 public TrackDetailsDialog.with_values(Gtk.Widget parent, string title, string name) {
40 this.set_parent(parent);
41 this.set_title(title);
42 this.set_default_response(Gtk.ResponseType.CANCEL);
43 construct_interface(name);
46 private void construct_interface(string name) {
47 this.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK);
49 Gtk.VBox control_area = (Gtk.VBox)this.get_content_area();
51 Gtk.HBox name_bar = new Gtk.HBox(false, 4);
53 Gtk.Label name_label = new Gtk.Label("Name");
54 name_bar.pack_start(name_label, false, false, 2);
55 name_entry = new Hildon.Entry(Hildon.SizeType.HALFSCREEN_WIDTH);
56 name_entry.set_text(name);
57 name_entry.set_placeholder("Project name");
58 name_entry.changed.connect(name_entry_changed);
59 name_bar.pack_start(name_entry, true, true, 2);
61 control_area.pack_start(name_bar, true, true, 4);
68 private void name_entry_changed() {
72 private void validate() {
74 good &= (0 < get_name().length);
75 this.set_response_sensitive(Gtk.ResponseType.OK, good);