[gnome-boxes] unattended-setup-box: Detect internet if needed
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] unattended-setup-box: Detect internet if needed
- Date: Fri, 15 Aug 2014 18:40:47 +0000 (UTC)
commit 61bd553d867b2d1e7aeb54e201fe7f16a934942b
Author: Lasse Schuirmann <lasse schuirmann gmail com>
Date: Tue Aug 12 18:06:49 2014 +0200
unattended-setup-box: Detect internet if needed
This is needed to take the needs-internet param of Osinfo.InstallScript
into account for the express installation.
https://bugzilla.gnome.org/show_bug.cgi?id=734675
src/unattended-installer.vala | 4 +++-
src/unattended-setup-box.vala | 29 +++++++++++++++++++++++++++--
2 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index a8f279c..c9e0394 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -100,7 +100,7 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
kbd = lang;
product_key_format = get_product_key_format ();
- setup_box = new UnattendedSetupBox (os_media.live, product_key_format);
+ setup_box = new UnattendedSetupBox (os_media.live, product_key_format, false);
setup_box.notify["ready-to-create"].connect (() => {
notify_property ("ready-to-create");
});
@@ -282,6 +282,8 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
public override void clean_up () {
base.clean_up ();
+ setup_box.clean_up ();
+
try {
if (disk_file != null) {
delete_file (disk_file);
diff --git a/src/unattended-setup-box.vala b/src/unattended-setup-box.vala
index 54bbc56..fb4f3d5 100644
--- a/src/unattended-setup-box.vala
+++ b/src/unattended-setup-box.vala
@@ -87,11 +87,12 @@ private class Boxes.UnattendedSetupBox : Gtk.Box {
private string? product_key_format;
- public UnattendedSetupBox (bool live, string? product_key_format) {
+ public UnattendedSetupBox (bool live, string? product_key_format, bool needs_internet) {
this.product_key_format = product_key_format;
- express_toggle.active = !live;
username_entry.text = Environment.get_user_name ();
+ setup_express_toggle (live, needs_internet);
+
if (product_key_format != null) {
product_key_label.visible = true;
@@ -105,6 +106,30 @@ private class Boxes.UnattendedSetupBox : Gtk.Box {
express_toggle.bind_property ("active", child, "sensitive", BindingFlags.SYNC_CREATE);
}
+ public void clean_up () {
+ NetworkMonitor.get_default ().network_changed.disconnect (update_express_toggle);
+ }
+
+ private void setup_express_toggle (bool live, bool needs_internet) {
+ express_toggle.active = !live;
+
+ if (!needs_internet)
+ return;
+
+ var network_monitor = NetworkMonitor.get_default ();
+ update_express_toggle (network_monitor.get_network_available ());
+ network_monitor.network_changed.connect (update_express_toggle);
+ }
+
+ private void update_express_toggle(bool network_available) {
+ if (network_available) {
+ express_toggle.sensitive = true;
+ } else {
+ express_toggle.sensitive = false;
+ express_toggle.active = false;
+ }
+ }
+
[GtkCallback]
private void on_mandatory_input_changed () {
notify_property ("ready-to-create");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]