Skip to content
API Documentation
BastionGuard™
RsyncLogWindow.vala
Go to the documentation of this file.
1/*
2 * RsyncLogWindow.vala
3 *
4 * Copyright 2012-2018 Tony George <teejeetech@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 *
21 *
22 */
23
24
25using Gtk;
26using Gee;
27
28using TeeJee.Logging;
33using TeeJee.System;
34using TeeJee.Misc;
35
36public class RsyncLogWindow : Window {
37
38 public signal void request_close();
39
40 //window
41 private int def_width = 800;
42 private int def_height = 600;
43
45 private string rsync_log_file;
46 private bool embedded_mode = false;
47
48 public RsyncLogWindow(string _rsync_log_file, bool embedded = false) {
49 embedded_mode = embedded;
50
51 log_debug("RsyncLogWindow: RsyncLogWindow()");
52
53 this.title = _("Rsync Log Viewer");
54 this.set_default_size(def_width, def_height);
55 this.set_icon_name("bastionguard-backup");
56 this.resizable = true;
57 if (!embedded_mode) this.modal = true;
58
59 if (!embedded_mode) this.close_request.connect(() => {
60 return on_close_request();
61 });
62
63 rsync_log_file = _rsync_log_file;
64
65 logbox = new RsyncLogBox(this);
66 this.set_child(logbox);
67
68 if (!embedded_mode)
69 show();
70
72
73 log_debug("RsyncLogWindow: RsyncLogWindow(): exit");
74 }
75
76 private bool on_close_request(){
77
78 if (logbox.is_running){
79 return true; // keep window open
80 }
81 else{
82 return false; // close window
83 }
84 }
85
86
87 public Gtk.Widget detach_root_widget() {
88 set_child(null);
89 return logbox;
90 }
91}
#define _(s)
void open_log(string _rsync_log_file)
RsyncLogBox(Gtk.Window _window)
signal void request_close()
RsyncLogWindow(string _rsync_log_file, bool embedded=false)
Gtk.Widget detach_root_widget()
RsyncLogBox logbox
void log_debug(string message)