[gnome-color-manager] trivial: when devices change, ensure we update the UI



commit f6ed63fa88c6f690886e7b1042c9ae7a7515ac52
Author: Richard Hughes <richard hughsie com>
Date:   Wed Mar 24 11:34:00 2010 +0000

    trivial: when devices change, ensure we update the UI

 src/gcm-prefs.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index b4407b0..1a60dd9 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -2168,7 +2168,8 @@ gcm_prefs_remove_device (GcmDevice *gcm_device)
 
 	/* remove */
 	id = gcm_device_get_id (gcm_device);
-	egg_debug ("removing: %s", id);
+	egg_debug ("removing: %s (connected: %i)", id,
+		   gcm_device_get_connected (gcm_device));
 
 	/* get first element */
 	model = GTK_TREE_MODEL (list_store_devices);
@@ -2197,7 +2198,9 @@ static gboolean
 gcm_prefs_added_idle_cb (GcmDevice *device)
 {
 	GcmDeviceTypeEnum type;
-	egg_debug ("added: %s", gcm_device_get_id (device));
+	egg_debug ("added: %s (connected: %i)",
+		   gcm_device_get_id (device),
+		   gcm_device_get_connected (device));
 
 	/* remove the saved device if it's already there */
 	gcm_prefs_remove_device (device);
@@ -2228,6 +2231,15 @@ gcm_prefs_added_cb (GcmClient *gcm_client_, GcmDevice *gcm_device, gpointer user
 }
 
 /**
+ * gcm_prefs_changed_cb:
+ **/
+static void
+gcm_prefs_changed_cb (GcmClient *gcm_client_, GcmDevice *gcm_device, gpointer user_data)
+{
+	g_idle_add ((GSourceFunc) gcm_prefs_added_idle_cb, g_object_ref (gcm_device));
+}
+
+/**
  * gcm_prefs_removed_cb:
  **/
 static void
@@ -3046,6 +3058,7 @@ main (int argc, char **argv)
 	gcm_client_set_use_threads (gcm_client, TRUE);
 	g_signal_connect (gcm_client, "added", G_CALLBACK (gcm_prefs_added_cb), NULL);
 	g_signal_connect (gcm_client, "removed", G_CALLBACK (gcm_prefs_removed_cb), NULL);
+	g_signal_connect (gcm_client, "changed", G_CALLBACK (gcm_prefs_changed_cb), NULL);
 	g_signal_connect (gcm_client, "notify::loading",
 			  G_CALLBACK (gcm_prefs_client_notify_loading_cb), NULL);
 



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