[gnome-boxes/cleanup-displays: 3/3] build: Make SPICE a hard dependency again




commit a3c7216d377f758204f4fd22436aec4bd41f3723
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Jun 29 11:46:01 2022 +0200

    build: Make SPICE a hard dependency again
    
    We no longer support running Boxes without SPICE.

 src/app.vala             |  2 --
 src/display-page.vala    |  6 ------
 src/libvirt-machine.vala |  8 --------
 src/meson.build          | 21 ++++-----------------
 src/vm-configurator.vala | 26 ++++++++------------------
 5 files changed, 12 insertions(+), 51 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index cff665b0..8c6a5e0a 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -193,9 +193,7 @@ public override int command_line (GLib.ApplicationCommandLine cmdline) {
         var parameter_string = _("— A simple application to access virtual machines");
         var opt_context = new OptionContext (parameter_string);
         opt_context.add_main_entries (options, null);
-#if HAS_SPICE
         opt_context.add_group (Spice.get_option_group ());
-#endif
         opt_context.add_group (Gtk.get_option_group (true));
         opt_context.set_help_enabled (false);
 
diff --git a/src/display-page.vala b/src/display-page.vala
index d30d898e..1fc1b4a1 100644
--- a/src/display-page.vala
+++ b/src/display-page.vala
@@ -20,9 +20,7 @@
     private unowned DisplayToolbar overlay_toolbar;
     [GtkChild]
     private unowned EventBox overlay_toolbar_box;
-#if HAS_SPICE
     public Boxes.TransferPopover transfer_popover;
-#endif
     private uint toolbar_hide_id;
     private uint toolbar_show_id;
     private ulong cursor_id;
@@ -81,9 +79,7 @@ public void setup_ui (AppWindow window) {
         target_list += urilist_entry;
 
         drag_dest_set (transfer_message_box, Gtk.DestDefaults.DROP, target_list, DragAction.ASK);
-#if HAS_SPICE
         transfer_popover = new Boxes.TransferPopover (window.topbar.display_toolbar);
-#endif
     }
 
      private void update_toolbar_visible() {
@@ -96,9 +92,7 @@ private void update_toolbar_visible() {
      }
 
      public void add_transfer (Object transfer_task) {
-#if HAS_SPICE
         transfer_popover.add_transfer (transfer_task);
-#endif
      }
 
      private void set_overlay_toolbar_visible(bool visible) {
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 11a00b9b..df5f39a6 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -65,17 +65,12 @@
     private bool _acceleration_3d;
     public bool acceleration_3d {
         get {
-#if HAS_SPICE
             return _acceleration_3d;
-#else
-            return false;
-#endif
         }
 
         set {
             _acceleration_3d = value;
 
-#if HAS_SPICE
             GLib.List<GVirConfig.DomainDevice> devices = null;
             foreach (var device in domain_config.get_devices ()) {
                 if (device is GVirConfig.DomainGraphicsSpice) {
@@ -100,7 +95,6 @@
             } catch (GLib.Error error) {
                 warning ("Failed to disable 3D Acceleration");
             }
-#endif
         }
     }
 
@@ -307,13 +301,11 @@ private Display? create_display () throws Boxes.Error {
             host = "localhost";
 
         switch (type) {
-#if HAS_SPICE
         case "spice":
             if (port > 0)
                 return new SpiceDisplay (this, config, host, port);
             else
                 return new SpiceDisplay.priv (this, config);
-#endif
 
         default:
             throw new Boxes.Error.INVALID ("unsupported display of type " + type);
diff --git a/src/meson.build b/src/meson.build
index 81a4e2fb..8a0d8382 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -73,7 +73,9 @@ vala_sources = [
   'search.vala',
   'searchbar.vala',
   'shared-folders.vala',
+  'spice-display.vala',
   'transfer-info-row.vala',
+  'transfer-popover.vala',
   'troubleshoot-view.vala',
   'topbar.vala',
   'ui.vala',
@@ -110,31 +112,16 @@ dependencies = [
   dependency ('libvirt-gconfig-1.0', version: '>= 4.0.0'),
   dependency ('libvirt-gobject-1.0', version: '>= 4.0.0'),
   dependency ('libxml-2.0', version: '>= 2.7.8'),
+  dependency ('spice-client-gtk-3.0', version: '>= 0.32'),
   dependency ('tracker-sparql-3.0'),
   dependency ('webkit2gtk-4.0', version: '>= 2.26.0'),
   cc.find_library('m', required : false),
   valac.find_library ('gio-2.0-workaround', dirs: vapi_dir),
   valac.find_library ('linux'),
   valac.find_library ('posix'),
+  valac.find_library ('spice-client-gtk-3.0'),
 ]
 
-spice = dependency ('spice-client-gtk-3.0', version: '>= 0.32')
-if spice.found ()
-  vala_args += '--define=HAS_SPICE'
-  # FIXME Remove and bump version after libhandy 1.6 is released.
-  vala_args += '--disable-since-check'
-
-  dependencies += [
-    spice,
-    valac.find_library ('spice-client-gtk-3.0')
-  ]
-
-  vala_sources += [
-    'spice-display.vala',
-    'transfer-popover.vala'
-  ]
-endif
-
 if get_option('flatpak')
   vala_args += '--define=FLATPAK'
 
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index cbb0f4ee..0d80433c 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -39,13 +39,6 @@
     private const string LIBOSINFO_XML = "<libosinfo>%s</libosinfo>";
     private const string LIBOSINFO_OS_ID_XML = "<os id=\"%s\"/>";
 
-    private const bool SPICE_AVAILABLE =
-#if HAS_SPICE
-        true;
-#else
-        false;
-#endif
-
     public static Domain create_domain_config (InstallerMedia install_media, string target_path, 
Capabilities caps, DomainCapabilities domain_caps)
                                         throws VMConfiguratorError {
         var domain = new Domain ();
@@ -91,12 +84,11 @@ public static Domain create_domain_config (InstallerMedia install_media, string
         set_target_media_config (domain, target_path, install_media);
         install_media.setup_domain_config (domain);
 
-        if(SPICE_AVAILABLE) {
-            domain.add_device (create_graphics_device());
-            add_usb_support (domain, install_media);
-            if (!App.is_running_in_flatpak ())
-                add_smartcard_support (domain);
-        }
+        domain.add_device (create_graphics_device());
+        add_usb_support (domain, install_media);
+
+        if (!App.is_running_in_flatpak ())
+            add_smartcard_support (domain);
 
         set_video_config (domain, install_media);
         set_sound_config (domain, install_media);
@@ -324,11 +316,9 @@ else if (device is DomainDisk) {
                 devices.prepend (device);
         }
 
-        if (SPICE_AVAILABLE) {
-            devices.prepend (create_spice_webdav_channel ());
-            devices.prepend (create_spice_agent_channel ());
-            devices.prepend (create_graphics_device ());
-        }
+        devices.prepend (create_spice_webdav_channel ());
+        devices.prepend (create_spice_agent_channel ());
+        devices.prepend (create_graphics_device ());
 
         if (iface != null) {
             var bridge = is_libvirt_bridge_net_available ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]