Skip to content
API Documentation
BastionGuard™
RestoreFinishBox.vala
Go to the documentation of this file.
1/*
2 * RestoreFinishBox.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
27using TeeJee.Logging;
32using TeeJee.System;
33using TeeJee.Misc;
34
35class RestoreFinishBox : Gtk.Box{
36 private Gtk.Label lbl_header;
37 private Gtk.Label lbl_message;
38 private Gtk.Window parent_window;
39
40 public RestoreFinishBox (Gtk.Window _parent_window) {
41
42 log_debug("RestoreFinishBox: RestoreFinishBox()");
43
44 //base(Gtk.Orientation.VERTICAL, 6); // issue with vala
45 GLib.Object(orientation: Gtk.Orientation.VERTICAL, spacing: 6); // work-around
46 parent_window = _parent_window;
47 margin_top = 12;
48 margin_bottom = 12;
49 margin_start = 12;
50 margin_end = 12;
51
52
53 lbl_header = add_label_header(this, _("Completed"), true);
54 lbl_message = add_label_scrolled(this, "", false, true, 0);
55
56 log_debug("RestoreFinishBox: RestoreFinishBox(): exit");
57 }
58
59 public void update_message(bool success, string message_header, string message_body){
60
61 // header -----------------------------------------
62
63 var txt = "";
64
65 if (message_header.length > 0){
66
67 txt = message_header;
68 }
69 else{
70 if (App.mirror_system){
71 txt = _("Cloning");
72 }
73 else{
74 txt = _("Restore");
75 }
76
77 if (success){
78 txt += " " + _("Completed");
79 }
80 else{
81 txt += " " + _("Completed With Errors");
82 }
83 }
84
85 lbl_header.label = format_text(txt, true, false, true);
86
87 // body ------------------------------------------------------
88
89 var msg = "";
90
91 if (message_body.length > 0){
92 msg = message_body;
93 }
94 else {
95
96 string bullet = "• ";
97
99 msg += bullet + _("Restored subvolumes will become active after system is restarted.") + "\n";
100 msg += "\n";
101 msg += bullet + _("You can continue working on the current system. After restart, the current system will be visible as a new snapshot. This snapshot can be restored later if required, to 'undo' the restore.") + "\n";
102 }
103
104 if (!App.btrfs_mode){
105 msg += bullet + _("If the restored system fails to boot, then boot from the Live CD/USB, install BastionGuard Backup, and try restoring another snapshot.") + "\n\n";
106 }
107
108 msg += "\n";
109 msg += "<b>" + _("Close window to exit") + "</b>\n\n";
110 }
111
112 lbl_message.label = msg;
113 }
114
115}
Main App
#define _(s)
bool restore_current_system
Definition Main.vala:2024
bool btrfs_mode
Definition Main.vala:52
bool mirror_system
Definition Main.vala:85
RestoreFinishBox(Gtk.Window _parent_window)
void update_message(bool success, string message_header, string message_body)
void log_debug(string message)