[gnome-color-manager] Add gcm_device_apply() and a virtual function for devices to override



commit b18a0c36d8de1477b8e4b2751268c5330fd81f51
Author: Richard Hughes <richard hughsie com>
Date:   Tue Feb 9 19:56:16 2010 +0000

    Add gcm_device_apply() and a virtual function for devices to override

 src/gcm-device.c |   21 +++++++++++++++++++++
 src/gcm-device.h |    4 ++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-device.c b/src/gcm-device.c
index d3ee5c0..0e003b9 100644
--- a/src/gcm-device.c
+++ b/src/gcm-device.c
@@ -390,6 +390,27 @@ out:
 }
 
 /**
+ * gcm_device_apply:
+ **/
+gboolean
+gcm_device_apply (GcmDevice *device, GError **error)
+{
+	gboolean ret = FALSE;
+	GcmDeviceClass *klass = GCM_DEVICE_GET_CLASS (device);
+
+	/* no support */
+	if (klass->apply == NULL) {
+		g_set_error (error, 1, 0, "no klass support");
+		goto out;
+	}
+
+	/* run the callback */
+	ret = klass->apply (device, error);
+out:
+	return ret;
+}
+
+/**
  * gcm_device_get_property:
  **/
 static void
diff --git a/src/gcm-device.h b/src/gcm-device.h
index 8600a4e..ecd4e5b 100644
--- a/src/gcm-device.h
+++ b/src/gcm-device.h
@@ -46,6 +46,8 @@ struct _GcmDevice
 struct _GcmDeviceClass
 {
 	GObjectClass	parent_class;
+	gboolean	 (*apply)			(GcmDevice		*device,
+							 GError			**error);
 	/* padding for future expansion */
 	void (*_gcm_reserved1) (void);
 	void (*_gcm_reserved2) (void);
@@ -60,6 +62,8 @@ gboolean	 gcm_device_load			(GcmDevice		*device,
 							 GError			**error);
 gboolean	 gcm_device_save			(GcmDevice		*device,
 							 GError			**error);
+gboolean	 gcm_device_apply			(GcmDevice		*device,
+							 GError			**error);
 
 G_END_DECLS
 



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