4
namespace Eidete.Widgets {
6
public class EndDialog : Window {
7
public EndDialog (EideteApp app){
8
var grid = new Grid ();
11
var title = new Label ("<span size='30000'>Recording done</span>");
12
title.use_markup = true;
13
title.halign = Align.START;
14
var sub_title = new Label ("<span size='15000'>And now?</span>");
15
sub_title.use_markup = true;
16
sub_title.halign = Align.START;
18
var save = new Button.from_stock (Stock.SAVE);
19
save.set_halign (Align.END);
21
var trash = new Button.with_label ("Trash it");
22
trash.image = new Image.from_stock (Stock.DELETE, IconSize.BUTTON);
23
trash.set_halign (Align.START);
25
grid.attach (title, 0, 0, 2, 1);
26
grid.attach (sub_title, 0, 1, 2, 1);
27
grid.attach (new Label (""), 0, 2, 1, 1);
28
grid.attach (save, 0, 3, 1, 1);
29
grid.attach (trash, 1, 3, 1, 1);
32
save.clicked.connect ( () => {
33
var filter = new FileFilter ();
34
filter.add_mime_type ("video/webm");
35
var file = new FileChooserDialog ("Choose destination", this,
36
FileChooserAction.SAVE, Stock.CANCEL, ResponseType.CANCEL, Stock.OK, ResponseType.OK);
38
file.do_overwrite_confirmation = true;
39
file.set_current_name ("Untitled.webm");
40
var res = file.run ();
41
if (res == ResponseType.OK){
42
this.save (app.settings.destination, file.get_filename ());
50
trash.clicked.connect ( () => {this.destroy ();});
53
this.destroy.connect (Gtk.main_quit);
57
private void save (string tmp, string dest){
58
var source = File.new_for_path (tmp);
59
var destination = File.new_for_path (dest);
61
source.copy (destination, FileCopyFlags.NONE);
62
}catch (GLib.Error e){stderr.printf ("Error: %s\n", e.message);}