Skip to content
This repository has been archived by the owner on Feb 3, 2019. It is now read-only.

Commit

Permalink
Add config option for connection timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenpowered committed Mar 7, 2019
1 parent 7a22e18 commit 9f4ae21
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Common/Main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class Main : GLib.Object{
public bool notify_dialog = true;
public int notify_interval_unit = 0;
public int notify_interval_value = 2;
public int connection_timeout_seconds = 15;

public bool message_shown = false;

Expand Down Expand Up @@ -149,9 +150,11 @@ public class Main : GLib.Object{
//config.set_string_member("show_grub_menu", LinuxKernel.show_grub_menu.to_string());
config.set_string_member("grub_timeout", LinuxKernel.grub_timeout.to_string());
config.set_string_member("update_grub_timeout", LinuxKernel.update_grub_timeout.to_string());
config.set_string_member("connection_timeout_seconds", connection_timeout_seconds.to_string());

config.set_string_member("message_shown", message_shown.to_string());


var json = new Json.Generator();
json.pretty = true;
json.indent = 2;
Expand Down Expand Up @@ -208,6 +211,7 @@ public class Main : GLib.Object{
notify_dialog = json_get_bool(config, "notify_dialog", true);
notify_interval_unit = json_get_int(config, "notify_interval_unit", 0);
notify_interval_value = json_get_int(config, "notify_interval_value", 2);
connection_timeout_seconds = json_get_int(config, "connection_timeout_seconds", 15);

LinuxKernel.hide_unstable = json_get_bool(config, "hide_unstable", true);
LinuxKernel.hide_older = json_get_bool(config, "hide_older", true);
Expand Down
31 changes: 31 additions & 0 deletions src/Gtk/SettingsDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,37 @@ public class SettingsDialog : Gtk.Dialog {

chk_update_grub_timeout.toggled();

// other
label = new Label("<b>" + _("Other") + "</b>");
label.set_use_markup(true);
label.xalign = (float) 0.0;
label.margin_top = 12;
label.margin_bottom = 6;
vbox_main.add (label);

var hbox = new Gtk.Box(Orientation.HORIZONTAL, 6);
vbox_main.add (hbox);

label = new Label(_("Internect connection timeout in "));
label.xalign = (float) 0.0;
label.margin_left = 6;
hbox.add (label);

var adjustment = new Gtk.Adjustment(App.connection_timeout_seconds, 1, 20, 1, 1, 0);
var spin = new Gtk.SpinButton (adjustment, 1, 0);
spin.xalign = (float) 0.5;
hbox.add(spin);
var spin_notify = spin;

spin.changed.connect(()=>{
App.connection_timeout_seconds = (int) spin_notify.get_value();
});

// combo
label = new Label(_("seconds"));
label.xalign = (float) 0.0;
hbox.add(combo);

// actions -------------------------

// ok
Expand Down

0 comments on commit 9f4ae21

Please sign in to comment.