Code cleanup

This commit is contained in:
Tony George 2018-01-26 14:40:39 +05:30
parent 37e8fa0d0f
commit 0af1d628b0
104 changed files with 23087 additions and 20324 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*
* AppConsole.vala
*
* Copyright 2015 Tony George <teejee2008@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -88,6 +88,7 @@ public class AppConsole : GLib.Object {
}
private static void set_locale() {
log_debug("setting locale...");
Intl.setlocale(GLib.LocaleCategory.MESSAGES, "timeshift");
Intl.textdomain(GETTEXT_PACKAGE);
@ -96,6 +97,7 @@ public class AppConsole : GLib.Object {
}
public static void check_if_admin(){
if (!user_is_admin()) {
log_msg(_("Application needs admin access."));
log_msg(_("Please run the application as admin (using 'sudo' or 'su')"));

View File

@ -1,3 +1,26 @@
/*
* AppExcludeEntry.vala
*
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
using TeeJee.Logging;
using TeeJee.FileSystem;
using TeeJee.JsonHelper;
@ -7,6 +30,7 @@ using TeeJee.System;
using TeeJee.Misc;
public class AppExcludeEntry : GLib.Object{
public string name = "";
public bool is_include = false;
public bool is_file = false;
@ -18,6 +42,7 @@ public class AppExcludeEntry : GLib.Object{
public static Gee.HashMap<string, AppExcludeEntry> app_map;
public AppExcludeEntry(string _name, bool _is_include = false){
name = _name;
is_include = _is_include;
@ -26,6 +51,7 @@ public class AppExcludeEntry : GLib.Object{
}
public string tooltip_text(){
string txt = "";
foreach(var item in items){
txt += "%s\n".printf(item);

View File

@ -1,7 +1,7 @@
/*
* Main.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -320,10 +320,12 @@ public class Main : GLib.Object{
}
public void initialize(){
initialize_repo();
}
public bool check_dependencies(out string msg){
msg = "";
log_debug("Main: check_dependencies()");
@ -350,6 +352,7 @@ public class Main : GLib.Object{
}
public void check_and_remove_timeshift_btrfs(){
if (cmd_exists("timeshift-btrfs")){
string std_out, std_err;
exec_sync("timeshift-btrfs-uninstall", out std_out, out std_err);
@ -617,6 +620,7 @@ public class Main : GLib.Object{
}
private void add_app_exclude_entries_for_prefix(string path_prefix){
string path = "";
path = path_combine(path_prefix, "root");
@ -3740,6 +3744,7 @@ public class Main : GLib.Object{
}
public void query_subvolume_info_thread(){
thread_subvol_info_running = true;
//query IDs
@ -3845,6 +3850,7 @@ public class Main : GLib.Object{
}
public bool query_subvolume_quotas(){
bool ok = query_subvolume_quota("@");
if (repo.device.uuid != repo.device_home.uuid){
ok = ok && query_subvolume_quota("@home");
@ -3954,13 +3960,16 @@ public class Main : GLib.Object{
}
public bool enable_subvolume_quotas(){
bool ok = enable_subvolume_quota("@");
if (repo.device.uuid != repo.device_home.uuid){
ok = ok && enable_subvolume_quota("@home");
}
if (ok){
log_msg(_("Enabled subvolume quota support"));
}
return ok;
}
@ -3975,7 +3984,9 @@ public class Main : GLib.Object{
cmd = "btrfs quota enable '%s'".printf(repo.mount_paths[subvol_name]);
log_debug(cmd);
ret_val = exec_sync(cmd, out std_out, out std_err);
if (ret_val != 0){
log_error (std_err);
log_error(_("btrfs returned an error") + ": %d".printf(ret_val));
@ -3987,13 +3998,16 @@ public class Main : GLib.Object{
}
public bool rescan_subvolume_quotas(){
bool ok = rescan_subvolume_quota("@");
if (repo.device.uuid != repo.device_home.uuid){
ok = ok && rescan_subvolume_quota("@home");
}
if (ok){
log_msg(_("Enabled subvolume quota support"));
}
return ok;
}
@ -4008,8 +4022,11 @@ public class Main : GLib.Object{
cmd = "btrfs quota rescan '%s'".printf(repo.mount_paths[subvol_name]);
log_debug(cmd);
ret_val = exec_sync(cmd, out std_out, out std_err);
if (ret_val != 0){
log_error (std_err);
log_error(_("btrfs returned an error") + ": %d".printf(ret_val));
log_error(_("Failed to rescan subvolume quota"));
@ -4031,7 +4048,9 @@ public class Main : GLib.Object{
int count = 0;
while (CronTab.has_job(entry, true, false)){
CronTab.remove_job(entry, true, true);
if (++count == 100){
break;
}
@ -4041,7 +4060,9 @@ public class Main : GLib.Object{
count = 0;
while (CronTab.has_job(entry, true, false)){
CronTab.remove_job(entry, true, true);
if (++count == 100){
break;
}

View File

@ -1,3 +1,27 @@
/*
* Snapshot.vala
*
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
using TeeJee.Logging;
using TeeJee.FileSystem;
using TeeJee.JsonHelper;
@ -8,6 +32,7 @@ using TeeJee.Misc;
using Json;
public class Snapshot : GLib.Object{
public string path = "";
public string name = "";
public DateTime date;
@ -140,6 +165,7 @@ public class Snapshot : GLib.Object{
}
public void add_tag(string tag){
if (!tags.contains(tag.strip())){
tags.add(tag.strip());
update_control_file();
@ -147,6 +173,7 @@ public class Snapshot : GLib.Object{
}
public void remove_tag(string tag){
if (tags.contains(tag.strip())){
tags.remove(tag.strip());
update_control_file();
@ -154,6 +181,7 @@ public class Snapshot : GLib.Object{
}
public bool has_tag(string tag){
return tags.contains(tag.strip());
}
@ -163,13 +191,17 @@ public class Snapshot : GLib.Object{
string ctl_file = path + "/info.json";
var f = File.new_for_path(ctl_file);
if (f.query_exists()) {
var parser = new Json.Parser();
try{
parser.load_from_file(ctl_file);
} catch (Error e) {
log_error (e.message);
}
var node = parser.get_root();
var config = node.get_object();
@ -243,14 +275,19 @@ public class Snapshot : GLib.Object{
}
public void read_exclude_list(){
string list_file = path + "/exclude.list";
exclude_list.clear();
var f = File.new_for_path(list_file);
if (f.query_exists()) {
foreach(string path in file_read(list_file).split("\n")){
path = path.strip();
if (!exclude_list.contains(path) && path.length > 0){
exclude_list.add(path);
}
@ -264,18 +301,24 @@ public class Snapshot : GLib.Object{
}
public void read_fstab_file(){
string fstab_path = path_combine(path, "/localhost/etc/fstab");
if (btrfs_mode){
fstab_path = path_combine(path, "/@/etc/fstab");
}
fstab_list = FsTabEntry.read_file(fstab_path);
}
public void read_crypttab_file(){
string crypttab_path = path_combine(path, "/localhost/etc/crypttab");
if (btrfs_mode){
crypttab_path = path_combine(path, "/@/etc/crypttab");
}
cryttab_list = CryptTabEntry.read_file(crypttab_path);
}
@ -329,6 +372,7 @@ public class Snapshot : GLib.Object{
}
public void remove_control_file(){
string ctl_file = path + "/info.json";
file_delete(ctl_file);
}
@ -453,6 +497,7 @@ public class Snapshot : GLib.Object{
// delete subvolumes
foreach(var subvol in subvolumes.values){
bool ok = subvol.remove();
if (!ok) {
log_error(_("Failed to remove snapshot") + ": %s".printf(name));
@ -464,6 +509,7 @@ public class Snapshot : GLib.Object{
// delete directories after **all** subvolumes have been deleted
foreach(var subvol in subvolumes.values){
bool ok = dir_delete(paths[subvol.name], true);
if (!ok) {
log_error(_("Failed to remove snapshot") + ": %s".printf(name));
@ -473,6 +519,7 @@ public class Snapshot : GLib.Object{
}
if (!dir_delete(path, true)){
log_error(_("Failed to remove snapshot") + ": %s".printf(name));
log_msg(string.nfill(78, '-'));
return false;
@ -485,10 +532,13 @@ public class Snapshot : GLib.Object{
}
public void mark_for_deletion(){
string delete_trigger_file = path + "/delete";
if (!file_exists(delete_trigger_file)){
file_write(delete_trigger_file, "");
}
marked_for_deletion = true;
}

View File

@ -1,3 +1,26 @@
/*
* SnapshotRepo.vala
*
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
using TeeJee.Logging;
using TeeJee.FileSystem;
using TeeJee.JsonHelper;
@ -359,6 +382,7 @@ public class SnapshotRepo : GLib.Object{
// get tagged snapshots
public Gee.ArrayList<Snapshot?> get_snapshots_by_tag(string tag = ""){
var list = new Gee.ArrayList<Snapshot?>();
foreach(Snapshot bak in snapshots){
@ -376,6 +400,7 @@ public class SnapshotRepo : GLib.Object{
}
public Snapshot? get_latest_snapshot(string tag, string sys_uuid){
var list = get_snapshots_by_tag(tag);
for(int i = list.size - 1; i >= 0; i--){
@ -389,6 +414,7 @@ public class SnapshotRepo : GLib.Object{
}
public Snapshot? get_oldest_snapshot(string tag, string sys_uuid){
var list = get_snapshots_by_tag(tag);
for(int i = 0; i < list.size; i++){

View File

@ -1,3 +1,26 @@
/*
* Subvolume.vala
*
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
using TeeJee.Logging;
using TeeJee.FileSystem;
using TeeJee.JsonHelper;
@ -38,10 +61,12 @@ public class Subvolume : GLib.Object{
}
public Device? get_device(){
return Device.get_device_by_uuid(device_uuid);
}
public static Gee.HashMap<string, Subvolume> detect_subvolumes_for_system_by_path(string system_path, SnapshotRepo? repo, Gtk.Window? parent_window){
public static Gee.HashMap<string, Subvolume> detect_subvolumes_for_system_by_path(
string system_path, SnapshotRepo? repo, Gtk.Window? parent_window){
var map = new Gee.HashMap<string, Subvolume>();
@ -51,11 +76,11 @@ public class Subvolume : GLib.Object{
var crypttab = CryptTabEntry.read_file(path_combine(system_path, "/etc/crypttab"));
foreach(var item in fstab){
if (!item.is_for_system_directory()){
continue;
}
if (!item.is_for_system_directory()){ continue; }
if (item.subvolume_name().length > 0){
var dev = item.resolve_device(crypttab, parent_window);
var dev_name = (dev == null) ? "" : dev.device;
var dev_uuid = (dev == null) ? "" : dev.uuid;
@ -71,10 +96,12 @@ public class Subvolume : GLib.Object{
}
public void print_info(){
log_debug("name=%s, uuid=%s, id=%ld, path=%s".printf(name, device_uuid, id, path));
}
public bool remove(){
string cmd = "";
string std_out;
string std_err;

View File

@ -1,7 +1,7 @@
/*
* AptikGtk.vala
*
* Copyright 2015 Tony George <teejee2008@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,7 @@
/*
* BackupBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -38,6 +37,7 @@ using TeeJee.System;
using TeeJee.Misc;
class BackupBox : Gtk.Box{
private Gtk.Spinner spinner;
public Gtk.Label lbl_msg;
public Gtk.Label lbl_status;
@ -102,7 +102,8 @@ class BackupBox : Gtk.Box{
}
private void add_progress_area(){
var hbox_status = new Box (Orientation.HORIZONTAL, 6);
var hbox_status = new Gtk.Box(Orientation.HORIZONTAL, 6);
add (hbox_status);
spinner = new Gtk.Spinner();
@ -132,7 +133,7 @@ class BackupBox : Gtk.Box{
ref Gtk.SizeGroup? sg_label, ref Gtk.SizeGroup? sg_value,
int add_margin_bottom = 0){
var hbox = new Box (Orientation.HORIZONTAL, 6);
var hbox = new Gtk.Box(Orientation.HORIZONTAL, 6);
box.add (hbox);
var label = add_label(hbox, text + ":");
@ -272,6 +273,7 @@ class BackupBox : Gtk.Box{
}
private void take_snapshot_thread(){
thread_status_success = App.create_snapshot(true,parent_window);
thread_is_running = false;
}

View File

@ -1,8 +1,7 @@
/*
* BackupBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -111,6 +110,7 @@ class BackupDeviceBox : Gtk.Box{
}
private void init_tv_devices(){
tv_devices = add_treeview(this);
tv_devices.vexpand = true;
tv_devices.headers_clickable = true;
@ -382,6 +382,7 @@ class BackupDeviceBox : Gtk.Box{
}
private void change_backup_device(Device pi){
// return if device has not changed
if ((App.repo.device != null) && (pi.uuid == App.repo.device.uuid)){ return; }
@ -394,6 +395,7 @@ class BackupDeviceBox : Gtk.Box{
App.repo = new SnapshotRepo.from_device(pi, parent_window, App.btrfs_mode);
if (pi.fstype == "luks"){
App.update_partitions();
var dev = Device.find_device_in_list_by_uuid(App.partitions, pi.uuid);
@ -422,6 +424,7 @@ class BackupDeviceBox : Gtk.Box{
}
private bool check_backup_location(){
bool ok = true;
App.repo.check_status();
@ -435,6 +438,7 @@ class BackupDeviceBox : Gtk.Box{
details = escape_html(details);
if (App.live_system()){
switch (status_code){
case SnapshotLocationStatus.NOT_SELECTED:
lbl_infobar_location.label = "<span weight=\"bold\">%s</span>".printf(details);
@ -537,6 +541,7 @@ class BackupDeviceBox : Gtk.Box{
}
private void tv_devices_refresh(){
App.update_partitions();
var model = new Gtk.TreeStore(4,
@ -610,7 +615,8 @@ class BackupDeviceBox : Gtk.Box{
tv_append_child_volumes(ref model, ref iter1, part);
}
else if ((part.kname == parent.kname) && (part.type == "disk") && part.has_linux_filesystem() && !part.has_children()){
else if ((part.kname == parent.kname) && (part.type == "disk")
&& part.has_linux_filesystem() && !part.has_children()){
// partition-less disk with linux filesystem

View File

@ -1,7 +1,7 @@
/*
* BackupWindow.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -67,7 +67,7 @@ class BackupWindow : Gtk.Window{
this.delete_event.connect(on_delete_event);
// vbox_main
vbox_main = new Box (Orientation.VERTICAL, 6);
vbox_main = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_main.margin = 12;
add(vbox_main);
@ -125,10 +125,12 @@ class BackupWindow : Gtk.Window{
}
private void save_changes(){
App.cron_job_update();
}
private void create_actions(){
var hbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
hbox.margin = 0;
hbox.margin_left = 24;
@ -184,6 +186,7 @@ class BackupWindow : Gtk.Window{
}
private void action_buttons_set_no_show_all(bool val){
btn_prev.no_show_all = val;
btn_next.no_show_all = val;
btn_close.no_show_all = val;
@ -216,6 +219,7 @@ class BackupWindow : Gtk.Window{
}
private void go_prev(){
switch(notebook.page){
case Tabs.ESTIMATE:
case Tabs.BACKUP_DEVICE:
@ -253,9 +257,7 @@ class BackupWindow : Gtk.Window{
private void initialize_tab(){
if (notebook.page < 0){
return;
}
if (notebook.page < 0){ return; }
log_msg("");
log_debug("page: %d".printf(notebook.page));

View File

@ -1,8 +1,7 @@
/*
* RestoreDeviceBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -70,7 +69,7 @@ class BootOptionsBox : Gtk.Box{
add_chk_reinstall_grub();
var hbox = new Box (Orientation.HORIZONTAL, 6);
var hbox = new Gtk.Box(Orientation.HORIZONTAL, 6);
hbox.margin_left = 12;
add (hbox);
@ -106,7 +105,7 @@ class BootOptionsBox : Gtk.Box{
/*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. Otherwise the system may fail to boot.");*/
hbox = new Gtk.Box (Orientation.HORIZONTAL, 6);
hbox = new Gtk.Box(Orientation.HORIZONTAL, 6);
add (hbox);
add_chk_update_initramfs(hbox);
@ -203,6 +202,7 @@ class BootOptionsBox : Gtk.Box{
}
private void refresh_cmb_grub_dev(){
var store = new Gtk.ListStore(2, typeof(Device), typeof(string));
TreeIter iter;

View File

@ -1,7 +1,7 @@
/*
* BootOptionsWindow.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,6 +33,7 @@ using TeeJee.System;
using TeeJee.Misc;
class BootOptionsWindow : Gtk.Window{
private Gtk.Box vbox_main;
private Gtk.ButtonBox bbox_action;
private BootOptionsBox boot_options_box;
@ -54,7 +55,7 @@ class BootOptionsWindow : Gtk.Window{
this.delete_event.connect(on_delete_event);
// vbox_main
vbox_main = new Box (Orientation.VERTICAL, 6);
vbox_main = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_main.margin = 12;
add(vbox_main);

View File

@ -1,8 +1,7 @@
/*
* DeleteBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -58,7 +57,7 @@ class DeleteBox : Gtk.Box{
// header
add_label_header(this, _("Deleting Snapshots..."), true);
var hbox_status = new Box (Orientation.HORIZONTAL, 6);
var hbox_status = new Gtk.Box(Orientation.HORIZONTAL, 6);
add (hbox_status);
spinner = new Gtk.Spinner();

View File

@ -1,7 +1,7 @@
/*
* DeleteFinishBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* DeleteWindow.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -68,7 +68,7 @@ class DeleteWindow : Gtk.Window{
this.delete_event.connect(on_delete_event);
// vbox_main
vbox_main = new Box (Orientation.VERTICAL, 6);
vbox_main = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_main.margin = 12;
add(vbox_main);
@ -77,7 +77,7 @@ class DeleteWindow : Gtk.Window{
// create tab
var vbox_tab = new Box (Orientation.VERTICAL, 6);
var vbox_tab = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_tab.margin = 0;
add_label_header(vbox_tab, _("Select Snapshots"), true);
@ -132,6 +132,7 @@ class DeleteWindow : Gtk.Window{
}
private void create_actions(){
var hbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
hbox.margin = 0;
hbox.margin_left = 24;
@ -200,6 +201,7 @@ class DeleteWindow : Gtk.Window{
}
private void action_buttons_set_no_show_all(bool val){
btn_prev.no_show_all = val;
btn_next.no_show_all = val;
btn_hide.no_show_all = val;
@ -224,6 +226,7 @@ class DeleteWindow : Gtk.Window{
}
private void go_prev(){
switch(notebook.page){
case Tabs.SNAPSHOT_LIST:
case Tabs.DELETE:
@ -245,9 +248,11 @@ class DeleteWindow : Gtk.Window{
App.delete_list = snapshot_list_box.selected_snapshots();
notebook.page = Tabs.DELETE;
break;
case Tabs.DELETE:
notebook.page = Tabs.DELETE_FINISH;
break;
case Tabs.DELETE_FINISH:
destroy();
break;
@ -280,6 +285,7 @@ class DeleteWindow : Gtk.Window{
bbox_action.set_layout (Gtk.ButtonBoxStyle.EXPAND);
#endif
break;
case Tabs.SNAPSHOT_LIST:
btn_prev.show();
btn_next.show();
@ -293,6 +299,7 @@ class DeleteWindow : Gtk.Window{
bbox_action.set_layout (Gtk.ButtonBoxStyle.EXPAND);
#endif
break;
case Tabs.DELETE_FINISH:
btn_prev.hide();
btn_next.hide();
@ -323,6 +330,7 @@ class DeleteWindow : Gtk.Window{
}
private bool validate_current_tab(){
switch(notebook.page){
case Tabs.SNAPSHOT_LIST:
var sel = snapshot_list_box.treeview.get_selection ();

View File

@ -1,7 +1,7 @@
/*
* EstimateBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -55,7 +55,7 @@ class EstimateBox : Gtk.Box{
// header
add_label_header(this, _("Estimating System Size..."), true);
var hbox_status = new Gtk.Box (Orientation.HORIZONTAL, 6);
var hbox_status = new Gtk.Box(Orientation.HORIZONTAL, 6);
add (hbox_status);
var spinner = new Gtk.Spinner();
@ -123,6 +123,7 @@ class EstimateBox : Gtk.Box{
}
private void estimate_system_size_thread(){
App.estimate_system_size();
log_debug("EstimateBox: thread finished");
thread_is_running = false;

View File

@ -1,7 +1,7 @@
/*
* ExcludeAppsBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -122,6 +122,7 @@ class ExcludeAppsBox : Gtk.Box{
col.pack_start (cell_text, false);
col.set_cell_data_func(cell_text, (cell_layout, cell, model, iter)=>{
AppExcludeEntry entry;
model.get (iter, 0, out entry, -1);
(cell as Gtk.CellRendererText).text = entry.name;
@ -129,6 +130,7 @@ class ExcludeAppsBox : Gtk.Box{
}
private void init_exclude_summary_link(Gtk.Box box){
var size_group = new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);
var button = add_button(box, _("Summary"), "", size_group, null);
button.clicked.connect(()=>{
@ -139,10 +141,12 @@ class ExcludeAppsBox : Gtk.Box{
// helpers
public void refresh(){
refresh_treeview();
}
public void refresh_treeview(){
var model = new Gtk.ListStore(3, typeof(AppExcludeEntry), typeof(bool), typeof(string));
treeview.model = model;

View File

@ -1,7 +1,7 @@
/*
* ExcludeBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,6 +33,7 @@ using TeeJee.System;
using TeeJee.Misc;
class ExcludeBox : Gtk.Box{
private Gtk.TreeView treeview;
private Gtk.Window parent_window;
private UsersBox users_box;
@ -66,6 +67,7 @@ class ExcludeBox : Gtk.Box{
}
public void set_users_box(UsersBox _users_box){
users_box = _users_box;
}
@ -144,7 +146,7 @@ class ExcludeBox : Gtk.Box{
model.get_iter_from_string (out iter, path);
model.get (iter, 0, out pattern);
bool exclude = true;
//bool exclude = true;
if (pattern.has_prefix("+ ")){
pattern = pattern[2:pattern.length];
@ -206,6 +208,7 @@ class ExcludeBox : Gtk.Box{
}
private void init_exclude_summary_link(Gtk.Box box){
var size_group = new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);
var button = add_button(box, _("Summary"), "", size_group, null);
button.clicked.connect(()=>{
@ -214,8 +217,8 @@ class ExcludeBox : Gtk.Box{
}
private void init_actions(){
// actions
var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 6);
add(hbox);
@ -405,6 +408,7 @@ class ExcludeBox : Gtk.Box{
}
private SList<string> browse_files(){
var dialog = new Gtk.FileChooserDialog(
_("Select file(s)"), parent_window,
Gtk.FileChooserAction.OPEN,
@ -425,6 +429,7 @@ class ExcludeBox : Gtk.Box{
}
private SList<string> browse_folder(){
var dialog = new Gtk.FileChooserDialog(
_("Select directory"), parent_window,
Gtk.FileChooserAction.SELECT_FOLDER,
@ -447,6 +452,7 @@ class ExcludeBox : Gtk.Box{
// helpers
public void refresh_treeview(){
var model = new Gtk.ListStore(4, typeof(string), typeof(string), typeof(bool), typeof(bool));
treeview.model = model;
@ -456,6 +462,7 @@ class ExcludeBox : Gtk.Box{
}
private void treeview_add_item(Gtk.TreeView treeview, string pattern){
log_debug("treeview_add_item(): %s".printf(pattern));
TreeIter iter;
@ -474,6 +481,7 @@ class ExcludeBox : Gtk.Box{
}
private void treeview_update_item(ref TreeIter iter, string pattern){
log_debug("treeview_update_item(): %s".printf(pattern));
bool include = pattern.has_prefix("+ ");
@ -485,8 +493,7 @@ class ExcludeBox : Gtk.Box{
model.set (iter, 3, !include);
}
private void cell_exclude_text_edited (
string path, string new_text) {
private void cell_exclude_text_edited(string path, string new_text) {
string old_pattern;
string new_pattern;
@ -503,10 +510,6 @@ class ExcludeBox : Gtk.Box{
new_pattern = new_text;
}
model.set (iter, 0, new_pattern);
//int index = temp_exclude_list.index_of(old_pattern);
//temp_exclude_list.insert(index, new_pattern);
//temp_exclude_list.remove(old_pattern);
}
public void save_changes(){
@ -539,42 +542,4 @@ class ExcludeBox : Gtk.Box{
users_box.refresh();
}
/*
private void btn_warning_clicked(){
string msg = "";
msg += _("Documents, music and other folders in your home directory are excluded by default.") + " ";
msg += _("Please do NOT include these folders in your snapshot unless you have a very good reason for doing so.") + " ";
msg += _("If you include any specific folders then these folders will get overwritten with previous contents when you restore a snapshot.");
var dialog = new Gtk.MessageDialog.with_markup(null, Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING, Gtk.ButtonsType.OK, msg);
dialog.set_title("Warning");
dialog.set_default_size (200, -1);
dialog.set_transient_for(this);
dialog.set_modal(true);
dialog.run();
dialog.destroy();
}
private void btn_reset_exclude_list_clicked(){
//create a temp exclude list ----------------------------
temp_exclude_list = new Gee.ArrayList<string>();
//refresh treeview --------------------------
refresh_treeview();
}
private bool lnk_default_list_activate(){
//show message window -----------------
var dialog = new ExcludeMessageWindow();
dialog.set_transient_for (this);
dialog.show_all();
dialog.run();
dialog.destroy();
return true;
}
*/
// TODO: Add link for default exclude items
}

View File

@ -1,7 +1,7 @@
/*
* ExcludeListSummaryWindow.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,6 +33,7 @@ using TeeJee.System;
using TeeJee.Misc;
class ExcludeListSummaryWindow : Gtk.Window{
private Gtk.Box vbox_main;
private Gtk.Label lbl_list;
private Gtk.Button btn_close;
@ -54,14 +55,12 @@ class ExcludeListSummaryWindow : Gtk.Window{
for_restore = _for_restore;
// vbox_main
vbox_main = new Box (Orientation.VERTICAL, 6);
vbox_main = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_main.margin = 12;
add(vbox_main);
add_label(vbox_main, _("Files &amp; directories matching the patterns below will be excluded. Patterns starting with a + will include the item instead of excluding."));
//add_label(vbox_main, _("Items"));
lbl_list = add_label_scrolled(vbox_main, "", true, true);
create_actions();
@ -75,7 +74,7 @@ class ExcludeListSummaryWindow : Gtk.Window{
private void create_actions(){
var hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 6);
vbox_main.add(hbox);
var size_group = new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);

View File

@ -1,7 +1,7 @@
/*
* ExcludeMessageWindow.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,8 +33,9 @@ using TeeJee.System;
using TeeJee.Misc;
public class ExcludeMessageWindow : Gtk.Dialog{
private Box vbox_main;
private Box hbox_action;
private Gtk.Box vbox_main;
private Gtk.Box hbox_action;
//exclude
private TreeView tv_exclude;
@ -152,12 +153,14 @@ public class ExcludeMessageWindow : Gtk.Dialog{
}
private void cell_exclude_text_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){
string pattern;
model.get (iter, 0, out pattern, -1);
(cell as Gtk.CellRendererText).text = pattern.has_prefix("+ ") ? pattern[2:pattern.length] : pattern;
}
private void tv_exclude_add_item(string path){
string icon_name = null;
TreeIter iter;
@ -178,6 +181,7 @@ public class ExcludeMessageWindow : Gtk.Dialog{
}
private void btn_ok_clicked(){
this.response(Gtk.ResponseType.OK);
return;
}

View File

@ -1,7 +1,7 @@
/*
* EstimateBox.vala
* FinishBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,6 +33,7 @@ using TeeJee.System;
using TeeJee.Misc;
class FinishBox : Gtk.Box{
private Gtk.Label lbl_header;
private Gtk.Label lbl_message;
@ -101,5 +102,4 @@ class FinishBox : Gtk.Box{
lbl_message.label = msg;
}
}

View File

@ -1,7 +1,7 @@
/*
* MainWindow.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -80,7 +80,7 @@ class MainWindow : Gtk.Window{
this.icon = IconManager.lookup("timeshift",16);
//vbox_main
vbox_main = new Box (Orientation.VERTICAL, 0);
vbox_main = new Gtk.Box(Orientation.VERTICAL, 0);
vbox_main.margin = 0;
add (vbox_main);
@ -101,6 +101,7 @@ class MainWindow : Gtk.Window{
}
private bool init_delayed(){
if (tmr_init > 0){
Source.remove(tmr_init);
tmr_init = 0;
@ -127,6 +128,7 @@ class MainWindow : Gtk.Window{
}
private void init_ui_toolbar(){
//toolbar
toolbar = new Gtk.Toolbar ();
toolbar.toolbar_style = ToolbarStyle.BOTH;
@ -211,10 +213,10 @@ class MainWindow : Gtk.Window{
button.clicked.connect(()=>{
menu_extra_popup(null);
});
}
private void init_ui_snapshot_list(){
snapshot_list_box = new SnapshotListBox(this);
snapshot_list_box.vexpand = true;
vbox_main.add(snapshot_list_box);
@ -229,6 +231,7 @@ class MainWindow : Gtk.Window{
}
private void init_ui_statusbar(){
// scrolled
var scrolled = new ScrolledWindow(null, null);
scrolled.set_shadow_type (ShadowType.ETCHED_IN);
@ -240,7 +243,7 @@ class MainWindow : Gtk.Window{
statusbar = scrolled;
// hbox_shield
var box = new Box (Orientation.HORIZONTAL, 6);
var box = new Gtk.Box(Orientation.HORIZONTAL, 6);
box.margin = 6;
box.margin_right = 12;
scrolled.add (box);
@ -251,7 +254,7 @@ class MainWindow : Gtk.Window{
img_shield.margin_bottom = 6;
box.add(img_shield);
var vbox = new Box (Orientation.VERTICAL, 6);
var vbox = new Gtk.Box(Orientation.VERTICAL, 6);
vbox.margin_right = 6;
box.add (vbox);
@ -271,7 +274,7 @@ class MainWindow : Gtk.Window{
//vbox.set_child_packing(lbl_shield_subnote, true, false, 0, PackType.START);
// snap_count
//vbox = new Box (Orientation.VERTICAL, 6);
//vbox = new Gtk.Box(Orientation.VERTICAL, 6);
//vbox.set_no_show_all(true);
//box.add (vbox);
//vbox_snap_count = vbox;
@ -283,31 +286,31 @@ class MainWindow : Gtk.Window{
scrolled.set_no_show_all(true);
box.add (scrolled);
vbox = new Box (Orientation.VERTICAL, 6);
vbox = new Gtk.Box(Orientation.VERTICAL, 6);
vbox.margin = 6;
vbox.margin_left = 12;
vbox.margin_right = 12;
scrolled.add(vbox);
scrolled_snap_count = scrolled;
var label = new Label("<b>" + "0.0%" + "</b>");
var label = new Gtk.Label("<b>" + "0.0%" + "</b>");
label.set_use_markup(true);
label.justify = Gtk.Justification.CENTER;
vbox.pack_start(label, true, true, 0);
lbl_snap_count = label;
label = new Label(_("Snapshots"));
label = new Gtk.Label(_("Snapshots"));
label.justify = Gtk.Justification.CENTER;
vbox.pack_start(label, false, false, 0);
label = new Label("");
label = new Gtk.Label("");
label.set_use_markup(true);
label.justify = Gtk.Justification.CENTER;
vbox.pack_start(label, false, false, 0);
lbl_snap_count_subnote = label;
// free space
//vbox = new Box (Orientation.VERTICAL, 6);
//vbox = new Gtk.Box(Orientation.VERTICAL, 6);
//vbox.set_no_show_all(true);
//box.add(vbox);
//vbox_free_space = vbox;
@ -319,22 +322,22 @@ class MainWindow : Gtk.Window{
scrolled.set_no_show_all(true);
box.add (scrolled);
vbox = new Box (Orientation.VERTICAL, 6);
vbox = new Gtk.Box(Orientation.VERTICAL, 6);
vbox.margin = 6;
scrolled.add(vbox);
scrolled_free_space = scrolled;
label = new Label("<b>" + "0.0%" + "</b>");
label = new Gtk.Label("<b>" + "0.0%" + "</b>");
label.set_use_markup(true);
label.justify = Gtk.Justification.CENTER;
vbox.pack_start(label, true, true, 0);
lbl_free_space = label;
label = new Label(_("Available"));
label = new Gtk.Label(_("Available"));
label.justify = Gtk.Justification.CENTER;
vbox.pack_start(label, false, false, 0);
label = new Label("");
label = new Gtk.Label("");
label.set_use_markup(true);
label.justify = Gtk.Justification.CENTER;
vbox.pack_start(label, false, false, 0);
@ -360,11 +363,6 @@ class MainWindow : Gtk.Window{
snapshot_list_box.refresh();
});
// snapshot logs
//menu_item = create_menu_item(_("View rsync log for selected snapshot"), "", "", 16);
//menu_extra.append(menu_item);
//menu_item.activate.connect(()=>{ view_snapshot_log(false); });
if (!App.live_system()){
// app logs
menu_item = create_menu_item(_("View TimeShift Logs"), "", "", 16);
@ -404,7 +402,7 @@ class MainWindow : Gtk.Window{
var menu_item = new Gtk.MenuItem();
var box = new Gtk.Box (Orientation.HORIZONTAL, 3);
var box = new Gtk.Box(Orientation.HORIZONTAL, 3);
menu_item.add(box);
var label = new Gtk.Label(label_text);
@ -421,7 +419,7 @@ class MainWindow : Gtk.Window{
var menu_item = new Gtk.MenuItem();
menu_item.sensitive = false;
var box = new Gtk.Box (Orientation.HORIZONTAL, 3);
var box = new Gtk.Box(Orientation.HORIZONTAL, 3);
menu_item.add(box);
box.add(new Gtk.Separator(Gtk.Orientation.HORIZONTAL));
@ -593,13 +591,16 @@ class MainWindow : Gtk.Window{
}
public void mark_selected(){
TreeIter iter;
bool is_success = true;
// check selected count ----------------
var sel = snapshot_list_box.treeview.get_selection();
if (sel.count_selected_rows() == 0){
gtk_messagebox(
_("No Snapshots Selected"),
_("Select the snapshots to mark for deletion"),
@ -612,8 +613,11 @@ class MainWindow : Gtk.Window{
var store = (Gtk.ListStore) snapshot_list_box.treeview.model;
bool iterExists = store.get_iter_first (out iter);
while (iterExists && is_success) {
if (sel.iter_is_selected (iter)){
Snapshot bak;
store.get (iter, 0, out bak);
// mark for deletion
@ -632,9 +636,13 @@ class MainWindow : Gtk.Window{
}
public void browse_selected(){
var sel = snapshot_list_box.treeview.get_selection ();
if (sel.count_selected_rows() == 0){
var f = File.new_for_path(App.repo.snapshots_path);
if (f.query_exists()){
exo_open_folder(App.repo.snapshots_path);
}
@ -648,8 +656,10 @@ class MainWindow : Gtk.Window{
var store = (Gtk.ListStore) snapshot_list_box.treeview.model;
bool iterExists = store.get_iter_first (out iter);
while (iterExists) {
if (sel.iter_is_selected (iter)){
Snapshot bak;
store.get (iter, 0, out bak);
@ -666,7 +676,9 @@ class MainWindow : Gtk.Window{
}
public void view_snapshot_log(bool view_restore_log){
var sel = snapshot_list_box.treeview.get_selection ();
if (sel.count_selected_rows() == 0){
gtk_messagebox(
_("Select Snapshot"),
@ -679,15 +691,14 @@ class MainWindow : Gtk.Window{
var store = (Gtk.ListStore) snapshot_list_box.treeview.model;
bool iterExists = store.get_iter_first (out iter);
while (iterExists) {
if (sel.iter_is_selected (iter)){
Snapshot bak;
store.get (iter, 0, out bak);
//exo_open_textfile(bak.path + "/rsync-log");
string log_file_name = bak.rsync_log_file;
if (view_restore_log){
log_file_name = bak.rsync_restore_log_file;;
@ -757,6 +768,7 @@ class MainWindow : Gtk.Window{
private void restore(){
TreeIter iter;
TreeSelection sel;
@ -764,7 +776,8 @@ class MainWindow : Gtk.Window{
//check if single snapshot is selected -------------
sel = snapshot_list_box.treeview.get_selection ();
sel = snapshot_list_box.treeview.get_selection();
if (sel.count_selected_rows() == 0){
gtk_messagebox(
_("No snapshots selected"),
@ -786,6 +799,7 @@ class MainWindow : Gtk.Window{
var store = (Gtk.ListStore) snapshot_list_box.treeview.model;
bool iterExists = store.get_iter_first (out iter);
while (iterExists) {
if (sel.iter_is_selected (iter)){
store.get (iter, 0, out snapshot_to_restore);
@ -795,6 +809,7 @@ class MainWindow : Gtk.Window{
}
if ((snapshot_to_restore != null) && (snapshot_to_restore.marked_for_deletion)){
gtk_messagebox(
_("Invalid snapshot"),
_("Selected snapshot is marked for deletion and cannot be restored"),
@ -885,10 +900,12 @@ class MainWindow : Gtk.Window{
}
private void btn_view_app_logs_clicked(){
exo_open_folder(App.log_dir);
}
public void btn_donate_clicked(){
var dialog = new DonationWindow();
dialog.set_transient_for(this);
dialog.show_all();
@ -897,6 +914,7 @@ class MainWindow : Gtk.Window{
}
private void btn_about_clicked (){
var dialog = new AboutWindow();
dialog.set_transient_for (this);
@ -939,6 +957,7 @@ class MainWindow : Gtk.Window{
}
private void ui_sensitive(bool enable){
toolbar.sensitive = enable;
snapshot_list_box.treeview.sensitive = enable;
gtk_set_busy(!enable, this);
@ -1081,6 +1100,7 @@ class MainWindow : Gtk.Window{
// ui helpers --------
private string format_text_large(string text){
return "<span size='xx-large'><b>" + text + "</b></span>";
}

View File

@ -1,8 +1,7 @@
/*
* RestoreBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -78,7 +77,7 @@ class RestoreBox : Gtk.Box{
lbl_header = add_label_header(this, _("Restoring Snapshot..."), true);
}
var hbox_status = new Box (Orientation.HORIZONTAL, 6);
var hbox_status = new Gtk.Box(Orientation.HORIZONTAL, 6);
add (hbox_status);
spinner = new Gtk.Spinner();
@ -142,7 +141,7 @@ class RestoreBox : Gtk.Box{
ref Gtk.SizeGroup? sg_label, ref Gtk.SizeGroup? sg_value,
int add_margin_bottom = 0){
var hbox = new Box (Orientation.HORIZONTAL, 6);
var hbox = new Gtk.Box(Orientation.HORIZONTAL, 6);
box.add (hbox);
var label = add_label(hbox, text + ":");
@ -276,6 +275,7 @@ class RestoreBox : Gtk.Box{
}
private void restore_thread(){
log_debug("RestoreBox: restore_thread()");
App.restore_snapshot(parent_window);
thread_is_running = false;

View File

@ -1,8 +1,7 @@
/*
* RestoreDeviceBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -121,6 +120,7 @@ class RestoreDeviceBox : Gtk.Box{
}
public void refresh(bool reset_device_selections = true){
log_debug("RestoreDeviceBox: refresh()");
App.update_partitions();
create_device_selection_options(reset_device_selections);
@ -424,6 +424,7 @@ class RestoreDeviceBox : Gtk.Box{
}
private void create_infobar_location(){
var infobar = new Gtk.InfoBar();
infobar.no_show_all = true;
add(infobar);
@ -504,8 +505,6 @@ class RestoreDeviceBox : Gtk.Box{
}
}
//check if grub device selected ---------------
if (App.reinstall_grub2 && (App.grub_device.length == 0)){

View File

@ -1,8 +1,7 @@
/*
* RestoreExcludeBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,6 +33,7 @@ using TeeJee.System;
using TeeJee.Misc;
class RestoreExcludeBox : Gtk.Box{
//private Gtk.CheckButton chk_web;
private Gtk.CheckButton chk_other;
private Gtk.CheckButton chk_web;
@ -50,31 +50,6 @@ class RestoreExcludeBox : Gtk.Box{
parent_window = _parent_window;
margin = 12;
// header ---------------
//var label = add_label_header(this, _("Items to Restore"), true);
// personal files --------------------------------
/*var chk = add_checkbox(this, _("Restore System Files &amp; Settings"));
//chk.margin_top = 12;
chk.active = true;
chk.sensitive = false;
chk = add_checkbox(this, _("Restore Local Application Settings"));
//chk.margin_top = 12;
chk.active = true;
chk.sensitive = false;*/
/*label = add_label(this, _("If un-checked, personal files and folders in home directory will be reset to the previous state."), false, true);
label.margin_left = 24;
label.wrap = true;
label.wrap_mode = Pango.WrapMode.WORD_CHAR;
var tt = _("Keep existing personal files and folders in home directory. If unchecked, personal files and folders in home directory will be reset to the state it was in when snapshot was taken.");
chk.set_tooltip_text(tt);
label.set_tooltip_text(tt);*/
// app settings header --------------------------------
var label = add_label_header(this, _("Exclude Application Settings"), true);
@ -152,11 +127,13 @@ class RestoreExcludeBox : Gtk.Box{
}
public void refresh(){
chk_web.toggled();
chk_torrent.toggled();
}
public bool show_all_apps(){
return chk_other.active;
}
}

View File

@ -1,7 +1,7 @@
/*
* RestoreFinishBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,7 @@
/*
* RestoreSummaryBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,6 +33,7 @@ using TeeJee.System;
using TeeJee.Misc;
class RestoreSummaryBox : Gtk.Box{
public Gtk.Label lbl_devices;
public Gtk.Label lbl_reboot;
public Gtk.Label lbl_disclaimer;
@ -65,20 +65,12 @@ class RestoreSummaryBox : Gtk.Box{
lbl_disclaimer = add_label(this, "", false, false, false);
// click next
//var label = add_label(this, _("Click Next to continue"), false, false, true);
//label.margin_top = 6;
//label.margin_bottom = 6;
// refresh
//refresh();
log_debug("RestoreSummaryBox: RestoreSummaryBox(): exit");
}
public void refresh(){
string msg_devices = "";
string msg_reboot = "";
string msg_disclaimer = "";

View File

@ -1,7 +1,7 @@
/*
* RestoreWindow.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -74,7 +74,7 @@ class RestoreWindow : Gtk.Window{
this.delete_event.connect(on_delete_event);
// vbox_main
vbox_main = new Box (Orientation.VERTICAL, 6);
vbox_main = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_main.margin = 12;
add(vbox_main);
@ -152,6 +152,7 @@ class RestoreWindow : Gtk.Window{
}
private void save_changes(){
App.cron_job_update();
}

View File

@ -1,7 +1,7 @@
/*
* RsyncLogBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -43,6 +43,9 @@ public class RsyncLogBox : Gtk.Box {
private Gtk.ComboBox cmb_filter;
private Gtk.Box hbox_filter;
private Gtk.Entry txt_pattern;
private Gtk.TreeViewColumn col_name;
private Gtk.TreeViewColumn col_status;
private string name_filter = "";
private string status_filter = "";
@ -82,7 +85,7 @@ public class RsyncLogBox : Gtk.Box {
if (App.dry_run){
lbl_header = add_label_header(this, _("Confirm Actions"), true);
}
create_progressbar();
create_filters();
@ -110,6 +113,13 @@ public class RsyncLogBox : Gtk.Box {
});
});
if (is_restore_log){
col_name.title = _("File (system)");
}
else{
col_name.title = _("File (snapshot)");
}
show_all();
tmr_init = Timeout.add(100, init_delayed);
@ -204,7 +214,7 @@ public class RsyncLogBox : Gtk.Box {
lbl_header = add_label_header(vbox_progress, _("Parsing log file..."), true);
var hbox_status = new Box (Orientation.HORIZONTAL, 6);
var hbox_status = new Gtk.Box(Orientation.HORIZONTAL, 6);
vbox_progress.add(hbox_status);
spinner = new Gtk.Spinner();
@ -230,7 +240,7 @@ public class RsyncLogBox : Gtk.Box {
log_debug("create_filters()");
var hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 6);
hbox.no_show_all = true;
this.add(hbox);
hbox_filter = hbox;
@ -357,10 +367,10 @@ public class RsyncLogBox : Gtk.Box {
string txt = "";
if (App.dry_run){
txt = _("Replace");
txt = _("Change");
}
else if (is_restore_log){
txt = _("Restored");
txt = _("Changed");
}
else{
txt = _("Changed");
@ -389,11 +399,13 @@ public class RsyncLogBox : Gtk.Box {
private uint tmr_action = 0;
private void add_action_delayed(){
clear_action_delayed();
tmr_action = Timeout.add(200, execute_action);
}
private void clear_action_delayed(){
if (tmr_action > 0){
Source.remove(tmr_action);
tmr_action = 0;
@ -452,6 +464,7 @@ public class RsyncLogBox : Gtk.Box {
var col = new Gtk.TreeViewColumn();
col.title = is_restore_log ? _("Action") : _("Status");
treeview.append_column(col);
col_status = col;
// cell icon
var cell_pix = new Gtk.CellRendererPixbuf();
@ -463,28 +476,6 @@ public class RsyncLogBox : Gtk.Box {
var cell_text = new Gtk.CellRendererText ();
col.pack_start (cell_text, false);
col.set_attributes(cell_text, "text", 4);
// render icon
/*col.set_cell_data_func (cell_pix, (cell_layout, cell, model, iter) => {
var pixcell = cell as Gtk.CellRendererPixbuf;
Gdk.Pixbuf pixbuf;
model.get (iter, 3, out pixbuf, -1);
pixcell.pixbuf = pixbuf;
});*/
// render text
/*col.set_cell_data_func (cell_text, (cell_layout, cell, model, iter) => {
var txtcell = cell as Gtk.CellRendererText;
string status;
model.get (iter, 4, out status, -1);
txtcell.text = status;
});*/
}
private void add_column_name(){
@ -496,7 +487,8 @@ public class RsyncLogBox : Gtk.Box {
col.resizable = true;
col.expand = true;
treeview.append_column(col);
col_name = col;
// cell icon
var cell_pix = new Gtk.CellRendererPixbuf();
cell_pix.stock_size = Gtk.IconSize.MENU;
@ -508,28 +500,6 @@ public class RsyncLogBox : Gtk.Box {
cell_text.ellipsize = Pango.EllipsizeMode.END;
col.pack_start (cell_text, false);
col.set_attributes(cell_text, "text", 2);
// render icon
/*col.set_cell_data_func (cell_pix, (cell_layout, cell, model, iter) => {
var pixcell = cell as Gtk.CellRendererPixbuf;
Gdk.Pixbuf pixbuf;
model.get (iter, 1, out pixbuf, -1);
pixcell.pixbuf = pixbuf;
});*/
// render text
/*col.set_cell_data_func (cell_text, (cell_layout, cell, model, iter) => {
var txtcell = cell as Gtk.CellRendererText;
string path;
model.get (iter, 2, out path, -1);
txtcell.text = path;
});*/
}
private void add_column_buffer(){
@ -585,11 +555,11 @@ public class RsyncLogBox : Gtk.Box {
case "permissions":
case "owner":
case "group":
status = App.dry_run ? _("Replace") : _("Restored");
status = App.dry_run ? _("Change") : _("Changed");
status_icon = IconManager.lookup("item-yellow",16);
break;
case "created":
status = App.dry_run ? _("Copy") : _("Created");
status = App.dry_run ? _("Create") : _("Created");
status_icon = IconManager.lookup("item-green",16);
break;
case "deleted":

View File

@ -1,7 +1,7 @@
/*
* RsyncLogWindow.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,8 +35,6 @@ using TeeJee.Misc;
public class RsyncLogWindow : Window {
private Gtk.Box vbox_main;
//window
private int def_width = 800;
private int def_height = 600;

View File

@ -1,7 +1,7 @@
/*
* ScheduleBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,6 +33,7 @@ using TeeJee.System;
using TeeJee.Misc;
class ScheduleBox : Gtk.Box{
private Gtk.Image img_shield;
private Gtk.Label lbl_shield;
private Gtk.Label lbl_shield_subnote;
@ -184,7 +185,7 @@ class ScheduleBox : Gtk.Box{
add(scrolled);
// hbox
var hbox = new Gtk.Box (Orientation.HORIZONTAL, 6);
var hbox = new Gtk.Box(Orientation.HORIZONTAL, 6);
hbox.margin = 6;
hbox.margin_bottom = 12;
scrolled.add (hbox);
@ -195,7 +196,7 @@ class ScheduleBox : Gtk.Box{
img_shield.margin_bottom = 6;
hbox.add(img_shield);
var vbox = new Box (Orientation.VERTICAL, 6);
var vbox = new Gtk.Box(Orientation.VERTICAL, 6);
hbox.add (vbox);
// lbl_shield
@ -281,15 +282,20 @@ class ScheduleBox : Gtk.Box{
}
public void update_statusbar(){
if (App.schedule_monthly || App.schedule_weekly || App.schedule_daily
|| App.schedule_hourly || App.schedule_boot){
img_shield.surface = IconManager.lookup_surface(IconManager.SHIELD_HIGH, IconManager.SHIELD_ICON_SIZE, img_shield.scale_factor);
img_shield.surface = IconManager.lookup_surface(IconManager.SHIELD_HIGH,
IconManager.SHIELD_ICON_SIZE, img_shield.scale_factor);
set_shield_label(_("Scheduled snapshots are enabled"));
set_shield_subnote(_("Snapshots will be created at selected intervals if snapshot disk has enough space (> 1 GB)"));
}
else{
img_shield.surface = IconManager.lookup_surface(IconManager.SHIELD_LOW, IconManager.SHIELD_ICON_SIZE, img_shield.scale_factor);
img_shield.surface = IconManager.lookup_surface(IconManager.SHIELD_LOW,
IconManager.SHIELD_ICON_SIZE, img_shield.scale_factor);
set_shield_label(_("Scheduled snapshots are disabled"));
set_shield_subnote(_("Select the intervals for creating snapshots"));
}

View File

@ -1,7 +1,7 @@
/*
* SettingsWindow.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -60,7 +60,7 @@ class SettingsWindow : Gtk.Window{
this.delete_event.connect(on_delete_event);
vbox_main = new Box (Orientation.VERTICAL, 0);
vbox_main = new Gtk.Box(Orientation.VERTICAL, 0);
//vbox_main.margin = 6;
add(vbox_main);

View File

@ -1,7 +1,7 @@
/*
* SetupWizardWindow.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,6 +33,7 @@ using TeeJee.System;
using TeeJee.Misc;
class SetupWizardWindow : Gtk.Window{
private Gtk.Box vbox_main;
private Gtk.Notebook notebook;
@ -68,7 +69,7 @@ class SetupWizardWindow : Gtk.Window{
this.delete_event.connect(on_delete_event);
// vbox_main
vbox_main = new Box (Orientation.VERTICAL, 6);
vbox_main = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_main.margin = 12;
add(vbox_main);
@ -159,6 +160,7 @@ class SetupWizardWindow : Gtk.Window{
}
private void create_actions(){
var hbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
hbox.margin = 0;
hbox.margin_left = 24;
@ -216,6 +218,7 @@ class SetupWizardWindow : Gtk.Window{
}
private void action_buttons_set_no_show_all(bool val){
btn_prev.no_show_all = val;
btn_next.no_show_all = val;
btn_close.no_show_all = val;
@ -248,6 +251,7 @@ class SetupWizardWindow : Gtk.Window{
}
private void go_prev(){
switch(notebook.page){
case Tabs.SNAPSHOT_BACKEND:
case Tabs.ESTIMATE:

View File

@ -1,8 +1,7 @@
/*
* SnapshotBackendBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -113,7 +112,9 @@ class SnapshotBackendBox : Gtk.Box{
}
private bool check_for_btrfs_tools(){
if (!cmd_exists("btrfs")){
string msg = _("The 'btrfs' command is not available on your system. Install the 'btrfs-tools' package and try again.");
string title = _("BTRFS Tools Not Found");
gtk_set_busy(false, parent_window);
@ -126,8 +127,8 @@ class SnapshotBackendBox : Gtk.Box{
}
}
private void add_description(){
// scrolled
var scrolled = new ScrolledWindow(null, null);
scrolled.set_shadow_type (ShadowType.ETCHED_IN);
@ -190,10 +191,12 @@ class SnapshotBackendBox : Gtk.Box{
}
public void init_backend(){
App.try_select_default_device_for_backup(parent_window);
}
public void refresh(){
opt_btrfs.active = App.btrfs_mode;
type_changed();
update_description();

View File

@ -1,8 +1,7 @@
/*
* SnapshotListBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -76,6 +75,7 @@ class SnapshotListBox : Gtk.Box{
}
private void init_treeview(){
//treeview
treeview = new TreeView();
treeview.get_selection().mode = SelectionMode.MULTIPLE;
@ -291,6 +291,7 @@ class SnapshotListBox : Gtk.Box{
}
private void init_list_view_context_menu(){
Gdk.RGBA gray = Gdk.RGBA();
gray.parse ("rgba(200,200,200,1)");
@ -344,10 +345,12 @@ class SnapshotListBox : Gtk.Box{
// signals
private bool treeview_popup_menu(){
return menu_snapshots_popup (menu_snapshots, null);
}
private bool treeview_button_press_event(Gdk.EventButton event){
if (event.button == 3) {
return menu_snapshots_popup (menu_snapshots, event);
}
@ -587,6 +590,7 @@ class SnapshotListBox : Gtk.Box{
}
public void hide_context_menu(){
// disconnect signal for shift+F10
treeview.popup_menu.disconnect(treeview_popup_menu);
@ -595,6 +599,7 @@ class SnapshotListBox : Gtk.Box{
}
public Gee.ArrayList<Snapshot> selected_snapshots(){
var list = new Gee.ArrayList<Snapshot>();
TreeIter iter;

View File

@ -1,7 +1,7 @@
/*
* UsersBox.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,7 @@
/*
* AppLock.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* ArchiveFile.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* AsyncTask.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* Bash.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* CronTab.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* DeleteFileTask.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
* Device.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* FileItem.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* FsTabEntry.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* AboutWindow.vala
*
* Copyright 2012-2017 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* CustomMessageDialog.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* DonationWindow.vala
*
* Copyright 2012-2017 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* TerminalWindow.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -71,7 +71,7 @@ public class TerminalWindow : Gtk.Window {
// vbox_main ---------------
vbox_main = new Box (Orientation.VERTICAL, 6);
vbox_main = new Gtk.Box(Orientation.VERTICAL, 6);
vbox_main.set_size_request (def_width, def_height);
add (vbox_main);

View File

@ -87,7 +87,7 @@ namespace TeeJee.GtkHelper{
/* Shows a simple input prompt */
//vbox_main
Gtk.Box vbox_main = new Box (Orientation.VERTICAL, 0);
Gtk.Box vbox_main = new Gtk.Box(Orientation.VERTICAL, 0);
vbox_main.margin = 0;
//lbl_input
@ -426,7 +426,7 @@ namespace TeeJee.GtkHelper{
var label = new Gtk.Label(title);
// vbox
var vbox = new Box (Gtk.Orientation.VERTICAL, spacing);
var vbox = new Gtk.Box(Gtk.Orientation.VERTICAL, spacing);
vbox.margin = margin;
book.append_page (vbox, label);

View File

@ -1,7 +1,7 @@
/*
* IconManager.vala
*
* Copyright 2017 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
* ProcStats.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
* OSDNotify.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
* ProcStats.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* RsyncTask.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -268,20 +268,24 @@ public class RsyncTask : AsyncTask{
}
var dis = new DataInputStream (file.read());
while ((line = dis.read_line (null)) != null) {
string item_path = "";
string item_disk_path = "";
string item_status = "";
string item_basepath = path_combine(file_parent(log_file_path), "localhost");
while ((line = dis.read_line(null)) != null) {
prg_count++;
if (line.strip().length == 0) { continue; }
string item_path = "";
var item_type = FileType.REGULAR;
string item_status = "";
bool item_is_symlink = false;
item_path = "";
MatchInfo match;
if (regex_list["log-created"].match(line, 0, out match)
|| regex_list["created"].match(line, 0, out match)) {
if (regex_list["created"].match(line, 0, out match)
|| regex_list["log-created"].match(line, 0, out match)) {
if (dos_changes != null){
dos_changes.put_string("%s\n".printf(line));
@ -290,13 +294,13 @@ public class RsyncTask : AsyncTask{
//log_debug("matched: created:%s".printf(line));
item_path = match.fetch(3).split(" -> ")[0].strip();
item_type = FileType.REGULAR;
/*item_type = FileType.REGULAR;
if (match.fetch(2) == "d"){
item_type = FileType.DIRECTORY;
}
else if (match.fetch(2) == "L"){
item_is_symlink = true;
}
}*/
item_status = "created";
}
else if (regex_list["log-deleted"].match(line, 0, out match)
@ -309,11 +313,11 @@ public class RsyncTask : AsyncTask{
}
item_path = match.fetch(1).split(" -> ")[0].strip();
item_type = item_path.has_suffix("/") ? FileType.DIRECTORY : FileType.REGULAR;
//item_type = item_path.has_suffix("/") ? FileType.DIRECTORY : FileType.REGULAR;
item_status = "deleted";
}
else if (regex_list["log-modified"].match(line, 0, out match)
|| regex_list["modified"].match(line, 0, out match)) {
else if (regex_list["modified"].match(line, 0, out match)
|| regex_list["log-modified"].match(line, 0, out match)) {
//log_debug("matched: modified:%s".printf(line));
@ -323,12 +327,12 @@ public class RsyncTask : AsyncTask{
item_path = match.fetch(12).split(" -> ")[0].strip();
if (match.fetch(2) == "d"){
/*if (match.fetch(2) == "d"){
item_type = FileType.DIRECTORY;
}
else if (match.fetch(2) == "L"){
item_is_symlink = true;
}
}*/
if (match.fetch(3) == "c"){
item_status = "checksum";
@ -356,26 +360,15 @@ public class RsyncTask : AsyncTask{
log_debug("not-matched: %s".printf(line));
}
if ((item_path.length > 0) && (item_path != "/./") && (item_path != "./")
//&& ((item_type == FileType.REGULAR)||(item_status == "created"))
){
if ((item_path.length > 0) && (item_path != "/./") && (item_path != "./")){
int64 item_size = 0;//int64.parse(size);
string item_disk_path = path_combine(file_parent(log_file_path),"localhost");
item_disk_path = path_combine(item_disk_path, item_path);
item_size = file_get_size(item_disk_path);
if (item_size == -1){
item_size = 0;
}
item_disk_path = path_combine(item_basepath, item_path);
var item = new FileItem.from_disk_path_with_basic_info(item_disk_path);
//var item = root.add_descendant(item_path, item_type, item_size, 0);
item.file_status = item_status;
item.is_symlink = item_is_symlink;
list.add(item);
//log_debug("added: %s".printf(item_path));
}
}
}
catch (Error e) {
@ -384,6 +377,7 @@ public class RsyncTask : AsyncTask{
if (dos_changes != null){
// archive the raw log file
log_msg("Archiving: %s".printf(log_file_path));
file_gzip(log_file_path);
}
@ -395,6 +389,7 @@ public class RsyncTask : AsyncTask{
// execution ----------------------------
public void execute() {
log_debug("RsyncTask:execute()");
prepare();

View File

@ -2,7 +2,7 @@
/*
* SystemGroup.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
* SystemUser.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
* TeeJee.FileSystem.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
* TeeJee.JsonHelper.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
* TeeJee.Logging.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
* TeeJee.Misc.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
/*
* TeeJee.ProcessHelper.vala
*
* Copyright 2012-17 Tony George <teejeetech@gmail.com>
* Copyright 2012-2018 Tony George <teejeetech@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

Some files were not shown because too many files have changed in this diff Show More