Reworked track settings.
[demorecorder] / src / ProgressPopUp.vala
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
6 *   Software Foundation
7 *
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
12 *
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.
17 */
18 namespace IdWorks {
19
20 public class ProgressPopUp : Hildon.Dialog {
21   
22   Gtk.ProgressBar progress_bar;
23   Gtk.Label message;
24
25   public ProgressPopUp(string title, Gtk.Widget parent) {
26     this.set_title(title);
27     this.set_parent(parent);
28     this.set_default_response(Gtk.ResponseType.ACCEPT);
29     
30     construct_interface();
31   }
32   
33   private void construct_interface() {
34     //this.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL);
35     
36     Gtk.VBox control_area = (Gtk.VBox)this.get_content_area();
37     
38     message = new Gtk.Label("");
39     control_area.pack_start(message, true, true, 4);
40     
41     progress_bar = new Gtk.ProgressBar();
42     control_area.pack_end(progress_bar, false, false, 4);
43     
44     this.show_all();
45   }
46   
47   public void set_progress(double percent)
48   requires (percent <= 1.0 && percent >= 0.0) {
49     this.progress_bar.set_fraction(percent);
50   }
51   
52   public void set_message(string message) {
53     this.message.set_text(message);
54   }
55   
56   public void set_progress_text(string text) {
57     this.progress_bar.set_text(text);
58   }
59   
60   public void close_me() {
61     this.response(Gtk.ResponseType.ACCEPT);
62     this.close();
63   }
64
65 }
66
67 }