mirror of
https://github.com/linuxmint/timeshift.git
synced 2024-09-11 08:55:25 +03:00
Fix some compiler warnings
This commit is contained in:
parent
bf2b836783
commit
3391f69e26
@ -2756,7 +2756,7 @@ public class Main : GLib.Object{
|
||||
}
|
||||
}
|
||||
sh_fsck += "echo '' \n";
|
||||
int ret_val = exec_script_sync(sh_fsck, null, null, false, false, false, true);
|
||||
exec_script_sync(sh_fsck, null, null, false, false, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,10 +270,6 @@ public class SnapshotRepo : GLib.Object{
|
||||
else{
|
||||
return "";
|
||||
}
|
||||
|
||||
log_debug("SnapshotRepo: unlock_and_mount_device(): exit");
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public Device? unlock_encrypted_device(Device luks_device){
|
||||
|
@ -922,7 +922,7 @@ class MainWindow : Gtk.Window{
|
||||
|
||||
private void btn_about_clicked (){
|
||||
|
||||
var dialog = new AboutWindow();
|
||||
var dialog = new AboutWindow(this);
|
||||
dialog.set_transient_for (this);
|
||||
|
||||
dialog.authors = {
|
||||
|
@ -327,7 +327,6 @@ public class CronTab : GLib.Object {
|
||||
log_error("Cron directory type parameter not valid" + ": %s".printf(cron_dir_type));
|
||||
log_error("Expected values: d, hourly, daily, weekly, monthly");
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
string file_path = "/etc/cron.%s/%s".printf(cron_dir_type, file_name.replace(".","-")); // dot is not allowed in file name
|
||||
|
@ -1962,51 +1962,10 @@ public class Device : GLib.Object{
|
||||
return "<tt>%s</tt>".printf(tt);
|
||||
}
|
||||
|
||||
private string display_name(bool short_name = true, bool show_label = true, bool show_parent = true, bool show_alias = false){
|
||||
|
||||
string txt = "";
|
||||
|
||||
if (short_name){
|
||||
txt += kname;
|
||||
}
|
||||
else{
|
||||
txt += device;
|
||||
}
|
||||
|
||||
if (type == "disk"){
|
||||
if (vendor.length > 0){
|
||||
txt += " " + vendor;
|
||||
}
|
||||
if (model.length > 0){
|
||||
txt += " " + model;
|
||||
}
|
||||
if (size_bytes > 0) {
|
||||
if (txt.strip().length == 0){
|
||||
txt += "%s Device".printf(format_file_size(size_bytes, false, "", true, 0));
|
||||
}
|
||||
else{
|
||||
txt += " (%s)".printf(format_file_size(size_bytes, false, "", true, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (show_label && (label.length > 0)){
|
||||
txt += "(%s)".printf(label);
|
||||
}
|
||||
if (show_parent && has_parent() && (parent.type == "part")){ // TODO: if parent is crypt (like lvm on luks)
|
||||
txt += "(%s)".printf(pkname);
|
||||
}
|
||||
if (show_alias && (mapped_name.length > 0)){
|
||||
txt += "(%s)".printf(mapped_name);
|
||||
}
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
// testing -----------------------------------
|
||||
|
||||
public static void test_all(){
|
||||
|
||||
var list = get_block_devices_using_lsblk();
|
||||
log_msg("\n> get_block_devices_using_lsblk()");
|
||||
print_device_list(list);
|
||||
|
@ -31,7 +31,7 @@ using TeeJee.GtkHelper;
|
||||
using TeeJee.System;
|
||||
using TeeJee.Misc;
|
||||
|
||||
public class AboutWindow : Dialog {
|
||||
public class AboutWindow : Gtk.Window {
|
||||
|
||||
private Gtk.Box vbox_main;
|
||||
private Gtk.Box vbox_logo;
|
||||
@ -42,6 +42,7 @@ public class AboutWindow : Dialog {
|
||||
private Gtk.Button btn_license;
|
||||
private Gtk.Button btn_credits;
|
||||
private Gtk.Button btn_close;
|
||||
private Gtk.Window window;
|
||||
|
||||
private Gtk.Image img_logo;
|
||||
private Gtk.Label lbl_program_name;
|
||||
@ -203,22 +204,26 @@ public class AboutWindow : Dialog {
|
||||
|
||||
private string username = "";
|
||||
|
||||
public AboutWindow() {
|
||||
public AboutWindow(Gtk.Window _window) {
|
||||
|
||||
window = _window;
|
||||
|
||||
window_position = WindowPosition.CENTER_ON_PARENT;
|
||||
set_destroy_with_parent (true);
|
||||
set_modal (true);
|
||||
skip_taskbar_hint = false;
|
||||
set_default_size (450, 400);
|
||||
set_default_size(450, 450);
|
||||
|
||||
if (get_user_id_effective() == 0){
|
||||
username = get_username();
|
||||
log_debug("username: %s".printf(username));
|
||||
}
|
||||
|
||||
vbox_main = get_content_area();
|
||||
vbox_main.margin = 6;
|
||||
|
||||
vbox_main = new Gtk.Box(Orientation.VERTICAL,0);
|
||||
vbox_main.margin = 12;
|
||||
vbox_main.spacing = 6;
|
||||
|
||||
this.add(vbox_main);
|
||||
|
||||
vbox_logo = new Gtk.Box(Orientation.VERTICAL,0);
|
||||
vbox_main.add(vbox_logo);
|
||||
|
||||
@ -243,7 +248,6 @@ public class AboutWindow : Dialog {
|
||||
label.wrap_mode = Pango.WrapMode.WORD_CHAR;
|
||||
label.use_markup = true;
|
||||
label.margin = 6;
|
||||
label.margin_right = 25;
|
||||
sw_license.add(label);
|
||||
lbl_license = label;
|
||||
|
||||
@ -309,8 +313,8 @@ public class AboutWindow : Dialog {
|
||||
}
|
||||
|
||||
private void add_action_buttons(){
|
||||
|
||||
hbox_action = (Box) get_action_area();
|
||||
|
||||
hbox_action = add_button_box(vbox_main, Gtk.Orientation.HORIZONTAL, Gtk.ButtonBoxStyle.CENTER, 6);
|
||||
|
||||
//btn_license
|
||||
btn_license = new Gtk.Button.with_label(" " + _("License"));
|
||||
|
@ -48,9 +48,7 @@ public class CustomMessageDialog : Gtk.Dialog {
|
||||
private Gtk.MessageType msg_type;
|
||||
private Gtk.ButtonsType buttons_type;
|
||||
|
||||
public CustomMessageDialog(
|
||||
string _msg_title, string _msg_body,
|
||||
Gtk.MessageType _msg_type, Window? parent, Gtk.ButtonsType _buttons_type) {
|
||||
public CustomMessageDialog(string _msg_title, string _msg_body, Gtk.MessageType _msg_type, Window? parent, Gtk.ButtonsType _buttons_type) {
|
||||
|
||||
set_transient_for(parent);
|
||||
set_modal(true);
|
||||
@ -62,34 +60,18 @@ public class CustomMessageDialog : Gtk.Dialog {
|
||||
|
||||
init_window();
|
||||
|
||||
//lbl_msg.label += string.nfill(4000, 'n');
|
||||
|
||||
lbl_msg.expand = true;
|
||||
sw_msg.expand = true;
|
||||
sw_msg.vscrollbar_policy = PolicyType.NEVER;
|
||||
|
||||
//log_debug("0: label=%dx%d".printf(lbl_msg.get_allocated_width(), lbl_msg.get_allocated_height()));
|
||||
//log_debug("0: scroll=%dx%d".printf(sw_msg.get_allocated_width(), sw_msg.get_allocated_height()));
|
||||
|
||||
sw_msg.set_size_request(500, 150); // sets minimum size
|
||||
|
||||
//log_debug("0: label=%dx%d".printf(lbl_msg.get_allocated_width(), lbl_msg.get_allocated_height()));
|
||||
//log_debug("0: scroll=%dx%d".printf(sw_msg.get_allocated_width(), sw_msg.get_allocated_height()));
|
||||
|
||||
show_all();
|
||||
|
||||
//log_debug("1: label=%dx%d".printf(lbl_msg.get_allocated_width(), lbl_msg.get_allocated_height()));
|
||||
//log_debug("1: scroll=%dx%d".printf(sw_msg.get_allocated_width(), sw_msg.get_allocated_height()));
|
||||
|
||||
if (lbl_msg.get_allocated_height() > 400){
|
||||
sw_msg.vscrollbar_policy = PolicyType.AUTOMATIC;
|
||||
sw_msg.set_size_request(500, 400);
|
||||
//gtk_do_events();
|
||||
//this.set_position(WindowPosition.CENTER);
|
||||
}
|
||||
|
||||
//log_debug("1: label=%dx%d".printf(lbl_msg.get_allocated_width(), lbl_msg.get_allocated_height()));
|
||||
//log_debug("1: scroll=%dx%d".printf(sw_msg.get_allocated_width(), sw_msg.get_allocated_height()));
|
||||
}
|
||||
|
||||
public void init_window () {
|
||||
@ -131,7 +113,6 @@ public class CustomMessageDialog : Gtk.Dialog {
|
||||
// image ----------------
|
||||
|
||||
var img = new Image.from_icon_name(icon_name, Gtk.IconSize.DIALOG);
|
||||
img.margin_right = 12;
|
||||
hbox_contents.add(img);
|
||||
|
||||
// label -------------------
|
||||
@ -146,8 +127,7 @@ public class CustomMessageDialog : Gtk.Dialog {
|
||||
lbl_msg.wrap = true;
|
||||
lbl_msg.wrap_mode = Pango.WrapMode.WORD_CHAR;
|
||||
lbl_msg.use_markup = true;
|
||||
lbl_msg.margin_right = 25;
|
||||
|
||||
|
||||
//sw_msg
|
||||
sw_msg = new Gtk.ScrolledWindow(null, null);
|
||||
//sw_msg.set_shadow_type (ShadowType.ETCHED_IN);
|
||||
@ -159,9 +139,6 @@ public class CustomMessageDialog : Gtk.Dialog {
|
||||
|
||||
// actions -------------------------
|
||||
|
||||
var action_area = get_action_area () as Gtk.Box;
|
||||
action_area.margin_top = 12;
|
||||
|
||||
switch(buttons_type){
|
||||
case Gtk.ButtonsType.OK:
|
||||
btn_ok = (Gtk.Button) add_button (_("OK"), Gtk.ResponseType.OK);
|
||||
|
@ -115,11 +115,8 @@ namespace TeeJee.GtkHelper{
|
||||
content.margin = 6;
|
||||
|
||||
//add buttons
|
||||
var actions = (Box) dlg.get_action_area ();
|
||||
dlg.add_button(_("OK"),Gtk.ResponseType.OK);
|
||||
dlg.add_button(_("Cancel"),Gtk.ResponseType.CANCEL);
|
||||
//actions.margin = 6;
|
||||
actions.margin_top = 12;
|
||||
|
||||
//keyboard shortcuts
|
||||
txt_input.key_press_event.connect ((w, event) => {
|
||||
@ -308,7 +305,6 @@ namespace TeeJee.GtkHelper{
|
||||
// TreeView
|
||||
var treeview = new TreeView();
|
||||
treeview.get_selection().mode = selection_mode;
|
||||
treeview.set_rules_hint (true);
|
||||
treeview.show_expanders = true;
|
||||
treeview.enable_tree_lines = true;
|
||||
|
||||
@ -450,10 +446,7 @@ namespace TeeJee.GtkHelper{
|
||||
if (show_border){
|
||||
scroll.set_shadow_type (ShadowType.ETCHED_IN);
|
||||
}
|
||||
else{
|
||||
label.margin_left = 0;
|
||||
}
|
||||
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
@ -498,7 +491,6 @@ namespace TeeJee.GtkHelper{
|
||||
private Gtk.Label add_label_subnote(Gtk.Box box, string text){
|
||||
|
||||
var label = add_label(box, text, false, true);
|
||||
label.margin_left = 6;
|
||||
return label;
|
||||
}
|
||||
|
||||
@ -590,70 +582,26 @@ namespace TeeJee.GtkHelper{
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
// add_toggle_button
|
||||
private Gtk.ToggleButton add_toggle_button(Gtk.Box box, string text, string tooltip, Gtk.SizeGroup? size_group, Gtk.Image? icon = null){
|
||||
|
||||
var button = new Gtk.ToggleButton();
|
||||
box.add(button);
|
||||
|
||||
button.set_label(text);
|
||||
button.set_tooltip_text(tooltip);
|
||||
|
||||
if (icon != null){
|
||||
button.set_image(icon);
|
||||
button.set_always_show_image(true);
|
||||
}
|
||||
|
||||
if (size_group != null){
|
||||
size_group.add_widget(button);
|
||||
}
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
// add_directory_chooser
|
||||
private Gtk.Entry add_directory_chooser(Gtk.Box box, string selected_directory, Gtk.Window parent_window){
|
||||
|
||||
// Entry
|
||||
var entry = new Gtk.Entry();
|
||||
entry.hexpand = true;
|
||||
//entry.margin_left = 6;
|
||||
entry.secondary_icon_stock = "gtk-open";
|
||||
entry.placeholder_text = _("Enter path or browse for directory");
|
||||
box.add (entry);
|
||||
public Gtk.ButtonBox add_button_box(Gtk.Container box, Gtk.Orientation orientation = Gtk.Orientation.HORIZONTAL,
|
||||
Gtk.ButtonBoxStyle layout = Gtk.ButtonBoxStyle.CENTER, int spacing = 6){
|
||||
|
||||
if ((selected_directory != null) && dir_exists(selected_directory)){
|
||||
entry.text = selected_directory;
|
||||
}
|
||||
var bbox = new Gtk.ButtonBox(orientation);
|
||||
bbox.set_layout(layout);
|
||||
bbox.set_spacing(spacing);
|
||||
box.add(bbox);
|
||||
|
||||
entry.icon_release.connect((p0, p1) => {
|
||||
//chooser
|
||||
var chooser = new Gtk.FileChooserDialog(
|
||||
_("Select Path"),
|
||||
parent_window,
|
||||
FileChooserAction.SELECT_FOLDER,
|
||||
"_Cancel",
|
||||
Gtk.ResponseType.CANCEL,
|
||||
"_Open",
|
||||
Gtk.ResponseType.ACCEPT
|
||||
);
|
||||
|
||||
chooser.select_multiple = false;
|
||||
chooser.set_filename(selected_directory);
|
||||
|
||||
if (chooser.run() == Gtk.ResponseType.ACCEPT) {
|
||||
entry.text = chooser.get_filename();
|
||||
|
||||
//App.repo = new SnapshotRepo.from_path(entry.text, this);
|
||||
//check_backup_location();
|
||||
}
|
||||
|
||||
chooser.destroy();
|
||||
});
|
||||
|
||||
return entry;
|
||||
/*
|
||||
Gtk.ButtonBoxStyle.CENTER
|
||||
CENTER - Buttons are centered in the box.
|
||||
EDGE - Buttons are placed at the edges of the box.
|
||||
END - Buttons are grouped towards the end of the box, (on the right for a HBox, or the bottom for a VBox).
|
||||
EXPAND - Buttons expand to fill the box.
|
||||
SPREAD - Buttons are evenly spread across the box.
|
||||
START - Buttons are grouped towards the start of the box, (on the left for a HBox, or the top for a VBox).
|
||||
*/
|
||||
|
||||
return bbox;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -422,13 +422,13 @@ namespace TeeJee.ProcessHelper{
|
||||
* */
|
||||
|
||||
int[] child_pids = get_process_children (process_pid);
|
||||
Posix.kill (process_pid, Posix.SIGTERM);
|
||||
Posix.kill (process_pid, Posix.Signal.TERM);
|
||||
|
||||
if (killChildren){
|
||||
Pid childPid;
|
||||
foreach (long pid in child_pids){
|
||||
childPid = (Pid) pid;
|
||||
Posix.kill (childPid, Posix.SIGTERM);
|
||||
Posix.kill (childPid, Posix.Signal.TERM);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -441,13 +441,13 @@ namespace TeeJee.ProcessHelper{
|
||||
* */
|
||||
|
||||
int[] child_pids = get_process_children (process_pid);
|
||||
Posix.kill (process_pid, Posix.SIGKILL);
|
||||
Posix.kill (process_pid, Posix.Signal.KILL);
|
||||
|
||||
if (killChildren){
|
||||
Pid childPid;
|
||||
foreach (long pid in child_pids){
|
||||
childPid = (Pid) pid;
|
||||
Posix.kill (childPid, Posix.SIGKILL);
|
||||
Posix.kill (childPid, Posix.Signal.KILL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,14 +275,6 @@ namespace TeeJee.System{
|
||||
return list;
|
||||
}
|
||||
|
||||
public int get_display_width(){
|
||||
return Gdk.Screen.get_default().get_width();
|
||||
}
|
||||
|
||||
public int get_display_height(){
|
||||
return Gdk.Screen.get_default().get_height();
|
||||
}
|
||||
|
||||
// internet helpers ----------------------
|
||||
|
||||
public bool shutdown (){
|
||||
|
Loading…
Reference in New Issue
Block a user