diff options
-rw-r--r-- | libcolord/cd-client.c | 30 | ||||
-rw-r--r-- | libcolord/cd-client.h | 2 | ||||
-rw-r--r-- | src/cd-device.c | 15 | ||||
-rw-r--r-- | src/org.freedesktop.ColorManager.xml | 20 |
4 files changed, 67 insertions, 0 deletions
diff --git a/libcolord/cd-client.c b/libcolord/cd-client.c index 22403e8..3afd5bb 100644 --- a/libcolord/cd-client.c +++ b/libcolord/cd-client.c @@ -62,6 +62,7 @@ enum { SIGNAL_CHANGED, SIGNAL_DEVICE_ADDED, SIGNAL_DEVICE_REMOVED, + SIGNAL_DEVICE_CHANGED, SIGNAL_PROFILE_ADDED, SIGNAL_PROFILE_REMOVED, SIGNAL_LAST @@ -920,6 +921,20 @@ cd_client_dbus_signal_cb (GDBusProxy *proxy, g_debug ("CdClient: emit '%s'", signal_name); g_signal_emit (client, signals[SIGNAL_DEVICE_REMOVED], 0, device); + } else if (g_strcmp0 (signal_name, "DeviceChanged") == 0) { + g_variant_get (parameters, "(o)", &object_path_tmp); + + /* is device in the cache? */ + device = cd_client_get_cache_device (client, + object_path_tmp); + if (device == NULL) { + g_debug ("failed to get cached device %s", + object_path_tmp); + goto out; + } + g_debug ("CdClient: emit '%s'", signal_name); + g_signal_emit (client, signals[SIGNAL_DEVICE_CHANGED], 0, + device); } else if (g_strcmp0 (signal_name, "ProfileAdded") == 0) { g_variant_get (parameters, "(o)", &object_path_tmp); @@ -1124,6 +1139,21 @@ cd_client_class_init (CdClientClass *klass) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, CD_TYPE_DEVICE); /** + * CdClient::device-changed: + * @client: the #CdClient instance that emitted the signal + * @device: the #CdDevice that was changed. + * + * The ::device-changed signal is emitted when a device is changed. + * + * Since: 0.1.2 + **/ + signals [SIGNAL_DEVICE_CHANGED] = + g_signal_new ("device-changed", + G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CdClientClass, device_changed), + NULL, NULL, g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, CD_TYPE_DEVICE); + /** * CdClient::profile-added: * @client: the #CdClient instance that emitted the signal * @profile: the #CdProfile that was added. diff --git a/libcolord/cd-client.h b/libcolord/cd-client.h index 3571cc6..8272d68 100644 --- a/libcolord/cd-client.h +++ b/libcolord/cd-client.h @@ -58,6 +58,8 @@ typedef struct CdDevice *device); void (*device_removed) (CdClient *client, CdDevice *device); + void (*device_changed) (CdClient *client, + CdDevice *device); void (*profile_added) (CdClient *client, CdProfile *profile); void (*profile_removed) (CdClient *client, diff --git a/src/cd-device.c b/src/cd-device.c index c98bd82..02edb6a 100644 --- a/src/cd-device.c +++ b/src/cd-device.c @@ -262,6 +262,21 @@ cd_device_dbus_emit_property_changed (CdDevice *device, g_warning ("CdDevice: failed to send signal %s", error_local->message); g_error_free (error_local); } + + /* emit signal */ + g_debug ("CdDevice: emit Changed"); + ret = g_dbus_connection_emit_signal (device->priv->connection, + NULL, + COLORD_DBUS_PATH, + COLORD_DBUS_INTERFACE, + "DeviceChanged", + g_variant_new ("(o)", + cd_device_get_object_path (device)), + &error_local); + if (!ret) { + g_warning ("CdDevice: failed to send signal %s", error_local->message); + g_error_free (error_local); + } } /** diff --git a/src/org.freedesktop.ColorManager.xml b/src/org.freedesktop.ColorManager.xml index a4def48..077a041 100644 --- a/src/org.freedesktop.ColorManager.xml +++ b/src/org.freedesktop.ColorManager.xml @@ -460,6 +460,26 @@ </signal> <!--***********************************************************--> + <signal name='DeviceChanged'> + <doc:doc> + <doc:description> + <doc:para> + A device has changed. + </doc:para> + </doc:description> + </doc:doc> + <arg type='o' name='object_path' direction='out'> + <doc:doc> + <doc:summary> + <doc:para> + The device path. + </doc:para> + </doc:summary> + </doc:doc> + </arg> + </signal> + + <!--***********************************************************--> <signal name='ProfileAdded'> <doc:doc> <doc:description> |