X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2FTrackDetailsDialog.vala;fp=src%2FTrackDetailsDialog.vala;h=ce4aed88eb66e73aa1b79d1e6f6978f099c64294;hb=d78286b837d46480c687687e6cdf43d0b4814258;hp=0000000000000000000000000000000000000000;hpb=116c137ffbdd892b59e3bfb19907bbde2d082acd;p=demorecorder diff --git a/src/TrackDetailsDialog.vala b/src/TrackDetailsDialog.vala new file mode 100644 index 0000000..ce4aed8 --- /dev/null +++ b/src/TrackDetailsDialog.vala @@ -0,0 +1,80 @@ +/* Demo Recorder for MAEMO 5 +* Copyright (C) 2010 Dru Moore +* 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