[gnome-builder] device: simplify IdeDevice for IdeConfiguration use



commit 20f4363d571abf9cbefba1797f71ad9bcf1f4928
Author: Christian Hergert <chergert redhat com>
Date:   Sun Feb 14 20:46:00 2016 -0800

    device: simplify IdeDevice for IdeConfiguration use

 libide/ide-device.c |   33 ++++++++++++---------------------
 libide/ide-device.h |   23 +++++++++++++----------
 2 files changed, 25 insertions(+), 31 deletions(-)
---
diff --git a/libide/ide-device.c b/libide/ide-device.c
index 897a658..13d67be 100644
--- a/libide/ide-device.c
+++ b/libide/ide-device.c
@@ -18,6 +18,7 @@
 
 #include <glib/gi18n.h>
 
+#include "ide-configuration.h"
 #include "ide-device.h"
 
 typedef struct
@@ -39,27 +40,6 @@ enum {
 static GParamSpec *properties [LAST_PROP];
 
 /**
- * ide_device_get_config:
- * @device: A #IdeDevice.
- *
- * Retrieves any custom configuration that is required to build for the
- * device. Such values might include additional options to autoconf
- * or paths to cross-compilers.
- *
- * Returns: (transfer none) (nullable): A #GKeyFile or %NULL.
- */
-GKeyFile *
-ide_device_get_config (IdeDevice *device)
-{
-  g_return_val_if_fail (IDE_IS_DEVICE (device), NULL);
-
-  if (IDE_DEVICE_GET_CLASS (device)->get_config)
-    return IDE_DEVICE_GET_CLASS (device)->get_config (device);
-
-  return NULL;
-}
-
-/**
  * ide_device_get_display_name:
  *
  * This function returns the name of the device. If no name has been set, then
@@ -257,3 +237,14 @@ static void
 ide_device_init (IdeDevice *self)
 {
 }
+
+void
+ide_device_prepare_configuration (IdeDevice        *self,
+                                  IdeConfiguration *configuration)
+{
+  g_assert (IDE_IS_DEVICE (self));
+  g_assert (IDE_IS_CONFIGURATION (configuration));
+
+  if (IDE_DEVICE_GET_CLASS (self)->prepare_configuration)
+    IDE_DEVICE_GET_CLASS (self)->prepare_configuration (self, configuration);
+}
diff --git a/libide/ide-device.h b/libide/ide-device.h
index f9bfd11..595436c 100644
--- a/libide/ide-device.h
+++ b/libide/ide-device.h
@@ -20,6 +20,7 @@
 #define IDE_DEVICE_H
 
 #include "ide-object.h"
+#include "ide-types.h"
 
 G_BEGIN_DECLS
 
@@ -31,18 +32,20 @@ struct _IdeDeviceClass
 {
   IdeObjectClass parent;
 
-  GKeyFile    *(*get_config)      (IdeDevice *device);
-  const gchar *(*get_system_type) (IdeDevice *device);
+  const gchar *(*get_system_type)       (IdeDevice        *self);
+  void         (*prepare_configuration) (IdeDevice        *self,
+                                         IdeConfiguration *configuration);
 };
 
-GKeyFile    *ide_device_get_config       (IdeDevice   *device);
-const gchar *ide_device_get_display_name (IdeDevice   *device);
-void         ide_device_set_display_name (IdeDevice   *device,
-                                          const gchar *display_name);
-const gchar *ide_device_get_id           (IdeDevice   *device);
-void         ide_device_set_id           (IdeDevice   *device,
-                                          const gchar *id);
-const gchar *ide_device_get_system_type  (IdeDevice   *device);
+const gchar *ide_device_get_display_name      (IdeDevice   *self);
+void         ide_device_set_display_name      (IdeDevice   *self,
+                                               const gchar *display_name);
+const gchar *ide_device_get_id                (IdeDevice   *self);
+void         ide_device_set_id                (IdeDevice   *self,
+                                               const gchar *id);
+const gchar *ide_device_get_system_type       (IdeDevice        *self);
+void         ide_device_prepare_configuration (IdeDevice        *self,
+                                               IdeConfiguration *configuration);
 
 G_END_DECLS
 


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