[gnome-color-manager] trivial: Add a changed signal to GcmChanged
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: Add a changed signal to GcmChanged
- Date: Wed, 24 Mar 2010 12:39:56 +0000 (UTC)
commit 73c415e20deadc094322cbd049861d22ebb83996
Author: Richard Hughes <richard hughsie com>
Date: Wed Mar 24 11:10:41 2010 +0000
trivial: Add a changed signal to GcmChanged
src/gcm-client.c | 42 +++++++++++++++++++++++++++++++++++++++++-
src/gcm-client.h | 1 +
2 files changed, 42 insertions(+), 1 deletions(-)
---
diff --git a/src/gcm-client.c b/src/gcm-client.c
index 040a806..47036d9 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -24,7 +24,7 @@
* @short_description: Client object to hold an array of devices.
*
* This object holds an array of %GcmDevices, and watches both udev and xorg
- * for changes. If a device is added or removed then a signal is fired.
+ * for changes. If a device is added, removed or changed then a signal is fired.
*/
#include "config.h"
@@ -81,6 +81,7 @@ enum {
enum {
SIGNAL_ADDED,
SIGNAL_REMOVED,
+ SIGNAL_CHANGED,
SIGNAL_LAST
};
@@ -177,6 +178,17 @@ gcm_client_get_device_by_id (GcmClient *client, const gchar *id)
}
/**
+ * gcm_client_device_changed_cb:
+ **/
+static void
+gcm_client_device_changed_cb (GcmDevice *device, GcmClient *client)
+{
+ /* emit a signal */
+ egg_debug ("emit changed: %s", gcm_device_get_id (device));
+ g_signal_emit (client, signals[SIGNAL_CHANGED], 0, device);
+}
+
+/**
* gcm_client_get_id_for_udev_device:
**/
static gchar *
@@ -282,6 +294,9 @@ gcm_client_gudev_add (GcmClient *client, GUdevDevice *udev_device)
/* signal the addition */
egg_debug ("emit: added %s to device list", gcm_device_get_id (device));
g_signal_emit (client, signals[SIGNAL_ADDED], 0, device);
+
+ /* connect to the changed signal */
+ g_signal_connect (device, "changed", G_CALLBACK (gcm_client_device_changed_cb), client);
out:
if (device != NULL)
g_object_unref (device);
@@ -531,6 +546,9 @@ gcm_client_xrandr_add (GcmClient *client, GnomeRROutput *output)
/* signal the addition */
egg_debug ("emit: added %s to device list", gcm_device_get_id (device));
g_signal_emit (client, signals[SIGNAL_ADDED], 0, device);
+
+ /* connect to the changed signal */
+ g_signal_connect (device, "changed", G_CALLBACK (gcm_client_device_changed_cb), client);
out:
if (device != NULL)
g_object_unref (device);
@@ -590,6 +608,9 @@ gcm_client_cups_add (GcmClient *client, cups_dest_t dest)
/* signal the addition */
egg_debug ("emit: added %s to device list", gcm_device_get_id (device));
g_signal_emit (client, signals[SIGNAL_ADDED], 0, device);
+
+ /* connect to the changed signal */
+ g_signal_connect (device, "changed", G_CALLBACK (gcm_client_device_changed_cb), client);
out:
if (device != NULL)
g_object_unref (device);
@@ -663,6 +684,9 @@ gcm_client_sane_add (GcmClient *client, const SANE_Device *sane_device)
/* signal the addition */
egg_debug ("emit: added %s to device list", gcm_device_get_id (device));
g_signal_emit (client, signals[SIGNAL_ADDED], 0, device);
+
+ /* connect to the changed signal */
+ g_signal_connect (device, "changed", G_CALLBACK (gcm_client_device_changed_cb), client);
out:
if (device != NULL)
g_object_unref (device);
@@ -782,6 +806,9 @@ gcm_client_add_unconnected_device (GcmClient *client, GKeyFile *keyfile, const g
/* signal the addition */
egg_debug ("emit: added %s to device list", id);
g_signal_emit (client, signals[SIGNAL_ADDED], 0, device);
+
+ /* connect to the changed signal */
+ g_signal_connect (device, "changed", G_CALLBACK (gcm_client_device_changed_cb), client);
out:
if (device != NULL)
g_object_unref (device);
@@ -941,6 +968,9 @@ gcm_client_add_device (GcmClient *client, GcmDevice *device, GError **error)
egg_debug ("emit added: %s", id);
g_signal_emit (client, signals[SIGNAL_ADDED], 0, device);
+ /* connect to the changed signal */
+ g_signal_connect (device, "changed", G_CALLBACK (gcm_client_device_changed_cb), client);
+
/* all okay */
ret = TRUE;
out:
@@ -1148,6 +1178,16 @@ gcm_client_class_init (GcmClientClass *klass)
NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_OBJECT);
+ /**
+ * GcmClient::changed
+ **/
+ signals[SIGNAL_CHANGED] =
+ g_signal_new ("changed",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GcmClientClass, changed),
+ NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, G_TYPE_OBJECT);
+
g_type_class_add_private (klass, sizeof (GcmClientPrivate));
}
diff --git a/src/gcm-client.h b/src/gcm-client.h
index 0b1e9a1..9d5cbc9 100644
--- a/src/gcm-client.h
+++ b/src/gcm-client.h
@@ -51,6 +51,7 @@ struct _GcmClientClass
GObjectClass parent_class;
void (* added) (GcmDevice *device);
void (* removed) (GcmDevice *device);
+ void (* changed) (GcmDevice *device);
/* padding for future expansion */
void (*_gcm_reserved1) (void);
void (*_gcm_reserved2) (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]