[gnome-boxes] machine: Add 'is_local' prop
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] machine: Add 'is_local' prop
- Date: Tue, 18 Aug 2015 16:15:04 +0000 (UTC)
commit 5bae0d71dfec7af5d11e28f699ae310f50f724dd
Author: Adrien Plazas <kekun plazas laposte net>
Date: Mon Jun 29 12:20:05 2015 +0200
machine: Add 'is_local' prop
This will used in the next commit to filter local and remote machines
and is needed to offer multiple ready-made searches.
https://bugzilla.gnome.org/show_bug.cgi?id=751710
src/libvirt-machine.vala | 10 ++++++++++
src/machine.vala | 10 ++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index ab43324..9c8cfbc 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -42,6 +42,16 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
public bool run_in_bg { get; set; } // If true, machine will never be paused automatically by Boxes.
+ public override bool is_local {
+ get {
+ // If the URI is prefixed by "qemu" or "qemu+unix" and the domain is "system" of "session" then
it is local.
+ if (/^qemu(\+unix)?:\/\/\/(system|session)/i.match (source.uri))
+ return true;
+
+ return base.is_local;
+ }
+ }
+
public override void disconnect_display () {
stay_on_display = false;
diff --git a/src/machine.vala b/src/machine.vala
index 7fa64de..1c1a6ff 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -55,6 +55,16 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
}
}
+ public virtual bool is_local {
+ get {
+ // If the adress is in the 127.0.0.0 block or is localhost, then it is local
+ if (/:\/\/(127\.\d+\.\d+\.\d+|localhost)/i.match (source.uri))
+ return true;
+
+ return false;
+ }
+ }
+
private ulong show_id;
private ulong hide_id;
private ulong disconnected_id;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]