Adding first code drop
[demorecorder] / src / ProgressPopUp.vala
diff --git a/src/ProgressPopUp.vala b/src/ProgressPopUp.vala
new file mode 100644 (file)
index 0000000..ae48d1b
--- /dev/null
@@ -0,0 +1,67 @@
+/*  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 ProgressPopUp : Hildon.Dialog {
+  
+  Gtk.ProgressBar progress_bar;
+  Gtk.Label message;
+
+  public ProgressPopUp(string title, Gtk.Widget parent) {
+    this.set_title(title);
+    this.set_parent(parent);
+    this.set_default_response(Gtk.ResponseType.ACCEPT);
+    
+    construct_interface();
+  }
+  
+  private void construct_interface() {
+    //this.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL);
+    
+    Gtk.VBox control_area = (Gtk.VBox)this.get_content_area();
+    
+    message = new Gtk.Label("");
+    control_area.pack_start(message, true, true, 4);
+    
+    progress_bar = new Gtk.ProgressBar();
+    control_area.pack_end(progress_bar, false, false, 4);
+    
+    this.show_all();
+  }
+  
+  public void set_progress(double percent)
+  requires (percent <= 1.0 && percent >= 0.0) {
+    this.progress_bar.set_fraction(percent);
+  }
+  
+  public void set_message(string message) {
+    this.message.set_text(message);
+  }
+  
+  public void set_progress_text(string text) {
+    this.progress_bar.set_text(text);
+  }
+  
+  public void close_me() {
+    this.response(Gtk.ResponseType.ACCEPT);
+    this.close();
+  }
+
+}
+
+}
\ No newline at end of file