[gnome-color-manager/colord] Reset the device if the display device changes in colord



commit 191b0024b0a1030a5bf5aef4c68aacffd88e9d4e
Author: Richard Hughes <richard hughsie com>
Date:   Tue Feb 1 22:03:39 2011 +0000

    Reset the device if the display device changes in colord

 src/gcm-session.c |   35 +++++++++++++++++++++++++----------
 1 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/src/gcm-session.c b/src/gcm-session.c
index 6bf72bb..15014e1 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -491,6 +491,18 @@ gcm_session_device_added_assign_cb (CdClient *client_,
 }
 
 /**
+ * gcm_session_device_changed_assign_cb:
+ **/
+static void
+gcm_session_device_changed_assign_cb (CdClient *client_,
+				      CdDevice *device,
+				      gpointer user_data)
+{
+	g_debug ("%s changed", cd_device_get_id (device));
+	gcm_session_device_assign (device);
+}
+
+/**
  * gcm_session_get_profile_for_window:
  **/
 static const gchar *
@@ -1106,6 +1118,9 @@ main (int argc, char *argv[])
 	g_signal_connect (client, "device-added",
 			  G_CALLBACK (gcm_session_device_added_assign_cb),
 			  NULL);
+	g_signal_connect (client, "device-changed",
+			  G_CALLBACK (gcm_session_device_changed_assign_cb),
+			  NULL);
 	ret = cd_client_connect_sync (client, NULL, &error);
 	if (!ret) {
 		g_warning ("failed to connect to colord: %s", error->message);
@@ -1113,6 +1128,16 @@ main (int argc, char *argv[])
 		goto out;
 	}
 
+	/* have access to all profiles */
+	profile_store = gcm_profile_store_new ();
+	g_signal_connect (profile_store, "added",
+			  G_CALLBACK (gcm_session_profile_store_added_cb),
+			  NULL);
+	g_signal_connect (profile_store, "removed",
+			  G_CALLBACK (gcm_session_profile_store_removed_cb),
+			  NULL);
+	gcm_profile_store_search (profile_store);
+
 	/* set for each device that already exist */
 	array = cd_client_get_devices_sync (client, NULL, &error);
 	if (array == NULL) {
@@ -1145,16 +1170,6 @@ main (int argc, char *argv[])
 		goto out;
 	}
 
-	/* have access to all profiles */
-	profile_store = gcm_profile_store_new ();
-	g_signal_connect (profile_store, "added",
-			  G_CALLBACK (gcm_session_profile_store_added_cb),
-			  NULL);
-	g_signal_connect (profile_store, "removed",
-			  G_CALLBACK (gcm_session_profile_store_removed_cb),
-			  NULL);
-	gcm_profile_store_search (profile_store);
-
 	/* create new objects */
 	loop = g_main_loop_new (NULL, FALSE);
 



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