[gnome-boxes/remote-viewer-only] app: Introduce "Remote Viewer" runtime mode
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/remote-viewer-only] app: Introduce "Remote Viewer" runtime mode
- Date: Wed, 15 Jan 2020 12:26:35 +0000 (UTC)
commit a694469cef6331bf69fbe87b6a38581ac2d17f69
Author: Felipe Borges <felipeborges gnome org>
Date: Wed Jan 8 11:24:57 2020 +0100
app: Introduce "Remote Viewer" runtime mode
By running Boxes with the --remote-viewer option, the user gets a
version of the application without the virtualization bits. It also
prevents Boxes from conecting/launching the virtualization backend.
Fixes #177
data/ui/collection-toolbar.ui | 15 +++++++++++++--
src/app.vala | 19 +++++++++++++------
src/collection-toolbar.vala | 15 +++++++++++++--
src/wizard-source.vala | 2 ++
4 files changed, 41 insertions(+), 10 deletions(-)
---
diff --git a/data/ui/collection-toolbar.ui b/data/ui/collection-toolbar.ui
index 2e1d0ce1..f3dd4d10 100644
--- a/data/ui/collection-toolbar.ui
+++ b/data/ui/collection-toolbar.ui
@@ -9,8 +9,19 @@
</style>
<child type="title">
- <object class="BoxesCollectionFilterSwitcher" id="filter_switcher">
+ <object class="GtkStack" id="title_stack">
<property name="visible">True</property>
+ <child>
+ <object class="BoxesCollectionFilterSwitcher" id="filter_switcher">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="remote_viewer_title">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Remote Viewer</property>
+ </object>
+ </child>
</object>
</child>
@@ -232,7 +243,7 @@
<property name="orientation">vertical</property>
<property name="margin">10</property>
<child>
- <object class="GtkModelButton">
+ <object class="GtkModelButton" id="create_vm_entry">
<property name="visible">True</property>
<property name="text" translatable="yes">Create a Virtual Machineā¦</property>
<signal name="clicked" handler="on_create_vm_btn_clicked"/>
diff --git a/src/app.vala b/src/app.vala
index 5fe63c9d..ca91d80c 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -134,11 +134,6 @@ public override void startup () {
Gtk.init (ref args2);
collection = new Collection ();
-
- brokers.insert ("libvirt", LibvirtBroker.get_default ());
-
- check_cpu_vt_capability.begin ();
- check_module_kvm_loaded.begin ();
}
public bool has_broker_for_source_type (string type) {
@@ -165,12 +160,21 @@ public override void activate () {
activate_async.begin ();
+ if (opt_remote_viewer)
+ return;
+
+ brokers.insert ("libvirt", LibvirtBroker.get_default ());
+
+ check_cpu_vt_capability.begin ();
+ check_module_kvm_loaded.begin ();
+
window.show_welcome_tutorial ();
}
static bool opt_fullscreen;
static bool opt_help;
static string opt_open_uuid;
+ public static bool opt_remote_viewer;
static string[] opt_uris;
static string[] opt_search;
const OptionEntry[] options = {
@@ -179,6 +183,7 @@ public override void activate () {
{ "checks", 0, 0, OptionArg.NONE, null, N_("Check virtualization capabilities"), null },
{ "open-uuid", 0, 0, OptionArg.STRING, ref opt_open_uuid, N_("Open box with UUID"), null },
{ "search", 0, 0, OptionArg.STRING_ARRAY, ref opt_search, N_("Search term"), null },
+ { "remote-viewer", 0, 0, OptionArg.NONE, ref opt_remote_viewer, N_("Launch only remote viewing
capabilities"), null },
// A 'broker' is a virtual-machine manager (local or remote). Currently only libvirt is supported.
{ "", 0, 0, OptionArg.STRING_ARRAY, ref opt_uris, N_("URL to display, broker or installer media"),
null },
{ null }
@@ -187,6 +192,7 @@ public override void activate () {
public override int command_line (GLib.ApplicationCommandLine cmdline) {
opt_fullscreen = false;
opt_help = false;
+ opt_remote_viewer = false;
opt_open_uuid = null;
opt_uris = null;
opt_search = null;
@@ -416,7 +422,8 @@ public async void add_collection_source (CollectionSource source) throws GLib.Er
private async void activate_async () {
yield move_configs_from_cache ();
- yield setup_default_source ();
+ if (!opt_remote_viewer)
+ yield setup_default_source ();
is_ready = true;
ready ();
diff --git a/src/collection-toolbar.vala b/src/collection-toolbar.vala
index 281058a9..f4027bcc 100644
--- a/src/collection-toolbar.vala
+++ b/src/collection-toolbar.vala
@@ -20,7 +20,13 @@
[GtkChild]
private MenuButton hamburger_btn;
[GtkChild]
+ private ModelButton create_vm_entry;
+ [GtkChild]
+ private Stack title_stack;
+ [GtkChild]
private CollectionFilterSwitcher filter_switcher;
+ [GtkChild]
+ private Label remote_viewer_title;
private AppWindow window;
@@ -43,7 +49,12 @@ public void setup_ui (AppWindow window) {
window.notify["ui-state"].connect (ui_state_changed);
App.app.notify["main-window"].connect (ui_state_changed);
- filter_switcher.setup_ui (window);
+ if (!App.opt_remote_viewer)
+ filter_switcher.setup_ui (window);
+ else {
+ create_vm_entry.visible = false;
+ title_stack.set_visible_child (remote_viewer_title);
+ }
var builder = new Builder.from_resource ("/org/gnome/Boxes/ui/menus.ui");
MenuModel menu = (MenuModel) builder.get_object ("app-menu");
@@ -118,7 +129,7 @@ private void ui_state_changed () {
new_btn.show ();
grid_btn.visible = window.view_type != AppWindow.ViewType.ICON;
list_btn.visible = window.view_type != AppWindow.ViewType.LIST;
- custom_title = filter_switcher;
+ custom_title = title_stack;
break;
case UIState.CREDS:
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index d008692f..aec549e1 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -482,6 +482,8 @@ private void add_media_entry (InstallerMedia media) {
}
private async void update_libvirt_sytem_entry_visibility () {
+ if (App.opt_remote_viewer)
+ return;
try {
libvirt_sys_importer = yield new LibvirtSystemImporter ();
} catch (GLib.Error error) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]