--- /dev/null
+/* Demo Recorder for MAEMO 5
+* Copyright (C) 2010 Dru Moore <usr@dru-id.co.uk>
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2,
+* or (at your option) any later version, as published by the Free
+* Software Foundation
+*
+* This program 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; if not, write to the
+* Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+namespace IdWorks {
+
+ public class TrackDetailsDialog : Hildon.Dialog {
+
+ Hildon.Entry name_entry;
+
+ public string get_name() {
+ return name_entry.get_text();
+ }
+ public void set_name(string name) {
+ name_entry.set_text(name);
+ validate();
+ }
+
+ public TrackDetailsDialog(Gtk.Widget parent, string title) {
+ this.set_parent(parent);
+ this.set_title(title);
+ this.set_default_response(Gtk.ResponseType.CANCEL);
+ construct_interface("");
+ }
+
+ public TrackDetailsDialog.with_values(Gtk.Widget parent, string title, string name) {
+ this.set_parent(parent);
+ this.set_title(title);
+ this.set_default_response(Gtk.ResponseType.CANCEL);
+ construct_interface(name);
+ }
+
+ private void construct_interface(string name) {
+ this.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK);
+
+ Gtk.VBox control_area = (Gtk.VBox)this.get_content_area();
+
+ Gtk.HBox name_bar = new Gtk.HBox(false, 4);
+
+ Gtk.Label name_label = new Gtk.Label("Name");
+ name_bar.pack_start(name_label, false, false, 2);
+ name_entry = new Hildon.Entry(Hildon.SizeType.HALFSCREEN_WIDTH);
+ name_entry.set_text(name);
+ name_entry.set_placeholder("Project name");
+ name_entry.changed.connect(name_entry_changed);
+ name_bar.pack_start(name_entry, true, true, 2);
+
+ control_area.pack_start(name_bar, true, true, 4);
+
+ validate();
+
+ this.show_all();
+ }
+
+ private void name_entry_changed() {
+ validate();
+ }
+
+ private void validate() {
+ bool good = true;
+ good &= (0 < get_name().length);
+ this.set_response_sensitive(Gtk.ResponseType.OK, good);
+ }
+
+ }
+
+}
\ No newline at end of file