1
by Tony George
Initial release |
1 |
/*
|
2 |
* MainWindow.vala
|
|
178
by Tony George
v1.7.4 |
3 |
*
|
1
by Tony George
Initial release |
4 |
* Copyright 2013 Tony George <teejee2008@gmail.com>
|
178
by Tony George
v1.7.4 |
5 |
*
|
1
by Tony George
Initial release |
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.
|
|
178
by Tony George
v1.7.4 |
10 |
*
|
1
by Tony George
Initial release |
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.
|
|
178
by Tony George
v1.7.4 |
15 |
*
|
1
by Tony George
Initial release |
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.
|
|
178
by Tony George
v1.7.4 |
20 |
*
|
21 |
*
|
|
1
by Tony George
Initial release |
22 |
*/
|
23 |
||
24 |
using Gtk; |
|
25 |
using Gee; |
|
33
by Tony George
Updated utility lib to v1.1 |
26 |
|
27 |
using TeeJee.Logging; |
|
28 |
using TeeJee.FileSystem; |
|
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
29 |
using TeeJee.Devices; |
33
by Tony George
Updated utility lib to v1.1 |
30 |
using TeeJee.JSON; |
31 |
using TeeJee.ProcessManagement; |
|
32 |
using TeeJee.GtkHelper; |
|
33 |
using TeeJee.Multimedia; |
|
34 |
using TeeJee.System; |
|
35 |
using TeeJee.Misc; |
|
1
by Tony George
Initial release |
36 |
|
37 |
public class RestoreWindow : Gtk.Dialog{ |
|
38 |
private Box vbox_main; |
|
39 |
private Box hbox_action; |
|
40 |
private Notebook notebook; |
|
41 |
||
42 |
//target device
|
|
43 |
private Label lbl_header_partitions; |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
44 |
private RadioButton radio_sys; |
45 |
private RadioButton radio_other; |
|
1
by Tony George
Initial release |
46 |
private TreeView tv_partitions; |
47 |
private ScrolledWindow sw_partitions; |
|
48 |
private TreeViewColumn col_device_target; |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
49 |
private TreeViewColumn col_mount; |
1
by Tony George
Initial release |
50 |
private TreeViewColumn col_fs; |
51 |
private TreeViewColumn col_size; |
|
52 |
private TreeViewColumn col_dist; |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
53 |
private CellRendererCombo cell_mount; |
178
by Tony George
v1.7.4 |
54 |
|
1
by Tony George
Initial release |
55 |
//bootloader
|
56 |
private Label lbl_header_bootloader; |
|
57 |
private ComboBox cmb_boot_device; |
|
110
by Tony George
Added option to skip bootloader installation |
58 |
private CheckButton chk_skip_grub_install; |
178
by Tony George
v1.7.4 |
59 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
60 |
//apps
|
61 |
private Label lbl_app; |
|
62 |
private Box vbox_app; |
|
63 |
private Label lbl_app_message; |
|
64 |
private TreeView tv_app; |
|
65 |
private ScrolledWindow sw_app; |
|
66 |
private TreeViewColumn col_app; |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
67 |
|
1
by Tony George
Initial release |
68 |
//exclude
|
69 |
private Label lbl_exclude; |
|
70 |
private Box vbox_exclude; |
|
71 |
private LinkButton lnk_default_list; |
|
72 |
private TreeView tv_exclude; |
|
73 |
private ScrolledWindow sw_exclude; |
|
74 |
private TreeViewColumn col_exclude; |
|
75 |
private Toolbar toolbar_exclude; |
|
76 |
private ToolButton btn_remove; |
|
77 |
private ToolButton btn_warning; |
|
78 |
private ToolButton btn_reset_exclude_list; |
|
178
by Tony George
v1.7.4 |
79 |
|
1
by Tony George
Initial release |
80 |
private MenuToolButton btn_exclude; |
81 |
private Gtk.Menu menu_exclude; |
|
82 |
private ImageMenuItem menu_exclude_add_file; |
|
83 |
private ImageMenuItem menu_exclude_add_folder; |
|
84 |
private ImageMenuItem menu_exclude_add_folder_contents; |
|
178
by Tony George
v1.7.4 |
85 |
|
1
by Tony George
Initial release |
86 |
private MenuToolButton btn_include; |
87 |
private Gtk.Menu menu_include; |
|
88 |
private ImageMenuItem menu_include_add_file; |
|
89 |
private ImageMenuItem menu_include_add_folder; |
|
178
by Tony George
v1.7.4 |
90 |
|
1
by Tony George
Initial release |
91 |
private Gee.ArrayList<string> temp_exclude_list; |
178
by Tony George
v1.7.4 |
92 |
|
1
by Tony George
Initial release |
93 |
//actions
|
94 |
private Button btn_cancel; |
|
95 |
private Button btn_restore; |
|
178
by Tony George
v1.7.4 |
96 |
|
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
97 |
private Device selected_target = null; |
178
by Tony George
v1.7.4 |
98 |
|
1
by Tony George
Initial release |
99 |
public RestoreWindow () { |
100 |
this.title = _("Restore"); |
|
101 |
this.window_position = WindowPosition.CENTER_ON_PARENT; |
|
102 |
this.set_destroy_with_parent (true); |
|
103 |
this.set_modal (true); |
|
25
by Tony George
Add exclude entries for root user's home dircetory |
104 |
this.set_default_size (550, 500); |
86
by Tony George
Update messages |
105 |
this.skip_taskbar_hint = true; |
102
by Tony George
Updated toolbar icons |
106 |
this.icon = get_app_icon(16); |
178
by Tony George
v1.7.4 |
107 |
|
1
by Tony George
Initial release |
108 |
//vbox_main
|
109 |
vbox_main = get_content_area (); |
|
110 |
||
111 |
//notebook
|
|
112 |
notebook = new Notebook (); |
|
113 |
notebook.margin = 6; |
|
114 |
vbox_main.pack_start (notebook, true, true, 0); |
|
115 |
||
116 |
//target device tab -------------------------------------------------
|
|
178
by Tony George
v1.7.4 |
117 |
|
1
by Tony George
Initial release |
118 |
//lbl_exclude
|
119 |
lbl_exclude = new Label (_("Target")); |
|
120 |
||
121 |
//vbox_target
|
|
122 |
Box vbox_target = new Box (Orientation.VERTICAL, 6); |
|
123 |
vbox_target.margin = 6; |
|
124 |
notebook.append_page (vbox_target, lbl_exclude); |
|
178
by Tony George
v1.7.4 |
125 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
126 |
//hbox_device
|
127 |
Box hbox_device = new Box (Orientation.HORIZONTAL, 6); |
|
110
by Tony George
Added option to skip bootloader installation |
128 |
//hbox_device.margin = 6;
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
129 |
vbox_target.add(hbox_device); |
130 |
||
1
by Tony George
Initial release |
131 |
//lbl_header_partitions
|
126
by Tony George
New option to clone current system |
132 |
lbl_header_partitions = new Gtk.Label((App.mirror_system ? _("Device for Cloning System") : _("Device for Restoring Snapshot")) + ":"); |
1
by Tony George
Initial release |
133 |
lbl_header_partitions.xalign = (float) 0.0; |
134 |
lbl_header_partitions.set_use_markup(true); |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
135 |
hbox_device.add(lbl_header_partitions); |
136 |
||
137 |
radio_sys = new RadioButton(null); |
|
138 |
hbox_device.add(radio_sys); |
|
139 |
radio_sys.label = "Current System"; |
|
178
by Tony George
v1.7.4 |
140 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
141 |
radio_other = new RadioButton.from_widget(radio_sys); |
142 |
hbox_device.add(radio_other); |
|
143 |
radio_other.label = "Other Device"; |
|
144 |
||
126
by Tony George
New option to clone current system |
145 |
if (App.live_system() || App.mirror_system){ |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
146 |
radio_other.active = true; |
147 |
radio_sys.sensitive = false; |
|
148 |
}
|
|
149 |
else{ |
|
150 |
radio_sys.sensitive = true; |
|
151 |
radio_sys.active = true; |
|
152 |
}
|
|
178
by Tony George
v1.7.4 |
153 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
154 |
radio_sys.toggled.connect(() => { |
155 |
sw_partitions.sensitive = radio_other.active; |
|
178
by Tony George
v1.7.4 |
156 |
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
157 |
refresh_tv_partitions(); |
178
by Tony George
v1.7.4 |
158 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
159 |
if (radio_sys.active){ |
160 |
App.restore_target = App.root_device; |
|
161 |
}
|
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
162 |
else{ |
163 |
init_mounts(); |
|
164 |
}
|
|
165 |
||
178
by Tony George
v1.7.4 |
166 |
//tv_partitions_select_target();
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
167 |
cmb_boot_device_select_default(); |
168 |
});
|
|
178
by Tony George
v1.7.4 |
169 |
|
1
by Tony George
Initial release |
170 |
//tv_partitions
|
171 |
tv_partitions = new TreeView(); |
|
172 |
tv_partitions.get_selection().mode = SelectionMode.SINGLE; |
|
173 |
tv_partitions.set_rules_hint (true); |
|
174 |
tv_partitions.button_release_event.connect(tv_partitions_button_press_event); |
|
178
by Tony George
v1.7.4 |
175 |
|
1
by Tony George
Initial release |
176 |
//sw_partitions
|
177 |
sw_partitions = new ScrolledWindow(null, null); |
|
178 |
sw_partitions.set_shadow_type (ShadowType.ETCHED_IN); |
|
179 |
sw_partitions.add (tv_partitions); |
|
180 |
sw_partitions.expand = true; |
|
181 |
vbox_target.add(sw_partitions); |
|
178
by Tony George
v1.7.4 |
182 |
|
1
by Tony George
Initial release |
183 |
//col_device
|
184 |
col_device_target = new TreeViewColumn(); |
|
185 |
col_device_target.title = _("Device"); |
|
186 |
col_device_target.spacing = 1; |
|
73
by Tony George
Restore window: Add tooltip description |
187 |
tv_partitions.append_column(col_device_target); |
178
by Tony George
v1.7.4 |
188 |
|
158
by Tony George
Unlock all encrypted devices selected by user before restore; Unlocked device will be autoselected silently without prompt; Display lock icon for encrypted devices |
189 |
CellRendererPixbuf cell_device_icon = new CellRendererPixbuf(); |
1
by Tony George
Initial release |
190 |
cell_device_icon.xpad = 1; |
191 |
col_device_target.pack_start (cell_device_icon, false); |
|
158
by Tony George
Unlock all encrypted devices selected by user before restore; Unlocked device will be autoselected silently without prompt; Display lock icon for encrypted devices |
192 |
col_device_target.set_attributes(cell_device_icon, "pixbuf", 3); |
1
by Tony George
Initial release |
193 |
|
194 |
CellRendererText cell_device_target = new CellRendererText (); |
|
195 |
col_device_target.pack_start (cell_device_target, false); |
|
196 |
col_device_target.set_cell_data_func (cell_device_target, cell_device_target_render); |
|
73
by Tony George
Restore window: Add tooltip description |
197 |
|
198 |
//col_fs
|
|
199 |
col_fs = new TreeViewColumn(); |
|
200 |
col_fs.title = _("Type"); |
|
201 |
CellRendererText cell_fs = new CellRendererText (); |
|
202 |
cell_fs.xalign = (float) 0.5; |
|
203 |
col_fs.pack_start (cell_fs, false); |
|
204 |
col_fs.set_cell_data_func (cell_fs, cell_fs_render); |
|
205 |
tv_partitions.append_column(col_fs); |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
206 |
|
207 |
//col_mount
|
|
208 |
col_mount = new TreeViewColumn(); |
|
209 |
col_mount.title = _("Mount"); |
|
210 |
cell_mount = new CellRendererCombo(); |
|
211 |
cell_mount.xalign = (float) 0.0; |
|
212 |
cell_mount.editable = true; |
|
213 |
cell_mount.width = 70; |
|
214 |
col_mount.pack_start (cell_mount, false); |
|
115
by Tony George
v1.5 |
215 |
col_mount.set_cell_data_func (cell_mount, cell_mount_render); |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
216 |
tv_partitions.append_column(col_mount); |
178
by Tony George
v1.7.4 |
217 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
218 |
cell_mount.set_property ("text-column", 0); |
219 |
col_mount.add_attribute (cell_mount, "text", 1); |
|
220 |
||
221 |
//populate combo
|
|
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
222 |
var model = new Gtk.ListStore(1, typeof(string)); |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
223 |
cell_mount.model = model; |
178
by Tony George
v1.7.4 |
224 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
225 |
TreeIter iter; |
226 |
model.append(out iter); |
|
227 |
model.set (iter, 0, "/"); |
|
228 |
model.append(out iter); |
|
229 |
model.set (iter, 0, "/home"); |
|
230 |
model.append(out iter); |
|
231 |
model.set (iter, 0, "/boot"); |
|
232 |
||
233 |
cell_mount.changed.connect((path, iter_new) => { |
|
234 |
string val; |
|
235 |
cell_mount.model.get (iter_new, 0, out val); |
|
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
236 |
model = (Gtk.ListStore) tv_partitions.model; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
237 |
model.get_iter_from_string (out iter, path); |
238 |
model.set (iter, 1, val); |
|
239 |
});
|
|
178
by Tony George
v1.7.4 |
240 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
241 |
cell_mount.edited.connect((path, new_text) => { |
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
242 |
model = (Gtk.ListStore) tv_partitions.model; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
243 |
model.get_iter_from_string (out iter, path); |
244 |
model.set (iter, 1, new_text); |
|
245 |
});
|
|
1
by Tony George
Initial release |
246 |
|
247 |
//col_size
|
|
248 |
col_size = new TreeViewColumn(); |
|
249 |
col_size.title = _("Size"); |
|
250 |
CellRendererText cell_size = new CellRendererText (); |
|
251 |
cell_size.xalign = (float) 1.0; |
|
252 |
col_size.pack_start (cell_size, false); |
|
253 |
col_size.set_cell_data_func (cell_size, cell_size_render); |
|
254 |
tv_partitions.append_column(col_size); |
|
178
by Tony George
v1.7.4 |
255 |
|
1
by Tony George
Initial release |
256 |
//col_dist
|
257 |
col_dist = new TreeViewColumn(); |
|
258 |
col_dist.title = _("System"); |
|
259 |
CellRendererText cell_dist = new CellRendererText (); |
|
260 |
col_dist.pack_start (cell_dist, false); |
|
261 |
col_dist.set_cell_data_func (cell_dist, cell_dist_render); |
|
262 |
tv_partitions.append_column(col_dist); |
|
73
by Tony George
Restore window: Add tooltip description |
263 |
|
264 |
tv_partitions.set_tooltip_column(2); |
|
178
by Tony George
v1.7.4 |
265 |
|
1
by Tony George
Initial release |
266 |
//bootloader options -------------------------------------------
|
178
by Tony George
v1.7.4 |
267 |
|
1
by Tony George
Initial release |
268 |
//lbl_header_bootloader
|
21
by Tony George
Added support for LVM volumes; Updated restore window |
269 |
lbl_header_bootloader = new Gtk.Label(_("Device for Bootloader Installation") + ":"); |
1
by Tony George
Initial release |
270 |
lbl_header_bootloader.set_use_markup(true); |
271 |
lbl_header_bootloader.xalign = (float) 0.0; |
|
272 |
vbox_target.add(lbl_header_bootloader); |
|
178
by Tony George
v1.7.4 |
273 |
|
1
by Tony George
Initial release |
274 |
//hbox_grub
|
275 |
Box hbox_grub = new Box (Orientation.HORIZONTAL, 6); |
|
276 |
hbox_grub.margin_right = 6; |
|
110
by Tony George
Added option to skip bootloader installation |
277 |
//hbox_grub.margin_bottom = 6;
|
1
by Tony George
Initial release |
278 |
vbox_target.add (hbox_grub); |
279 |
||
280 |
//cmb_boot_device
|
|
281 |
cmb_boot_device = new ComboBox (); |
|
282 |
cmb_boot_device.hexpand = true; |
|
283 |
hbox_grub.add(cmb_boot_device); |
|
178
by Tony George
v1.7.4 |
284 |
|
1
by Tony George
Initial release |
285 |
CellRendererText cell_dev_margin = new CellRendererText (); |
286 |
cell_dev_margin.text = ""; |
|
287 |
cmb_boot_device.pack_start (cell_dev_margin, false); |
|
178
by Tony George
v1.7.4 |
288 |
|
1
by Tony George
Initial release |
289 |
CellRendererPixbuf cell_dev_icon = new CellRendererPixbuf (); |
75
by Tony George
Remove Gtk.Stock references |
290 |
cell_dev_icon.stock_id = "gtk-harddisk"; |
1
by Tony George
Initial release |
291 |
cmb_boot_device.pack_start (cell_dev_icon, false); |
178
by Tony George
v1.7.4 |
292 |
|
1
by Tony George
Initial release |
293 |
CellRendererText cell_device_grub = new CellRendererText(); |
294 |
cmb_boot_device.pack_start(cell_device_grub, false ); |
|
295 |
cmb_boot_device.set_cell_data_func (cell_device_grub, cell_device_grub_render); |
|
178
by Tony George
v1.7.4 |
296 |
|
110
by Tony George
Added option to skip bootloader installation |
297 |
string tt = "<b>" + _("** Advanced Users **") + "</b>\n\n"+ _("Skips bootloader (re)installation on target device.\nFiles in /boot directory on target partition will remain untouched.\n\nIf you are restoring a system that was bootable previously then it should boot successfully.\nOtherwise the system may fail to boot."); |
178
by Tony George
v1.7.4 |
298 |
|
110
by Tony George
Added option to skip bootloader installation |
299 |
//chk_skip_grub_install
|
300 |
chk_skip_grub_install = new CheckButton.with_label(_("Skip bootloader installation (not recommended)")); |
|
301 |
chk_skip_grub_install.active = false; |
|
302 |
chk_skip_grub_install.set_tooltip_markup(tt); |
|
303 |
vbox_target.add (chk_skip_grub_install); |
|
178
by Tony George
v1.7.4 |
304 |
|
110
by Tony George
Added option to skip bootloader installation |
305 |
chk_skip_grub_install.toggled.connect(()=>{ |
306 |
cmb_boot_device.sensitive = !chk_skip_grub_install.active; |
|
307 |
});
|
|
178
by Tony George
v1.7.4 |
308 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
309 |
//Exclude Apps tab ---------------------------------------------
|
178
by Tony George
v1.7.4 |
310 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
311 |
//lbl_apps
|
312 |
lbl_app = new Label (_("Exclude")); |
|
313 |
||
314 |
//vbox_apps
|
|
315 |
vbox_app = new Box(Gtk.Orientation.VERTICAL, 6); |
|
316 |
vbox_app.margin = 6; |
|
317 |
notebook.append_page (vbox_app, lbl_app); |
|
178
by Tony George
v1.7.4 |
318 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
319 |
//lbl_app_message
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
320 |
string msg = _("Select the applications for which current settings should be kept.") + "\n"; |
321 |
msg += _("For all other applications, settings will be restored from selected snapshot."); |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
322 |
lbl_app_message = new Label (msg); |
323 |
lbl_app_message.xalign = (float) 0.0; |
|
324 |
vbox_app.add(lbl_app_message); |
|
178
by Tony George
v1.7.4 |
325 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
326 |
//tv_app-----------------------------------------------
|
327 |
||
328 |
//tv_app
|
|
329 |
tv_app = new TreeView(); |
|
330 |
tv_app.get_selection().mode = SelectionMode.MULTIPLE; |
|
331 |
tv_app.headers_visible = false; |
|
332 |
tv_app.set_rules_hint (true); |
|
333 |
||
334 |
//sw_app
|
|
335 |
sw_app = new ScrolledWindow(null, null); |
|
336 |
sw_app.set_shadow_type (ShadowType.ETCHED_IN); |
|
337 |
sw_app.add (tv_app); |
|
338 |
sw_app.expand = true; |
|
339 |
vbox_app.add(sw_app); |
|
340 |
||
341 |
//col_app
|
|
342 |
col_app = new TreeViewColumn(); |
|
343 |
col_app.title = _("Application"); |
|
344 |
col_app.expand = true; |
|
345 |
tv_app.append_column(col_app); |
|
178
by Tony George
v1.7.4 |
346 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
347 |
CellRendererText cell_app_margin = new CellRendererText (); |
348 |
cell_app_margin.text = ""; |
|
349 |
col_app.pack_start (cell_app_margin, false); |
|
178
by Tony George
v1.7.4 |
350 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
351 |
CellRendererToggle cell_app_enabled = new CellRendererToggle (); |
352 |
cell_app_enabled.radio = false; |
|
353 |
cell_app_enabled.activatable = true; |
|
354 |
col_app.pack_start (cell_app_enabled, false); |
|
355 |
col_app.set_cell_data_func (cell_app_enabled, cell_app_enabled_render); |
|
178
by Tony George
v1.7.4 |
356 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
357 |
cell_app_enabled.toggled.connect (cell_app_enabled_toggled); |
178
by Tony George
v1.7.4 |
358 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
359 |
CellRendererText cell_app_text = new CellRendererText (); |
360 |
col_app.pack_start (cell_app_text, false); |
|
361 |
col_app.set_cell_data_func (cell_app_text, cell_app_text_render); |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
362 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
363 |
//Advanced tab ---------------------------------------------
|
178
by Tony George
v1.7.4 |
364 |
|
1
by Tony George
Initial release |
365 |
//lbl_exclude
|
366 |
lbl_exclude = new Label (_("Advanced")); |
|
367 |
||
368 |
//vbox_exclude
|
|
369 |
vbox_exclude = new Box(Gtk.Orientation.VERTICAL, 6); |
|
370 |
vbox_exclude.margin = 6; |
|
371 |
notebook.append_page (vbox_exclude, lbl_exclude); |
|
372 |
||
373 |
//toolbar_exclude ---------------------------------------------------
|
|
178
by Tony George
v1.7.4 |
374 |
|
1
by Tony George
Initial release |
375 |
//toolbar_exclude
|
376 |
toolbar_exclude = new Gtk.Toolbar (); |
|
377 |
toolbar_exclude.toolbar_style = ToolbarStyle.BOTH_HORIZ; |
|
378 |
vbox_exclude.add(toolbar_exclude); |
|
178
by Tony George
v1.7.4 |
379 |
|
1
by Tony George
Initial release |
380 |
string png_exclude = App.share_folder + "/timeshift/images/item-gray.png"; |
381 |
string png_include = App.share_folder + "/timeshift/images/item-blue.png"; |
|
178
by Tony George
v1.7.4 |
382 |
|
1
by Tony George
Initial release |
383 |
//btn_exclude
|
384 |
btn_exclude = new Gtk.MenuToolButton(null,""); |
|
385 |
toolbar_exclude.add(btn_exclude); |
|
178
by Tony George
v1.7.4 |
386 |
|
1
by Tony George
Initial release |
387 |
btn_exclude.is_important = true; |
388 |
btn_exclude.label = _("Exclude"); |
|
389 |
btn_exclude.set_tooltip_text (_("Exclude")); |
|
390 |
btn_exclude.set_icon_widget(new Gtk.Image.from_file (png_exclude)); |
|
178
by Tony George
v1.7.4 |
391 |
|
1
by Tony George
Initial release |
392 |
//btn_include
|
393 |
btn_include = new Gtk.MenuToolButton(null,""); |
|
394 |
toolbar_exclude.add(btn_include); |
|
178
by Tony George
v1.7.4 |
395 |
|
1
by Tony George
Initial release |
396 |
btn_include.is_important = true; |
397 |
btn_include.label = _("Include"); |
|
398 |
btn_include.set_tooltip_text (_("Include")); |
|
399 |
btn_include.set_icon_widget(new Gtk.Image.from_file (png_include)); |
|
178
by Tony George
v1.7.4 |
400 |
|
1
by Tony George
Initial release |
401 |
//btn_remove
|
75
by Tony George
Remove Gtk.Stock references |
402 |
btn_remove = new Gtk.ToolButton.from_stock("gtk-remove"); |
1
by Tony George
Initial release |
403 |
toolbar_exclude.add(btn_remove); |
178
by Tony George
v1.7.4 |
404 |
|
1
by Tony George
Initial release |
405 |
btn_remove.is_important = true; |
406 |
btn_remove.label = _("Remove"); |
|
407 |
btn_remove.set_tooltip_text (_("Remove selected items")); |
|
408 |
||
409 |
btn_remove.clicked.connect (btn_remove_clicked); |
|
410 |
||
411 |
//btn_warning
|
|
75
by Tony George
Remove Gtk.Stock references |
412 |
btn_warning = new Gtk.ToolButton.from_stock("gtk-dialog-warning"); |
1
by Tony George
Initial release |
413 |
toolbar_exclude.add(btn_warning); |
178
by Tony George
v1.7.4 |
414 |
|
1
by Tony George
Initial release |
415 |
btn_warning.is_important = true; |
416 |
btn_warning.label = _("Warning"); |
|
417 |
btn_warning.set_tooltip_text (_("Warning")); |
|
418 |
||
419 |
btn_warning.clicked.connect (btn_warning_clicked); |
|
420 |
||
421 |
//separator
|
|
422 |
var separator = new Gtk.SeparatorToolItem(); |
|
423 |
separator.set_draw (false); |
|
424 |
separator.set_expand (true); |
|
425 |
toolbar_exclude.add(separator); |
|
178
by Tony George
v1.7.4 |
426 |
|
1
by Tony George
Initial release |
427 |
//btn_reset_exclude_list
|
75
by Tony George
Remove Gtk.Stock references |
428 |
btn_reset_exclude_list = new Gtk.ToolButton.from_stock("gtk-refresh"); |
1
by Tony George
Initial release |
429 |
toolbar_exclude.add(btn_reset_exclude_list); |
178
by Tony George
v1.7.4 |
430 |
|
1
by Tony George
Initial release |
431 |
btn_reset_exclude_list.is_important = false; |
432 |
btn_reset_exclude_list.label = _("Reset"); |
|
433 |
btn_reset_exclude_list.set_tooltip_text (_("Reset this list to default state")); |
|
434 |
||
435 |
btn_reset_exclude_list.clicked.connect (btn_reset_exclude_list_clicked); |
|
178
by Tony George
v1.7.4 |
436 |
|
1
by Tony George
Initial release |
437 |
//menu --------------------------------------------------
|
178
by Tony George
v1.7.4 |
438 |
|
1
by Tony George
Initial release |
439 |
//menu_exclude
|
440 |
menu_exclude = new Gtk.Menu(); |
|
441 |
btn_exclude.set_menu(menu_exclude); |
|
178
by Tony George
v1.7.4 |
442 |
|
1
by Tony George
Initial release |
443 |
//menu_exclude_add_file
|
444 |
menu_exclude_add_file = new ImageMenuItem.with_label (""); |
|
445 |
menu_exclude_add_file.label = _("Exclude File(s)"); |
|
446 |
menu_exclude_add_file.set_image(new Gtk.Image.from_file (png_exclude)); |
|
447 |
menu_exclude.append(menu_exclude_add_file); |
|
178
by Tony George
v1.7.4 |
448 |
|
1
by Tony George
Initial release |
449 |
menu_exclude_add_file.activate.connect (menu_exclude_add_files_clicked); |
450 |
||
451 |
//menu_exclude_add_folder
|
|
452 |
menu_exclude_add_folder = new ImageMenuItem.with_label (""); |
|
453 |
menu_exclude_add_folder.label = _("Exclude Directory"); |
|
454 |
menu_exclude_add_folder.set_image(new Gtk.Image.from_file (png_exclude)); |
|
455 |
menu_exclude.append(menu_exclude_add_folder); |
|
178
by Tony George
v1.7.4 |
456 |
|
1
by Tony George
Initial release |
457 |
menu_exclude_add_folder.activate.connect (menu_exclude_add_folder_clicked); |
458 |
||
459 |
//menu_exclude_add_folder_contents
|
|
460 |
menu_exclude_add_folder_contents = new ImageMenuItem.with_label (""); |
|
461 |
menu_exclude_add_folder_contents.label = _("Exclude Directory Contents"); |
|
462 |
menu_exclude_add_folder_contents.set_image(new Gtk.Image.from_file (png_exclude)); |
|
463 |
menu_exclude.append(menu_exclude_add_folder_contents); |
|
178
by Tony George
v1.7.4 |
464 |
|
1
by Tony George
Initial release |
465 |
menu_exclude_add_folder_contents.activate.connect (menu_exclude_add_folder_contents_clicked); |
178
by Tony George
v1.7.4 |
466 |
|
1
by Tony George
Initial release |
467 |
//menu_include
|
468 |
menu_include = new Gtk.Menu(); |
|
469 |
btn_include.set_menu(menu_include); |
|
178
by Tony George
v1.7.4 |
470 |
|
1
by Tony George
Initial release |
471 |
//menu_include_add_file
|
472 |
menu_include_add_file = new ImageMenuItem.with_label (""); |
|
473 |
menu_include_add_file.label = _("Include File(s)"); |
|
474 |
menu_include_add_file.set_image(new Gtk.Image.from_file (png_include)); |
|
475 |
menu_include.append(menu_include_add_file); |
|
178
by Tony George
v1.7.4 |
476 |
|
1
by Tony George
Initial release |
477 |
menu_include_add_file.activate.connect (menu_include_add_files_clicked); |
478 |
||
479 |
//menu_include_add_folder
|
|
480 |
menu_include_add_folder = new ImageMenuItem.with_label (""); |
|
481 |
menu_include_add_folder.label = _("Include Directory"); |
|
482 |
menu_include_add_folder.set_image(new Gtk.Image.from_file (png_include)); |
|
483 |
menu_include.append(menu_include_add_folder); |
|
178
by Tony George
v1.7.4 |
484 |
|
1
by Tony George
Initial release |
485 |
menu_include_add_folder.activate.connect (menu_include_add_folder_clicked); |
178
by Tony George
v1.7.4 |
486 |
|
1
by Tony George
Initial release |
487 |
menu_exclude.show_all(); |
488 |
menu_include.show_all(); |
|
178
by Tony George
v1.7.4 |
489 |
|
1
by Tony George
Initial release |
490 |
//tv_exclude-----------------------------------------------
|
178
by Tony George
v1.7.4 |
491 |
|
1
by Tony George
Initial release |
492 |
//tv_exclude
|
493 |
tv_exclude = new TreeView(); |
|
494 |
tv_exclude.get_selection().mode = SelectionMode.MULTIPLE; |
|
495 |
tv_exclude.headers_visible = true; |
|
496 |
tv_exclude.set_rules_hint (true); |
|
497 |
//tv_exclude.row_activated.connect(tv_exclude_row_activated);
|
|
178
by Tony George
v1.7.4 |
498 |
|
1
by Tony George
Initial release |
499 |
//sw_exclude
|
500 |
sw_exclude = new ScrolledWindow(null, null); |
|
501 |
sw_exclude.set_shadow_type (ShadowType.ETCHED_IN); |
|
502 |
sw_exclude.add (tv_exclude); |
|
503 |
sw_exclude.expand = true; |
|
504 |
vbox_exclude.add(sw_exclude); |
|
505 |
||
506 |
//col_exclude
|
|
507 |
col_exclude = new TreeViewColumn(); |
|
508 |
col_exclude.title = _("File Pattern"); |
|
509 |
col_exclude.expand = true; |
|
178
by Tony George
v1.7.4 |
510 |
|
1
by Tony George
Initial release |
511 |
CellRendererText cell_exclude_margin = new CellRendererText (); |
512 |
cell_exclude_margin.text = ""; |
|
513 |
col_exclude.pack_start (cell_exclude_margin, false); |
|
178
by Tony George
v1.7.4 |
514 |
|
1
by Tony George
Initial release |
515 |
CellRendererPixbuf cell_exclude_icon = new CellRendererPixbuf (); |
516 |
col_exclude.pack_start (cell_exclude_icon, false); |
|
517 |
col_exclude.set_attributes(cell_exclude_icon, "pixbuf", 1); |
|
178
by Tony George
v1.7.4 |
518 |
|
1
by Tony George
Initial release |
519 |
CellRendererText cell_exclude_text = new CellRendererText (); |
520 |
col_exclude.pack_start (cell_exclude_text, false); |
|
521 |
col_exclude.set_cell_data_func (cell_exclude_text, cell_exclude_text_render); |
|
522 |
cell_exclude_text.editable = true; |
|
523 |
tv_exclude.append_column(col_exclude); |
|
178
by Tony George
v1.7.4 |
524 |
|
1
by Tony George
Initial release |
525 |
cell_exclude_text.edited.connect (cell_exclude_text_edited); |
178
by Tony George
v1.7.4 |
526 |
|
1
by Tony George
Initial release |
527 |
//lnk_default_list
|
528 |
lnk_default_list = new LinkButton.with_label("",_("Some locations are excluded by default")); |
|
529 |
lnk_default_list.xalign = (float) 0.0; |
|
530 |
lnk_default_list.activate_link.connect(lnk_default_list_activate); |
|
531 |
vbox_exclude.add(lnk_default_list); |
|
178
by Tony George
v1.7.4 |
532 |
|
1
by Tony George
Initial release |
533 |
//Actions ----------------------------------------------
|
178
by Tony George
v1.7.4 |
534 |
|
1
by Tony George
Initial release |
535 |
//hbox_action
|
536 |
hbox_action = (Box) get_action_area (); |
|
537 |
||
538 |
//btn_restore
|
|
539 |
btn_restore = new Button(); |
|
540 |
hbox_action.add(btn_restore); |
|
178
by Tony George
v1.7.4 |
541 |
|
1
by Tony George
Initial release |
542 |
btn_restore.set_label (" " + _("Restore")); |
543 |
btn_restore.set_tooltip_text (_("Restore")); |
|
75
by Tony George
Remove Gtk.Stock references |
544 |
Gtk.Image img_restore = new Image.from_stock("gtk-go-forward", Gtk.IconSize.BUTTON); |
1
by Tony George
Initial release |
545 |
btn_restore.set_image(img_restore); |
546 |
btn_restore.clicked.connect (btn_restore_clicked); |
|
547 |
||
548 |
//btn_cancel
|
|
549 |
btn_cancel = new Button(); |
|
550 |
hbox_action.add(btn_cancel); |
|
178
by Tony George
v1.7.4 |
551 |
|
1
by Tony George
Initial release |
552 |
btn_cancel.set_label (" " + _("Cancel")); |
553 |
btn_cancel.set_tooltip_text (_("Cancel")); |
|
75
by Tony George
Remove Gtk.Stock references |
554 |
Gtk.Image img_cancel = new Image.from_stock("gtk-cancel", Gtk.IconSize.BUTTON); |
1
by Tony George
Initial release |
555 |
btn_cancel.set_image(img_cancel); |
556 |
btn_cancel.clicked.connect (btn_cancel_clicked); |
|
557 |
||
558 |
//initialize -----------------------------------------
|
|
56
by Tony George
Option to keep app settings while restoring snapshots |
559 |
|
560 |
btn_reset_exclude_list_clicked(); |
|
126
by Tony George
New option to clone current system |
561 |
|
1
by Tony George
Initial release |
562 |
refresh_tv_partitions(); |
563 |
refresh_cmb_boot_device(); |
|
59
by Tony George
Update message |
564 |
//refresh_tv_exclude(); //called by btn_reset_exclude_list_clicked()
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
565 |
refresh_tv_apps(); |
566 |
||
567 |
sw_partitions.sensitive = radio_other.active; |
|
178
by Tony George
v1.7.4 |
568 |
|
126
by Tony George
New option to clone current system |
569 |
notebook.switch_page.connect_after((page, new_page_index) => { |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
570 |
if (new_page_index == 1){ |
571 |
bool ok = check_and_mount_devices(); |
|
572 |
if (!ok){ |
|
126
by Tony George
New option to clone current system |
573 |
notebook.set_current_page(0); |
574 |
gtk_do_events(); |
|
575 |
return; |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
576 |
}
|
126
by Tony George
New option to clone current system |
577 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
578 |
//save current app selections
|
579 |
Gee.ArrayList<string> selected_app_list = new Gee.ArrayList<string>(); |
|
580 |
foreach(AppExcludeEntry entry in App.exclude_list_apps){ |
|
581 |
if (entry.enabled){ |
|
91
by Tony George
Restore Window: Exclude tab: Show relative path in exclude list; show items from ~/.local |
582 |
selected_app_list.add(entry.relpath); |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
583 |
}
|
584 |
}
|
|
178
by Tony George
v1.7.4 |
585 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
586 |
//refresh the list
|
587 |
App.add_app_exclude_entries(); |
|
178
by Tony George
v1.7.4 |
588 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
589 |
//restore app selections
|
590 |
foreach(AppExcludeEntry entry in App.exclude_list_apps){ |
|
91
by Tony George
Restore Window: Exclude tab: Show relative path in exclude list; show items from ~/.local |
591 |
if (selected_app_list.contains(entry.relpath)){ |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
592 |
entry.enabled = true; |
593 |
}
|
|
594 |
}
|
|
178
by Tony George
v1.7.4 |
595 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
596 |
//refresh treeview
|
597 |
refresh_tv_apps(); |
|
598 |
}
|
|
599 |
});
|
|
178
by Tony George
v1.7.4 |
600 |
|
126
by Tony George
New option to clone current system |
601 |
set_app_page_state(); |
178
by Tony George
v1.7.4 |
602 |
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
603 |
init_mounts(); |
178
by Tony George
v1.7.4 |
604 |
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
605 |
}
|
178
by Tony George
v1.7.4 |
606 |
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
607 |
private void init_mounts(){ |
608 |
TreeIter iter; |
|
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
609 |
Gtk.ListStore store; |
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
610 |
|
611 |
App.init_mount_list(); |
|
612 |
||
613 |
if (App.mirror_system){ |
|
614 |
//default all mount points to root device except /boot
|
|
615 |
for(int i = App.mount_list.size - 1; i >= 0; i--){ |
|
616 |
MountEntry mnt = App.mount_list[i]; |
|
617 |
if (mnt.mount_point != "/boot"){ |
|
618 |
App.mount_list.remove_at(i); |
|
619 |
}
|
|
620 |
}
|
|
178
by Tony George
v1.7.4 |
621 |
|
622 |
/* Note:
|
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
623 |
* While cloning the system, /boot is the only mount point that we will leave unchanged (to avoid encrypted systems from breaking)
|
624 |
* All other mounts like /home will be defaulted to target device (to prevent the "cloned" system from using the original device)
|
|
625 |
* */
|
|
626 |
}
|
|
627 |
||
628 |
//find the root mount point set by user
|
|
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
629 |
store = (Gtk.ListStore) tv_partitions.model; |
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
630 |
for (bool next = store.get_iter_first (out iter); next; next = store.iter_next (ref iter)) { |
631 |
Device pi; |
|
632 |
string mount_point; |
|
633 |
store.get(iter, 0, out pi); |
|
634 |
store.get(iter, 1, out mount_point); |
|
635 |
||
636 |
foreach(MountEntry mnt in App.mount_list){ |
|
637 |
if (mnt.device.device == pi.device){ |
|
638 |
store.set(iter, 1, mnt.mount_point, -1); |
|
639 |
}
|
|
640 |
}
|
|
641 |
}
|
|
126
by Tony George
New option to clone current system |
642 |
}
|
178
by Tony George
v1.7.4 |
643 |
|
126
by Tony George
New option to clone current system |
644 |
private void set_app_page_state(){ |
645 |
if (App.restore_target == null){ |
|
646 |
lbl_app.sensitive = false; |
|
647 |
vbox_app.sensitive = false; |
|
648 |
}
|
|
649 |
else{ |
|
650 |
lbl_app.sensitive = true; |
|
651 |
vbox_app.sensitive = true; |
|
652 |
}
|
|
653 |
}
|
|
178
by Tony George
v1.7.4 |
654 |
|
1
by Tony George
Initial release |
655 |
private void cell_device_target_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){ |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
656 |
Device pi; |
1
by Tony George
Initial release |
657 |
model.get (iter, 0, out pi, -1); |
178
by Tony George
v1.7.4 |
658 |
|
154
by Tony George
Added backup and restore support for LUKS-encrypted partitions |
659 |
string symlink = ""; |
660 |
foreach(string sym in pi.symlinks){ |
|
661 |
if (sym.has_prefix("/dev/mapper/")){ |
|
662 |
symlink = sym.replace("/dev/mapper/",""); |
|
663 |
}
|
|
664 |
}
|
|
665 |
||
185
by Tony George
Added embedded VTE terminal for restoring snapshots |
666 |
string txt = pi.device; |
667 |
||
1
by Tony George
Initial release |
668 |
if ((App.root_device != null) && (pi.device == App.root_device.device)){ |
185
by Tony George
Added embedded VTE terminal for restoring snapshots |
669 |
txt += " (" + _("sys") + ")"; |
1
by Tony George
Initial release |
670 |
}
|
178
by Tony George
v1.7.4 |
671 |
|
185
by Tony George
Added embedded VTE terminal for restoring snapshots |
672 |
if (symlink.length > 0){ |
673 |
txt += " → "; |
|
674 |
if (symlink.length > 10){ |
|
675 |
txt += symlink[0:10] + "..."; |
|
676 |
}
|
|
677 |
else{ |
|
678 |
txt += symlink; |
|
679 |
}
|
|
680 |
}
|
|
681 |
||
110
by Tony George
Added option to skip bootloader installation |
682 |
Gtk.CellRendererText ctxt = (cell as Gtk.CellRendererText); |
185
by Tony George
Added embedded VTE terminal for restoring snapshots |
683 |
ctxt.text = txt; |
110
by Tony George
Added option to skip bootloader installation |
684 |
set_cell_text_color(ref ctxt); |
685 |
}
|
|
178
by Tony George
v1.7.4 |
686 |
|
110
by Tony George
Added option to skip bootloader installation |
687 |
private void set_cell_text_color(ref CellRendererText cell){ |
688 |
string span = "<span>"; |
|
689 |
if (!sw_partitions.sensitive){ |
|
690 |
span = "<span foreground=\"#585858\">"; |
|
691 |
}
|
|
692 |
cell.markup = span + cell.text + "</span>"; |
|
693 |
}
|
|
178
by Tony George
v1.7.4 |
694 |
|
1
by Tony George
Initial release |
695 |
private void cell_fs_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){ |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
696 |
Device pi; |
1
by Tony George
Initial release |
697 |
model.get (iter, 0, out pi, -1); |
698 |
(cell as Gtk.CellRendererText).text = pi.type; |
|
110
by Tony George
Added option to skip bootloader installation |
699 |
Gtk.CellRendererText ctxt = (cell as Gtk.CellRendererText); |
700 |
set_cell_text_color(ref ctxt); |
|
1
by Tony George
Initial release |
701 |
}
|
178
by Tony George
v1.7.4 |
702 |
|
1
by Tony George
Initial release |
703 |
private void cell_size_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){ |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
704 |
Device pi; |
1
by Tony George
Initial release |
705 |
model.get (iter, 0, out pi, -1); |
73
by Tony George
Restore window: Add tooltip description |
706 |
(cell as Gtk.CellRendererText).text = (pi.size_mb > 0) ? "%s GB".printf(pi.size) : ""; |
110
by Tony George
Added option to skip bootloader installation |
707 |
Gtk.CellRendererText ctxt = (cell as Gtk.CellRendererText); |
708 |
set_cell_text_color(ref ctxt); |
|
73
by Tony George
Restore window: Add tooltip description |
709 |
}
|
178
by Tony George
v1.7.4 |
710 |
|
115
by Tony George
v1.5 |
711 |
private void cell_mount_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){ |
712 |
(cell as Gtk.CellRendererCombo).background = "#F2F5A9"; |
|
713 |
}
|
|
178
by Tony George
v1.7.4 |
714 |
|
1
by Tony George
Initial release |
715 |
private void cell_dist_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){ |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
716 |
Device pi; |
1
by Tony George
Initial release |
717 |
model.get (iter, 0, out pi, -1); |
718 |
(cell as Gtk.CellRendererText).text = pi.dist_info; |
|
110
by Tony George
Added option to skip bootloader installation |
719 |
Gtk.CellRendererText ctxt = (cell as Gtk.CellRendererText); |
720 |
set_cell_text_color(ref ctxt); |
|
1
by Tony George
Initial release |
721 |
}
|
178
by Tony George
v1.7.4 |
722 |
|
723 |
||
1
by Tony George
Initial release |
724 |
private void cell_device_grub_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){ |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
725 |
Device dev; |
726 |
model.get (iter, 0, out dev, -1); |
|
727 |
if (dev.devtype == "disk"){ |
|
728 |
(cell as Gtk.CellRendererText).markup = "<b>" + dev.description() + " (MBR)</b>"; |
|
107
by Tony George
Added option to install bootloader on partition VBR |
729 |
}
|
730 |
else{ |
|
172
by Tony George
Fixed various minor issues |
731 |
(cell as Gtk.CellRendererText).markup = dev.description(); |
107
by Tony George
Added option to install bootloader on partition VBR |
732 |
}
|
1
by Tony George
Initial release |
733 |
}
|
734 |
||
735 |
private void cell_exclude_text_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){ |
|
25
by Tony George
Add exclude entries for root user's home dircetory |
736 |
string pattern; |
737 |
model.get (iter, 0, out pattern, -1); |
|
1
by Tony George
Initial release |
738 |
(cell as Gtk.CellRendererText).text = pattern.has_prefix("+ ") ? pattern[2:pattern.length] : pattern; |
739 |
}
|
|
740 |
||
741 |
private void cell_exclude_text_edited (string path, string new_text) { |
|
9
by Tony George
Fixed: Exception while editing treeview column |
742 |
string old_pattern; |
743 |
string new_pattern; |
|
178
by Tony George
v1.7.4 |
744 |
|
1
by Tony George
Initial release |
745 |
TreeIter iter; |
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
746 |
var model = (Gtk.ListStore) tv_exclude.model; |
1
by Tony George
Initial release |
747 |
model.get_iter_from_string (out iter, path); |
9
by Tony George
Fixed: Exception while editing treeview column |
748 |
model.get (iter, 0, out old_pattern, -1); |
178
by Tony George
v1.7.4 |
749 |
|
9
by Tony George
Fixed: Exception while editing treeview column |
750 |
if (old_pattern.has_prefix("+ ")){ |
751 |
new_pattern = "+ " + new_text; |
|
752 |
}
|
|
753 |
else{ |
|
754 |
new_pattern = new_text; |
|
755 |
}
|
|
756 |
model.set (iter, 0, new_pattern); |
|
178
by Tony George
v1.7.4 |
757 |
|
9
by Tony George
Fixed: Exception while editing treeview column |
758 |
int index = temp_exclude_list.index_of(old_pattern); |
759 |
temp_exclude_list.insert(index, new_pattern); |
|
760 |
temp_exclude_list.remove(old_pattern); |
|
1
by Tony George
Initial release |
761 |
}
|
762 |
||
56
by Tony George
Option to keep app settings while restoring snapshots |
763 |
private void cell_app_enabled_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){ |
764 |
AppExcludeEntry entry; |
|
765 |
model.get (iter, 0, out entry, -1); |
|
766 |
(cell as Gtk.CellRendererToggle).active = entry.enabled; |
|
767 |
}
|
|
178
by Tony George
v1.7.4 |
768 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
769 |
private void cell_app_text_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){ |
770 |
AppExcludeEntry entry; |
|
771 |
model.get (iter, 0, out entry, -1); |
|
91
by Tony George
Restore Window: Exclude tab: Show relative path in exclude list; show items from ~/.local |
772 |
(cell as Gtk.CellRendererText).text = entry.relpath; |
56
by Tony George
Option to keep app settings while restoring snapshots |
773 |
}
|
774 |
||
775 |
private void cell_app_enabled_toggled (string path){ |
|
776 |
AppExcludeEntry entry; |
|
777 |
TreeIter iter; |
|
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
778 |
var model = (Gtk.ListStore) tv_app.model; //get model |
56
by Tony George
Option to keep app settings while restoring snapshots |
779 |
model.get_iter_from_string (out iter, path); //get selected iter |
780 |
model.get (iter, 0, out entry, -1); //get entry |
|
781 |
entry.enabled = !entry.enabled; |
|
782 |
}
|
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
783 |
|
1
by Tony George
Initial release |
784 |
private void refresh_cmb_boot_device(){ |
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
785 |
var store = new Gtk.ListStore(1, typeof(Device)); |
178
by Tony George
v1.7.4 |
786 |
|
107
by Tony George
Added option to install bootloader on partition VBR |
787 |
//add devices
|
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
788 |
Gee.ArrayList<Device> device_list = new Gee.ArrayList<Device>(); |
789 |
foreach(Device di in get_block_devices()) { |
|
790 |
device_list.add(di); |
|
107
by Tony George
Added option to install bootloader on partition VBR |
791 |
}
|
178
by Tony George
v1.7.4 |
792 |
|
107
by Tony George
Added option to install bootloader on partition VBR |
793 |
//add partitions
|
794 |
var list = App.partition_list; |
|
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
795 |
foreach(Device pi in list) { |
107
by Tony George
Added option to install bootloader on partition VBR |
796 |
if (!pi.has_linux_filesystem()) { continue; } |
167
by Tony George
CMD: Aligned columns and added header for lists; Fixed an issue with the natural sort function used for sorting partition list; Mapped devices will be excluded in GRUB device selection list |
797 |
if (pi.device.has_prefix("/dev/dm-")) { continue; } |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
798 |
device_list.add(pi); |
107
by Tony George
Added option to install bootloader on partition VBR |
799 |
}
|
178
by Tony George
v1.7.4 |
800 |
|
107
by Tony George
Added option to install bootloader on partition VBR |
801 |
//sort
|
178
by Tony George
v1.7.4 |
802 |
device_list.sort((a,b) => { |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
803 |
Device p1 = (Device) a; |
804 |
Device p2 = (Device) b; |
|
178
by Tony George
v1.7.4 |
805 |
|
107
by Tony George
Added option to install bootloader on partition VBR |
806 |
return strcmp(p1.device,p2.device); |
807 |
});
|
|
178
by Tony George
v1.7.4 |
808 |
|
107
by Tony George
Added option to install bootloader on partition VBR |
809 |
TreeIter iter; |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
810 |
foreach(Device entry in device_list) { |
1
by Tony George
Initial release |
811 |
store.append(out iter); |
107
by Tony George
Added option to install bootloader on partition VBR |
812 |
store.set (iter, 0, entry); |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
813 |
}
|
814 |
||
815 |
cmb_boot_device.set_model (store); |
|
816 |
cmb_boot_device_select_default(); |
|
817 |
}
|
|
818 |
||
819 |
private void cmb_boot_device_select_default(){ |
|
178
by Tony George
v1.7.4 |
820 |
if (App.restore_target == null){ |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
821 |
cmb_boot_device.active = -1; |
178
by Tony George
v1.7.4 |
822 |
return; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
823 |
}
|
178
by Tony George
v1.7.4 |
824 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
825 |
TreeIter iter; |
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
826 |
var store = (Gtk.ListStore) cmb_boot_device.model; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
827 |
int index = -1; |
178
by Tony George
v1.7.4 |
828 |
|
157
by Tony George
Fixed: GRUB device dropdown remains unselected in some cases instead of defaulting to the first available device |
829 |
int first_mbr_device_index = -1; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
830 |
for (bool next = store.get_iter_first (out iter); next; next = store.iter_next (ref iter)) { |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
831 |
Device dev; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
832 |
store.get(iter, 0, out dev); |
178
by Tony George
v1.7.4 |
833 |
|
1
by Tony George
Initial release |
834 |
index++; |
178
by Tony George
v1.7.4 |
835 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
836 |
if (dev.device == App.restore_target.device[0:8]){ |
837 |
cmb_boot_device.active = index; |
|
157
by Tony George
Fixed: GRUB device dropdown remains unselected in some cases instead of defaulting to the first available device |
838 |
break; |
839 |
}
|
|
178
by Tony George
v1.7.4 |
840 |
|
157
by Tony George
Fixed: GRUB device dropdown remains unselected in some cases instead of defaulting to the first available device |
841 |
if ((first_mbr_device_index == -1) && (dev.device.length == "/dev/sdX".length)){ |
842 |
first_mbr_device_index = index; |
|
1
by Tony George
Initial release |
843 |
}
|
844 |
}
|
|
178
by Tony George
v1.7.4 |
845 |
|
157
by Tony George
Fixed: GRUB device dropdown remains unselected in some cases instead of defaulting to the first available device |
846 |
//select first MBR device if not found
|
847 |
if (cmb_boot_device.active == -1){ |
|
848 |
cmb_boot_device.active = first_mbr_device_index; |
|
1
by Tony George
Initial release |
849 |
}
|
850 |
}
|
|
178
by Tony George
v1.7.4 |
851 |
|
1
by Tony George
Initial release |
852 |
private void refresh_tv_partitions(){ |
178
by Tony George
v1.7.4 |
853 |
|
1
by Tony George
Initial release |
854 |
App.update_partition_list(); |
178
by Tony George
v1.7.4 |
855 |
|
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
856 |
var model = new Gtk.ListStore(4, typeof(Device), typeof(string), typeof(string), typeof(Gdk.Pixbuf)); |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
857 |
tv_partitions.set_model (model); |
1
by Tony George
Initial release |
858 |
|
859 |
TreeIter iter; |
|
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
860 |
foreach(Device pi in App.partition_list) { |
1
by Tony George
Initial release |
861 |
if (!pi.has_linux_filesystem()) { continue; } |
126
by Tony George
New option to clone current system |
862 |
if (!radio_sys.sensitive && (App.root_device != null) && ((pi.device == App.root_device.device)||(pi.uuid == App.root_device.uuid))) { continue; } |
178
by Tony George
v1.7.4 |
863 |
|
84
by Tony George
v1.4 |
864 |
string tt = ""; |
160
by Tony George
Refactor code for displaying device name with alias |
865 |
tt += "%-7s".printf(_("Device")) + "\t: %s\n".printf(pi.full_name_with_alias); |
84
by Tony George
v1.4 |
866 |
tt += "%-7s".printf(_("UUID")) + "\t: %s\n".printf(pi.uuid); |
867 |
tt += "%-7s".printf(_("Type")) + "\t: %s\n".printf(pi.type); |
|
868 |
tt += "%-7s".printf(_("Label")) + "\t: %s\n".printf(pi.label); |
|
869 |
tt += "%-7s".printf(_("Size")) + "\t: %s\n".printf((pi.size_mb > 0) ? "%s GB".printf(pi.size) : ""); |
|
870 |
tt += "%-7s".printf(_("Used")) + "\t: %s\n".printf((pi.used_mb > 0) ? "%s GB".printf(pi.used) : ""); |
|
871 |
tt += "%-7s".printf(_("System")) + "\t: %s".printf(pi.dist_info); |
|
178
by Tony George
v1.7.4 |
872 |
|
1
by Tony George
Initial release |
873 |
model.append(out iter); |
73
by Tony George
Restore window: Add tooltip description |
874 |
model.set (iter,0,pi,1,"",2,tt); |
178
by Tony George
v1.7.4 |
875 |
|
158
by Tony George
Unlock all encrypted devices selected by user before restore; Unlocked device will be autoselected silently without prompt; Display lock icon for encrypted devices |
876 |
//set icon ----------------
|
178
by Tony George
v1.7.4 |
877 |
|
158
by Tony George
Unlock all encrypted devices selected by user before restore; Unlocked device will be autoselected silently without prompt; Display lock icon for encrypted devices |
878 |
Gdk.Pixbuf pix_selected = null; |
879 |
Gdk.Pixbuf pix_device = get_shared_icon("disk","disk.png",16).pixbuf; |
|
880 |
Gdk.Pixbuf pix_locked = get_shared_icon("locked","locked.svg",16).pixbuf; |
|
178
by Tony George
v1.7.4 |
881 |
|
158
by Tony George
Unlock all encrypted devices selected by user before restore; Unlocked device will be autoselected silently without prompt; Display lock icon for encrypted devices |
882 |
if (pi.type == "luks"){ |
883 |
pix_selected = pix_locked; |
|
884 |
}
|
|
885 |
else{ |
|
886 |
pix_selected = pix_device; |
|
887 |
}
|
|
178
by Tony George
v1.7.4 |
888 |
|
158
by Tony George
Unlock all encrypted devices selected by user before restore; Unlocked device will be autoselected silently without prompt; Display lock icon for encrypted devices |
889 |
model.set (iter, 3, pix_selected, -1); |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
890 |
}
|
178
by Tony George
v1.7.4 |
891 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
892 |
tv_partitions_select_target(); |
893 |
}
|
|
178
by Tony George
v1.7.4 |
894 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
895 |
private void tv_partitions_select_target(){ |
178
by Tony George
v1.7.4 |
896 |
|
897 |
if (App.restore_target == null){ |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
898 |
tv_partitions.get_selection().unselect_all(); |
178
by Tony George
v1.7.4 |
899 |
return; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
900 |
}
|
178
by Tony George
v1.7.4 |
901 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
902 |
TreeIter iter; |
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
903 |
var store = (Gtk.ListStore) tv_partitions.model; |
178
by Tony George
v1.7.4 |
904 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
905 |
for (bool next = store.get_iter_first (out iter); next; next = store.iter_next (ref iter)) { |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
906 |
Device pi; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
907 |
string mount_point; |
908 |
store.get(iter, 0, out pi); |
|
909 |
store.get(iter, 1, out mount_point); |
|
910 |
if (pi.device == App.restore_target.device){ |
|
911 |
TreePath path = store.get_path(iter); |
|
912 |
tv_partitions.get_selection().select_path(path); |
|
1
by Tony George
Initial release |
913 |
}
|
914 |
}
|
|
915 |
}
|
|
178
by Tony George
v1.7.4 |
916 |
|
1
by Tony George
Initial release |
917 |
private void refresh_tv_exclude(){ |
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
918 |
var model = new Gtk.ListStore(2, typeof(string), typeof(Gdk.Pixbuf)); |
1
by Tony George
Initial release |
919 |
tv_exclude.model = model; |
178
by Tony George
v1.7.4 |
920 |
|
1
by Tony George
Initial release |
921 |
foreach(string path in temp_exclude_list){ |
922 |
tv_exclude_add_item(path); |
|
923 |
}
|
|
924 |
}
|
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
925 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
926 |
private void refresh_tv_apps(){ |
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
927 |
var model = new Gtk.ListStore(1, typeof(AppExcludeEntry)); |
56
by Tony George
Option to keep app settings while restoring snapshots |
928 |
tv_app.model = model; |
178
by Tony George
v1.7.4 |
929 |
|
56
by Tony George
Option to keep app settings while restoring snapshots |
930 |
foreach(AppExcludeEntry entry in App.exclude_list_apps){ |
931 |
TreeIter iter; |
|
932 |
model.append(out iter); |
|
933 |
model.set (iter, 0, entry, -1); |
|
934 |
}
|
|
935 |
}
|
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
936 |
|
1
by Tony George
Initial release |
937 |
private void tv_exclude_add_item(string path){ |
938 |
Gdk.Pixbuf pix_exclude = null; |
|
939 |
Gdk.Pixbuf pix_include = null; |
|
940 |
Gdk.Pixbuf pix_selected = null; |
|
25
by Tony George
Add exclude entries for root user's home dircetory |
941 |
|
1
by Tony George
Initial release |
942 |
try{ |
943 |
pix_exclude = new Gdk.Pixbuf.from_file (App.share_folder + "/timeshift/images/item-gray.png"); |
|
944 |
pix_include = new Gdk.Pixbuf.from_file (App.share_folder + "/timeshift/images/item-blue.png"); |
|
945 |
}
|
|
946 |
catch(Error e){ |
|
947 |
log_error (e.message); |
|
948 |
}
|
|
949 |
||
950 |
TreeIter iter; |
|
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
951 |
var model = (Gtk.ListStore) tv_exclude.model; |
1
by Tony George
Initial release |
952 |
model.append(out iter); |
178
by Tony George
v1.7.4 |
953 |
|
1
by Tony George
Initial release |
954 |
if (path.has_prefix("+ ")){ |
955 |
pix_selected = pix_include; |
|
956 |
}
|
|
957 |
else{ |
|
958 |
pix_selected = pix_exclude; |
|
959 |
}
|
|
178
by Tony George
v1.7.4 |
960 |
|
25
by Tony George
Add exclude entries for root user's home dircetory |
961 |
model.set (iter, 0, path, 1, pix_selected, -1); |
178
by Tony George
v1.7.4 |
962 |
|
1
by Tony George
Initial release |
963 |
Adjustment adj = tv_exclude.get_hadjustment(); |
964 |
adj.value = adj.upper; |
|
965 |
}
|
|
178
by Tony George
v1.7.4 |
966 |
|
1
by Tony George
Initial release |
967 |
private bool lnk_default_list_activate(){ |
25
by Tony George
Add exclude entries for root user's home dircetory |
968 |
//show message window -----------------
|
969 |
var dialog = new ExcludeMessageWindow(); |
|
970 |
dialog.set_transient_for (this); |
|
971 |
dialog.show_all(); |
|
1
by Tony George
Initial release |
972 |
dialog.run(); |
973 |
dialog.destroy(); |
|
974 |
return true; |
|
975 |
}
|
|
976 |
||
977 |
private bool tv_partitions_button_press_event(Gdk.EventButton event){ |
|
978 |
TreeIter iter; |
|
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
979 |
Gtk.ListStore store; |
1
by Tony George
Initial release |
980 |
TreeSelection sel; |
981 |
bool iterExists; |
|
178
by Tony George
v1.7.4 |
982 |
|
1
by Tony George
Initial release |
983 |
//get selected target device
|
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
984 |
Device restore_target = null; |
1
by Tony George
Initial release |
985 |
sel = tv_partitions.get_selection (); |
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
986 |
store = (Gtk.ListStore) tv_partitions.model; |
1
by Tony George
Initial release |
987 |
iterExists = store.get_iter_first (out iter); |
178
by Tony George
v1.7.4 |
988 |
while (iterExists) { |
1
by Tony George
Initial release |
989 |
if (sel.iter_is_selected (iter)){ |
990 |
store.get (iter, 0, out restore_target); |
|
991 |
break; |
|
992 |
}
|
|
993 |
iterExists = store.iter_next (ref iter); |
|
994 |
}
|
|
995 |
App.restore_target = restore_target; |
|
178
by Tony George
v1.7.4 |
996 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
997 |
//select grub device
|
107
by Tony George
Added option to install bootloader on partition VBR |
998 |
if (selected_target == null){ |
999 |
cmb_boot_device_select_default(); |
|
1000 |
}
|
|
1001 |
else if (selected_target.device != restore_target.device){ |
|
178
by Tony George
v1.7.4 |
1002 |
cmb_boot_device_select_default(); |
107
by Tony George
Added option to install bootloader on partition VBR |
1003 |
}
|
1004 |
else{ |
|
1005 |
//target device has not changed - do not reset to default boot device
|
|
1006 |
}
|
|
1007 |
selected_target = restore_target; |
|
178
by Tony George
v1.7.4 |
1008 |
|
126
by Tony George
New option to clone current system |
1009 |
set_app_page_state(); |
178
by Tony George
v1.7.4 |
1010 |
|
1
by Tony George
Initial release |
1011 |
return false; |
1012 |
}
|
|
1013 |
||
1014 |
||
1015 |
private void menu_exclude_add_files_clicked(){ |
|
178
by Tony George
v1.7.4 |
1016 |
|
1
by Tony George
Initial release |
1017 |
var list = browse_files(); |
178
by Tony George
v1.7.4 |
1018 |
|
1
by Tony George
Initial release |
1019 |
if (list.length() > 0){ |
1020 |
foreach(string path in list){ |
|
1021 |
if (!temp_exclude_list.contains(path)){ |
|
1022 |
temp_exclude_list.add(path); |
|
1023 |
tv_exclude_add_item(path); |
|
1024 |
App.first_snapshot_size = 0; //re-calculate |
|
1025 |
}
|
|
1026 |
}
|
|
1027 |
}
|
|
1028 |
}
|
|
1029 |
||
1030 |
private void menu_exclude_add_folder_clicked(){ |
|
178
by Tony George
v1.7.4 |
1031 |
|
1
by Tony George
Initial release |
1032 |
var list = browse_folder(); |
178
by Tony George
v1.7.4 |
1033 |
|
1
by Tony George
Initial release |
1034 |
if (list.length() > 0){ |
1035 |
foreach(string path in list){ |
|
178
by Tony George
v1.7.4 |
1036 |
|
1
by Tony George
Initial release |
1037 |
path = path + "/"; |
178
by Tony George
v1.7.4 |
1038 |
|
1
by Tony George
Initial release |
1039 |
if (!temp_exclude_list.contains(path)){ |
1040 |
temp_exclude_list.add(path); |
|
1041 |
tv_exclude_add_item(path); |
|
1042 |
App.first_snapshot_size = 0; //re-calculate |
|
1043 |
}
|
|
1044 |
}
|
|
1045 |
}
|
|
1046 |
}
|
|
1047 |
||
1048 |
private void menu_exclude_add_folder_contents_clicked(){ |
|
178
by Tony George
v1.7.4 |
1049 |
|
1
by Tony George
Initial release |
1050 |
var list = browse_folder(); |
178
by Tony George
v1.7.4 |
1051 |
|
1
by Tony George
Initial release |
1052 |
if (list.length() > 0){ |
1053 |
foreach(string path in list){ |
|
178
by Tony George
v1.7.4 |
1054 |
|
1
by Tony George
Initial release |
1055 |
path = path + "/*"; |
178
by Tony George
v1.7.4 |
1056 |
|
1
by Tony George
Initial release |
1057 |
if (!temp_exclude_list.contains(path)){ |
1058 |
temp_exclude_list.add(path); |
|
1059 |
tv_exclude_add_item(path); |
|
1060 |
App.first_snapshot_size = 0; //re-calculate |
|
1061 |
}
|
|
1062 |
}
|
|
1063 |
}
|
|
1064 |
}
|
|
1065 |
||
1066 |
private void menu_include_add_files_clicked(){ |
|
178
by Tony George
v1.7.4 |
1067 |
|
1
by Tony George
Initial release |
1068 |
var list = browse_files(); |
178
by Tony George
v1.7.4 |
1069 |
|
1
by Tony George
Initial release |
1070 |
if (list.length() > 0){ |
1071 |
foreach(string path in list){ |
|
178
by Tony George
v1.7.4 |
1072 |
|
1
by Tony George
Initial release |
1073 |
path = path.has_prefix("+ ") ? path : "+ " + path; |
178
by Tony George
v1.7.4 |
1074 |
|
1
by Tony George
Initial release |
1075 |
if (!temp_exclude_list.contains(path)){ |
1076 |
temp_exclude_list.add(path); |
|
1077 |
tv_exclude_add_item(path); |
|
1078 |
App.first_snapshot_size = 0; //re-calculate |
|
1079 |
}
|
|
1080 |
}
|
|
1081 |
}
|
|
1082 |
}
|
|
1083 |
||
1084 |
private void menu_include_add_folder_clicked(){ |
|
178
by Tony George
v1.7.4 |
1085 |
|
1
by Tony George
Initial release |
1086 |
var list = browse_folder(); |
178
by Tony George
v1.7.4 |
1087 |
|
1
by Tony George
Initial release |
1088 |
if (list.length() > 0){ |
1089 |
foreach(string path in list){ |
|
178
by Tony George
v1.7.4 |
1090 |
|
1
by Tony George
Initial release |
1091 |
path = path.has_prefix("+ ") ? path : "+ " + path; |
1092 |
path = path + "/***"; |
|
178
by Tony George
v1.7.4 |
1093 |
|
1
by Tony George
Initial release |
1094 |
if (!temp_exclude_list.contains(path)){ |
1095 |
temp_exclude_list.add(path); |
|
1096 |
tv_exclude_add_item(path); |
|
1097 |
App.first_snapshot_size = 0; //re-calculate |
|
1098 |
}
|
|
1099 |
}
|
|
1100 |
}
|
|
1101 |
}
|
|
1102 |
||
1103 |
private SList<string> browse_files(){ |
|
1104 |
var dialog = new Gtk.FileChooserDialog(_("Select file(s)"), this, Gtk.FileChooserAction.OPEN, |
|
75
by Tony George
Remove Gtk.Stock references |
1105 |
"gtk-cancel", Gtk.ResponseType.CANCEL, |
1106 |
"gtk-open", Gtk.ResponseType.ACCEPT); |
|
1
by Tony George
Initial release |
1107 |
dialog.action = FileChooserAction.OPEN; |
1108 |
dialog.set_transient_for(this); |
|
1109 |
dialog.local_only = true; |
|
1110 |
dialog.set_modal (true); |
|
1111 |
dialog.set_select_multiple (true); |
|
1112 |
||
1113 |
dialog.run(); |
|
1114 |
var list = dialog.get_filenames(); |
|
1115 |
dialog.destroy (); |
|
178
by Tony George
v1.7.4 |
1116 |
|
1
by Tony George
Initial release |
1117 |
return list; |
1118 |
}
|
|
1119 |
||
1120 |
private SList<string> browse_folder(){ |
|
1121 |
var dialog = new Gtk.FileChooserDialog(_("Select directory"), this, Gtk.FileChooserAction.OPEN, |
|
75
by Tony George
Remove Gtk.Stock references |
1122 |
"gtk-cancel", Gtk.ResponseType.CANCEL, |
1123 |
"gtk-open", Gtk.ResponseType.ACCEPT); |
|
1
by Tony George
Initial release |
1124 |
dialog.action = FileChooserAction.SELECT_FOLDER; |
1125 |
dialog.local_only = true; |
|
1126 |
dialog.set_transient_for(this); |
|
1127 |
dialog.set_modal (true); |
|
1128 |
dialog.set_select_multiple (false); |
|
178
by Tony George
v1.7.4 |
1129 |
|
1
by Tony George
Initial release |
1130 |
dialog.run(); |
1131 |
var list = dialog.get_filenames(); |
|
1132 |
dialog.destroy (); |
|
178
by Tony George
v1.7.4 |
1133 |
|
1
by Tony George
Initial release |
1134 |
return list; |
1135 |
}
|
|
1136 |
||
1137 |
||
1138 |
private void btn_remove_clicked(){ |
|
1139 |
TreeSelection sel = tv_exclude.get_selection (); |
|
1140 |
TreeIter iter; |
|
1141 |
bool iterExists = tv_exclude.model.get_iter_first (out iter); |
|
178
by Tony George
v1.7.4 |
1142 |
while (iterExists) { |
1
by Tony George
Initial release |
1143 |
if (sel.iter_is_selected (iter)){ |
1144 |
string path; |
|
1145 |
tv_exclude.model.get (iter, 0, out path); |
|
1146 |
temp_exclude_list.remove(path); |
|
1147 |
App.first_snapshot_size = 0; //re-calculate |
|
1148 |
}
|
|
1149 |
iterExists = tv_exclude.model.iter_next (ref iter); |
|
1150 |
}
|
|
1151 |
||
1152 |
refresh_tv_exclude(); |
|
1153 |
}
|
|
1154 |
||
1155 |
private void btn_warning_clicked(){ |
|
1156 |
string msg = ""; |
|
1157 |
msg += _("By default, any item that was included/excluded at the time of taking the snapshot will be included/excluded.") + " "; |
|
1158 |
msg += _("Any exclude patterns in the current exclude list will also be excluded.") + " "; |
|
1159 |
msg += _("To see which files are included in the snapshot use the 'Browse' button on the main window."); |
|
178
by Tony George
v1.7.4 |
1160 |
|
1
by Tony George
Initial release |
1161 |
var dialog = new Gtk.MessageDialog.with_markup(null, Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING, Gtk.ButtonsType.OK, msg); |
1162 |
dialog.set_title("Warning"); |
|
1163 |
dialog.set_default_size (200, -1); |
|
1164 |
dialog.set_transient_for(this); |
|
1165 |
dialog.set_modal(true); |
|
1166 |
dialog.run(); |
|
1167 |
dialog.destroy(); |
|
1168 |
}
|
|
178
by Tony George
v1.7.4 |
1169 |
|
1
by Tony George
Initial release |
1170 |
private void btn_reset_exclude_list_clicked(){ |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1171 |
//create a temp exclude list
|
1
by Tony George
Initial release |
1172 |
temp_exclude_list = new Gee.ArrayList<string>(); |
178
by Tony George
v1.7.4 |
1173 |
|
1
by Tony George
Initial release |
1174 |
//add all include/exclude items from snapshot list
|
126
by Tony George
New option to clone current system |
1175 |
if (App.snapshot_to_restore != null){ |
1176 |
foreach(string path in App.snapshot_to_restore.exclude_list){ |
|
1177 |
if (!temp_exclude_list.contains(path) && !App.exclude_list_default.contains(path) && !App.exclude_list_home.contains(path)){ |
|
1178 |
temp_exclude_list.add(path); |
|
1179 |
}
|
|
1
by Tony George
Initial release |
1180 |
}
|
1181 |
}
|
|
178
by Tony George
v1.7.4 |
1182 |
|
1
by Tony George
Initial release |
1183 |
//add all exclude items from current list
|
1184 |
foreach(string path in App.exclude_list_user){ |
|
1185 |
if (!temp_exclude_list.contains(path) && !App.exclude_list_default.contains(path) && !App.exclude_list_home.contains(path)){ |
|
178
by Tony George
v1.7.4 |
1186 |
|
1
by Tony George
Initial release |
1187 |
if (!path.has_prefix("+ ")){ //don't add include entries from current exclude list |
1188 |
temp_exclude_list.add(path); |
|
1189 |
}
|
|
1190 |
}
|
|
178
by Tony George
v1.7.4 |
1191 |
}
|
1192 |
||
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1193 |
//refresh treeview
|
1
by Tony George
Initial release |
1194 |
refresh_tv_exclude(); |
1195 |
}
|
|
1196 |
||
1197 |
private void btn_restore_clicked(){ |
|
109
by Tony George
Fixed: Check if backup device is online before backup, browse, delete and restore actions |
1198 |
//check if backup device is online
|
1199 |
if (!check_backup_device_online()) { return; } |
|
178
by Tony George
v1.7.4 |
1200 |
|
1
by Tony George
Initial release |
1201 |
//Note: A successful restore will reboot the system if target device is same as system device
|
178
by Tony George
v1.7.4 |
1202 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1203 |
bool ok = check_and_mount_devices(); |
1204 |
if (!ok){ |
|
1205 |
return; |
|
1206 |
}
|
|
110
by Tony George
Added option to skip bootloader installation |
1207 |
|
1208 |
//save grub install options ----------------------
|
|
178
by Tony George
v1.7.4 |
1209 |
|
110
by Tony George
Added option to skip bootloader installation |
1210 |
App.reinstall_grub2 = !chk_skip_grub_install.active; |
1211 |
||
1212 |
TreeIter iter; |
|
1213 |
if (App.reinstall_grub2){ |
|
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
1214 |
Device entry; |
110
by Tony George
Added option to skip bootloader installation |
1215 |
cmb_boot_device.get_active_iter (out iter); |
1216 |
TreeModel model = (TreeModel) cmb_boot_device.model; |
|
1217 |
model.get(iter, 0, out entry); |
|
1218 |
App.grub_device = entry.device; |
|
1219 |
}
|
|
1220 |
else{ |
|
1221 |
App.grub_device = ""; |
|
1222 |
}
|
|
178
by Tony George
v1.7.4 |
1223 |
|
1
by Tony George
Initial release |
1224 |
//save modified exclude list ----------------------
|
178
by Tony George
v1.7.4 |
1225 |
|
1
by Tony George
Initial release |
1226 |
App.exclude_list_restore.clear(); |
178
by Tony George
v1.7.4 |
1227 |
|
1
by Tony George
Initial release |
1228 |
//add default entries
|
1229 |
foreach(string path in App.exclude_list_default){ |
|
1230 |
if (!App.exclude_list_restore.contains(path)){ |
|
1231 |
App.exclude_list_restore.add(path); |
|
1232 |
}
|
|
1233 |
}
|
|
178
by Tony George
v1.7.4 |
1234 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1235 |
//add app entries
|
1236 |
foreach(AppExcludeEntry entry in App.exclude_list_apps){ |
|
1237 |
if (entry.enabled){ |
|
91
by Tony George
Restore Window: Exclude tab: Show relative path in exclude list; show items from ~/.local |
1238 |
string pattern = entry.pattern(); |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1239 |
if (!App.exclude_list_restore.contains(pattern)){ |
1240 |
App.exclude_list_restore.add(pattern); |
|
1241 |
}
|
|
178
by Tony George
v1.7.4 |
1242 |
|
91
by Tony George
Restore Window: Exclude tab: Show relative path in exclude list; show items from ~/.local |
1243 |
pattern = entry.pattern(true); |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1244 |
if (!App.exclude_list_restore.contains(pattern)){ |
1245 |
App.exclude_list_restore.add(pattern); |
|
1246 |
}
|
|
1247 |
}
|
|
1248 |
}
|
|
178
by Tony George
v1.7.4 |
1249 |
|
1
by Tony George
Initial release |
1250 |
//add modified user entries
|
1251 |
foreach(string path in temp_exclude_list){ |
|
1252 |
if (!App.exclude_list_restore.contains(path) && !App.exclude_list_home.contains(path)){ |
|
1253 |
App.exclude_list_restore.add(path); |
|
1254 |
}
|
|
1255 |
}
|
|
1256 |
||
1257 |
//add home entries
|
|
1258 |
foreach(string path in App.exclude_list_home){ |
|
1259 |
if (!App.exclude_list_restore.contains(path)){ |
|
1260 |
App.exclude_list_restore.add(path); |
|
1261 |
}
|
|
1262 |
}
|
|
178
by Tony George
v1.7.4 |
1263 |
|
110
by Tony George
Added option to skip bootloader installation |
1264 |
//exclude timeshift backups
|
1
by Tony George
Initial release |
1265 |
string timeshift_path = "/timeshift/*"; |
1266 |
if (!App.exclude_list_restore.contains(timeshift_path)){ |
|
1267 |
App.exclude_list_restore.add(timeshift_path); |
|
1268 |
}
|
|
178
by Tony George
v1.7.4 |
1269 |
|
110
by Tony George
Added option to skip bootloader installation |
1270 |
//exclude boot directory if grub install is skipped
|
1271 |
if (!App.reinstall_grub2){ |
|
1272 |
App.exclude_list_restore.add("/boot/*"); |
|
1
by Tony George
Initial release |
1273 |
}
|
178
by Tony George
v1.7.4 |
1274 |
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
1275 |
//display and confirm mount points ------------
|
178
by Tony George
v1.7.4 |
1276 |
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
1277 |
if (!radio_sys.active){ |
1278 |
if (show_mount_list() != Gtk.ResponseType.OK){ |
|
1279 |
return; |
|
1280 |
}
|
|
1281 |
}
|
|
1282 |
||
1
by Tony George
Initial release |
1283 |
//last option to quit - show disclaimer ------------
|
178
by Tony George
v1.7.4 |
1284 |
|
1
by Tony George
Initial release |
1285 |
if (show_disclaimer() == Gtk.ResponseType.YES){ |
1286 |
this.response(Gtk.ResponseType.OK); |
|
1287 |
}
|
|
1288 |
else{ |
|
1289 |
this.response(Gtk.ResponseType.CANCEL); |
|
1290 |
}
|
|
1291 |
}
|
|
1292 |
||
109
by Tony George
Fixed: Check if backup device is online before backup, browse, delete and restore actions |
1293 |
private bool check_backup_device_online(){ |
1294 |
if (!App.backup_device_online()){ |
|
1295 |
gtk_messagebox(_("Device Offline"),_("Backup device is not available"), null, true); |
|
1296 |
return false; |
|
1297 |
}
|
|
1298 |
else{ |
|
1299 |
return true; |
|
1300 |
}
|
|
1301 |
}
|
|
178
by Tony George
v1.7.4 |
1302 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1303 |
private bool check_and_mount_devices(){ |
1304 |
TreeIter iter; |
|
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
1305 |
Gtk.ListStore store; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1306 |
TreeSelection sel; |
178
by Tony George
v1.7.4 |
1307 |
|
126
by Tony George
New option to clone current system |
1308 |
//check if target device selected ---------------
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1309 |
|
1310 |
if (radio_sys.active){ |
|
1311 |
//we are restoring the current system - no need to mount devices
|
|
1312 |
App.restore_target = App.root_device; |
|
1313 |
return true; |
|
1314 |
}
|
|
1315 |
else{ |
|
1316 |
//we are restoring to another disk - mount selected devices
|
|
178
by Tony George
v1.7.4 |
1317 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1318 |
App.restore_target = null; |
126
by Tony George
New option to clone current system |
1319 |
App.mount_list.clear(); |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1320 |
bool no_mount_points_set_by_user = true; |
126
by Tony George
New option to clone current system |
1321 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1322 |
//find the root mount point set by user
|
176
by Tony George
Fixed ambiguous references to Gtk.ListStore |
1323 |
store = (Gtk.ListStore) tv_partitions.model; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1324 |
for (bool next = store.get_iter_first (out iter); next; next = store.iter_next (ref iter)) { |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
1325 |
Device pi; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1326 |
string mount_point; |
1327 |
store.get(iter, 0, out pi); |
|
1328 |
store.get(iter, 1, out mount_point); |
|
126
by Tony George
New option to clone current system |
1329 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1330 |
if ((mount_point != null) && (mount_point.length > 0)){ |
1331 |
mount_point = mount_point.strip(); |
|
1332 |
no_mount_points_set_by_user = false; |
|
178
by Tony George
v1.7.4 |
1333 |
|
126
by Tony George
New option to clone current system |
1334 |
App.mount_list.add(new MountEntry(pi,mount_point)); |
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
1335 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1336 |
if (mount_point == "/"){ |
1337 |
App.restore_target = pi; |
|
178
by Tony George
v1.7.4 |
1338 |
}
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1339 |
}
|
1340 |
}
|
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
1341 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1342 |
if (App.restore_target == null){ |
1343 |
//no root mount point was set by user
|
|
178
by Tony George
v1.7.4 |
1344 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1345 |
if (no_mount_points_set_by_user){ |
1346 |
//user has not set any mount points
|
|
178
by Tony George
v1.7.4 |
1347 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1348 |
//check if a device is selected in treeview
|
1349 |
sel = tv_partitions.get_selection (); |
|
178
by Tony George
v1.7.4 |
1350 |
if (sel.count_selected_rows() == 1){ |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1351 |
//use selected device as the root mount point
|
1352 |
for (bool next = store.get_iter_first (out iter); next; next = store.iter_next (ref iter)) { |
|
1353 |
if (sel.iter_is_selected (iter)){ |
|
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
1354 |
Device pi; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1355 |
store.get(iter, 0, out pi); |
1356 |
App.restore_target = pi; |
|
126
by Tony George
New option to clone current system |
1357 |
App.mount_list.add(new MountEntry(pi,"/")); |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1358 |
break; |
1359 |
}
|
|
1360 |
}
|
|
1361 |
}
|
|
1362 |
else{ |
|
1363 |
//no device selected and no mount points set by user
|
|
1364 |
string title = _("Select Target Device"); |
|
1365 |
string msg = _("Please select the target device from the list"); |
|
1366 |
gtk_messagebox(title, msg, this, true); |
|
178
by Tony George
v1.7.4 |
1367 |
return false; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1368 |
}
|
1369 |
}
|
|
1370 |
else{ |
|
1371 |
//user has set some mount points but not set the root mount point
|
|
1372 |
string title = _("Select Root Device"); |
|
1373 |
string msg = _("Please select the root device (/)"); |
|
1374 |
gtk_messagebox(title, msg, this, true); |
|
178
by Tony George
v1.7.4 |
1375 |
return false; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1376 |
}
|
1377 |
}
|
|
178
by Tony George
v1.7.4 |
1378 |
|
154
by Tony George
Added backup and restore support for LUKS-encrypted partitions |
1379 |
//check BTRFS subvolume layout --------------
|
178
by Tony George
v1.7.4 |
1380 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1381 |
if (App.restore_target.type == "btrfs"){ |
1382 |
if (App.check_btrfs_volume(App.restore_target) == false){ |
|
1383 |
string title = _("Unsupported Subvolume Layout"); |
|
1384 |
string msg = _("The target partition has an unsupported subvolume layout.") + " "; |
|
1385 |
msg += _("Only ubuntu-type layouts with @ and @home subvolumes are currently supported.") + "\n\n"; |
|
1386 |
gtk_messagebox(title, msg, this, true); |
|
178
by Tony George
v1.7.4 |
1387 |
return false; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1388 |
}
|
1389 |
}
|
|
154
by Tony George
Added backup and restore support for LUKS-encrypted partitions |
1390 |
|
1391 |
//mount target device -------------
|
|
178
by Tony George
v1.7.4 |
1392 |
|
155
by Tony George
Updated code for unlocking encrypted devices and mounting devices before restore |
1393 |
bool status = App.mount_target_device(this); |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1394 |
if (status == false){ |
1395 |
string title = _("Error"); |
|
1396 |
string msg = _("Failed to mount device") + ": %s".printf(App.restore_target.device); |
|
1397 |
gtk_messagebox(title, msg, this, true); |
|
178
by Tony George
v1.7.4 |
1398 |
return false; |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1399 |
}
|
1400 |
}
|
|
178
by Tony George
v1.7.4 |
1401 |
|
126
by Tony George
New option to clone current system |
1402 |
//check if grub device selected ---------------
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1403 |
|
178
by Tony George
v1.7.4 |
1404 |
if (!chk_skip_grub_install.active && cmb_boot_device.active < 0){ |
126
by Tony George
New option to clone current system |
1405 |
string title =_("Boot device not selected"); |
1406 |
string msg = _("Please select the boot device"); |
|
1407 |
gtk_messagebox(title, msg, this, true); |
|
178
by Tony George
v1.7.4 |
1408 |
return false; |
126
by Tony George
New option to clone current system |
1409 |
}
|
178
by Tony George
v1.7.4 |
1410 |
|
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1411 |
return true; |
1412 |
}
|
|
178
by Tony George
v1.7.4 |
1413 |
|
1
by Tony George
Initial release |
1414 |
private int show_disclaimer(){ |
146
by Tony George
Updated command-line options; Added option to restore fom commandline; Use Libgudev for querying devices; Various Improvements |
1415 |
string msg = App.disclaimer_pre_restore(); |
1416 |
msg += "\n\n"; |
|
1
by Tony George
Initial release |
1417 |
msg += "<b>" + _("Continue with restore?") + "</b>\n"; |
178
by Tony George
v1.7.4 |
1418 |
|
1
by Tony George
Initial release |
1419 |
var dialog = new Gtk.MessageDialog.with_markup(null, Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING, Gtk.ButtonsType.YES_NO, msg); |
1420 |
dialog.set_title(_("DISCLAIMER")); |
|
1421 |
dialog.set_default_size (200, -1); |
|
1422 |
dialog.set_transient_for(this); |
|
1423 |
dialog.set_modal(true); |
|
1424 |
int response = dialog.run(); |
|
1425 |
dialog.destroy(); |
|
1426 |
return response; |
|
1427 |
}
|
|
1428 |
||
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
1429 |
private int show_mount_list(){ |
1430 |
string msg = _("Following mounts will be used for restored system:") + "\n\n"; |
|
160
by Tony George
Refactor code for displaying device name with alias |
1431 |
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
1432 |
int max_mount = _("Mount").length; |
1433 |
int max_dev = _("Device").length; |
|
178
by Tony George
v1.7.4 |
1434 |
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
1435 |
foreach(MountEntry mnt in App.mount_list){ |
160
by Tony George
Refactor code for displaying device name with alias |
1436 |
string dev_name = mnt.device.short_name_with_alias; |
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
1437 |
if (dev_name.length > max_dev){ max_dev = dev_name.length; } |
1438 |
if (mnt.mount_point.length > max_mount){ max_mount = mnt.mount_point.length; } |
|
1439 |
}
|
|
1440 |
||
1441 |
msg += "<tt>"; |
|
1442 |
msg += "<b>"; |
|
1443 |
msg += ("%%-%ds %%-%ds\n\n".printf(max_dev, max_mount)).printf(_("Device"),_("Mount")); |
|
1444 |
msg += "</b>"; |
|
1445 |
foreach(MountEntry mnt in App.mount_list){ |
|
160
by Tony George
Refactor code for displaying device name with alias |
1446 |
msg += ("%%-%ds %%-%ds\n\n".printf(max_dev, max_mount)).printf(mnt.device.short_name_with_alias, mnt.mount_point); |
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
1447 |
}
|
1448 |
msg += "</tt>"; |
|
1449 |
msg += "\n" + _("Click OK to continue") + "\n"; |
|
178
by Tony George
v1.7.4 |
1450 |
|
159
by Tony George
Updated code for reading options from command line; Auto-select default mounts while restoring from GUI; Display a confirmation prompt for device mounts before restore |
1451 |
var dialog = new Gtk.MessageDialog.with_markup(null, Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING, Gtk.ButtonsType.OK_CANCEL, msg); |
1452 |
dialog.set_title(_("Confirm Mounts")); |
|
1453 |
dialog.set_default_size (200, -1); |
|
1454 |
dialog.set_transient_for(this); |
|
1455 |
dialog.set_modal(true); |
|
1456 |
int response = dialog.run(); |
|
1457 |
dialog.destroy(); |
|
1458 |
return response; |
|
1459 |
}
|
|
178
by Tony George
v1.7.4 |
1460 |
|
1
by Tony George
Initial release |
1461 |
private void btn_cancel_clicked(){ |
70
by Tony George
Restore window: add option to mount /home, /boot and other mount points |
1462 |
App.unmount_target_device(); |
1
by Tony George
Initial release |
1463 |
this.response(Gtk.ResponseType.CANCEL); |
178
by Tony George
v1.7.4 |
1464 |
return; |
1
by Tony George
Initial release |
1465 |
}
|
1466 |
||
1467 |
}
|