Lessen warnings on build

This commit is contained in:
Ryo Nakano 2021-11-27 12:38:09 +09:00
parent f7b14727c2
commit 59033b3a1a
4 changed files with 29 additions and 42 deletions

View File

@ -24,7 +24,6 @@ modules:
- name: easyssh
buildsystem: meson
config-opts:
- '-Dlibunity=false'
- '-Dubuntu-bionic-patched-vte=false'
- '-Dpatched-vte=true'
sources:

View File

@ -135,7 +135,7 @@ namespace EasySSH {
var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL);
box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
box.margin_left = 5;
box.margin_start = 5;
welcome = new Welcome();
welcome_accounts = new WelcomeAccounts();
box.add(welcome);
@ -931,9 +931,6 @@ namespace EasySSH {
public Host edit_host(string old_name, Host e_host) {
var host = hostmanager.get_host_by_name(old_name);
if(host == null){
return null;
}
var group = hostmanager.get_group_by_name(host.group);
e_host.notebook = host.notebook;
if(host.group == e_host.group) {
@ -1066,24 +1063,11 @@ namespace EasySSH {
}
#endif
var file = File.new_for_path (Application.settings.get_string ("hosts-folder").replace ("%20", " ") + filename);
{
if (file.query_exists ()) {
file.delete ();
}
var dos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));
dos.put_string (data);
}
write_data_to_file (file, data);
if(Application.settings.get_boolean ("sync-ssh-config")){
var file_ssh = File.new_for_path (Environment.get_home_dir () + "/.ssh/config");
{
if (file_ssh.query_exists ()) {
file_ssh.delete ();
}
var dos_ssh = new DataOutputStream (file_ssh.create (FileCreateFlags.REPLACE_DESTINATION));
dos_ssh.put_string (data_ssh_config);
}
write_data_to_file (file_ssh, data_ssh_config);
}
}
@ -1119,15 +1103,7 @@ namespace EasySSH {
}
#endif
var file = File.new_for_path (Application.settings.get_string ("hosts-folder").replace ("%20", " ") + filename);
{
if (file.query_exists ()) {
file.delete ();
}
var dos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));
dos.put_string (data);
}
write_data_to_file (file, data);
}
public void save_bookmarks() {
@ -1160,15 +1136,7 @@ namespace EasySSH {
}
#endif
var file = File.new_for_path (Application.settings.get_string ("hosts-folder").replace ("%20", " ") + filename);
{
if (file.query_exists ()) {
file.delete ();
}
var dos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));
dos.put_string (data);
}
write_data_to_file (file, data);
}
public void backup_ssh_config() {
@ -1475,5 +1443,22 @@ namespace EasySSH {
}
message_dialog.destroy ();
}
private void write_data_to_file (File file, string data) {
if (file.query_exists ()) {
try {
file.delete ();
} catch (Error e) {
warning (e.message);
}
}
try {
var dos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));
dos.put_string (data);
} catch (Error e) {
warning (e.message);
}
}
}
}

View File

@ -217,7 +217,6 @@ namespace EasySSH {
}
private void term_send(string cmd) {
var n_cmd = cmd + "\n";
#if UBUNTU_BIONIC_PATCHED_VTE
term.feed_child(cmd, cmd.length);
#else

View File

@ -134,7 +134,7 @@ namespace EasySSH {
if (uri != null && ! get_has_selection ()) {
try {
Gtk.show_uri (null, uri, Gtk.get_current_event_time ());
Gtk.show_uri_on_window (window, uri, Gtk.get_current_event_time ());
} catch (GLib.Error error) {
warning ("Could Not Open link");
}
@ -171,8 +171,12 @@ namespace EasySSH {
public void active_shell() {
if(ssh){
this.spawn_sync(Vte.PtyFlags.DEFAULT, null, {"/bin/sh"},
null, SpawnFlags.SEARCH_PATH, null, out this.child_pid, null);
try {
this.spawn_sync(Vte.PtyFlags.DEFAULT, null, {"/bin/sh"},
null, SpawnFlags.SEARCH_PATH, null, out this.child_pid, null);
} catch (Error e) {
warning (e.message);
}
}else{
string dir = GLib.Environment.get_current_dir ();
var shell = Vte.get_user_shell ();