[gnome-color-manager] trivial: adapt to the new libcolord API
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: adapt to the new libcolord API
- Date: Mon, 30 May 2011 21:01:09 +0000 (UTC)
commit d81afd4c9ac21d7239c31487b5d7b9c0b7148f0a
Author: Richard Hughes <richard hughsie com>
Date: Mon May 30 22:01:01 2011 +0100
trivial: adapt to the new libcolord API
src/gcm-calibrate-native.c | 6 +----
src/gcm-list-store-profiles.c | 6 ++--
src/gcm-picker.c | 16 +++++++------
src/gcm-prefs.c | 2 +-
src/gcm-session.c | 49 +++++++++++++++++++++++++++++++++++++---
5 files changed, 59 insertions(+), 20 deletions(-)
---
diff --git a/src/gcm-calibrate-native.c b/src/gcm-calibrate-native.c
index 82fc518..01ba2b9 100644
--- a/src/gcm-calibrate-native.c
+++ b/src/gcm-calibrate-native.c
@@ -77,16 +77,12 @@ static void
gcm_calibrate_native_sample_measure (CdSensor *sensor, GCancellable *cancellable, GcmColorSample *sample)
{
GError *error = NULL;
- gboolean ret;
- ret = cd_sensor_get_sample_sync (sensor,
+ sample->result = cd_sensor_get_sample_sync (sensor,
CD_SENSOR_CAP_LCD,
- sample->result,
- NULL,
cancellable,
&error);
g_assert_no_error (error);
- g_assert (ret);
}
/**
diff --git a/src/gcm-list-store-profiles.c b/src/gcm-list-store-profiles.c
index 08af3ad..56153eb 100644
--- a/src/gcm-list-store-profiles.c
+++ b/src/gcm-list-store-profiles.c
@@ -58,9 +58,9 @@ gcm_list_store_refresh_profiles (GtkListStore *list_store)
profile = g_ptr_array_index (profiles, i);
/* find the profile relationship */
- relation = cd_device_get_profile_relation (priv->device,
- profile,
- NULL, NULL);
+ relation = cd_device_get_profile_relation_sync (priv->device,
+ profile,
+ NULL, NULL);
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
diff --git a/src/gcm-picker.c b/src/gcm-picker.c
index a5a5db2..ec3c9af 100644
--- a/src/gcm-picker.c
+++ b/src/gcm-picker.c
@@ -253,6 +253,7 @@ static void
gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
{
gboolean ret;
+ CdColorXYZ *tmp = NULL;
GError *error = NULL;
/* reset the image */
@@ -270,18 +271,17 @@ gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
}
/* get color */
- ret = cd_sensor_get_sample_sync (sensor,
+ tmp = cd_sensor_get_sample_sync (sensor,
CD_SENSOR_CAP_LCD,
- &last_sample,
- NULL,
NULL,
&error);
- if (!ret) {
- g_warning ("failed to get ambient: %s", error->message);
+ if (tmp == NULL) {
+ g_warning ("failed to get sample: %s", error->message);
g_error_free (error);
goto out;
}
-
+ cd_color_copy_xyz (tmp, &last_sample);
+#if 0
/* get ambient */
ret = cd_sensor_get_sample_sync (sensor,
CD_SENSOR_CAP_AMBIENT,
@@ -294,7 +294,7 @@ gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
g_error_free (error);
goto out;
}
-
+#endif
/* unlock */
ret = cd_sensor_unlock_sync (sensor,
NULL,
@@ -308,6 +308,8 @@ gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
gcm_picker_refresh_results ();
gcm_picker_got_results ();
out:
+ if (tmp != NULL)
+ cd_color_xyz_free (tmp);
return;
}
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 77755db..c1527d5 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -1229,7 +1229,7 @@ gcm_prefs_delete_cb (GtkWidget *widget, GcmPrefsPriv *prefs)
/* try to delete device */
ret = cd_client_delete_device_sync (prefs->client,
- cd_device_get_id (prefs->current_device),
+ prefs->current_device,
prefs->cancellable,
&error);
if (!ret) {
diff --git a/src/gcm-session.c b/src/gcm-session.c
index fdf050e..d0f84bf 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -100,7 +100,7 @@ gcm_session_profile_added_notify_cb (CdClient *client,
CdProfile *profile,
GcmSessionPrivate *priv)
{
- GHashTable *metadata;
+ GHashTable *metadata = NULL;
const gchar *edid_md5;
GcmX11Output *output = NULL;
GError *error = NULL;
@@ -108,6 +108,15 @@ gcm_session_profile_added_notify_cb (CdClient *client,
gchar *device_id = NULL;
gboolean ret;
+ /* get properties */
+ ret = cd_profile_connect_sync (profile, NULL, &error);
+ if (!ret) {
+ g_warning ("cannot connect to profile: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
/* does the profile have EDID metadata? */
metadata = cd_profile_get_metadata (profile);
edid_md5 = g_hash_table_lookup (metadata, "EDID_md5");
@@ -140,6 +149,15 @@ gcm_session_profile_added_notify_cb (CdClient *client,
goto out;
}
+ /* get properties */
+ ret = cd_device_connect_sync (device, NULL, &error);
+ if (!ret) {
+ g_warning ("cannot connect to device: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
/* add the profile to the device */
ret = cd_device_add_profile_sync (device,
CD_DEVICE_RELATION_SOFT,
@@ -386,6 +404,15 @@ gcm_session_device_assign (GcmSessionPrivate *priv, CdDevice *device)
const gchar *qualifier_default[] = { "*", NULL};
const gchar *xrandr_id;
+ /* get properties */
+ ret = cd_device_connect_sync (device, NULL, &error);
+ if (!ret) {
+ g_warning ("failed to connect to device: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
/* check we care */
kind = cd_device_get_kind (device);
if (kind != CD_DEVICE_KIND_DISPLAY)
@@ -481,6 +508,15 @@ gcm_session_device_assign (GcmSessionPrivate *priv, CdDevice *device)
goto out;
}
+ /* get properties */
+ ret = cd_profile_connect_sync (profile, NULL, &error);
+ if (!ret) {
+ g_warning ("failed to connect to profile: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
/* get the filename */
filename = cd_profile_get_filename (profile);
g_assert (filename != NULL);
@@ -560,7 +596,7 @@ gcm_session_device_changed_assign_cb (CdClient *client,
CdDevice *device,
GcmSessionPrivate *priv)
{
- g_debug ("%s changed", cd_device_get_id (device));
+ g_debug ("%s changed", cd_device_get_object_path (device));
gcm_session_device_assign (priv, device);
}
@@ -1041,11 +1077,16 @@ gcm_x11_screen_output_removed_cb (GcmX11Screen *screen_,
{
gboolean ret;
GError *error = NULL;
+ CdDevice *device;
g_debug ("output %s removed",
gcm_x11_output_get_name (output));
+ device = cd_client_find_device_sync (priv->client,
+ gcm_x11_output_get_name (output),
+ NULL,
+ &error);
ret = cd_client_delete_device_sync (priv->client,
- gcm_x11_output_get_name (output),
+ device,
NULL,
&error);
if (!ret) {
@@ -1055,7 +1096,7 @@ gcm_x11_screen_output_removed_cb (GcmX11Screen *screen_,
goto out;
}
out:
- return;
+ g_object_unref (device);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]