1 /* Copyright 2009 Yorba Foundation
3 * This software is licensed under the GNU Lesser General Public License
4 * (version 2.1 or later). See the COPYING file in this distribution.
8 class TrackInformation : Hildon.Dialog {
13 set_title("New Track");
15 add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
16 Gtk.STOCK_OK, Gtk.ResponseType.OK,
18 Gtk.Label label = new Gtk.Label("Track name:");
19 entry = new Hildon.Entry(Hildon.SizeType.HALFSCREEN_WIDTH | Hildon.SizeType.FINGER_HEIGHT);
20 entry.set_activates_default(true);
21 entry.changed.connect(on_entry_changed);
23 Gtk.Table table = new Gtk.Table(1, 2, false);
24 table.attach_defaults(label, 0, 1, 0, 1);
25 table.attach_defaults(entry, 1, 2, 0, 1);
26 table.set_col_spacing(0, 12);
27 table.set_border_width(12);
29 vbox.pack_start(table, true, true, 0);
31 set_default_response(Gtk.ResponseType.OK);
34 public void set_track_name(string new_name) {
35 entry.set_text(new_name);
36 entry.select_region(0, -1);
39 public string get_track_name() {
40 return entry.get_text().strip();
43 private void on_entry_changed() {
44 bool is_valid = get_track_name().length > 0;
45 set_response_sensitive(Gtk.ResponseType.OK, is_valid);