[gnome-builder] local-device: override get_info_async() when necessary



commit 610974227a6894309158586a8090ccd0b263bc80
Author: Christian Hergert <chergert redhat com>
Date:   Thu Mar 8 16:16:33 2018 -0800

    local-device: override get_info_async() when necessary
    
    If the device was created to be a cross-architecture device, then we need
    to use that as our system information when requested.

 src/libide/local/ide-local-device.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/local/ide-local-device.c b/src/libide/local/ide-local-device.c
index 8a73e74e0..aa9edbd25 100644
--- a/src/libide/local/ide-local-device.c
+++ b/src/libide/local/ide-local-device.c
@@ -51,13 +51,15 @@ ide_local_device_get_info_async (IdeDevice           *device,
                                  GAsyncReadyCallback  callback,
                                  gpointer             user_data)
 {
+  IdeLocalDevice *self = (IdeLocalDevice *)device;
+  IdeLocalDevicePrivate *priv = ide_local_device_get_instance_private (self);
   g_autoptr(GTask) task = NULL;
   g_autoptr(IdeDeviceInfo) info = NULL;
   const gchar *system_type = NULL;
   g_auto(GStrv) parts = NULL;
   g_autofree gchar *arch = NULL;
 
-  g_assert (IDE_IS_LOCAL_DEVICE (device));
+  g_assert (IDE_IS_LOCAL_DEVICE (self));
   g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
 
   task = g_task_new (device, cancellable, callback, user_data);
@@ -78,6 +80,15 @@ ide_local_device_get_info_async (IdeDevice           *device,
         ide_device_info_set_system (info, parts[2]);
     }
 
+  /* Now override anything that was specified in the device */
+
+  if (priv->arch != NULL)
+    ide_device_info_set_arch (info, priv->arch);
+  if (priv->kernel != NULL)
+    ide_device_info_set_kernel (info, priv->kernel);
+  if (priv->system != NULL)
+    ide_device_info_set_system (info, priv->system);
+
   g_task_return_pointer (task, g_steal_pointer (&info), g_object_unref);
 }
 


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