Skip to content
API Documentation
BastionGuard™
EstimateBox.vala
Go to the documentation of this file.
1/*
2 * EstimateBox.vala
3 *
4 * Copyright 2012-2018 Tony George <teejeetech@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 *
21 *
22 */
23
24using Gtk;
25using Gee;
26
27#if XAPP
28using XApp;
29#endif
30
31using TeeJee.Logging;
36using TeeJee.System;
37using TeeJee.Misc;
38
39class EstimateBox : Gtk.Box{
40
41 private Gtk.ProgressBar progressbar;
42 private Gtk.Window parent_window;
43
44 public EstimateBox (Gtk.Window _parent_window) {
45
46 log_debug("EstimateBox: EstimateBox()");
47
48 //base(Gtk.Orientation.VERTICAL, 6); // issue with vala
49 GLib.Object(orientation: Gtk.Orientation.VERTICAL, spacing: 6); // work-around
50 parent_window = _parent_window;
51 margin_top = 12;
52 margin_bottom = 12;
53 margin_start = 12;
54 margin_end = 12;
55
56 // header
57 add_label_header(this, _("Estimating System Size..."), true);
58
59 var hbox_status = new Gtk.Box(Orientation.HORIZONTAL, 6);
60 append(hbox_status);
61
62 var spinner = new Gtk.Spinner();
63 spinner.start();
64 hbox_status.append(spinner);
65
66 //lbl_msg
67 var lbl_msg = add_label(hbox_status, _("Please wait..."));
68 lbl_msg.halign = Align.START;
69 lbl_msg.ellipsize = Pango.EllipsizeMode.END;
70 lbl_msg.max_width_chars = 50;
71
72 //progressbar
73 progressbar = new Gtk.ProgressBar();
74 progressbar.pulse_step = 0.01;
75 //progressbar.set_size_request(-1,25);
76 append(progressbar);
77
78 log_debug("EstimateBox: EstimateBox(): exit");
79 }
80
81 public void estimate_system_size() {
82
84 log_debug("EstimateBox: size > 0");
85 return;
86 }
87
88 // start the estimation if not already running
89
90 log_debug("EstimateBox: thread started");
91
92 #if XAPP
93 XApp.set_window_progress_pulse(parent_window, true);
94 #endif
95 progressbar.pulse();
96
98
99 #if XAPP
100 XApp.set_window_progress_pulse(parent_window, false);
101 #endif
102 }
103}
Main App
#define _(s)
void estimate_system_size()
Gtk.ProgressBar progressbar
EstimateBox(Gtk.Window _parent_window)
Gtk.Window parent_window
Definition Main.vala:39
static uint64 first_snapshot_size
Definition Main.vala:123
uint64 estimate_system_size(progressCallback? callback=null)
Definition Main.vala:4168
Gtk.Label add_label(Gtk.Box box, string text, bool bold=false, bool italic=false, bool large=false)
void log_debug(string message)